Blender  V3.3
gpencil_bake_animation.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2021 Blender Foundation. */
3 
8 #include "MEM_guardedalloc.h"
9 
10 #include "BLI_blenlib.h"
11 #include "BLI_ghash.h"
12 #include "BLI_math.h"
13 
14 #include "DNA_anim_types.h"
15 #include "DNA_gpencil_types.h"
16 #include "DNA_material_types.h"
17 #include "DNA_scene_types.h"
18 #include "DNA_screen_types.h"
19 
20 #include "BKE_anim_data.h"
21 #include "BKE_context.h"
22 #include "BKE_duplilist.h"
23 #include "BKE_gpencil.h"
24 #include "BKE_gpencil_geom.h"
25 #include "BKE_gpencil_modifier.h"
26 #include "BKE_layer.h"
27 #include "BKE_main.h"
28 #include "BKE_material.h"
29 #include "BKE_object.h"
30 #include "BKE_report.h"
31 #include "BKE_scene.h"
32 
33 #include "DEG_depsgraph.h"
34 #include "DEG_depsgraph_query.h"
35 
36 #include "WM_api.h"
37 #include "WM_types.h"
38 
39 #include "RNA_access.h"
40 #include "RNA_define.h"
41 
42 #include "ED_gpencil.h"
44 
45 #include "gpencil_intern.h"
46 
48  {GP_REPROJECT_KEEP, "KEEP", 0, "No Reproject", ""},
49  {GP_REPROJECT_FRONT, "FRONT", 0, "Front", "Reproject the strokes using the X-Z plane"},
50  {GP_REPROJECT_SIDE, "SIDE", 0, "Side", "Reproject the strokes using the Y-Z plane"},
51  {GP_REPROJECT_TOP, "TOP", 0, "Top", "Reproject the strokes using the X-Y plane"},
53  "VIEW",
54  0,
55  "View",
56  "Reproject the strokes to end up on the same plane, as if drawn from the current "
57  "viewpoint "
58  "using 'Cursor' Stroke Placement"},
60  "CURSOR",
61  0,
62  "Cursor",
63  "Reproject the strokes using the orientation of 3D cursor"},
64  {0, nullptr, 0, nullptr, nullptr},
65 };
66 
67 /* Check frame_end is always > start frame! */
69  struct Scene *UNUSED(scene),
70  struct PointerRNA *ptr)
71 {
72  int frame_start = RNA_int_get(ptr, "frame_start");
73  int frame_end = RNA_int_get(ptr, "frame_end");
74 
75  if (frame_end <= frame_start) {
76  RNA_int_set(ptr, "frame_end", frame_start + 1);
77  }
78 }
79 
80 /* Extract mesh animation to Grease Pencil. */
82 {
85  return false;
86  }
87 
88  /* Check if grease pencil or empty for dupli groups. */
89  if ((obact == nullptr) || (!ELEM(obact->type, OB_GPENCIL, OB_EMPTY))) {
90  return false;
91  }
92 
93  /* Only if the current view is 3D View. */
95  return (area && area->spacetype);
96 }
97 
98 struct GpBakeOb {
99  struct GpBakeOb *next, *prev;
101 };
102 
103 /* Get list of keyframes used by selected objects. */
105  const bool only_selected,
106  GHash *r_keyframes)
107 {
108  /* Loop all objects to get the list of keyframes used. */
109  LISTBASE_FOREACH (GpBakeOb *, elem, ob_list) {
110  Object *ob = elem->ob;
112  if ((adt == nullptr) || (adt->action == nullptr)) {
113  continue;
114  }
115  LISTBASE_FOREACH (FCurve *, fcurve, &adt->action->curves) {
116  int i;
117  BezTriple *bezt;
118  for (i = 0, bezt = fcurve->bezt; i < fcurve->totvert; i++, bezt++) {
119  /* Keyframe number is x value of point. */
120  if ((bezt->f2 & SELECT) || (!only_selected)) {
121  /* Insert only one key for each keyframe number. */
122  int key = (int)bezt->vec[1][0];
123  if (!BLI_ghash_haskey(r_keyframes, POINTER_FROM_INT(key))) {
124  BLI_ghash_insert(r_keyframes, POINTER_FROM_INT(key), POINTER_FROM_INT(key));
125  }
126  }
127  }
128  }
129  }
130 }
131 
133 {
134  GpBakeOb *elem = nullptr;
135  ListBase *lb;
137  LISTBASE_FOREACH (DupliObject *, dob, lb) {
138  if (dob->ob->type != OB_GPENCIL) {
139  continue;
140  }
141 
142  elem = MEM_cnew<GpBakeOb>(__func__);
143  elem->ob = dob->ob;
144  BLI_addtail(list, elem);
145  }
146 
148 }
149 
151 {
152  GpBakeOb *elem = nullptr;
153 
154  /* Add active object. In some files this could not be in selected array. */
155  Object *obact = CTX_data_active_object(C);
156 
157  if (obact->type == OB_GPENCIL) {
158  elem = MEM_cnew<GpBakeOb>(__func__);
159  elem->ob = obact;
160  BLI_addtail(list, elem);
161  }
162  /* Add duplilist. */
163  else if (obact->type == OB_EMPTY) {
164  gpencil_bake_duplilist(depsgraph, scene, obact, list);
165  }
166 
167  /* Add other selected objects. */
168  CTX_DATA_BEGIN (C, Object *, ob, selected_objects) {
169  if (ob == obact) {
170  continue;
171  }
172  /* Add selected objects. */
173  if (ob->type == OB_GPENCIL) {
174  elem = MEM_cnew<GpBakeOb>(__func__);
175  elem->ob = ob;
176  BLI_addtail(list, elem);
177  }
178 
179  /* Add duplilist. */
180  if (ob->type == OB_EMPTY) {
182  }
183  }
184  CTX_DATA_END;
185 }
186 
188 {
189  LISTBASE_FOREACH_MUTABLE (GpBakeOb *, elem, list) {
190  MEM_SAFE_FREE(elem);
191  }
192 }
193 
195 {
196  Main *bmain = CTX_data_main(C);
199  View3D *v3d = CTX_wm_view3d(C);
200 
201  ListBase ob_selected_list = {nullptr, nullptr};
202  gpencil_bake_ob_list(C, depsgraph, scene, &ob_selected_list);
203 
204  /* Grab all relevant settings. */
205  const int step = RNA_int_get(op->ptr, "step");
206 
207  const int frame_start = (scene->r.sfra > RNA_int_get(op->ptr, "frame_start")) ?
208  scene->r.sfra :
209  RNA_int_get(op->ptr, "frame_start");
210 
211  const int frame_end = (scene->r.efra < RNA_int_get(op->ptr, "frame_end")) ?
212  scene->r.efra :
213  RNA_int_get(op->ptr, "frame_end");
214 
215  const bool only_selected = RNA_boolean_get(op->ptr, "only_selected");
216  const int frame_offset = RNA_int_get(op->ptr, "frame_target") - frame_start;
217  const eGP_ReprojectModes project_type = (eGP_ReprojectModes)RNA_enum_get(op->ptr,
218  "project_type");
219 
220  /* Create a new grease pencil object. */
221  Object *ob_gpencil = nullptr;
222  ushort local_view_bits = (v3d && v3d->localvd) ? v3d->local_view_uuid : 0;
223  ob_gpencil = ED_gpencil_add_object(C, scene->cursor.location, local_view_bits);
224  float invmat[4][4];
225  invert_m4_m4(invmat, ob_gpencil->obmat);
226 
227  bGPdata *gpd_dst = (bGPdata *)ob_gpencil->data;
228  gpd_dst->draw_mode = GP_DRAWMODE_2D;
229 
230  /* Set cursor to indicate working. */
231  WM_cursor_wait(true);
232 
233  GP_SpaceConversion gsc = {nullptr};
234  SnapObjectContext *sctx = nullptr;
235  if (project_type != GP_REPROJECT_KEEP) {
236  /* Init space conversion stuff. */
238  /* Move the grease pencil object to conversion data. */
239  gsc.ob = ob_gpencil;
240 
241  /* Init snap context for geometry projection. */
243  }
244 
245  /* Loop all frame range. */
246  int oldframe = (int)DEG_get_ctime(depsgraph);
247  int key = -1;
248 
249  /* Get list of keyframes. */
250  GHash *keyframe_list = BLI_ghash_int_new(__func__);
251  if (only_selected) {
252  animdata_keyframe_list_get(&ob_selected_list, only_selected, keyframe_list);
253  }
254 
255  for (int i = frame_start; i < frame_end + 1; i++) {
256  key++;
257  /* Jump if not step limit but include last frame always. */
258  if ((key % step != 0) && (i != frame_end)) {
259  continue;
260  }
261 
262  /* Check if frame is in the list of frames to be exported. */
263  if ((only_selected) && (!BLI_ghash_haskey(keyframe_list, POINTER_FROM_INT(i)))) {
264  continue;
265  }
266 
267  /* Move scene to new frame. */
268  scene->r.cfra = i;
270 
271  /* Loop all objects in the list. */
272  LISTBASE_FOREACH (GpBakeOb *, elem, &ob_selected_list) {
273  Object *ob_eval = (Object *)DEG_get_evaluated_object(depsgraph, elem->ob);
274  bGPdata *gpd_src = static_cast<bGPdata *>(ob_eval->data);
275 
276  LISTBASE_FOREACH (bGPDlayer *, gpl_src, &gpd_src->layers) {
277  /* Create destination layer. */
278  char *layer_name;
279  layer_name = BLI_sprintfN("%s_%s", elem->ob->id.name + 2, gpl_src->info);
280  bGPDlayer *gpl_dst = BKE_gpencil_layer_named_get(gpd_dst, layer_name);
281  if (gpl_dst == nullptr) {
282  gpl_dst = BKE_gpencil_layer_addnew(gpd_dst, layer_name, true, false);
283  }
284  MEM_freeN(layer_name);
285 
286  /* Apply time modifier. */
287  int remap_cfra = BKE_gpencil_time_modifier_cfra(
288  depsgraph, scene, elem->ob, gpl_src, scene->r.cfra, false);
289  /* Duplicate frame. */
291  gpl_src, remap_cfra, GP_GETFRAME_USE_PREV);
292  if (gpf_src == nullptr) {
293  continue;
294  }
295  bGPDframe *gpf_dst = BKE_gpencil_frame_duplicate(gpf_src, true);
296  gpf_dst->framenum = scene->r.cfra + frame_offset;
297  gpf_dst->flag &= ~GP_FRAME_SELECT;
298  BLI_addtail(&gpl_dst->frames, gpf_dst);
299 
300  LISTBASE_FOREACH (bGPDstroke *, gps, &gpf_dst->strokes) {
301  gps->runtime.gps_orig = NULL;
302  /* Create material of the stroke. */
303  Material *ma_src = BKE_object_material_get(elem->ob, gps->mat_nr + 1);
304  bool found = false;
305  for (int index = 0; index < ob_gpencil->totcol; index++) {
306  Material *ma_dst = BKE_object_material_get(ob_gpencil, index + 1);
307  if (ma_src == ma_dst) {
308  found = true;
309  break;
310  }
311  }
312  if (!found) {
313  BKE_object_material_slot_add(bmain, ob_gpencil);
315  bmain, ob_gpencil, ma_src, ob_gpencil->totcol, BKE_MAT_ASSIGN_USERPREF);
316  }
317 
318  /* Set new material index. */
319  gps->mat_nr = BKE_gpencil_object_material_index_get(ob_gpencil, ma_src);
320 
321  /* Update point location to new object space. */
322  for (int j = 0; j < gps->totpoints; j++) {
323  bGPDspoint *pt = &gps->points[j];
324  pt->runtime.idx_orig = 0;
325  pt->runtime.pt_orig = NULL;
326  mul_m4_v3(ob_eval->obmat, &pt->x);
327  mul_m4_v3(invmat, &pt->x);
328  }
329 
330  /* Reproject stroke. */
331  if (project_type != GP_REPROJECT_KEEP) {
333  depsgraph, &gsc, sctx, gpl_dst, gpf_dst, gps, project_type, false);
334  }
335  else {
337  }
338  }
339  }
340  }
341  }
342  /* Return scene frame state and DB to original state. */
343  scene->r.cfra = oldframe;
345 
346  /* Free memory. */
347  gpencil_bake_free_ob_list(&ob_selected_list);
348  if (sctx != nullptr) {
350  }
351  /* Free temp hash table. */
352  if (keyframe_list != nullptr) {
353  BLI_ghash_free(keyframe_list, nullptr, nullptr);
354  }
355 
356  /* Notifiers. */
362 
363  /* Reset cursor. */
364  WM_cursor_wait(false);
365 
366  /* done */
367  return OPERATOR_FINISHED;
368 }
369 
371  wmOperator *op,
372  const wmEvent *UNUSED(event))
373 {
374  PropertyRNA *prop;
376 
377  prop = RNA_struct_find_property(op->ptr, "frame_start");
378  if (!RNA_property_is_set(op->ptr, prop)) {
379  const int frame_start = RNA_property_int_get(op->ptr, prop);
380  if (frame_start < scene->r.sfra) {
381  RNA_property_int_set(op->ptr, prop, scene->r.sfra);
382  }
383  }
384 
385  prop = RNA_struct_find_property(op->ptr, "frame_end");
386  if (!RNA_property_is_set(op->ptr, prop)) {
387  const int frame_end = RNA_property_int_get(op->ptr, prop);
388  if (frame_end > scene->r.efra) {
389  RNA_property_int_set(op->ptr, prop, scene->r.efra);
390  }
391  }
392 
393  /* Show popup dialog to allow editing. */
394  return WM_operator_props_dialog_popup(C, op, 250);
395 }
396 
398 {
399  PropertyRNA *prop;
400 
401  /* identifiers */
402  ot->name = "Bake Object Transform to Grease Pencil";
403  ot->idname = "GPENCIL_OT_bake_grease_pencil_animation";
404  ot->description = "Bake grease pencil object transform to grease pencil keyframes";
405 
406  /* callbacks */
410 
411  /* flags */
413 
414  /* properties */
415  prop = RNA_def_int(
416  ot->srna, "frame_start", 1, 1, 100000, "Start Frame", "The start frame", 1, 100000);
417 
418  prop = RNA_def_int(
419  ot->srna, "frame_end", 250, 1, 100000, "End Frame", "The end frame of animation", 1, 100000);
421 
422  prop = RNA_def_int(ot->srna, "step", 1, 1, 100, "Step", "Step between generated frames", 1, 100);
423 
425  "only_selected",
426  false,
427  "Only Selected Keyframes",
428  "Convert only selected keyframes");
429  RNA_def_int(
430  ot->srna, "frame_target", 1, 1, 100000, "Target Frame", "Destination frame", 1, 100000);
431 
433  "project_type",
436  "Projection Type",
437  "");
438 }
struct AnimData * BKE_animdata_from_id(const struct ID *id)
struct ScrArea * CTX_wm_area(const bContext *C)
Definition: context.c:738
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1090
#define CTX_DATA_BEGIN(C, Type, instance, member)
Definition: BKE_context.h:269
@ CTX_MODE_OBJECT
Definition: BKE_context.h:118
struct Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
Definition: context.c:1528
struct Object * CTX_data_active_object(const bContext *C)
Definition: context.c:1353
struct View3D * CTX_wm_view3d(const bContext *C)
Definition: context.c:784
struct Main * CTX_data_main(const bContext *C)
Definition: context.c:1074
#define CTX_DATA_END
Definition: BKE_context.h:278
enum eContextObjectMode CTX_data_mode_enum(const bContext *C)
Definition: context.c:1228
struct ListBase * object_duplilist(struct Depsgraph *depsgraph, struct Scene *sce, struct Object *ob)
void free_object_duplilist(struct ListBase *lb)
struct bGPDframe * BKE_gpencil_frame_duplicate(const struct bGPDframe *gpf_src, bool dup_strokes)
struct bGPDlayer * BKE_gpencil_layer_addnew(struct bGPdata *gpd, const char *name, bool setactive, bool add_to_header)
Definition: gpencil.c:621
int BKE_gpencil_object_material_index_get(struct Object *ob, struct Material *ma)
Definition: gpencil.c:2199
struct bGPDlayer * BKE_gpencil_layer_named_get(struct bGPdata *gpd, const char *name)
Definition: gpencil.c:1419
struct bGPDframe * BKE_gpencil_layer_frame_get(struct bGPDlayer *gpl, int cframe, eGP_GetFrame_Mode addnew)
Definition: gpencil.c:1232
@ GP_GETFRAME_USE_PREV
Definition: BKE_gpencil.h:338
void BKE_gpencil_stroke_geometry_update(struct bGPdata *gpd, struct bGPDstroke *gps)
int BKE_gpencil_time_modifier_cfra(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct bGPDlayer *gpl, int cfra, bool is_render)
General operations, lookup, etc. for materials.
struct Material * BKE_object_material_get(struct Object *ob, short act)
Definition: material.c:687
void BKE_object_material_assign(struct Main *bmain, struct Object *ob, struct Material *ma, short act, int assign_type)
Definition: material.c:1047
bool BKE_object_material_slot_add(struct Main *bmain, struct Object *ob)
Definition: material.c:1232
@ BKE_MAT_ASSIGN_USERPREF
Definition: BKE_material.h:80
General operations, lookup, etc. for blender objects.
void BKE_scene_graph_update_for_newframe(struct Depsgraph *depsgraph)
Definition: scene.cc:2728
bool BLI_ghash_haskey(const GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
Definition: BLI_ghash.c:822
GHash * BLI_ghash_int_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
void BLI_ghash_insert(GHash *gh, void *key, void *val)
Definition: BLI_ghash.c:710
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
Definition: BLI_ghash.c:863
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:336
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
Definition: BLI_listbase.h:354
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:80
bool invert_m4_m4(float R[4][4], const float A[4][4])
Definition: math_matrix.c:1287
void mul_m4_v3(const float M[4][4], float r[3])
Definition: math_matrix.c:729
size_t size_t char * BLI_sprintfN(const char *__restrict format,...) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_PRINTF_FORMAT(1
unsigned short ushort
Definition: BLI_sys_types.h:68
#define POINTER_FROM_INT(i)
#define UNUSED(x)
#define ELEM(...)
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:35
void DEG_id_tag_update(struct ID *id, int flag)
void DEG_relations_tag_update(struct Main *bmain)
float DEG_get_ctime(const Depsgraph *graph)
struct Object * DEG_get_evaluated_object(const struct Depsgraph *depsgraph, struct Object *object)
@ ID_RECALC_COPY_ON_WRITE
Definition: DNA_ID.h:834
@ ID_RECALC_SELECT
Definition: DNA_ID.h:818
@ GP_DRAWMODE_2D
@ GP_FRAME_SELECT
@ OB_EMPTY
@ OB_GPENCIL
@ OPERATOR_FINISHED
eGP_ReprojectModes
Definition: ED_gpencil.h:52
@ GP_REPROJECT_VIEW
Definition: ED_gpencil.h:58
@ GP_REPROJECT_CURSOR
Definition: ED_gpencil.h:62
@ GP_REPROJECT_KEEP
Definition: ED_gpencil.h:64
@ GP_REPROJECT_SIDE
Definition: ED_gpencil.h:55
@ GP_REPROJECT_TOP
Definition: ED_gpencil.h:56
@ GP_REPROJECT_FRONT
Definition: ED_gpencil.h:54
SnapObjectContext * ED_transform_snap_object_context_create(struct Scene *scene, int flag)
void ED_transform_snap_object_context_destroy(SnapObjectContext *sctx)
_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 const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble GLdouble r _GL_VOID_RET _GL_VOID GLfloat GLfloat r _GL_VOID_RET _GL_VOID GLint GLint r _GL_VOID_RET _GL_VOID GLshort GLshort r _GL_VOID_RET _GL_VOID GLdouble GLdouble r
Read Guarded memory(de)allocation.
#define MEM_SAFE_FREE(v)
#define C
Definition: RandGen.cpp:25
@ OPTYPE_UNDO
Definition: WM_types.h:148
@ OPTYPE_REGISTER
Definition: WM_types.h:146
#define ND_OB_ACTIVE
Definition: WM_types.h:388
#define NC_SCENE
Definition: WM_types.h:328
#define NA_ADDED
Definition: WM_types.h:525
#define NC_OBJECT
Definition: WM_types.h:329
int main(int argc, char *argv[])
#define SELECT
Scene scene
const Depsgraph * depsgraph
void GPENCIL_OT_bake_grease_pencil_animation(wmOperatorType *ot)
static int gpencil_bake_grease_pencil_animation_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
const EnumPropertyItem rna_gpencil_reproject_type_items[]
static void gpencil_bake_free_ob_list(ListBase *list)
static int gpencil_bake_grease_pencil_animation_exec(bContext *C, wmOperator *op)
static void animdata_keyframe_list_get(ListBase *ob_list, const bool only_selected, GHash *r_keyframes)
static bool gpencil_bake_grease_pencil_animation_poll(bContext *C)
static void gpencil_bake_set_frame_end(struct Main *UNUSED(main), struct Scene *UNUSED(scene), struct PointerRNA *ptr)
static void gpencil_bake_duplilist(Depsgraph *depsgraph, Scene *scene, Object *ob, ListBase *list)
static void gpencil_bake_ob_list(bContext *C, Depsgraph *depsgraph, Scene *scene, ListBase *list)
void gpencil_point_conversion_init(struct bContext *C, GP_SpaceConversion *r_gsc)
Object * ED_gpencil_add_object(bContext *C, const float loc[3], ushort local_view_bits)
void ED_gpencil_stroke_reproject(Depsgraph *depsgraph, const GP_SpaceConversion *gsc, SnapObjectContext *sctx, bGPDlayer *gpl, bGPDframe *gpf, bGPDstroke *gps, const eGP_ReprojectModes mode, const bool keep_original)
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
static void area(int d1, int d2, int e1, int e2, float weights[2])
void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value)
Definition: rna_access.c:2449
bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:5271
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
Definition: rna_access.c:4921
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
Definition: rna_access.c:717
int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:2429
int RNA_int_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:4910
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:4863
int RNA_enum_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:5004
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3493
void RNA_def_property_update_runtime(PropertyRNA *prop, const void *func)
Definition: rna_define.c:2911
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, int default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
Definition: rna_define.c:3597
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3783
bAction * action
float vec[3][3]
uint8_t f2
struct Object * ob
struct GpBakeOb * prev
struct GpBakeOb * next
Definition: BKE_main.h:121
float obmat[4][4]
void * data
struct RenderData r
View3DCursor cursor
unsigned short local_view_uuid
struct View3D * localvd
ListBase curves
ListBase strokes
ListBase frames
struct bGPDspoint * pt_orig
bGPDspoint_Runtime runtime
ListBase layers
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:919
const char * name
Definition: WM_types.h:888
const char * idname
Definition: WM_types.h:890
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:943
struct StructRNA * srna
Definition: WM_types.h:969
const char * description
Definition: WM_types.h:893
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:903
struct PointerRNA * ptr
void WM_cursor_wait(bool val)
Definition: wm_cursors.c:209
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
PointerRNA * ptr
Definition: wm_files.c:3480
wmOperatorType * ot
Definition: wm_files.c:3479
int WM_operator_props_dialog_popup(bContext *C, wmOperator *op, int width)