Blender V5.0
BKE_constraint.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
10
11struct BlendDataReader;
12struct BlendWriter;
13struct Depsgraph;
14struct ID;
15struct ListBase;
16struct Object;
17struct Scene;
18struct bConstraint;
20struct bPoseChannel;
21
22/* ---------------------------------------------------------------------------- */
23
24/* special struct for use in constraint evaluation */
25typedef struct bConstraintOb {
27 struct Depsgraph *depsgraph;
29 struct Scene *scene;
31 struct Object *ob;
34
36 float matrix[4][4];
38 float startmat[4][4];
41
43 short type;
48 short rotOrder;
50
51/* ---------------------------------------------------------------------------- */
52
53/* Callback format for performing operations on ID-pointers for Constraints */
54typedef void (*ConstraintIDFunc)(struct bConstraint *con,
55 struct ID **idpoin,
56 bool is_reference,
57 void *userdata);
58
59/* ....... */
60
74typedef struct bConstraintTypeInfo {
75 /* Admin/identity. */
77 short type;
79 short size;
81 char name[32];
83 char struct_name[32];
84
85 /* data management function pointers - special handling */
87 void (*free_data)(struct bConstraint *con);
89 void (*id_looper)(struct bConstraint *con, ConstraintIDFunc func, void *userdata);
91 void (*copy_data)(struct bConstraint *con, struct bConstraint *src);
96 void (*new_data)(void *cdata);
97
98 /* target handling function pointers */
103 int (*get_constraint_targets)(struct bConstraint *con, struct ListBase *list);
108 void (*flush_constraint_targets)(struct bConstraint *con, struct ListBase *list, bool no_copy);
109
110 /* evaluation */
120 bool (*get_target_matrix)(struct Depsgraph *depsgraph,
121 struct bConstraint *con,
122 struct bConstraintOb *cob,
123 struct bConstraintTarget *ct,
124 float ctime);
129 void (*evaluate_constraint)(struct bConstraint *con,
130 struct bConstraintOb *cob,
131 struct ListBase *targets);
133
134/* Function Prototypes for bConstraintTypeInfo's */
135
146
147/* ---------------------------------------------------------------------------- */
148
149/* Constraint function prototypes */
150
154void BKE_constraint_unique_name(struct bConstraint *con, struct ListBase *list);
155
159struct bConstraint *BKE_constraint_duplicate_ex(struct bConstraint *src, int flag, bool do_extern);
160
165 struct bPoseChannel *pchan,
166 struct bConstraint *src);
170struct bConstraint *BKE_constraint_copy_for_object(struct Object *ob, struct bConstraint *src);
171
172void BKE_constraints_free(struct ListBase *list);
176void BKE_constraints_free_ex(struct ListBase *list, bool do_id_user);
177void BKE_constraints_copy(struct ListBase *dst, const struct ListBase *src, bool do_extern);
182 const struct ListBase *src,
183 int flag,
184 bool do_extern);
191void BKE_constraints_id_loop(struct ListBase *list,
192 ConstraintIDFunc func,
193 const int flag,
194 void *userdata);
195void BKE_constraint_free_data(struct bConstraint *con);
201void BKE_constraint_free_data_ex(struct bConstraint *con, bool do_id_user);
202
204
205/* Constraint API function prototypes */
206
214void BKE_constraints_active_set(ListBase *list, struct bConstraint *con);
215struct bConstraint *BKE_constraints_find_name(struct ListBase *list, const char *name);
216
221 struct bConstraintTarget *tgt,
222 struct bPoseChannel **r_pchan);
223
231 const struct bConstraint *con);
232
236struct bConstraint *BKE_constraint_add_for_object(struct Object *ob, const char *name, short type);
241 struct bPoseChannel *pchan,
242 const char *name,
243 short type);
244
248bool BKE_constraint_remove_ex(ListBase *list, struct Object *ob, struct bConstraint *con);
249
253bool BKE_constraint_apply_for_object(struct Depsgraph *depsgraph,
254 struct Scene *scene,
255 struct Object *ob,
256 struct bConstraint *con);
258 struct Scene *scene,
259 ListBase /*bConstraint*/ *constraints,
260 struct Object *ob,
261 struct bConstraint *con);
262
263bool BKE_constraint_apply_for_pose(struct Depsgraph *depsgraph,
264 struct Scene *scene,
265 struct Object *ob,
266 struct bPoseChannel *pchan,
267 struct bConstraint *con);
269 struct Scene *scene,
270 ListBase /*bConstraint*/ *constraints,
271 struct Object *ob,
272 struct bConstraint *con,
273 struct bPoseChannel *pchan);
274
276
277/* Constraint Evaluation function prototypes */
278
285struct bConstraintOb *BKE_constraints_make_evalob(struct Depsgraph *depsgraph,
286 struct Scene *scene,
287 struct Object *ob,
288 void *subdata,
289 short datatype);
294
301 struct bPoseChannel *pchan,
302 struct bConstraintOb *cob,
303 float mat[4][4],
304 short from,
305 short to,
306 bool keep_scale);
307
316void BKE_constraint_target_matrix_get(struct Depsgraph *depsgraph,
317 struct Scene *scene,
318 struct bConstraint *con,
319 int index,
320 short ownertype,
321 void *ownerdata,
322 float mat[4][4],
323 float ctime);
324
332int BKE_constraint_targets_get(struct bConstraint *con, struct ListBase *r_targets);
333
341void BKE_constraint_targets_flush(struct bConstraint *con, struct ListBase *targets, bool no_copy);
342
347 struct bConstraint *con,
348 struct bConstraintOb *ob,
349 struct ListBase *targets,
350 float ctime);
351
359
367void BKE_constraints_solve(struct Depsgraph *depsgraph,
368 struct ListBase *conlist,
369 struct bConstraintOb *cob,
370 float ctime);
371
372void BKE_constraint_blend_write(struct BlendWriter *writer, struct ListBase *conlist);
374 struct ID *id_owner,
375 struct ListBase *lb);
bool BKE_constraint_apply_for_object(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct bConstraint *con)
void BKE_constraints_free_ex(struct ListBase *list, bool do_id_user)
struct bConstraint * BKE_constraints_find_name(struct ListBase *list, const char *name)
void BKE_constraints_solve(struct Depsgraph *depsgraph, struct ListBase *conlist, struct bConstraintOb *cob, float ctime)
struct bConstraint * BKE_constraint_find_from_target(struct Object *ob, struct bConstraintTarget *tgt, struct bPoseChannel **r_pchan)
void BKE_constraints_free(struct ListBase *list)
void BKE_constraint_targets_flush(struct bConstraint *con, struct ListBase *targets, bool no_copy)
void BKE_constraint_mat_convertspace(struct Object *ob, struct bPoseChannel *pchan, struct bConstraintOb *cob, float mat[4][4], short from, short to, bool keep_scale)
void BKE_constraint_blend_write(struct BlendWriter *writer, struct ListBase *conlist)
void(* ConstraintIDFunc)(struct bConstraint *con, struct ID **idpoin, bool is_reference, void *userdata)
int BKE_constraint_targets_get(struct bConstraint *con, struct ListBase *r_targets)
void BKE_constraints_copy(struct ListBase *dst, const struct ListBase *src, bool do_extern)
bool BKE_constraint_remove_ex(ListBase *list, struct Object *ob, struct bConstraint *con)
void BKE_constraint_blend_read_data(struct BlendDataReader *reader, struct ID *id_owner, struct ListBase *lb)
struct bConstraint * BKE_constraint_copy_for_pose(struct Object *ob, struct bPoseChannel *pchan, struct bConstraint *src)
struct bConstraint * BKE_constraint_add_for_object(struct Object *ob, const char *name, short type)
void BKE_constraint_free_data(struct bConstraint *con)
bool BKE_constraint_apply_and_remove_for_pose(struct Depsgraph *depsgraph, struct Scene *scene, ListBase *constraints, struct Object *ob, struct bConstraint *con, struct bPoseChannel *pchan)
bool BKE_constraint_is_nonlocal_in_liboverride(const struct Object *ob, const struct bConstraint *con)
void BKE_constraint_custom_object_space_init(struct bConstraintOb *cob, struct bConstraint *con)
void BKE_constraint_free_data_ex(struct bConstraint *con, bool do_id_user)
bool BKE_constraint_target_uses_bbone(struct bConstraint *con, struct bConstraintTarget *ct)
const bConstraintTypeInfo * BKE_constraint_typeinfo_get(struct bConstraint *con)
struct bConstraint * BKE_constraint_add_for_pose(struct Object *ob, struct bPoseChannel *pchan, const char *name, short type)
bool BKE_constraint_apply_and_remove_for_object(struct Depsgraph *depsgraph, struct Scene *scene, ListBase *constraints, struct Object *ob, struct bConstraint *con)
struct bConstraint * BKE_constraint_copy_for_object(struct Object *ob, struct bConstraint *src)
struct bConstraint * BKE_constraint_duplicate_ex(struct bConstraint *src, int flag, bool do_extern)
void BKE_constraints_copy_ex(struct ListBase *dst, const struct ListBase *src, int flag, bool do_extern)
struct bConstraint * BKE_constraints_active_get(struct ListBase *list)
void BKE_constraint_target_matrix_get(struct Depsgraph *depsgraph, struct Scene *scene, struct bConstraint *con, int index, short ownertype, void *ownerdata, float mat[4][4], float ctime)
void BKE_constraint_targets_for_solving_get(struct Depsgraph *depsgraph, struct bConstraint *con, struct bConstraintOb *ob, struct ListBase *targets, float ctime)
void BKE_constraints_clear_evalob(struct bConstraintOb *cob)
bool BKE_constraint_apply_for_pose(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan, struct bConstraint *con)
const bConstraintTypeInfo * BKE_constraint_typeinfo_from_type(int type)
void BKE_constraints_active_set(ListBase *list, struct bConstraint *con)
void BKE_constraint_panel_expand(struct bConstraint *con)
void BKE_constraints_id_loop(struct ListBase *list, ConstraintIDFunc func, const int flag, void *userdata)
struct bConstraintOb * BKE_constraints_make_evalob(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, void *subdata, short datatype)
void BKE_constraint_unique_name(struct bConstraint *con, struct ListBase *list)
BPy_StructRNA * depsgraph
btSequentialImpulseConstraintSolverMt int btPersistentManifold int btTypedConstraint ** constraints
const char * name
Definition DNA_ID.h:414
float startmat[4][4]
float matrix[4][4]
float space_obj_world_matrix[4][4]
struct bPoseChannel * pchan
struct Scene * scene
struct Object * ob
struct Depsgraph * depsgraph
void(* id_looper)(struct bConstraint *con, ConstraintIDFunc func, void *userdata)
int(* get_constraint_targets)(struct bConstraint *con, struct ListBase *list)
void(* evaluate_constraint)(struct bConstraint *con, struct bConstraintOb *cob, struct ListBase *targets)
void(* flush_constraint_targets)(struct bConstraint *con, struct ListBase *list, bool no_copy)
bool(* get_target_matrix)(struct Depsgraph *depsgraph, struct bConstraint *con, struct bConstraintOb *cob, struct bConstraintTarget *ct, float ctime)
void(* copy_data)(struct bConstraint *con, struct bConstraint *src)
void(* free_data)(struct bConstraint *con)
void(* new_data)(void *cdata)
uint8_t flag
Definition wm_window.cc:145