Blender  V2.93
gpencil_modifier.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2017, Blender Foundation
17  * This is a new part of Blender
18  */
19 
24 #include <stdio.h>
25 
26 #include "MEM_guardedalloc.h"
27 
28 #include "BLI_blenlib.h"
29 #include "BLI_math_geom.h"
30 #include "BLI_math_vector.h"
31 #include "BLI_string_utils.h"
32 #include "BLI_utildefines.h"
33 
34 #include "BLT_translation.h"
35 
36 #include "DNA_armature_types.h"
38 #include "DNA_gpencil_types.h"
39 #include "DNA_meshdata_types.h"
40 #include "DNA_modifier_types.h"
41 #include "DNA_object_types.h"
42 #include "DNA_scene_types.h"
43 #include "DNA_screen_types.h"
44 
45 #include "BKE_colortools.h"
46 #include "BKE_gpencil.h"
47 #include "BKE_gpencil_geom.h"
48 #include "BKE_gpencil_modifier.h"
49 #include "BKE_lattice.h"
50 #include "BKE_lib_id.h"
51 #include "BKE_lib_query.h"
52 #include "BKE_material.h"
53 #include "BKE_object.h"
54 
55 #include "DEG_depsgraph.h"
56 #include "DEG_depsgraph_query.h"
57 
59 
60 #include "BLO_read_write.h"
61 
62 #include "CLG_log.h"
63 
64 static CLG_LogRef LOG = {"bke.gpencil_modifier"};
66 #if 0
67 /* Note that GPencil actually does not support these atm, but might do in the future. */
69 #endif
70 
71 /* Lattice Modifier ---------------------------------- */
72 /* Usually, evaluation of the lattice modifier is self-contained.
73  * However, since GP's modifiers operate on a per-stroke basis,
74  * we need to these two extra functions that called before/after
75  * each loop over all the geometry being evaluated.
76  */
77 
83 {
85  if (md->type == eGpencilModifierType_Lattice) {
87  Object *latob = NULL;
88 
89  latob = mmd->object;
90  if ((!latob) || (latob->type != OB_LATTICE)) {
91  return;
92  }
93  if (mmd->cache_data) {
95  }
96 
97  /* init deform data */
99  }
100  }
101 }
102 
108 {
110  if (md->type == eGpencilModifierType_Lattice) {
112  if ((mmd) && (mmd->cache_data)) {
114  mmd->cache_data = NULL;
115  }
116  }
117  }
118 }
119 
120 /* *************************************************** */
121 /* Modifier Methods - Evaluation Loops, etc. */
122 
123 /* This is to include things that are not modifiers in the evaluation of the modifier stack, for
124  * example parenting to an armature or lattice without having a real modifier. */
126  const Object *ob, GpencilVirtualModifierData *UNUSED(virtualModifierData))
127 {
129 
130 #if 0
131  /* Note that GPencil actually does not support these atm, but might do in the future. */
132  *virtualModifierData = virtualModifierCommonData;
133  if (ob->parent) {
134  if (ob->parent->type == OB_ARMATURE && ob->partype == PARSKEL) {
135  virtualModifierData->amd.object = ob->parent;
136  virtualModifierData->amd.modifier.next = md;
137  virtualModifierData->amd.deformflag = ((bArmature *)(ob->parent->data))->deformflag;
138  md = &virtualModifierData->amd.modifier;
139  }
140  else if (ob->parent->type == OB_LATTICE && ob->partype == PARSKEL) {
141  virtualModifierData->lmd.object = ob->parent;
142  virtualModifierData->lmd.modifier.next = md;
143  md = &virtualModifierData->lmd.modifier;
144  }
145  }
146 #endif
147 
148  return md;
149 }
150 
157 {
160 
161  if (mti && mti->generateStrokes) {
162  return true;
163  }
164  }
165  return false;
166 }
167 
174 {
177 
178  if (mti && mti->remapTime) {
179  return true;
180  }
181  }
182  return false;
183 }
184 
191 {
193  /* Only if enabled in edit mode. */
194  if (!GPENCIL_MODIFIER_EDIT(md, true) && GPENCIL_MODIFIER_ACTIVE(md, false)) {
195  if ((md->type == eGpencilModifierType_Armature) || (md->type == eGpencilModifierType_Hook) ||
196  (md->type == eGpencilModifierType_Lattice) ||
197  (md->type == eGpencilModifierType_Offset)) {
198  return true;
199  }
200  }
201  }
202  return false;
203 }
204 
205 /* apply time modifiers */
207  Depsgraph *depsgraph, Scene *scene, Object *ob, bGPDlayer *gpl, int cfra, bool is_render)
208 {
209  bGPdata *gpd = ob->data;
210  const bool is_edit = GPENCIL_ANY_EDIT_MODE(gpd);
211  int nfra = cfra;
212 
214  if (GPENCIL_MODIFIER_ACTIVE(md, is_render)) {
216 
217  if ((GPENCIL_MODIFIER_EDIT(md, is_edit)) && (!is_render)) {
218  continue;
219  }
220 
221  if (mti->remapTime) {
222  nfra = mti->remapTime(md, depsgraph, scene, ob, gpl, cfra);
223  /* if the frame number changed, don't evaluate more and return */
224  if (nfra != cfra) {
225  return nfra;
226  }
227  }
228  }
229  }
230 
231  /* if no time modifier, return original frame number */
232  return nfra;
233 }
234 
241 {
242  DEG_debug_print_eval(depsgraph, __func__, gpd->id.name, gpd);
243  int ctime = (int)DEG_get_ctime(depsgraph);
244 
245  /* update active frame */
246  LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
247  gpl->actframe = BKE_gpencil_layer_frame_get(gpl, ctime, GP_GETFRAME_USE_PREV);
248  }
249 
250  if (DEG_is_active(depsgraph)) {
251  bGPdata *gpd_orig = (bGPdata *)DEG_get_original_id(&gpd->id);
252 
253  /* sync "actframe" changes back to main-db too,
254  * so that editing tools work with copy-on-write
255  * when the current frame changes
256  */
257  LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd_orig->layers) {
258  gpl->actframe = BKE_gpencil_layer_frame_get(gpl, ctime, GP_GETFRAME_USE_PREV);
259  }
260  }
261 }
262 
267 {
268  /* Initialize modifier types */
269  gpencil_modifier_type_init(modifier_gpencil_types); /* MOD_gpencil_util.c */
270 
271 #if 0
272  /* Note that GPencil actually does not support these atm, but might do in the future. */
273  /* Initialize global cmmon storage used for virtual modifier list */
278 
282 
285 #endif
286 }
287 
294 {
297 
298  /* note, this name must be made unique later */
299  BLI_strncpy(md->name, DATA_(mti->name), sizeof(md->name));
300 
301  md->type = type;
304  md->ui_expand_flag = 1; /* Only expand the parent panel at first. */
305 
308  }
309 
310  if (mti->initData) {
311  mti->initData(md);
312  }
313 
314  return md;
315 }
316 
317 static void modifier_free_data_id_us_cb(void *UNUSED(userData),
318  Object *UNUSED(ob),
319  ID **idpoin,
320  int cb_flag)
321 {
322  ID *id = *idpoin;
323  if (id != NULL && (cb_flag & IDWALK_CB_USER) != 0) {
324  id_us_min(id);
325  }
326 }
327 
334 {
336 
337  if ((flag & LIB_ID_CREATE_NO_USER_REFCOUNT) == 0) {
338  if (mti->foreachIDLink) {
340  }
341  }
342 
343  if (mti->freeData) {
344  mti->freeData(md);
345  }
346  if (md->error) {
347  MEM_freeN(md->error);
348  }
349 
350  MEM_freeN(md);
351 }
352 
358 {
360 }
361 
362 /* check unique name */
364 {
365  if (modifiers && gmd) {
367  return BLI_uniquename(modifiers,
368  gmd,
369  DATA_(gmti->name),
370  '.',
371  offsetof(GpencilModifierData, name),
372  sizeof(gmd->name));
373  }
374  return false;
375 }
376 
383 {
385 
386  return mti->dependsOnTime && mti->dependsOnTime(md);
387 }
388 
395 {
396  /* type unsigned, no need to check < 0 */
397  if (type < NUM_GREASEPENCIL_MODIFIER_TYPES && type > 0 &&
398  modifier_gpencil_types[type]->name[0] != '\0') {
400  }
401 
402  return NULL;
403 }
404 
412 {
414 
415  strcpy(r_idname, GPENCIL_MODIFIER_TYPE_PANEL_PREFIX);
416  strcat(r_idname, mti->name);
417 }
418 
420 {
422 }
423 
430  GpencilModifierData *md_dst)
431 {
433 
434  /* md_dst may have already be fully initialized with some extra allocated data,
435  * we need to free it now to avoid memleak. */
436  if (mti->freeData) {
437  mti->freeData(md_dst);
438  }
439 
440  const size_t data_size = sizeof(GpencilModifierData);
441  const char *md_src_data = ((const char *)md_src) + data_size;
442  char *md_dst_data = ((char *)md_dst) + data_size;
443  BLI_assert(data_size <= (size_t)mti->struct_size);
444  memcpy(md_dst_data, md_src_data, (size_t)mti->struct_size - data_size);
445 }
446 
447 static void gpencil_modifier_copy_data_id_us_cb(void *UNUSED(userData),
448  Object *UNUSED(ob),
449  ID **idpoin,
450  int cb_flag)
451 {
452  ID *id = *idpoin;
453  if (id != NULL && (cb_flag & IDWALK_CB_USER) != 0) {
454  id_us_plus(id);
455  }
456 }
457 
465  GpencilModifierData *target,
466  const int flag)
467 {
469 
470  target->mode = md->mode;
471  target->flag = md->flag;
472  target->ui_expand_flag = md->ui_expand_flag; /* Expand the parent panel by default. */
473 
474  if (mti->copyData) {
475  mti->copyData(md, target);
476  }
477 
478  if ((flag & LIB_ID_CREATE_NO_USER_REFCOUNT) == 0) {
479  if (mti->foreachIDLink) {
481  }
482  }
483 }
484 
491 {
492  BKE_gpencil_modifier_copydata_ex(md, target, 0);
493 }
494 
496 {
498 
499  for (; md; md = md->next) {
500  if (md->type == type) {
501  break;
502  }
503  }
504 
505  return md;
506 }
507 
513 void BKE_gpencil_modifier_set_error(GpencilModifierData *md, const char *_format, ...)
514 {
515  char buffer[512];
516  va_list ap;
517  const char *format = TIP_(_format);
518 
519  va_start(ap, _format);
520  vsnprintf(buffer, sizeof(buffer), format, ap);
521  va_end(ap);
522  buffer[sizeof(buffer) - 1] = '\0';
523 
524  if (md->error) {
525  MEM_freeN(md->error);
526  }
527 
528  md->error = BLI_strdup(buffer);
529 
530  CLOG_STR_ERROR(&LOG, md->error);
531 }
532 
540  const GpencilModifierData *gmd)
541 {
542  return (ID_IS_OVERRIDE_LIBRARY(ob) &&
543  (gmd == NULL || (gmd->flag & eGpencilModifierFlag_OverrideLibrary_Local) == 0));
544 }
545 
553 {
555 
556  for (; md; md = md->next) {
558 
559  if (mti->foreachIDLink) {
560  mti->foreachIDLink(md, ob, walk, userData);
561  }
562  }
563 }
564 
573  void *userData)
574 {
576 
577  for (; md; md = md->next) {
579 
580  if (mti->foreachTexLink) {
581  mti->foreachTexLink(md, ob, walk, userData);
582  }
583  }
584 }
585 
593 {
594  return BLI_findstring(&(ob->greasepencil_modifiers), name, offsetof(GpencilModifierData, name));
595 }
596 
606 {
607  const bool is_render = (bool)(DEG_get_mode(depsgraph) == DAG_EVAL_RENDER);
608  const bool time_remap = BKE_gpencil_has_time_modifiers(ob);
609  int cfra_eval = (int)DEG_get_ctime(depsgraph);
610 
611  int remap_cfra = cfra_eval;
612  if (time_remap) {
613  remap_cfra = gpencil_time_modifier(depsgraph, scene, ob, gpl, cfra_eval, is_render);
614  }
615 
616  return remap_cfra;
617 }
618 
628  Scene *scene,
629  Object *ob,
630  bGPDlayer *gpl)
631 {
632  int remap_cfra = gpencil_remap_time_get(depsgraph, scene, ob, gpl);
634 
635  return gpf;
636 }
637 
638 static void gpencil_assign_object_eval(Object *object)
639 {
641 
642  bGPdata *gpd_eval = object->runtime.gpd_eval;
643 
645 
646  if (object->id.tag & LIB_TAG_COPIED_ON_WRITE) {
647  object->data = gpd_eval;
648  }
649 }
650 
651 /* Helper: Copy active frame from original datablock to evaluated datablock for modifiers. */
653  Depsgraph *depsgraph, Scene *scene, Object *ob, bGPdata *gpd_orig, bGPdata *gpd_eval)
654 {
655 
656  bGPDlayer *gpl_eval = gpd_eval->layers.first;
657  LISTBASE_FOREACH (bGPDlayer *, gpl_orig, &gpd_orig->layers) {
658 
659  if (gpl_eval != NULL) {
660  bGPDframe *gpf_orig = gpl_orig->actframe;
661 
662  int remap_cfra = gpencil_remap_time_get(depsgraph, scene, ob, gpl_orig);
663  if ((gpf_orig == NULL) || (gpf_orig && gpf_orig->framenum != remap_cfra)) {
664  gpf_orig = BKE_gpencil_layer_frame_get(gpl_orig, remap_cfra, GP_GETFRAME_USE_PREV);
665  }
666 
667  if (gpf_orig != NULL) {
668  int gpf_index = BLI_findindex(&gpl_orig->frames, gpf_orig);
669  bGPDframe *gpf_eval = BLI_findlink(&gpl_eval->frames, gpf_index);
670 
671  if (gpf_eval != NULL) {
672  /* Delete old strokes. */
673  BKE_gpencil_free_strokes(gpf_eval);
674  /* Copy again strokes. */
675  BKE_gpencil_frame_copy_strokes(gpf_orig, gpf_eval);
676 
677  gpf_eval->runtime.gpf_orig = (bGPDframe *)gpf_orig;
678  BKE_gpencil_frame_original_pointers_update(gpf_orig, gpf_eval);
679  }
680  }
681 
682  gpl_eval = gpl_eval->next;
683  }
684  }
685 }
686 
688 {
689  const int flags = LIB_ID_COPY_LOCALIZE;
690 
691  bGPdata *result = (bGPdata *)BKE_id_copy_ex(NULL, &gpd->id, NULL, flags);
692  return result;
693 }
694 
702 {
703  bGPdata *gpd_eval = (bGPdata *)ob->data;
704  Object *ob_orig = (Object *)DEG_get_original_id(&ob->id);
705  bGPdata *gpd_orig = (bGPdata *)ob_orig->data;
706 
707  /* Need check if some layer is parented or transformed. */
708  bool do_parent = false;
709  bool do_transform = false;
710  LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd_orig->layers) {
711  if (gpl->parent != NULL) {
712  do_parent = true;
713  break;
714  }
715 
716  /* Only do layer transformations for non-zero or animated transforms. */
717  bool transformed = ((!is_zero_v3(gpl->location)) || (!is_zero_v3(gpl->rotation)) ||
718  (!is_one_v3(gpl->scale)));
719  float tmp_mat[4][4];
720  loc_eul_size_to_mat4(tmp_mat, gpl->location, gpl->rotation, gpl->scale);
721  transformed |= !equals_m4m4(gpl->layer_mat, tmp_mat);
722  if (transformed) {
723  do_transform = true;
724  break;
725  }
726  }
727 
728  const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd_eval);
729  const bool is_curve_edit = (bool)GPENCIL_CURVE_EDIT_SESSIONS_ON(gpd_eval);
730  const bool do_modifiers = (bool)((!is_multiedit) && (!is_curve_edit) &&
731  (ob->greasepencil_modifiers.first != NULL) &&
733  if ((!do_modifiers) && (!do_parent) && (!do_transform)) {
734  return;
735  }
736  DEG_debug_print_eval(depsgraph, __func__, gpd_eval->id.name, gpd_eval);
737 
738  /* If only one user, don't need a new copy, just update data of the frame. */
739  if (gpd_orig->id.us == 1) {
740  ob->runtime.gpd_eval = NULL;
741  gpencil_copy_activeframe_to_eval(depsgraph, scene, ob, ob_orig->data, gpd_eval);
742  return;
743  }
744 
745  /* Copy full Datablock to evaluated version. */
746  ob->runtime.gpd_orig = gpd_orig;
747  if (ob->runtime.gpd_eval != NULL) {
749  ob->runtime.gpd_eval = NULL;
750  ob->data = ob->runtime.gpd_orig;
751  }
755 }
756 
764 {
765  bGPdata *gpd = (bGPdata *)ob->data;
766  const bool is_edit = GPENCIL_ANY_EDIT_MODE(gpd);
767  const bool is_render = (bool)(DEG_get_mode(depsgraph) == DAG_EVAL_RENDER);
768  const bool is_curve_edit = (bool)(GPENCIL_CURVE_EDIT_SESSIONS_ON(gpd) && !is_render);
769  const bool is_multiedit = (bool)(GPENCIL_MULTIEDIT_SESSIONS_ON(gpd) && !is_render);
770  const bool do_modifiers = (bool)((!is_multiedit) && (!is_curve_edit) &&
771  (ob->greasepencil_modifiers.first != NULL) &&
773  if (!do_modifiers) {
774  return;
775  }
776 
777  /* Init general modifiers data. */
779 
780  const bool time_remap = BKE_gpencil_has_time_modifiers(ob);
781 
783 
784  if (GPENCIL_MODIFIER_ACTIVE(md, is_render)) {
786 
787  if ((GPENCIL_MODIFIER_EDIT(md, is_edit)) && (!is_render)) {
788  continue;
789  }
790 
791  /* Apply geometry modifiers (add new geometry). */
792  if (mti && mti->generateStrokes) {
793  mti->generateStrokes(md, depsgraph, ob);
794  }
795 
796  /* Apply deform modifiers and Time remap (only change geometry). */
797  if ((time_remap) || (mti && mti->deformStroke)) {
798  LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
800  if (gpf == NULL) {
801  continue;
802  }
803 
804  if (mti->deformStroke) {
805  LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
806  mti->deformStroke(md, depsgraph, ob, gpl, gpf, gps);
807  }
808  }
809  }
810  }
811  }
812  }
813 
814  /* Clear any lattice data. */
816 }
817 
819 {
820  if (modbase == NULL) {
821  return;
822  }
823 
824  LISTBASE_FOREACH (GpencilModifierData *, md, modbase) {
826  if (mti == NULL) {
827  return;
828  }
829 
830  BLO_write_struct_by_name(writer, mti->struct_name, md);
831 
832  if (md->type == eGpencilModifierType_Thick) {
834 
835  if (gpmd->curve_thickness) {
837  }
838  }
839  else if (md->type == eGpencilModifierType_Noise) {
841 
842  if (gpmd->curve_intensity) {
844  }
845  }
846  else if (md->type == eGpencilModifierType_Hook) {
848 
849  if (gpmd->curfalloff) {
851  }
852  }
853  else if (md->type == eGpencilModifierType_Tint) {
855  if (gpmd->colorband) {
856  BLO_write_struct(writer, ColorBand, gpmd->colorband);
857  }
858  if (gpmd->curve_intensity) {
860  }
861  }
862  else if (md->type == eGpencilModifierType_Smooth) {
864  if (gpmd->curve_intensity) {
866  }
867  }
868  else if (md->type == eGpencilModifierType_Color) {
870  if (gpmd->curve_intensity) {
872  }
873  }
874  else if (md->type == eGpencilModifierType_Opacity) {
876  if (gpmd->curve_intensity) {
878  }
879  }
880  }
881 }
882 
884 {
885  BLO_read_list(reader, lb);
886 
888  md->error = NULL;
889 
890  /* if modifiers disappear, or for upward compatibility */
891  if (NULL == BKE_gpencil_modifier_get_info(md->type)) {
892  md->type = eModifierType_None;
893  }
894 
895  if (md->type == eGpencilModifierType_Lattice) {
897  gpmd->cache_data = NULL;
898  }
899  else if (md->type == eGpencilModifierType_Hook) {
901 
902  BLO_read_data_address(reader, &hmd->curfalloff);
903  if (hmd->curfalloff) {
905  }
906  }
907  else if (md->type == eGpencilModifierType_Noise) {
909 
910  BLO_read_data_address(reader, &gpmd->curve_intensity);
911  if (gpmd->curve_intensity) {
913  /* initialize the curve. Maybe this could be moved to modififer logic */
915  }
916  }
917  else if (md->type == eGpencilModifierType_Thick) {
919 
920  BLO_read_data_address(reader, &gpmd->curve_thickness);
921  if (gpmd->curve_thickness) {
924  }
925  }
926  else if (md->type == eGpencilModifierType_Tint) {
928  BLO_read_data_address(reader, &gpmd->colorband);
929  BLO_read_data_address(reader, &gpmd->curve_intensity);
930  if (gpmd->curve_intensity) {
933  }
934  }
935  else if (md->type == eGpencilModifierType_Smooth) {
937  BLO_read_data_address(reader, &gpmd->curve_intensity);
938  if (gpmd->curve_intensity) {
941  }
942  }
943  else if (md->type == eGpencilModifierType_Color) {
945  BLO_read_data_address(reader, &gpmd->curve_intensity);
946  if (gpmd->curve_intensity) {
949  }
950  }
951  else if (md->type == eGpencilModifierType_Opacity) {
953  BLO_read_data_address(reader, &gpmd->curve_intensity);
954  if (gpmd->curve_intensity) {
957  }
958  }
959  }
960 }
961 
963 {
965 
966  /* If linking from a library, clear 'local' library override flag. */
967  if (ob->id.lib != NULL) {
970  }
971  }
972 }
void BKE_curvemapping_init(struct CurveMapping *cumap)
Definition: colortools.c:1200
void BKE_curvemapping_blend_read(struct BlendDataReader *reader, struct CurveMapping *cumap)
Definition: colortools.c:1252
void BKE_curvemapping_blend_write(struct BlendWriter *writer, const struct CurveMapping *cumap)
void BKE_gpencil_eval_delete(struct bGPdata *gpd_eval)
Definition: gpencil.c:512
bool BKE_gpencil_free_strokes(struct bGPDframe *gpf)
Definition: gpencil.c:425
void BKE_gpencil_frame_original_pointers_update(const struct bGPDframe *gpf_orig, const struct bGPDframe *gpf_eval)
Definition: gpencil.c:2839
struct bGPDframe * BKE_gpencil_layer_frame_get(struct bGPDlayer *gpl, int cframe, eGP_GetFrame_Mode addnew)
Definition: gpencil.c:1307
void BKE_gpencil_update_orig_pointers(const struct Object *ob_orig, const struct Object *ob_eval)
void BKE_gpencil_frame_copy_strokes(struct bGPDframe *gpf_src, struct bGPDframe *gpf_dst)
Definition: gpencil.c:1032
#define GPENCIL_SIMPLIFY_MODIF(scene)
Definition: BKE_gpencil.h:59
@ GP_GETFRAME_USE_PREV
Definition: BKE_gpencil.h:187
#define GPENCIL_MODIFIER_EDIT(_md, _is_edit)
#define GPENCIL_MODIFIER_TYPE_PANEL_PREFIX
void(* GreasePencilTexWalkFunc)(void *userData, struct Object *ob, struct GpencilModifierData *md, const char *propname)
@ eGpencilModifierTypeFlag_EnableInEditmode
#define GPENCIL_MODIFIER_ACTIVE(_md, _is_render)
void(* GreasePencilIDWalkFunc)(void *userData, struct Object *ob, struct ID **idpoin, int cb_flag)
void BKE_lattice_deform_data_destroy(struct LatticeDeformData *lattice_deform_data)
struct LatticeDeformData * BKE_lattice_deform_data_create(const struct Object *oblatt, const struct Object *ob) ATTR_WARN_UNUSED_RESULT
void id_us_min(struct ID *id)
Definition: lib_id.c:297
@ LIB_ID_COPY_LOCALIZE
Definition: BKE_lib_id.h:145
@ LIB_ID_CREATE_NO_USER_REFCOUNT
Definition: BKE_lib_id.h:92
struct ID * BKE_id_copy_ex(struct Main *bmain, const struct ID *id, struct ID **r_newid, const int flag)
void id_us_plus(struct ID *id)
Definition: lib_id.c:288
@ IDWALK_CB_USER
Definition: BKE_lib_query.h:87
General operations, lookup, etc. for materials.
General operations, lookup, etc. for blender objects.
void BKE_object_modifiers_lib_link_common(void *userData, struct Object *ob, struct ID **idpoin, int cb_flag)
Definition: object.c:5706
#define BLI_assert(a)
Definition: BLI_assert.h:58
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:172
void * BLI_findstring(const struct ListBase *listbase, const char *id, const int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
bool equals_m4m4(const float mat1[4][4], const float mat2[4][4])
Definition: math_matrix.c:2612
void loc_eul_size_to_mat4(float R[4][4], const float loc[3], const float eul[3], const float size[3])
Definition: math_matrix.c:2653
MINLINE bool is_zero_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
MINLINE bool is_one_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL() ATTR_MALLOC
Definition: string.c:70
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t maxncpy) ATTR_NONNULL()
Definition: string.c:108
bool BLI_uniquename(struct ListBase *list, void *vlink, const char *defname, char delim, int name_offset, size_t len)
Definition: string_utils.c:381
#define UNUSED(x)
#define BLO_read_data_address(reader, ptr_p)
void BLO_write_struct_by_name(BlendWriter *writer, const char *struct_name, const void *data_ptr)
Definition: writefile.c:1291
#define BLO_write_struct(writer, struct_name, data_ptr)
void BLO_read_list(BlendDataReader *reader, struct ListBase *list)
Definition: readfile.c:5654
#define TIP_(msgid)
#define DATA_(msgid)
#define CLOG_STR_ERROR(clg_ref, str)
Definition: CLG_log.h:210
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:51
bool DEG_is_active(const struct Depsgraph *depsgraph)
Definition: depsgraph.cc:331
@ DAG_EVAL_RENDER
Definition: DEG_depsgraph.h:62
void DEG_debug_print_eval(struct Depsgraph *depsgraph, const char *function_name, const char *object_name, const void *object_address)
float DEG_get_ctime(const Depsgraph *graph)
eEvaluationMode DEG_get_mode(const Depsgraph *graph)
struct ID * DEG_get_original_id(struct ID *id)
@ LIB_TAG_COPIED_ON_WRITE_EVAL_RESULT
Definition: DNA_ID.h:567
@ LIB_TAG_COPIED_ON_WRITE
Definition: DNA_ID.h:565
#define ID_IS_OVERRIDE_LIBRARY(_id)
Definition: DNA_ID.h:445
@ eGpencilModifierMode_Render
@ eGpencilModifierMode_Editmode
@ eGpencilModifierMode_Virtual
@ eGpencilModifierMode_Realtime
struct GpencilModifierData GpencilModifierData
@ eGpencilModifierFlag_OverrideLibrary_Local
@ eGpencilModifierType_Noise
@ eGpencilModifierType_Color
@ eGpencilModifierType_Lattice
@ eGpencilModifierType_Opacity
@ eGpencilModifierType_Hook
@ eGpencilModifierType_Armature
@ eGpencilModifierType_Smooth
@ eGpencilModifierType_Tint
@ NUM_GREASEPENCIL_MODIFIER_TYPES
@ eGpencilModifierType_Thick
@ eGpencilModifierType_Offset
#define GPENCIL_MULTIEDIT_SESSIONS_ON(gpd)
#define GPENCIL_CURVE_EDIT_SESSIONS_ON(gpd)
#define GPENCIL_ANY_EDIT_MODE(gpd)
@ eModifierType_None
Object is a sort of wrapper for general info.
@ PARSKEL
@ OB_LATTICE
@ OB_ARMATURE
@ UI_PANEL_DATA_EXPAND_ROOT
_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
Read Guarded memory(de)allocation.
void gpencil_modifier_type_init(GpencilModifierTypeInfo *types[])
static VirtualModifierData virtualModifierCommonData
Scene scene
const Depsgraph * depsgraph
bool BKE_gpencil_has_geometry_modifiers(Object *ob)
bool BKE_gpencil_has_transform_modifiers(Object *ob)
void BKE_gpencil_modifier_panel_expand(GpencilModifierData *md)
static bGPdata * gpencil_copy_for_eval(bGPdata *gpd)
void BKE_gpencil_lattice_init(Object *ob)
void BKE_gpencil_modifiers_calc(Depsgraph *depsgraph, Scene *scene, Object *ob)
void BKE_gpencil_modifiers_foreach_ID_link(Object *ob, GreasePencilIDWalkFunc walk, void *userData)
GpencilModifierData * BKE_gpencil_modifiers_get_virtual_modifierlist(const Object *ob, GpencilVirtualModifierData *UNUSED(virtualModifierData))
GpencilModifierData * BKE_gpencil_modifiers_findby_type(Object *ob, GpencilModifierType type)
void BKE_gpencil_modifier_blend_write(BlendWriter *writer, ListBase *modbase)
static int gpencil_remap_time_get(Depsgraph *depsgraph, Scene *scene, Object *ob, bGPDlayer *gpl)
GpencilModifierData * BKE_gpencil_modifier_new(int type)
void BKE_gpencil_lattice_clear(Object *ob)
void BKE_gpencil_frame_active_set(Depsgraph *depsgraph, bGPdata *gpd)
void BKE_gpencil_modifier_free_ex(GpencilModifierData *md, const int flag)
void BKE_gpencil_modifierType_panel_id(GpencilModifierType type, char *r_idname)
void BKE_gpencil_modifier_blend_read_lib(BlendLibReader *reader, Object *ob)
static void modifier_free_data_id_us_cb(void *UNUSED(userData), Object *UNUSED(ob), ID **idpoin, int cb_flag)
void BKE_gpencil_modifier_init(void)
static void gpencil_modifier_copy_data_id_us_cb(void *UNUSED(userData), Object *UNUSED(ob), ID **idpoin, int cb_flag)
bool BKE_gpencil_modifier_is_nonlocal_in_liboverride(const Object *ob, const GpencilModifierData *gmd)
bool BKE_gpencil_modifier_depends_ontime(GpencilModifierData *md)
bool BKE_gpencil_modifier_unique_name(ListBase *modifiers, GpencilModifierData *gmd)
static GpencilModifierTypeInfo * modifier_gpencil_types[NUM_GREASEPENCIL_MODIFIER_TYPES]
bGPDframe * BKE_gpencil_frame_retime_get(Depsgraph *depsgraph, Scene *scene, Object *ob, bGPDlayer *gpl)
void BKE_gpencil_modifiers_foreach_tex_link(Object *ob, GreasePencilTexWalkFunc walk, void *userData)
void BKE_gpencil_modifier_set_error(GpencilModifierData *md, const char *_format,...)
void BKE_gpencil_modifier_blend_read_data(BlendDataReader *reader, ListBase *lb)
bool BKE_gpencil_has_time_modifiers(Object *ob)
void BKE_gpencil_prepare_eval_data(Depsgraph *depsgraph, Scene *scene, Object *ob)
GpencilModifierData * BKE_gpencil_modifiers_findby_name(Object *ob, const char *name)
static void gpencil_copy_activeframe_to_eval(Depsgraph *depsgraph, Scene *scene, Object *ob, bGPdata *gpd_orig, bGPdata *gpd_eval)
void BKE_gpencil_modifier_copydata_ex(GpencilModifierData *md, GpencilModifierData *target, const int flag)
static CLG_LogRef LOG
void BKE_gpencil_modifier_copydata(GpencilModifierData *md, GpencilModifierData *target)
static void gpencil_assign_object_eval(Object *object)
void BKE_gpencil_modifier_free(GpencilModifierData *md)
const GpencilModifierTypeInfo * BKE_gpencil_modifier_get_info(GpencilModifierType type)
void BKE_gpencil_modifier_copydata_generic(const GpencilModifierData *md_src, GpencilModifierData *md_dst)
static int gpencil_time_modifier(Depsgraph *depsgraph, Scene *scene, Object *ob, bGPDlayer *gpl, int cfra, bool is_render)
__kernel void ccl_constant KernelData ccl_global void ccl_global char ccl_global int ccl_global char ccl_global unsigned int ccl_global float * buffer
format
Definition: logImageCore.h:47
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:45
struct CurveMapping * curve_intensity
struct GpencilModifierData * next
void(* generateStrokes)(struct GpencilModifierData *md, struct Depsgraph *depsgraph, struct Object *ob)
GpencilModifierTypeFlag flags
void(* initData)(struct GpencilModifierData *md)
void(* copyData)(const struct GpencilModifierData *md, struct GpencilModifierData *target)
void(* freeData)(struct GpencilModifierData *md)
bool(* dependsOnTime)(struct GpencilModifierData *md)
void(* foreachIDLink)(struct GpencilModifierData *md, struct Object *ob, GreasePencilIDWalkFunc walk, void *userData)
void(* deformStroke)(struct GpencilModifierData *md, struct Depsgraph *depsgraph, struct Object *ob, struct bGPDlayer *gpl, struct bGPDframe *gpf, struct bGPDstroke *gps)
void(* foreachTexLink)(struct GpencilModifierData *md, struct Object *ob, GreasePencilTexWalkFunc walk, void *userData)
int(* remapTime)(struct GpencilModifierData *md, struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct bGPDlayer *gpl, int cfra)
Definition: DNA_ID.h:273
int tag
Definition: DNA_ID.h:292
struct Library * lib
Definition: DNA_ID.h:277
int us
Definition: DNA_ID.h:293
char name[66]
Definition: DNA_ID.h:283
struct LatticeDeformData * cache_data
void * first
Definition: DNA_listBase.h:47
struct CurveMapping * curve_intensity
struct bGPdata * gpd_orig
struct bGPdata * gpd_eval
short partype
ListBase greasepencil_modifiers
Object_Runtime runtime
struct Object * parent
void * data
struct CurveMapping * curve_thickness
struct CurveMapping * curve_intensity
ArmatureModifierData amd
Definition: BKE_modifier.h:499
LatticeModifierData lmd
Definition: BKE_modifier.h:501
struct bGPDframe * gpf_orig
bGPDframe_Runtime runtime
ListBase strokes
struct bGPDlayer * next
ListBase frames
ListBase layers
bGPdata_Runtime runtime
ccl_device_inline int mod(int x, int m)
Definition: util_math.h:405