Blender V4.3
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
11struct BlendDataReader;
12struct BlendWriter;
13struct Depsgraph;
14struct ID;
15struct ListBase;
16struct Object;
17struct Scene;
18struct bConstraint;
20struct bPoseChannel;
21
22/* ---------------------------------------------------------------------------- */
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27/* special struct for use in constraint evaluation */
28typedef struct bConstraintOb {
30 struct Depsgraph *depsgraph;
32 struct Scene *scene;
34 struct Object *ob;
37
39 float matrix[4][4];
41 float startmat[4][4];
44
46 short type;
49 short rotOrder;
51
52/* ---------------------------------------------------------------------------- */
53
54/* Callback format for performing operations on ID-pointers for Constraints */
55typedef void (*ConstraintIDFunc)(struct bConstraint *con,
56 struct ID **idpoin,
57 bool is_reference,
58 void *userdata);
59
60/* ....... */
61
75typedef struct bConstraintTypeInfo {
76 /* Admin/identity. */
78 short type;
80 short size;
82 char name[32];
84 char struct_name[32];
85
86 /* data management function pointers - special handling */
88 void (*free_data)(struct bConstraint *con);
90 void (*id_looper)(struct bConstraint *con, ConstraintIDFunc func, void *userdata);
92 void (*copy_data)(struct bConstraint *con, struct bConstraint *src);
97 void (*new_data)(void *cdata);
98
99 /* target handling function pointers */
104 int (*get_constraint_targets)(struct bConstraint *con, struct ListBase *list);
109 void (*flush_constraint_targets)(struct bConstraint *con, struct ListBase *list, bool no_copy);
110
111 /* evaluation */
113 void (*get_target_matrix)(struct Depsgraph *depsgraph,
114 struct bConstraint *con,
115 struct bConstraintOb *cob,
116 struct bConstraintTarget *ct,
117 float ctime);
122 void (*evaluate_constraint)(struct bConstraint *con,
123 struct bConstraintOb *cob,
124 struct ListBase *targets);
126
127/* Function Prototypes for bConstraintTypeInfo's */
128
139
140/* ---------------------------------------------------------------------------- */
141
142/* Constraint function prototypes */
143
147void BKE_constraint_unique_name(struct bConstraint *con, struct ListBase *list);
148
152struct bConstraint *BKE_constraint_duplicate_ex(struct bConstraint *src, int flag, bool do_extern);
153
158 struct bPoseChannel *pchan,
159 struct bConstraint *src);
163struct bConstraint *BKE_constraint_copy_for_object(struct Object *ob, struct bConstraint *src);
164
165void BKE_constraints_free(struct ListBase *list);
169void BKE_constraints_free_ex(struct ListBase *list, bool do_id_user);
170void BKE_constraints_copy(struct ListBase *dst, const struct ListBase *src, bool do_extern);
175 const struct ListBase *src,
176 int flag,
177 bool do_extern);
184void BKE_constraints_id_loop(struct ListBase *list,
185 ConstraintIDFunc func,
186 const int flag,
187 void *userdata);
188void BKE_constraint_free_data(struct bConstraint *con);
194void BKE_constraint_free_data_ex(struct bConstraint *con, bool do_id_user);
195
197
198/* Constraint API function prototypes */
199
207void BKE_constraints_active_set(ListBase *list, struct bConstraint *con);
208struct bConstraint *BKE_constraints_find_name(struct ListBase *list, const char *name);
209
214 struct bConstraintTarget *tgt,
215 struct bPoseChannel **r_pchan);
216
224 const struct bConstraint *con);
225
229struct bConstraint *BKE_constraint_add_for_object(struct Object *ob, const char *name, short type);
234 struct bPoseChannel *pchan,
235 const char *name,
236 short type);
237
238bool BKE_constraint_remove_ex(ListBase *list, struct Object *ob, struct bConstraint *con);
242bool BKE_constraint_remove(ListBase *list, struct bConstraint *con);
243
247bool BKE_constraint_apply_for_object(struct Depsgraph *depsgraph,
248 struct Scene *scene,
249 struct Object *ob,
250 struct bConstraint *con);
252 struct Scene *scene,
253 ListBase /*bConstraint*/ *constraints,
254 struct Object *ob,
255 struct bConstraint *con);
256
257bool BKE_constraint_apply_for_pose(struct Depsgraph *depsgraph,
258 struct Scene *scene,
259 struct Object *ob,
260 struct bPoseChannel *pchan,
261 struct bConstraint *con);
263 struct Scene *scene,
264 ListBase /*bConstraint*/ *constraints,
265 struct Object *ob,
266 struct bConstraint *con,
267 struct bPoseChannel *pchan);
268
270
271/* Constraint Evaluation function prototypes */
272
279struct bConstraintOb *BKE_constraints_make_evalob(struct Depsgraph *depsgraph,
280 struct Scene *scene,
281 struct Object *ob,
282 void *subdata,
283 short datatype);
288
295 struct bPoseChannel *pchan,
296 struct bConstraintOb *cob,
297 float mat[4][4],
298 short from,
299 short to,
300 bool keep_scale);
301
310void BKE_constraint_target_matrix_get(struct Depsgraph *depsgraph,
311 struct Scene *scene,
312 struct bConstraint *con,
313 int index,
314 short ownertype,
315 void *ownerdata,
316 float mat[4][4],
317 float ctime);
318
326int BKE_constraint_targets_get(struct bConstraint *con, struct ListBase *r_targets);
327
335void BKE_constraint_targets_flush(struct bConstraint *con, struct ListBase *targets, bool no_copy);
336
341 struct bConstraint *con,
342 struct bConstraintOb *ob,
343 struct ListBase *targets,
344 float ctime);
345
353
361void BKE_constraints_solve(struct Depsgraph *depsgraph,
362 struct ListBase *conlist,
363 struct bConstraintOb *cob,
364 float ctime);
365
366void BKE_constraint_blend_write(struct BlendWriter *writer, struct ListBase *conlist);
368 struct ID *id_owner,
369 struct ListBase *lb);
370
371#ifdef __cplusplus
372}
373#endif
struct bConstraintOb bConstraintOb
bool BKE_constraint_apply_for_object(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct bConstraint *con)
bool BKE_constraint_remove(ListBase *list, struct bConstraint *con)
void BKE_constraints_free_ex(struct ListBase *list, bool do_id_user)
struct bConstraintTypeInfo bConstraintTypeInfo
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)
btSequentialImpulseConstraintSolverMt int btPersistentManifold int btTypedConstraint ** constraints
const Depsgraph * depsgraph
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
Definition DNA_ID.h:413
float startmat[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)
void(* copy_data)(struct bConstraint *con, struct bConstraint *src)
void(* get_target_matrix)(struct Depsgraph *depsgraph, struct bConstraint *con, struct bConstraintOb *cob, struct bConstraintTarget *ct, float ctime)
void(* free_data)(struct bConstraint *con)
void(* new_data)(void *cdata)
uint8_t flag
Definition wm_window.cc:138