Blender  V3.3
BKE_constraint.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2001-2002 NaN Holding BV. All rights reserved. */
3 
4 #pragma once
5 
10 struct BlendDataReader;
11 struct BlendExpander;
12 struct BlendLibReader;
13 struct BlendWriter;
14 struct Depsgraph;
15 struct ID;
16 struct ListBase;
17 struct Object;
18 struct Scene;
19 struct bConstraint;
20 struct bConstraintTarget;
21 struct bPoseChannel;
22 
23 /* ---------------------------------------------------------------------------- */
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 /* special struct for use in constraint evaluation */
29 typedef struct bConstraintOb {
33  struct Scene *scene;
35  struct Object *ob;
38 
40  float matrix[4][4];
42  float startmat[4][4];
45 
47  short type;
49  short rotOrder;
51 
52 /* ---------------------------------------------------------------------------- */
53 
54 /* Callback format for performing operations on ID-pointers for Constraints */
55 typedef void (*ConstraintIDFunc)(struct bConstraint *con,
56  struct ID **idpoin,
57  bool is_reference,
58  void *userdata);
59 
60 /* ....... */
61 
75 typedef struct bConstraintTypeInfo {
76  /* admin/ident */
78  short type;
80  short size;
82  char name[32];
84  char structName[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 */
114  struct bConstraint *con,
115  struct bConstraintOb *cob,
116  struct bConstraintTarget *ct,
117  float ctime);
120  struct bConstraintOb *cob,
121  struct ListBase *targets);
123 
124 /* Function Prototypes for bConstraintTypeInfo's */
125 
136 
137 /* ---------------------------------------------------------------------------- */
138 
139 /* Constraint function prototypes */
140 
144 void BKE_constraint_unique_name(struct bConstraint *con, struct ListBase *list);
145 
149 struct bConstraint *BKE_constraint_duplicate_ex(struct bConstraint *src, int flag, bool do_extern);
150 
155  struct bPoseChannel *pchan,
156  struct bConstraint *src);
161 
162 void BKE_constraints_free(struct ListBase *list);
166 void BKE_constraints_free_ex(struct ListBase *list, bool do_id_user);
167 void BKE_constraints_copy(struct ListBase *dst, const struct ListBase *src, bool do_extern);
172  const struct ListBase *src,
173  int flag,
174  bool do_extern);
178 void BKE_constraints_id_loop(struct ListBase *list, ConstraintIDFunc func, void *userdata);
179 void BKE_constraint_free_data(struct bConstraint *con);
185 void BKE_constraint_free_data_ex(struct bConstraint *con, bool do_id_user);
186 
188 
189 /* Constraint API function prototypes */
190 
194 struct bConstraint *BKE_constraints_active_get(struct ListBase *list);
198 void BKE_constraints_active_set(ListBase *list, struct bConstraint *con);
199 struct bConstraint *BKE_constraints_find_name(struct ListBase *list, const char *name);
200 
205  struct bConstraintTarget *tgt,
206  struct bPoseChannel **r_pchan);
207 
215  const struct bConstraint *con);
216 
220 struct bConstraint *BKE_constraint_add_for_object(struct Object *ob, const char *name, short type);
225  struct bPoseChannel *pchan,
226  const char *name,
227  short type);
228 
230  struct Object *ob,
231  struct bConstraint *con,
232  bool clear_dep);
236 bool BKE_constraint_remove(ListBase *list, struct bConstraint *con);
237 
242  struct Scene *scene,
243  struct Object *ob,
244  struct bConstraint *con);
246  struct Scene *scene,
247  ListBase /*bConstraint*/ *constraints,
248  struct Object *ob,
249  struct bConstraint *con);
250 
252  struct Scene *scene,
253  struct Object *ob,
254  struct bPoseChannel *pchan,
255  struct bConstraint *con);
257  struct Scene *scene,
258  ListBase /*bConstraint*/ *constraints,
259  struct Object *ob,
260  struct bConstraint *con,
261  struct bPoseChannel *pchan);
262 
263 void BKE_constraint_panel_expand(struct bConstraint *con);
264 
265 /* Constraint Evaluation function prototypes */
266 
274  struct Scene *scene,
275  struct Object *ob,
276  void *subdata,
277  short datatype);
282 
289  struct bPoseChannel *pchan,
290  struct bConstraintOb *cob,
291  float mat[4][4],
292  short from,
293  short to,
294  bool keep_scale);
295 
305  struct Scene *scene,
306  struct bConstraint *con,
307  int index,
308  short ownertype,
309  void *ownerdata,
310  float mat[4][4],
311  float ctime);
312 
320 int BKE_constraint_targets_get(struct bConstraint *con, struct ListBase *r_targets);
321 
329 void BKE_constraint_targets_flush(struct bConstraint *con, struct ListBase *targets, bool no_copy);
330 
335  struct bConstraint *con,
336  struct bConstraintOb *ob,
337  struct ListBase *targets,
338  float ctime);
339 
347 
356  struct ListBase *conlist,
357  struct bConstraintOb *cob,
358  float ctime);
359 
360 void BKE_constraint_blend_write(struct BlendWriter *writer, struct ListBase *conlist);
361 void BKE_constraint_blend_read_data(struct BlendDataReader *reader, struct ListBase *lb);
363  struct ID *id,
364  struct ListBase *conlist);
365 void BKE_constraint_blend_read_expand(struct BlendExpander *expander, struct ListBase *lb);
366 
367 #ifdef __cplusplus
368 }
369 #endif
struct bConstraintOb bConstraintOb
bool BKE_constraint_apply_for_object(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct bConstraint *con)
Definition: constraint.c:5617
bool BKE_constraint_remove(ListBase *list, struct bConstraint *con)
Definition: constraint.c:5592
void BKE_constraints_id_loop(struct ListBase *list, ConstraintIDFunc func, void *userdata)
Definition: constraint.c:5877
void BKE_constraints_free_ex(struct ListBase *list, bool do_id_user)
Definition: constraint.c:5576
struct bConstraint * BKE_constraint_copy_for_object(struct Object *ob, struct bConstraint *src)
Definition: constraint.c:5966
struct bConstraintTypeInfo bConstraintTypeInfo
void BKE_constraints_solve(struct Depsgraph *depsgraph, struct ListBase *conlist, struct bConstraintOb *cob, float ctime)
Definition: constraint.c:6352
void BKE_constraints_free(struct ListBase *list)
Definition: constraint.c:5587
void BKE_constraint_targets_flush(struct bConstraint *con, struct ListBase *targets, bool no_copy)
Definition: constraint.c:6186
struct bConstraint * BKE_constraint_add_for_object(struct Object *ob, const char *name, short type)
Definition: constraint.c:5870
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)
Definition: constraint.c:245
void BKE_constraint_blend_write(struct BlendWriter *writer, struct ListBase *conlist)
Definition: constraint.c:6437
void BKE_constraint_blend_read_expand(struct BlendExpander *expander, struct ListBase *lb)
Definition: constraint.c:6596
void(* ConstraintIDFunc)(struct bConstraint *con, struct ID **idpoin, bool is_reference, void *userdata)
struct bConstraint * BKE_constraints_find_name(struct ListBase *list, const char *name)
Definition: constraint.c:5996
void BKE_constraint_blend_read_data(struct BlendDataReader *reader, struct ListBase *lb)
Definition: constraint.c:6489
int BKE_constraint_targets_get(struct bConstraint *con, struct ListBase *r_targets)
Definition: constraint.c:6157
void BKE_constraints_copy(struct ListBase *dst, const struct ListBase *src, bool do_extern)
struct bConstraintOb * BKE_constraints_make_evalob(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, void *subdata, short datatype)
Definition: constraint.c:119
const bConstraintTypeInfo * BKE_constraint_typeinfo_from_type(int type)
Definition: constraint.c:5487
bool BKE_constraint_remove_ex(ListBase *list, struct Object *ob, struct bConstraint *con, bool clear_dep)
Definition: constraint.c:5603
void BKE_constraint_blend_read_lib(struct BlendLibReader *reader, struct ID *id, struct ListBase *conlist)
Definition: constraint.c:6559
void BKE_constraint_free_data(struct bConstraint *con)
Definition: constraint.c:5571
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)
Definition: constraint.c:5720
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)
Definition: constraint.c:6331
void BKE_constraint_free_data_ex(struct bConstraint *con, bool do_id_user)
Definition: constraint.c:5549
struct bConstraint * BKE_constraint_find_from_target(struct Object *ob, struct bConstraintTarget *tgt, struct bPoseChannel **r_pchan)
Definition: constraint.c:6052
bool BKE_constraint_target_uses_bbone(struct bConstraint *con, struct bConstraintTarget *ct)
Definition: constraint.c:5847
bool BKE_constraint_apply_and_remove_for_object(struct Depsgraph *depsgraph, struct Scene *scene, ListBase *constraints, struct Object *ob, struct bConstraint *con)
Definition: constraint.c:5658
struct bConstraint * BKE_constraints_active_get(struct ListBase *list)
Definition: constraint.c:6001
void BKE_constraints_copy_ex(struct ListBase *dst, const struct ListBase *src, int flag, bool do_extern)
const bConstraintTypeInfo * BKE_constraint_typeinfo_get(struct bConstraint *con)
Definition: constraint.c:5506
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)
Definition: constraint.c:6214
void BKE_constraint_targets_for_solving_get(struct Depsgraph *depsgraph, struct bConstraint *con, struct bConstraintOb *ob, struct ListBase *targets, float ctime)
Definition: constraint.c:6293
void BKE_constraints_clear_evalob(struct bConstraintOb *cob)
Definition: constraint.c:196
struct bConstraint * BKE_constraint_copy_for_pose(struct Object *ob, struct bPoseChannel *pchan, struct bConstraint *src)
Definition: constraint.c:5955
bool BKE_constraint_apply_for_pose(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan, struct bConstraint *con)
Definition: constraint.c:5671
void BKE_constraints_active_set(ListBase *list, struct bConstraint *con)
Definition: constraint.c:6017
void BKE_constraint_panel_expand(struct bConstraint *con)
Definition: constraint.c:5734
struct bConstraint * BKE_constraint_add_for_pose(struct Object *ob, struct bPoseChannel *pchan, const char *name, short type)
Definition: constraint.c:5858
void BKE_constraint_unique_name(struct bConstraint *con, struct ListBase *list)
Definition: constraint.c:112
struct bConstraint * BKE_constraint_duplicate_ex(struct bConstraint *src, int flag, bool do_extern)
Definition: constraint.c:5947
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:35
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
btSequentialImpulseConstraintSolverMt int btPersistentManifold int btTypedConstraint ** constraints
StackEntry * from
Scene scene
const Depsgraph * depsgraph
SyclQueue void void * src
SyclQueue void void size_t num_bytes void
Definition: DNA_ID.h:368
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)
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)