Blender  V3.3
object_shader_fx.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2018 Blender Foundation. All rights reserved. */
3 
8 #include <math.h>
9 #include <stdio.h>
10 #include <stdlib.h>
11 #include <string.h>
12 
13 #include "MEM_guardedalloc.h"
14 
15 #include "DNA_gpencil_types.h"
16 #include "DNA_object_types.h"
17 #include "DNA_scene_types.h"
18 #include "DNA_shader_fx_types.h"
19 
20 #include "BLI_listbase.h"
21 #include "BLI_string.h"
22 #include "BLI_string_utf8.h"
23 #include "BLI_utildefines.h"
24 
25 #include "BLT_translation.h"
26 
27 #include "BKE_context.h"
28 #include "BKE_lib_id.h"
29 #include "BKE_main.h"
30 #include "BKE_object.h"
31 #include "BKE_report.h"
32 #include "BKE_shader_fx.h"
33 
34 #include "DEG_depsgraph.h"
35 #include "DEG_depsgraph_build.h"
36 #include "DEG_depsgraph_query.h"
37 
38 #include "RNA_access.h"
39 #include "RNA_define.h"
40 #include "RNA_enum_types.h"
41 #include "RNA_prototypes.h"
42 
43 #include "ED_object.h"
44 #include "ED_screen.h"
45 
46 #include "UI_interface.h"
47 
48 #include "WM_api.h"
49 #include "WM_types.h"
50 
51 #include "object_intern.h"
52 
53 /* -------------------------------------------------------------------- */
58  ReportList *reports, Main *bmain, Scene *UNUSED(scene), Object *ob, const char *name, int type)
59 {
60  ShaderFxData *new_fx = NULL;
62 
63  if (ob->type != OB_GPENCIL) {
64  BKE_reportf(reports, RPT_WARNING, "Effect cannot be added to object '%s'", ob->id.name + 2);
65  return NULL;
66  }
67 
68  if (fxi->flags & eShaderFxTypeFlag_Single) {
69  if (BKE_shaderfx_findby_type(ob, type)) {
70  BKE_report(reports, RPT_WARNING, "Only one Effect of this type is allowed");
71  return NULL;
72  }
73  }
74 
75  /* get new effect data to add */
76  new_fx = BKE_shaderfx_new(type);
77 
78  BLI_addtail(&ob->shader_fx, new_fx);
79 
80  if (name) {
81  BLI_strncpy_utf8(new_fx->name, name, sizeof(new_fx->name));
82  }
83 
84  /* make sure effect data has unique name */
85  BKE_shaderfx_unique_name(&ob->shader_fx, new_fx);
86 
87  bGPdata *gpd = ob->data;
89 
92 
93  return new_fx;
94 }
95 
96 /* Return true if the object has a effect of type 'type' other than
97  * the shaderfx pointed to be 'exclude', otherwise returns false. */
99  const ShaderFxData *exclude,
101 {
102  ShaderFxData *fx;
103 
104  for (fx = ob->shader_fx.first; fx; fx = fx->next) {
105  if ((fx != exclude) && (fx->type == type)) {
106  return true;
107  }
108  }
109 
110  return false;
111 }
112 
113 static bool object_shaderfx_remove(Main *bmain,
114  Object *ob,
115  ShaderFxData *fx,
116  bool *UNUSED(r_sort_depsgraph))
117 {
118  /* It seems on rapid delete it is possible to
119  * get called twice on same effect, so make
120  * sure it is in list. */
121  if (BLI_findindex(&ob->shader_fx, fx) == -1) {
122  return 0;
123  }
124 
126 
127  BLI_remlink(&ob->shader_fx, fx);
128  BKE_shaderfx_free(fx);
130 
131  return 1;
132 }
133 
135 {
136  bool sort_depsgraph = false;
137  bool ok;
138 
139  ok = object_shaderfx_remove(bmain, ob, fx, &sort_depsgraph);
140 
141  if (!ok) {
142  BKE_reportf(reports, RPT_ERROR, "Effect '%s' not in object '%s'", fx->name, ob->id.name);
143  return 0;
144  }
145 
148 
149  return 1;
150 }
151 
153 {
154  ShaderFxData *fx = ob->shader_fx.first;
155  bool sort_depsgraph = false;
156 
157  if (!fx) {
158  return;
159  }
160 
161  while (fx) {
162  ShaderFxData *next_fx;
163 
164  next_fx = fx->next;
165 
166  object_shaderfx_remove(bmain, ob, fx, &sort_depsgraph);
167 
168  fx = next_fx;
169  }
170 
173 }
174 
176 {
177  if (fx->prev) {
178  BLI_remlink(&ob->shader_fx, fx);
179  BLI_insertlinkbefore(&ob->shader_fx, fx->prev, fx);
180  }
181 
182  return 1;
183 }
184 
186 {
187  if (fx->next) {
188  BLI_remlink(&ob->shader_fx, fx);
189  BLI_insertlinkafter(&ob->shader_fx, fx->next, fx);
190  }
191 
192  return 1;
193 }
194 
196  Object *ob,
197  ShaderFxData *fx,
198  const int index)
199 {
200  BLI_assert(fx != NULL);
201  BLI_assert(index >= 0);
202  if (index >= BLI_listbase_count(&ob->shader_fx)) {
203  BKE_report(reports, RPT_WARNING, "Cannot move effect beyond the end of the stack");
204  return false;
205  }
206 
207  int fx_index = BLI_findindex(&ob->shader_fx, fx);
208  BLI_assert(fx_index != -1);
209  if (fx_index < index) {
210  /* Move shaderfx down in list. */
211  for (; fx_index < index; fx_index++) {
212  if (!ED_object_shaderfx_move_down(reports, ob, fx)) {
213  break;
214  }
215  }
216  }
217  else {
218  /* Move shaderfx up in list. */
219  for (; fx_index > index; fx_index--) {
220  if (!ED_object_shaderfx_move_up(reports, ob, fx)) {
221  break;
222  }
223  }
224  }
225 
228 
229  return true;
230 }
231 
233 {
234  BLI_freelistN(&dst->shader_fx);
235  BKE_shaderfx_copy(&dst->shader_fx, &src->shader_fx);
236 
239 }
240 
242 {
243  ShaderFxData *nfx = BKE_shaderfx_new(fx->type);
244  BLI_strncpy(nfx->name, fx->name, sizeof(nfx->name));
245  BKE_shaderfx_copydata(fx, nfx);
246  BLI_addtail(&dst->shader_fx, nfx);
247 
250 }
251 
254 /* -------------------------------------------------------------------- */
259  StructRNA *rna_type,
260  int obtype_flag,
261  const bool is_liboverride_allowed)
262 {
263  PointerRNA ptr = CTX_data_pointer_get_type(C, "shaderfx", rna_type);
265  ShaderFxData *fx = ptr.data; /* May be NULL. */
266 
268  return false;
269  }
270 
271  /* NOTE: Temporary 'forbid all' for overrides, until we implement support to add shaderfx to
272  * overrides. */
273  if (ID_IS_OVERRIDE_LIBRARY(ob)) {
274  CTX_wm_operator_poll_msg_set(C, "Cannot edit shaderfxs in a library override");
275  return false;
276  }
277 
278  if (obtype_flag != 0 && ((1 << ob->type) & obtype_flag) == 0) {
279  CTX_wm_operator_poll_msg_set(C, "Object type is not supported");
280  return false;
281  }
283  CTX_wm_operator_poll_msg_set(C, "Cannot edit library or override data");
284  return false;
285  }
288  C, "Cannot edit shaderfxs coming from linked data in a library override");
289  return false;
290  }
291 
292  return true;
293 }
294 
296 {
297  return edit_shaderfx_poll_generic(C, &RNA_ShaderFx, 0, false);
298 }
299 
302 /* -------------------------------------------------------------------- */
307 {
308  Main *bmain = CTX_data_main(C);
311  int type = RNA_enum_get(op->ptr, "type");
312 
313  if (!ED_object_shaderfx_add(op->reports, bmain, scene, ob, NULL, type)) {
314  return OPERATOR_CANCELLED;
315  }
316 
318 
319  return OPERATOR_FINISHED;
320 }
321 
324  PropertyRNA *UNUSED(prop),
325  bool *r_free)
326 {
328  EnumPropertyItem *item = NULL;
329  const EnumPropertyItem *fx_item, *group_item = NULL;
330  const ShaderFxTypeInfo *mti;
331  int totitem = 0, a;
332 
333  if (!ob) {
335  }
336 
339  if (fx_item->identifier[0]) {
340  mti = BKE_shaderfx_get_info(fx_item->value);
341 
342  if (mti->flags & eShaderFxTypeFlag_NoUserAdd) {
343  continue;
344  }
345  }
346  else {
347  group_item = fx_item;
348  fx_item = NULL;
349 
350  continue;
351  }
352 
353  if (group_item) {
354  RNA_enum_item_add(&item, &totitem, group_item);
355  group_item = NULL;
356  }
357 
358  RNA_enum_item_add(&item, &totitem, fx_item);
359  }
360 
361  RNA_enum_item_end(&item, &totitem);
362  *r_free = true;
363 
364  return item;
365 }
366 
368 {
369  /* identifiers */
370  ot->name = "Add Effect";
371  ot->description = "Add a visual effect to the active object";
372  ot->idname = "OBJECT_OT_shaderfx_add";
373 
374  /* api callbacks */
378 
379  /* flags */
381 
382  /* properties */
383  ot->prop = RNA_def_enum(
386 
387  /* Abused, for "Light"... */
389 }
390 
393 /* -------------------------------------------------------------------- */
398 {
399  PropertyRNA *prop = RNA_def_string(
400  ot->srna, "shaderfx", NULL, MAX_NAME, "Shader", "Name of the shaderfx to edit");
402 }
403 
405 {
407  ot->srna, "report", false, "Report", "Create a notification after the operation");
409 }
410 
418  wmOperator *op,
419  const wmEvent *event,
420  int *r_retval)
421 {
422  if (RNA_struct_property_is_set(op->ptr, "shaderfx")) {
423  return true;
424  }
425 
426  PointerRNA ctx_ptr = CTX_data_pointer_get_type(C, "shaderfx", &RNA_ShaderFx);
427  if (ctx_ptr.data != NULL) {
428  ShaderFxData *fx = ctx_ptr.data;
429  RNA_string_set(op->ptr, "shaderfx", fx->name);
430  return true;
431  }
432 
433  /* Check the custom data of panels under the mouse for an effect. */
434  if (event != NULL) {
436 
437  if (!(panel_ptr == NULL || RNA_pointer_is_null(panel_ptr))) {
438  if (RNA_struct_is_a(panel_ptr->type, &RNA_ShaderFx)) {
439  ShaderFxData *fx = panel_ptr->data;
440  RNA_string_set(op->ptr, "shaderfx", fx->name);
441  return true;
442  }
443 
444  BLI_assert(r_retval != NULL); /* We need the return value in this case. */
445  if (r_retval != NULL) {
447  }
448  return false;
449  }
450  }
451 
452  if (r_retval != NULL) {
453  *r_retval = OPERATOR_CANCELLED;
454  }
455  return false;
456 }
457 
459 {
460  char shaderfx_name[MAX_NAME];
461  ShaderFxData *fx;
462  RNA_string_get(op->ptr, "shaderfx", shaderfx_name);
463 
464  fx = BKE_shaderfx_findby_name(ob, shaderfx_name);
465 
466  if (fx && type != 0 && fx->type != type) {
467  fx = NULL;
468  }
469 
470  return fx;
471 }
472 
475 /* -------------------------------------------------------------------- */
480 {
481  Main *bmain = CTX_data_main(C);
483  ShaderFxData *fx = edit_shaderfx_property_get(op, ob, 0);
484  if (!fx) {
485  return OPERATOR_CANCELLED;
486  }
487 
488  /* Store name temporarily for report. */
489  char name[MAX_NAME];
490  strcpy(name, fx->name);
491 
492  if (!ED_object_shaderfx_remove(op->reports, bmain, ob, fx)) {
493  return OPERATOR_CANCELLED;
494  }
495 
496  if (RNA_boolean_get(op->ptr, "report")) {
497  BKE_reportf(op->reports, RPT_INFO, "Removed effect: %s", name);
498  }
499 
501 
502  return OPERATOR_FINISHED;
503 }
504 
505 static int shaderfx_remove_invoke(bContext *C, wmOperator *op, const wmEvent *event)
506 {
507  int retval;
508  if (edit_shaderfx_invoke_properties(C, op, event, &retval)) {
509  return shaderfx_remove_exec(C, op);
510  }
511  return retval;
512 }
513 
515 {
516  ot->name = "Remove Grease Pencil Effect";
517  ot->description = "Remove a effect from the active grease pencil object";
518  ot->idname = "OBJECT_OT_shaderfx_remove";
519 
523 
524  /* flags */
528 }
529 
532 /* -------------------------------------------------------------------- */
537 {
539  ShaderFxData *fx = edit_shaderfx_property_get(op, ob, 0);
540 
541  if (!fx || !ED_object_shaderfx_move_up(op->reports, ob, fx)) {
542  return OPERATOR_CANCELLED;
543  }
544 
547 
548  return OPERATOR_FINISHED;
549 }
550 
551 static int shaderfx_move_up_invoke(bContext *C, wmOperator *op, const wmEvent *event)
552 {
553  int retval;
554  if (edit_shaderfx_invoke_properties(C, op, event, &retval)) {
555  return shaderfx_move_up_exec(C, op);
556  }
557  return retval;
558 }
559 
561 {
562  ot->name = "Move Up Effect";
563  ot->description = "Move effect up in the stack";
564  ot->idname = "OBJECT_OT_shaderfx_move_up";
565 
569 
570  /* flags */
573 }
574 
577 /* -------------------------------------------------------------------- */
582 {
584  ShaderFxData *fx = edit_shaderfx_property_get(op, ob, 0);
585 
586  if (!fx || !ED_object_shaderfx_move_down(op->reports, ob, fx)) {
587  return OPERATOR_CANCELLED;
588  }
589 
592 
593  return OPERATOR_FINISHED;
594 }
595 
596 static int shaderfx_move_down_invoke(bContext *C, wmOperator *op, const wmEvent *event)
597 {
598  int retval;
599  if (edit_shaderfx_invoke_properties(C, op, event, &retval)) {
600  return shaderfx_move_down_exec(C, op);
601  }
602  return retval;
603 }
604 
606 {
607  ot->name = "Move Down Effect";
608  ot->description = "Move effect down in the stack";
609  ot->idname = "OBJECT_OT_shaderfx_move_down";
610 
614 
615  /* flags */
618 }
619 
622 /* -------------------------------------------------------------------- */
627 {
629  ShaderFxData *fx = edit_shaderfx_property_get(op, ob, 0);
630  int index = RNA_int_get(op->ptr, "index");
631 
632  if (!fx || !ED_object_shaderfx_move_to_index(op->reports, ob, fx, index)) {
633  return OPERATOR_CANCELLED;
634  }
635 
636  return OPERATOR_FINISHED;
637 }
638 
640 {
641  int retval;
642  if (edit_shaderfx_invoke_properties(C, op, event, &retval)) {
643  return shaderfx_move_to_index_exec(C, op);
644  }
645  return retval;
646 }
647 
649 {
650  ot->name = "Move Effect to Index";
651  ot->idname = "OBJECT_OT_shaderfx_move_to_index";
652  ot->description =
653  "Change the effect's position in the list so it evaluates after the set number of "
654  "others";
655 
659 
660  /* flags */
663  RNA_def_int(
664  ot->srna, "index", 0, 0, INT_MAX, "Index", "The index to move the effect to", 0, INT_MAX);
665 }
666 
669 /* -------------------------------------------------------------------- */
674 {
676  ShaderFxData *fx = edit_shaderfx_property_get(op, ob, 0);
677  if (!fx) {
678  return OPERATOR_CANCELLED;
679  }
680  ShaderFxData *nfx = BKE_shaderfx_new(fx->type);
681  if (!nfx) {
682  return OPERATOR_CANCELLED;
683  }
684 
685  BLI_strncpy(nfx->name, fx->name, sizeof(nfx->name));
686  /* Make sure effect data has unique name. */
688 
689  BKE_shaderfx_copydata(fx, nfx);
690  BLI_insertlinkafter(&ob->shader_fx, fx, nfx);
691 
694 
695  return OPERATOR_FINISHED;
696 }
697 
698 static int shaderfx_copy_invoke(bContext *C, wmOperator *op, const wmEvent *event)
699 {
700  int retval;
701  if (edit_shaderfx_invoke_properties(C, op, event, &retval)) {
702  return shaderfx_copy_exec(C, op);
703  }
704  return retval;
705 }
706 
708 {
709  ot->name = "Copy Effect";
710  ot->description = "Duplicate effect at the same position in the stack";
711  ot->idname = "OBJECT_OT_shaderfx_copy";
712 
716 
717  /* flags */
720 }
721 
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1090
PointerRNA CTX_data_pointer_get_type(const bContext *C, const char *member, StructRNA *type)
Definition: context.c:473
void CTX_wm_operator_poll_msg_set(struct bContext *C, const char *msg)
Definition: context.c:1042
struct Main * CTX_data_main(const bContext *C)
Definition: context.c:1074
bool BKE_id_is_editable(const struct Main *bmain, const struct ID *id)
General operations, lookup, etc. for blender objects.
void BKE_object_free_derived_caches(struct Object *ob)
Definition: object.cc:1774
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition: report.c:83
void BKE_shaderfx_copy(struct ListBase *dst, const struct ListBase *src)
struct ShaderFxData * BKE_shaderfx_findby_type(struct Object *ob, ShaderFxType type)
Definition: shader_fx.c:233
void BKE_shaderfx_free(struct ShaderFxData *fx)
Definition: shader_fx.c:117
void BKE_shaderfx_copydata(struct ShaderFxData *fx, struct ShaderFxData *target)
Definition: shader_fx.c:215
const ShaderFxTypeInfo * BKE_shaderfx_get_info(ShaderFxType type)
Definition: shader_fx.c:139
struct ShaderFxData * BKE_shaderfx_new(int type)
Definition: shader_fx.c:62
struct ShaderFxData * BKE_shaderfx_findby_name(struct Object *ob, const char *name)
Definition: shader_fx.c:259
bool BKE_shaderfx_is_nonlocal_in_liboverride(const struct Object *ob, const struct ShaderFxData *shaderfx)
@ eShaderFxTypeFlag_NoUserAdd
Definition: BKE_shader_fx.h:50
@ eShaderFxTypeFlag_Single
Definition: BKE_shader_fx.h:47
bool BKE_shaderfx_unique_name(struct ListBase *shaderfx, struct ShaderFxData *fx)
Definition: shader_fx.c:122
#define BLI_assert(a)
Definition: BLI_assert.h:46
void BLI_insertlinkafter(struct ListBase *listbase, void *vprevlink, void *vnewlink) ATTR_NONNULL(1)
Definition: listbase.c:301
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
Definition: listbase.c:466
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:80
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:100
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:340
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
Definition: string.c:64
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL(1
#define UNUSED_FUNCTION(x)
#define UNUSED(x)
#define BLT_I18NCONTEXT_ID_ID
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:771
@ ID_RECALC_GEOMETRY
Definition: DNA_ID.h:791
#define ID_IS_OVERRIDE_LIBRARY(_id)
Definition: DNA_ID.h:588
#define MAX_NAME
Definition: DNA_defs.h:48
Object is a sort of wrapper for general info.
@ OB_GPENCIL
ShaderFxType
@ eShaderFxType_Blur
@ OPERATOR_CANCELLED
@ OPERATOR_FINISHED
@ OPERATOR_PASS_THROUGH
struct Object * ED_object_active_context(const struct bContext *C)
bool ED_operator_object_active_editable_ex(struct bContext *C, const Object *ob)
Definition: screen_ops.c:376
_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.
@ PROP_SKIP_SAVE
Definition: RNA_types.h:218
@ PROP_HIDDEN
Definition: RNA_types.h:216
#define C
Definition: RandGen.cpp:25
struct PointerRNA * UI_region_panel_custom_data_under_cursor(const struct bContext *C, const struct wmEvent *event)
@ OPTYPE_INTERNAL
Definition: WM_types.h:168
@ OPTYPE_UNDO
Definition: WM_types.h:148
@ OPTYPE_REGISTER
Definition: WM_types.h:146
#define ND_SHADERFX
Definition: WM_types.h:420
#define NC_OBJECT
Definition: WM_types.h:329
Scene scene
SyclQueue void void * src
static unsigned a[3]
Definition: RandGen.cpp:78
static const EnumPropertyItem * shaderfx_add_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
static int shaderfx_move_to_index_exec(bContext *C, wmOperator *op)
static int shaderfx_add_exec(bContext *C, wmOperator *op)
void OBJECT_OT_shaderfx_move_to_index(wmOperatorType *ot)
static int shaderfx_remove_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static int shaderfx_move_up_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static int shaderfx_move_down_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void OBJECT_OT_shaderfx_add(wmOperatorType *ot)
static int shaderfx_move_up_exec(bContext *C, wmOperator *op)
static int shaderfx_copy_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static void edit_shaderfx_properties(wmOperatorType *ot)
void OBJECT_OT_shaderfx_move_up(wmOperatorType *ot)
static int shaderfx_remove_exec(bContext *C, wmOperator *op)
static int shaderfx_copy_exec(bContext *C, wmOperator *op)
int ED_object_shaderfx_move_down(ReportList *UNUSED(reports), Object *ob, ShaderFxData *fx)
void ED_object_shaderfx_copy(Object *dst, ShaderFxData *fx)
static void edit_shaderfx_report_property(wmOperatorType *ot)
static bool edit_shaderfx_invoke_properties(bContext *C, wmOperator *op, const wmEvent *event, int *r_retval)
static bool object_shaderfx_remove(Main *bmain, Object *ob, ShaderFxData *fx, bool *UNUSED(r_sort_depsgraph))
static bool UNUSED_FUNCTION() object_has_shaderfx(const Object *ob, const ShaderFxData *exclude, ShaderFxType type)
void OBJECT_OT_shaderfx_copy(wmOperatorType *ot)
static bool edit_shaderfx_poll(bContext *C)
void OBJECT_OT_shaderfx_remove(wmOperatorType *ot)
int ED_object_shaderfx_move_up(ReportList *UNUSED(reports), Object *ob, ShaderFxData *fx)
bool ED_object_shaderfx_move_to_index(ReportList *reports, Object *ob, ShaderFxData *fx, const int index)
void ED_object_shaderfx_link(Object *dst, Object *src)
void OBJECT_OT_shaderfx_move_down(wmOperatorType *ot)
bool ED_object_shaderfx_remove(ReportList *reports, Main *bmain, Object *ob, ShaderFxData *fx)
static int shaderfx_move_to_index_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static int shaderfx_move_down_exec(bContext *C, wmOperator *op)
void ED_object_shaderfx_clear(Main *bmain, Object *ob)
ShaderFxData * ED_object_shaderfx_add(ReportList *reports, Main *bmain, Scene *UNUSED(scene), Object *ob, const char *name, int type)
static bool edit_shaderfx_poll_generic(bContext *C, StructRNA *rna_type, int obtype_flag, const bool is_liboverride_allowed)
static ShaderFxData * edit_shaderfx_property_get(wmOperator *op, Object *ob, int type)
bool is_liboverride_allowed
bool RNA_struct_is_a(const StructRNA *type, const StructRNA *srna)
Definition: rna_access.c:695
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
Definition: rna_access.c:5155
void RNA_string_get(PointerRNA *ptr, const char *name, char *value)
Definition: rna_access.c:5116
int RNA_int_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:4910
bool RNA_pointer_is_null(const PointerRNA *ptr)
Definition: rna_access.c:164
bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
Definition: rna_access.c:5301
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_enum_item_end(EnumPropertyItem **items, int *totitem)
Definition: rna_define.c:4487
void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item)
Definition: rna_define.c:4436
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:3687
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
Definition: rna_define.c:2848
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1490
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
void RNA_def_enum_funcs(PropertyRNA *prop, EnumPropertyItemFunc itemfunc)
Definition: rna_define.c:3830
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
const EnumPropertyItem rna_enum_object_shaderfx_type_items[]
Definition: rna_shader_fx.c:33
const char * identifier
Definition: RNA_types.h:461
char name[66]
Definition: DNA_ID.h:378
void * first
Definition: DNA_listBase.h:31
Definition: BKE_main.h:121
ListBase shader_fx
void * data
struct StructRNA * type
Definition: RNA_types.h:37
void * data
Definition: RNA_types.h:38
struct ID * owner_id
Definition: RNA_types.h:36
struct ShaderFxData * prev
struct ShaderFxData * next
ShaderFxTypeFlag flags
Definition: BKE_shader_fx.h:75
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
PropertyRNA * prop
Definition: WM_types.h:981
struct ReportList * reports
struct PointerRNA * ptr
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:3480
wmOperatorType * ot
Definition: wm_files.c:3479
int WM_menu_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))