Blender  V2.93
object_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) 2018 Blender Foundation.
17  * All rights reserved.
18  */
19 
24 #include <math.h>
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include <string.h>
28 
29 #include "MEM_guardedalloc.h"
30 
32 #include "DNA_gpencil_types.h"
33 #include "DNA_object_types.h"
34 #include "DNA_scene_types.h"
35 
36 #include "BLI_listbase.h"
37 #include "BLI_string_utf8.h"
38 #include "BLI_utildefines.h"
39 
40 #include "BKE_context.h"
41 #include "BKE_gpencil.h"
42 #include "BKE_gpencil_modifier.h"
43 #include "BKE_main.h"
44 #include "BKE_object.h"
45 #include "BKE_report.h"
46 
47 #include "DEG_depsgraph.h"
48 #include "DEG_depsgraph_build.h"
49 #include "DEG_depsgraph_query.h"
50 
51 #include "RNA_access.h"
52 #include "RNA_define.h"
53 #include "RNA_enum_types.h"
54 
55 #include "ED_object.h"
56 #include "ED_screen.h"
57 
58 #include "UI_interface.h"
59 
60 #include "WM_api.h"
61 #include "WM_types.h"
62 
63 #include "object_intern.h"
64 
65 /******************************** API ****************************/
66 
68  ReportList *reports, Main *bmain, Scene *UNUSED(scene), Object *ob, const char *name, int type)
69 {
70  GpencilModifierData *new_md = NULL;
72 
73  if (ob->type != OB_GPENCIL) {
74  BKE_reportf(reports, RPT_WARNING, "Modifiers cannot be added to object '%s'", ob->id.name + 2);
75  return NULL;
76  }
77 
80  BKE_report(reports, RPT_WARNING, "Only one modifier of this type is allowed");
81  return NULL;
82  }
83  }
84 
85  /* get new modifier data to add */
87 
88  BLI_addtail(&ob->greasepencil_modifiers, new_md);
89 
90  if (name) {
91  BLI_strncpy_utf8(new_md->name, name, sizeof(new_md->name));
92  }
93 
94  /* make sure modifier data has unique name */
96 
97  /* Enable edit mode visible by default. */
100  }
101 
102  bGPdata *gpd = ob->data;
104 
107 
108  return new_md;
109 }
110 
112  Object *ob,
114  bool *UNUSED(r_sort_depsgraph))
115 {
116  /* It seems on rapid delete it is possible to
117  * get called twice on same modifier, so make
118  * sure it is in list. */
119  if (BLI_findindex(&ob->greasepencil_modifiers, md) == -1) {
120  return false;
121  }
122 
124 
128 
129  return true;
130 }
131 
133  Main *bmain,
134  Object *ob,
136 {
137  bool sort_depsgraph = false;
138  bool ok;
139 
140  ok = gpencil_object_modifier_remove(bmain, ob, md, &sort_depsgraph);
141 
142  if (!ok) {
143  BKE_reportf(reports, RPT_ERROR, "Modifier '%s' not in object '%s'", md->name, ob->id.name);
144  return false;
145  }
146 
149 
150  return true;
151 }
152 
154 {
156  bool sort_depsgraph = false;
157 
158  if (!md) {
159  return;
160  }
161 
162  while (md) {
163  GpencilModifierData *next_md;
164 
165  next_md = md->next;
166 
167  gpencil_object_modifier_remove(bmain, ob, md, &sort_depsgraph);
168 
169  md = next_md;
170  }
171 
174 }
175 
177  Object *ob,
179 {
180  if (md->prev) {
183  }
184 
185  return true;
186 }
187 
189  Object *ob,
191 {
192  if (md->next) {
195  }
196 
197  return true;
198 }
199 
201  Object *ob,
203  const int index)
204 {
205  BLI_assert(md != NULL);
206  BLI_assert(index >= 0);
207  if (index >= BLI_listbase_count(&ob->greasepencil_modifiers)) {
208  BKE_report(reports, RPT_WARNING, "Cannot move modifier beyond the end of the stack");
209  return false;
210  }
211 
212  int md_index = BLI_findindex(&ob->greasepencil_modifiers, md);
213  BLI_assert(md_index != -1);
214  if (md_index < index) {
215  /* Move modifier down in list. */
216  for (; md_index < index; md_index++) {
217  if (!ED_object_gpencil_modifier_move_down(reports, ob, md)) {
218  break;
219  }
220  }
221  }
222  else {
223  /* Move modifier up in list. */
224  for (; md_index > index; md_index--) {
225  if (!ED_object_gpencil_modifier_move_up(reports, ob, md)) {
226  break;
227  }
228  }
229  }
230 
233 
234  return true;
235 }
236 
238  ReportList *reports, Main *bmain, Depsgraph *depsgraph, Object *ob, GpencilModifierData *md)
239 {
241 
242  if (mti->isDisabled && mti->isDisabled(md, 0)) {
243  BKE_report(reports, RPT_ERROR, "Modifier is disabled, skipping apply");
244  return false;
245  }
246 
247  if (ob->type == OB_GPENCIL) {
248  if (ELEM(NULL, ob, ob->data)) {
249  return false;
250  }
251  if (mti->bakeModifier == NULL) {
252  BKE_report(reports, RPT_ERROR, "Not implemented");
253  return false;
254  }
255  mti->bakeModifier(bmain, depsgraph, md, ob);
257  }
258  else {
259  BKE_report(reports, RPT_ERROR, "Cannot apply modifier for this object type");
260  return false;
261  }
262 
263  return true;
264 }
265 
267  ReportList *reports,
269  Object *ob,
271  int UNUSED(mode))
272 {
273 
274  if (ob->type == OB_GPENCIL) {
275  if (ob->mode != OB_MODE_OBJECT) {
276  BKE_report(reports, RPT_ERROR, "Modifiers cannot be applied in paint, sculpt or edit mode");
277  return false;
278  }
279 
280  if (((ID *)ob->data)->us > 1) {
281  BKE_report(reports, RPT_ERROR, "Modifiers cannot be applied to multi-user data");
282  return false;
283  }
284  }
285  else if (((ID *)ob->data)->us > 1) {
286  BKE_report(reports, RPT_ERROR, "Modifiers cannot be applied to multi-user data");
287  return false;
288  }
289 
290  if (md != ob->greasepencil_modifiers.first) {
291  BKE_report(reports, RPT_INFO, "Applied modifier was not first, result may not be as expected");
292  }
293 
294  if (!gpencil_modifier_apply_obdata(reports, bmain, depsgraph, ob, md)) {
295  return false;
296  }
297 
300 
301  return true;
302 }
303 
305 {
306  GpencilModifierData *nmd;
309 
312  BKE_report(reports, RPT_WARNING, "Only one modifier of this type is allowed");
313  return false;
314  }
315  }
316 
317  nmd = BKE_gpencil_modifier_new(md->type);
321 
323 
324  return true;
325 }
326 
328 {
332 }
333 
334 /************************ add modifier operator *********************/
335 
337 {
338  Main *bmain = CTX_data_main(C);
341  int type = RNA_enum_get(op->ptr, "type");
342 
343  if (!ED_object_gpencil_modifier_add(op->reports, bmain, scene, ob, NULL, type)) {
344  return OPERATOR_CANCELLED;
345  }
346 
348 
349  return OPERATOR_FINISHED;
350 }
351 
354  PropertyRNA *UNUSED(prop),
355  bool *r_free)
356 {
358  EnumPropertyItem *item = NULL;
359  const EnumPropertyItem *md_item, *group_item = NULL;
360  const GpencilModifierTypeInfo *mti;
361  int totitem = 0, a;
362 
363  if (!ob) {
365  }
366 
369  if (md_item->identifier[0]) {
370  mti = BKE_gpencil_modifier_get_info(md_item->value);
371 
373  continue;
374  }
375  }
376  else {
377  group_item = md_item;
378  md_item = NULL;
379 
380  continue;
381  }
382 
383  if (group_item) {
384  RNA_enum_item_add(&item, &totitem, group_item);
385  group_item = NULL;
386  }
387 
388  RNA_enum_item_add(&item, &totitem, md_item);
389  }
390 
391  RNA_enum_item_end(&item, &totitem);
392  *r_free = true;
393 
394  return item;
395 }
396 
398 {
399  PropertyRNA *prop;
400 
401  /* identifiers */
402  ot->name = "Add Modifier";
403  ot->description = "Add a procedural operation/effect to the active grease pencil object";
404  ot->idname = "OBJECT_OT_gpencil_modifier_add";
405 
406  /* api callbacks */
410 
411  /* flags */
413 
414  /* properties */
415  prop = RNA_def_enum(ot->srna,
416  "type",
419  "Type",
420  "");
422  ot->prop = prop;
423 }
424 
425 /********** generic functions for operators using mod names and data context *********************/
426 
428  StructRNA *rna_type,
429  int obtype_flag,
430  const bool is_liboverride_allowed)
431 {
432  PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", rna_type);
434  GpencilModifierData *mod = ptr.data; /* May be NULL. */
435 
436  if (!ob || ID_IS_LINKED(ob)) {
437  return false;
438  }
439  if (obtype_flag && ((1 << ob->type) & obtype_flag) == 0) {
440  return false;
441  }
443  return false;
444  }
445 
446  if (!is_liboverride_allowed && BKE_gpencil_modifier_is_nonlocal_in_liboverride(ob, mod)) {
448  C, "Cannot edit modifiers coming from linked data in a library override");
449  return false;
450  }
451 
452  return true;
453 }
454 
456 {
458 }
459 
460 /* Used by operators performing actions allowed also on modifiers from the overridden linked object
461  * (not only from added 'local' ones). */
463 {
465 }
466 
468 {
469  PropertyRNA *prop = RNA_def_string(
470  ot->srna, "modifier", NULL, MAX_NAME, "Modifier", "Name of the modifier to edit");
472 }
473 
475 {
477  ot->srna, "report", false, "Report", "Create a notification after the operation");
479 }
480 
488  wmOperator *op,
489  const wmEvent *event,
490  int *r_retval)
491 {
492  if (RNA_struct_property_is_set(op->ptr, "modifier")) {
493  return true;
494  }
495 
497  if (ctx_ptr.data != NULL) {
498  GpencilModifierData *md = ctx_ptr.data;
499  RNA_string_set(op->ptr, "modifier", md->name);
500  return true;
501  }
502 
503  /* Check the custom data of panels under the mouse for a modifier. */
504  if (event != NULL) {
506 
507  if (!(panel_ptr == NULL || RNA_pointer_is_null(panel_ptr))) {
508  if (RNA_struct_is_a(panel_ptr->type, &RNA_GpencilModifier)) {
509  GpencilModifierData *md = panel_ptr->data;
510  RNA_string_set(op->ptr, "modifier", md->name);
511  return true;
512  }
513 
514  BLI_assert(r_retval != NULL); /* We need the return value in this case. */
515  if (r_retval != NULL) {
517  }
518  return false;
519  }
520  }
521 
522  if (r_retval != NULL) {
523  *r_retval = OPERATOR_CANCELLED;
524  }
525  return false;
526 }
527 
529  Object *ob,
530  int type)
531 {
532  char modifier_name[MAX_NAME];
534  RNA_string_get(op->ptr, "modifier", modifier_name);
535 
537 
538  if (md && type != 0 && md->type != type) {
539  md = NULL;
540  }
541 
542  return md;
543 }
544 
545 /************************ remove modifier operator *********************/
546 
548 {
549  Main *bmain = CTX_data_main(C);
552 
553  if (md == NULL) {
554  return OPERATOR_CANCELLED;
555  }
556 
557  /* Store name temporarily for report. */
558  char name[MAX_NAME];
559  strcpy(name, md->name);
560 
561  if (!ED_object_gpencil_modifier_remove(op->reports, bmain, ob, md)) {
562  return OPERATOR_CANCELLED;
563  }
564 
566 
567  if (RNA_boolean_get(op->ptr, "report")) {
568  BKE_reportf(op->reports, RPT_INFO, "Removed modifier: %s", name);
569  }
570 
571  return OPERATOR_FINISHED;
572 }
573 
575 {
576  int retval;
577  if (gpencil_edit_modifier_invoke_properties(C, op, event, &retval)) {
578  return gpencil_modifier_remove_exec(C, op);
579  }
580  return retval;
581 }
582 
584 {
585  ot->name = "Remove Grease Pencil Modifier";
586  ot->description = "Remove a modifier from the active grease pencil object";
587  ot->idname = "OBJECT_OT_gpencil_modifier_remove";
588 
592 
593  /* flags */
597 }
598 
599 /************************ move up modifier operator *********************/
600 
602 {
605 
606  if (!md || !ED_object_gpencil_modifier_move_up(op->reports, ob, md)) {
607  return OPERATOR_CANCELLED;
608  }
609 
612 
613  return OPERATOR_FINISHED;
614 }
615 
617 {
618  int retval;
619  if (gpencil_edit_modifier_invoke_properties(C, op, event, &retval)) {
620  return gpencil_modifier_move_up_exec(C, op);
621  }
622  return retval;
623 }
624 
626 {
627  ot->name = "Move Up Modifier";
628  ot->description = "Move modifier up in the stack";
629  ot->idname = "OBJECT_OT_gpencil_modifier_move_up";
630 
634 
635  /* flags */
638 }
639 
640 /************************ move down modifier operator *********************/
641 
643 {
646 
647  if (!md || !ED_object_gpencil_modifier_move_down(op->reports, ob, md)) {
648  return OPERATOR_CANCELLED;
649  }
650 
653 
654  return OPERATOR_FINISHED;
655 }
656 
658 {
659  int retval;
660  if (gpencil_edit_modifier_invoke_properties(C, op, event, &retval)) {
662  }
663  return retval;
664 }
665 
667 {
668  ot->name = "Move Down Modifier";
669  ot->description = "Move modifier down in the stack";
670  ot->idname = "OBJECT_OT_gpencil_modifier_move_down";
671 
675 
676  /* flags */
679 }
680 
681 /* ************************* Move to Index Gpencil Modifier Operator ************************* */
682 
684 {
687  int index = RNA_int_get(op->ptr, "index");
688 
689  if (!ED_object_gpencil_modifier_move_to_index(op->reports, ob, md, index)) {
690  return OPERATOR_CANCELLED;
691  }
692 
693  return OPERATOR_FINISHED;
694 }
695 
697 {
698  int retval;
699  if (gpencil_edit_modifier_invoke_properties(C, op, event, &retval)) {
701  }
702  return retval;
703 }
704 
706 {
707  ot->name = "Move Active Modifier to Index";
708  ot->idname = "OBJECT_OT_gpencil_modifier_move_to_index";
709  ot->description =
710  "Change the modifier's position in the list so it evaluates after the set number of "
711  "others";
712 
716 
717  /* flags */
720  RNA_def_int(
721  ot->srna, "index", 0, 0, INT_MAX, "Index", "The index to move the modifier to", 0, INT_MAX);
722 }
723 
724 /************************ apply modifier operator *********************/
725 
727 {
728  Main *bmain = CTX_data_main(C);
732  int apply_as = RNA_enum_get(op->ptr, "apply_as");
733  const bool do_report = RNA_boolean_get(op->ptr, "report");
734 
735  if (md == NULL) {
736  return OPERATOR_CANCELLED;
737  }
738 
739  int reports_len;
740  char name[MAX_NAME];
741  if (do_report) {
742  reports_len = BLI_listbase_count(&op->reports->list);
743  strcpy(name, md->name); /* Store name temporarily since the modifier is removed. */
744  }
745 
746  if (!ED_object_gpencil_modifier_apply(bmain, op->reports, depsgraph, ob, md, apply_as)) {
747  return OPERATOR_CANCELLED;
748  }
749 
752 
753  if (do_report) {
754  /* Only add this report if the operator didn't cause another one. The purpose here is
755  * to alert that something happened, and the previous report will do that anyway. */
756  if (BLI_listbase_count(&op->reports->list) == reports_len) {
757  BKE_reportf(op->reports, RPT_INFO, "Applied modifier: %s", name);
758  }
759  }
760 
761  return OPERATOR_FINISHED;
762 }
763 
765 {
766  int retval;
767  if (gpencil_edit_modifier_invoke_properties(C, op, event, &retval)) {
768  return gpencil_modifier_apply_exec(C, op);
769  }
770  return retval;
771 }
772 
774  {MODIFIER_APPLY_DATA, "DATA", 0, "Object Data", "Apply modifier to the object's data"},
776  "SHAPE",
777  0,
778  "New Shape",
779  "Apply deform-only modifier to a new shape on this object"},
780  {0, NULL, 0, NULL, NULL},
781 };
782 
784 {
785  ot->name = "Apply Modifier";
786  ot->description = "Apply modifier and remove from the stack";
787  ot->idname = "OBJECT_OT_gpencil_modifier_apply";
788 
792 
793  /* flags */
795 
797  "apply_as",
800  "Apply As",
801  "How to apply the modifier to the geometry");
804 }
805 
806 /************************ copy modifier operator *********************/
807 
809 {
812 
813  if (!md || !ED_object_gpencil_modifier_copy(op->reports, ob, md)) {
814  return OPERATOR_CANCELLED;
815  }
816 
819 
820  return OPERATOR_FINISHED;
821 }
822 
824 {
825  int retval;
826  if (gpencil_edit_modifier_invoke_properties(C, op, event, &retval)) {
827  return gpencil_modifier_copy_exec(C, op);
828  }
829  return retval;
830 }
831 
833 {
834  ot->name = "Copy Modifier";
835  ot->description = "Duplicate modifier at the same position in the stack";
836  ot->idname = "OBJECT_OT_gpencil_modifier_copy";
837 
841 
842  /* flags */
845 }
846 
847 /************************ Copy Modifier to Selected Operator *********************/
848 
850 {
853 
854  if (!md) {
855  return OPERATOR_CANCELLED;
856  }
857 
858  if (obact->type != OB_GPENCIL) {
859  BKE_reportf(op->reports,
860  RPT_ERROR,
861  "Source object '%s' is not a grease pencil object",
862  obact->id.name + 2);
863  return OPERATOR_CANCELLED;
864  }
865 
866  CTX_DATA_BEGIN (C, Object *, ob, selected_objects) {
867  if (ob == obact) {
868  continue;
869  }
870 
871  if (ob->type != OB_GPENCIL) {
872  BKE_reportf(op->reports,
873  RPT_WARNING,
874  "Destination object '%s' is not a grease pencil object",
875  ob->id.name + 2);
876  continue;
877  }
878 
879  /* This always returns true right now. */
881 
884  }
885  CTX_DATA_END;
886 
887  return OPERATOR_FINISHED;
888 }
889 
891  wmOperator *op,
892  const wmEvent *event)
893 {
894  int retval;
895  if (gpencil_edit_modifier_invoke_properties(C, op, event, &retval)) {
897  }
898  return retval;
899 }
900 
902 {
904 
905  /* This could have a performance impact in the worst case, where there are many objects selected
906  * and none of them pass the check. But that should be uncommon, and this operator is only
907  * exposed in a drop-down menu anyway. */
908  bool found_supported_objects = false;
909  CTX_DATA_BEGIN (C, Object *, ob, selected_objects) {
910  if (ob == obact) {
911  continue;
912  }
913 
914  if (ob->type == OB_GPENCIL) {
915  found_supported_objects = true;
916  break;
917  }
918  }
919  CTX_DATA_END;
920 
921  if (!found_supported_objects) {
922  CTX_wm_operator_poll_msg_set(C, "No supported objects were selected");
923  return false;
924  }
925  return true;
926 }
927 
929 {
930  ot->name = "Copy Modifier to Selected";
931  ot->description = "Copy the modifier from the active object to all selected objects";
932  ot->idname = "OBJECT_OT_gpencil_modifier_copy_to_selected";
933 
937 
938  /* flags */
941 }
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1034
#define CTX_DATA_BEGIN(C, Type, instance, member)
Definition: BKE_context.h:252
PointerRNA CTX_data_pointer_get_type(const bContext *C, const char *member, StructRNA *type)
Definition: context.c:456
struct Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
Definition: context.c:1424
void CTX_wm_operator_poll_msg_set(struct bContext *C, const char *msg)
Definition: context.c:1006
struct Main * CTX_data_main(const bContext *C)
Definition: context.c:1018
#define CTX_DATA_END
Definition: BKE_context.h:260
void BKE_gpencil_modifier_free(struct GpencilModifierData *md)
bool BKE_gpencil_modifier_unique_name(struct ListBase *modifiers, struct GpencilModifierData *gmd)
@ eGpencilModifierTypeFlag_Single
@ eGpencilModifierTypeFlag_SupportsEditmode
@ eGpencilModifierTypeFlag_NoUserAdd
struct GpencilModifierData * BKE_gpencil_modifiers_findby_name(struct Object *ob, const char *name)
bool BKE_gpencil_modifier_is_nonlocal_in_liboverride(const struct Object *ob, const struct GpencilModifierData *gmd)
struct GpencilModifierData * BKE_gpencil_modifiers_findby_type(struct Object *ob, GpencilModifierType type)
void BKE_gpencil_modifier_copydata(struct GpencilModifierData *md, struct GpencilModifierData *target)
const GpencilModifierTypeInfo * BKE_gpencil_modifier_get_info(GpencilModifierType type)
struct GpencilModifierData * BKE_gpencil_modifier_new(int type)
General operations, lookup, etc. for blender objects.
void BKE_object_free_derived_caches(struct Object *ob)
Definition: object.c:1719
bool BKE_object_copy_gpencil_modifier(struct Object *ob_dst, struct GpencilModifierData *md)
Definition: object.c:1512
void BKE_report(ReportList *reports, ReportType type, const char *message)
Definition: report.c:104
void BKE_reportf(ReportList *reports, ReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
#define BLI_assert(a)
Definition: BLI_assert.h:58
void BLI_insertlinkafter(struct ListBase *listbase, void *vprevlink, void *vnewlink) ATTR_NONNULL(1)
Definition: listbase.c:352
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:110
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:133
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_insertlinkbefore(struct ListBase *listbase, void *vnextlink, void *vnewlink) ATTR_NONNULL(1)
Definition: listbase.c:395
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
Definition: string_utf8.c:258
#define UNUSED(x)
#define ELEM(...)
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:51
void DEG_id_tag_update(struct ID *id, int flag)
void DEG_relations_tag_update(struct Main *bmain)
@ ID_RECALC_TRANSFORM
Definition: DNA_ID.h:599
@ ID_RECALC_ANIMATION
Definition: DNA_ID.h:614
@ ID_RECALC_GEOMETRY
Definition: DNA_ID.h:611
#define ID_IS_LINKED(_id)
Definition: DNA_ID.h:426
#define MAX_NAME
Definition: DNA_defs.h:62
@ eGpencilModifierMode_Editmode
@ eGpencilModifierFlag_OverrideLibrary_Local
@ eGpencilModifierType_Thick
@ OB_MODE_OBJECT
Object is a sort of wrapper for general info.
@ OB_GPENCIL
@ OPERATOR_CANCELLED
@ OPERATOR_FINISHED
@ OPERATOR_PASS_THROUGH
struct Object * ED_object_active_context(const struct bContext *C)
@ MODIFIER_APPLY_DATA
Definition: ED_object.h:399
@ MODIFIER_APPLY_SHAPE
Definition: ED_object.h:400
bool ED_operator_object_active_editable(struct bContext *C)
Definition: screen_ops.c:366
_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.
StructRNA RNA_GpencilModifier
@ PROP_HIDDEN
Definition: RNA_types.h:202
#define C
Definition: RandGen.cpp:39
struct PointerRNA * UI_region_panel_custom_data_under_cursor(const struct bContext *C, const struct wmEvent *event)
@ OPTYPE_INTERNAL
Definition: WM_types.h:175
@ OPTYPE_UNDO
Definition: WM_types.h:155
@ OPTYPE_REGISTER
Definition: WM_types.h:153
#define ND_MODIFIER
Definition: WM_types.h:363
#define NC_OBJECT
Definition: WM_types.h:280
Scene scene
const Depsgraph * depsgraph
static const char * modifier_name[LS_MODIFIER_NUM]
Definition: linestyle.c:775
static unsigned a[3]
Definition: RandGen.cpp:92
void OBJECT_OT_gpencil_modifier_copy(wmOperatorType *ot)
void ED_object_gpencil_modifier_copy_to_object(Object *ob_dst, GpencilModifierData *md)
void OBJECT_OT_gpencil_modifier_add(wmOperatorType *ot)
static int gpencil_modifier_remove_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void OBJECT_OT_gpencil_modifier_move_up(wmOperatorType *ot)
void OBJECT_OT_gpencil_modifier_move_down(wmOperatorType *ot)
static bool gpencil_modifier_apply_obdata(ReportList *reports, Main *bmain, Depsgraph *depsgraph, Object *ob, GpencilModifierData *md)
static int gpencil_modifier_copy_to_selected_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static int gpencil_modifier_move_to_index_exec(bContext *C, wmOperator *op)
GpencilModifierData * ED_object_gpencil_modifier_add(ReportList *reports, Main *bmain, Scene *UNUSED(scene), Object *ob, const char *name, int type)
static const EnumPropertyItem gpencil_modifier_apply_as_items[]
static int gpencil_modifier_move_to_index_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static void gpencil_edit_modifier_report_property(wmOperatorType *ot)
void ED_object_gpencil_modifier_clear(Main *bmain, Object *ob)
static int gpencil_modifier_apply_exec(bContext *C, wmOperator *op)
bool ED_object_gpencil_modifier_remove(ReportList *reports, Main *bmain, Object *ob, GpencilModifierData *md)
bool ED_object_gpencil_modifier_move_to_index(ReportList *reports, Object *ob, GpencilModifierData *md, const int index)
static int gpencil_modifier_add_exec(bContext *C, wmOperator *op)
static int gpencil_modifier_move_down_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void OBJECT_OT_gpencil_modifier_copy_to_selected(wmOperatorType *ot)
static GpencilModifierData * gpencil_edit_modifier_property_get(wmOperator *op, Object *ob, int type)
static void gpencil_edit_modifier_properties(wmOperatorType *ot)
static int gpencil_modifier_move_up_exec(bContext *C, wmOperator *op)
static int gpencil_modifier_copy_exec(bContext *C, wmOperator *op)
static int gpencil_modifier_move_up_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static int gpencil_modifier_apply_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void OBJECT_OT_gpencil_modifier_move_to_index(wmOperatorType *ot)
bool ED_object_gpencil_modifier_move_down(ReportList *UNUSED(reports), Object *ob, GpencilModifierData *md)
static int gpencil_modifier_copy_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static int gpencil_modifier_move_down_exec(bContext *C, wmOperator *op)
static const EnumPropertyItem * gpencil_modifier_add_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
static bool gpencil_edit_modifier_poll_generic(bContext *C, StructRNA *rna_type, int obtype_flag, const bool is_liboverride_allowed)
static bool gpencil_edit_modifier_liboverride_allowed_poll(bContext *C)
bool ED_object_gpencil_modifier_copy(ReportList *reports, Object *ob, GpencilModifierData *md)
static bool gpencil_edit_modifier_invoke_properties(bContext *C, wmOperator *op, const wmEvent *event, int *r_retval)
void OBJECT_OT_gpencil_modifier_remove(wmOperatorType *ot)
bool ED_object_gpencil_modifier_apply(Main *bmain, ReportList *reports, Depsgraph *depsgraph, Object *ob, GpencilModifierData *md, int UNUSED(mode))
static bool gpencil_modifier_copy_to_selected_poll(bContext *C)
static bool gpencil_object_modifier_remove(Main *bmain, Object *ob, GpencilModifierData *md, bool *UNUSED(r_sort_depsgraph))
static int gpencil_modifier_copy_to_selected_exec(bContext *C, wmOperator *op)
void OBJECT_OT_gpencil_modifier_apply(wmOperatorType *ot)
static int gpencil_modifier_remove_exec(bContext *C, wmOperator *op)
bool ED_object_gpencil_modifier_move_up(ReportList *UNUSED(reports), Object *ob, GpencilModifierData *md)
static bool gpencil_edit_modifier_poll(bContext *C)
void edit_modifier_properties(struct wmOperatorType *ot)
bool RNA_struct_is_a(const StructRNA *type, const StructRNA *srna)
Definition: rna_access.c:844
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
Definition: rna_access.c:6550
void RNA_string_get(PointerRNA *ptr, const char *name, char *value)
Definition: rna_access.c:6514
int RNA_int_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:6308
bool RNA_pointer_is_null(const PointerRNA *ptr)
Definition: rna_access.c:174
bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
Definition: rna_access.c:6685
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:6261
int RNA_enum_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:6402
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3481
void RNA_enum_item_end(EnumPropertyItem **items, int *totitem)
Definition: rna_define.c:4470
void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item)
Definition: rna_define.c:4416
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3675
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1512
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:3585
void RNA_def_enum_funcs(PropertyRNA *prop, EnumPropertyItemFunc itemfunc)
Definition: rna_define.c:3819
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:3771
const EnumPropertyItem rna_enum_object_greasepencil_modifier_type_items[]
const EnumPropertyItem rna_enum_object_modifier_type_items[]
Definition: rna_modifier.c:62
const char * identifier
Definition: RNA_types.h:446
struct GpencilModifierData * next
struct GpencilModifierData * prev
void(* bakeModifier)(struct Main *bmain, struct Depsgraph *depsgraph, struct GpencilModifierData *md, struct Object *ob)
GpencilModifierTypeFlag flags
bool(* isDisabled)(struct GpencilModifierData *md, int userRenderParams)
Definition: DNA_ID.h:273
char name[66]
Definition: DNA_ID.h:283
void * first
Definition: DNA_listBase.h:47
Definition: BKE_main.h:116
ListBase greasepencil_modifiers
void * data
struct StructRNA * type
Definition: RNA_types.h:51
void * data
Definition: RNA_types.h:52
struct ID * owner_id
Definition: RNA_types.h:50
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:752
const char * name
Definition: WM_types.h:721
const char * idname
Definition: WM_types.h:723
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:776
struct StructRNA * srna
Definition: WM_types.h:802
const char * description
Definition: WM_types.h:726
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:736
PropertyRNA * prop
Definition: WM_types.h:814
struct ReportList * reports
struct PointerRNA * ptr
ccl_device_inline int mod(int x, int m)
Definition: util_math.h:405
void WM_main_add_notifier(unsigned int type, void *reference)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
PointerRNA * ptr
Definition: wm_files.c:3157
wmOperatorType * ot
Definition: wm_files.c:3156
int WM_menu_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
Definition: wm_operators.c:982