Blender  V2.93
object_shader_fx.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 
31 #include "DNA_gpencil_types.h"
32 #include "DNA_object_types.h"
33 #include "DNA_scene_types.h"
34 #include "DNA_shader_fx_types.h"
35 
36 #include "BLI_listbase.h"
37 #include "BLI_string.h"
38 #include "BLI_string_utf8.h"
39 #include "BLI_utildefines.h"
40 
41 #include "BLT_translation.h"
42 
43 #include "BKE_context.h"
44 #include "BKE_main.h"
45 #include "BKE_object.h"
46 #include "BKE_report.h"
47 #include "BKE_shader_fx.h"
48 
49 #include "DEG_depsgraph.h"
50 #include "DEG_depsgraph_build.h"
51 #include "DEG_depsgraph_query.h"
52 
53 #include "RNA_access.h"
54 #include "RNA_define.h"
55 #include "RNA_enum_types.h"
56 
57 #include "ED_object.h"
58 #include "ED_screen.h"
59 
60 #include "UI_interface.h"
61 
62 #include "WM_api.h"
63 #include "WM_types.h"
64 
65 #include "object_intern.h"
66 
67 /******************************** API ****************************/
68 
70  ReportList *reports, Main *bmain, Scene *UNUSED(scene), Object *ob, const char *name, int type)
71 {
72  ShaderFxData *new_fx = NULL;
74 
75  if (ob->type != OB_GPENCIL) {
76  BKE_reportf(reports, RPT_WARNING, "Effect cannot be added to object '%s'", ob->id.name + 2);
77  return NULL;
78  }
79 
80  if (fxi->flags & eShaderFxTypeFlag_Single) {
81  if (BKE_shaderfx_findby_type(ob, type)) {
82  BKE_report(reports, RPT_WARNING, "Only one Effect of this type is allowed");
83  return NULL;
84  }
85  }
86 
87  /* get new effect data to add */
88  new_fx = BKE_shaderfx_new(type);
89 
90  BLI_addtail(&ob->shader_fx, new_fx);
91 
92  if (name) {
93  BLI_strncpy_utf8(new_fx->name, name, sizeof(new_fx->name));
94  }
95 
96  /* make sure effect data has unique name */
97  BKE_shaderfx_unique_name(&ob->shader_fx, new_fx);
98 
99  bGPdata *gpd = ob->data;
101 
104 
105  return new_fx;
106 }
107 
108 /* Return true if the object has a effect of type 'type' other than
109  * the shaderfx pointed to be 'exclude', otherwise returns false. */
111  const ShaderFxData *exclude,
113 {
114  ShaderFxData *fx;
115 
116  for (fx = ob->shader_fx.first; fx; fx = fx->next) {
117  if ((fx != exclude) && (fx->type == type)) {
118  return true;
119  }
120  }
121 
122  return false;
123 }
124 
125 static bool object_shaderfx_remove(Main *bmain,
126  Object *ob,
127  ShaderFxData *fx,
128  bool *UNUSED(r_sort_depsgraph))
129 {
130  /* It seems on rapid delete it is possible to
131  * get called twice on same effect, so make
132  * sure it is in list. */
133  if (BLI_findindex(&ob->shader_fx, fx) == -1) {
134  return 0;
135  }
136 
138 
139  BLI_remlink(&ob->shader_fx, fx);
140  BKE_shaderfx_free(fx);
142 
143  return 1;
144 }
145 
147 {
148  bool sort_depsgraph = false;
149  bool ok;
150 
151  ok = object_shaderfx_remove(bmain, ob, fx, &sort_depsgraph);
152 
153  if (!ok) {
154  BKE_reportf(reports, RPT_ERROR, "Effect '%s' not in object '%s'", fx->name, ob->id.name);
155  return 0;
156  }
157 
160 
161  return 1;
162 }
163 
165 {
166  ShaderFxData *fx = ob->shader_fx.first;
167  bool sort_depsgraph = false;
168 
169  if (!fx) {
170  return;
171  }
172 
173  while (fx) {
174  ShaderFxData *next_fx;
175 
176  next_fx = fx->next;
177 
178  object_shaderfx_remove(bmain, ob, fx, &sort_depsgraph);
179 
180  fx = next_fx;
181  }
182 
185 }
186 
188 {
189  if (fx->prev) {
190  BLI_remlink(&ob->shader_fx, fx);
191  BLI_insertlinkbefore(&ob->shader_fx, fx->prev, fx);
192  }
193 
194  return 1;
195 }
196 
198 {
199  if (fx->next) {
200  BLI_remlink(&ob->shader_fx, fx);
201  BLI_insertlinkafter(&ob->shader_fx, fx->next, fx);
202  }
203 
204  return 1;
205 }
206 
208  Object *ob,
209  ShaderFxData *fx,
210  const int index)
211 {
212  BLI_assert(fx != NULL);
213  BLI_assert(index >= 0);
214  if (index >= BLI_listbase_count(&ob->shader_fx)) {
215  BKE_report(reports, RPT_WARNING, "Cannot move effect beyond the end of the stack");
216  return false;
217  }
218 
219  int fx_index = BLI_findindex(&ob->shader_fx, fx);
220  BLI_assert(fx_index != -1);
221  if (fx_index < index) {
222  /* Move shaderfx down in list. */
223  for (; fx_index < index; fx_index++) {
224  if (!ED_object_shaderfx_move_down(reports, ob, fx)) {
225  break;
226  }
227  }
228  }
229  else {
230  /* Move shaderfx up in list. */
231  for (; fx_index > index; fx_index--) {
232  if (!ED_object_shaderfx_move_up(reports, ob, fx)) {
233  break;
234  }
235  }
236  }
237 
240 
241  return true;
242 }
243 
245 {
246  BLI_freelistN(&dst->shader_fx);
247  BKE_shaderfx_copy(&dst->shader_fx, &src->shader_fx);
248 
251 }
252 
254 {
255  ShaderFxData *nfx = BKE_shaderfx_new(fx->type);
256  BLI_strncpy(nfx->name, fx->name, sizeof(nfx->name));
257  BKE_shaderfx_copydata(fx, nfx);
258  BLI_addtail(&dst->shader_fx, nfx);
259 
262 }
263 
264 /************************ add effect operator *********************/
265 
267 {
268  Main *bmain = CTX_data_main(C);
271  int type = RNA_enum_get(op->ptr, "type");
272 
273  if (!ED_object_shaderfx_add(op->reports, bmain, scene, ob, NULL, type)) {
274  return OPERATOR_CANCELLED;
275  }
276 
278 
279  return OPERATOR_FINISHED;
280 }
281 
284  PropertyRNA *UNUSED(prop),
285  bool *r_free)
286 {
288  EnumPropertyItem *item = NULL;
289  const EnumPropertyItem *fx_item, *group_item = NULL;
290  const ShaderFxTypeInfo *mti;
291  int totitem = 0, a;
292 
293  if (!ob) {
295  }
296 
299  if (fx_item->identifier[0]) {
300  mti = BKE_shaderfx_get_info(fx_item->value);
301 
302  if (mti->flags & eShaderFxTypeFlag_NoUserAdd) {
303  continue;
304  }
305  }
306  else {
307  group_item = fx_item;
308  fx_item = NULL;
309 
310  continue;
311  }
312 
313  if (group_item) {
314  RNA_enum_item_add(&item, &totitem, group_item);
315  group_item = NULL;
316  }
317 
318  RNA_enum_item_add(&item, &totitem, fx_item);
319  }
320 
321  RNA_enum_item_end(&item, &totitem);
322  *r_free = true;
323 
324  return item;
325 }
326 
328 {
329  /* identifiers */
330  ot->name = "Add Effect";
331  ot->description = "Add a visual effect to the active object";
332  ot->idname = "OBJECT_OT_shaderfx_add";
333 
334  /* api callbacks */
338 
339  /* flags */
341 
342  /* properties */
343  ot->prop = RNA_def_enum(
346 
347  /* Abused, for "Light"... */
349 }
350 
351 /* -------------------------------------------------------------------- */
355 static bool edit_shaderfx_poll_generic(bContext *C, StructRNA *rna_type, int obtype_flag)
356 {
357  PointerRNA ptr = CTX_data_pointer_get_type(C, "shaderfx", rna_type);
359  ShaderFxData *fx = ptr.data; /* May be NULL. */
360 
361  if (!ob || ID_IS_LINKED(ob)) {
362  return false;
363  }
364  if (obtype_flag && ((1 << ob->type) & obtype_flag) == 0) {
365  return false;
366  }
368  return false;
369  }
370 
371  if (ID_IS_OVERRIDE_LIBRARY(ob)) {
372  if ((fx == NULL) || (fx->flag & eShaderFxFlag_OverrideLibrary_Local) == 0) {
373  CTX_wm_operator_poll_msg_set(C, "Cannot edit shaderfxs coming from library override");
374  return false;
375  }
376  }
377 
378  return true;
379 }
380 
382 {
384 }
385 
387 {
388  PropertyRNA *prop = RNA_def_string(
389  ot->srna, "shaderfx", NULL, MAX_NAME, "Shader", "Name of the shaderfx to edit");
391 }
392 
394 {
396  ot->srna, "report", false, "Report", "Create a notification after the operation");
398 }
399 
407  wmOperator *op,
408  const wmEvent *event,
409  int *r_retval)
410 {
411  if (RNA_struct_property_is_set(op->ptr, "shaderfx")) {
412  return true;
413  }
414 
415  PointerRNA ctx_ptr = CTX_data_pointer_get_type(C, "shaderfx", &RNA_ShaderFx);
416  if (ctx_ptr.data != NULL) {
417  ShaderFxData *fx = ctx_ptr.data;
418  RNA_string_set(op->ptr, "shaderfx", fx->name);
419  return true;
420  }
421 
422  /* Check the custom data of panels under the mouse for an effect. */
423  if (event != NULL) {
425 
426  if (!(panel_ptr == NULL || RNA_pointer_is_null(panel_ptr))) {
427  if (RNA_struct_is_a(panel_ptr->type, &RNA_ShaderFx)) {
428  ShaderFxData *fx = panel_ptr->data;
429  RNA_string_set(op->ptr, "shaderfx", fx->name);
430  return true;
431  }
432 
433  BLI_assert(r_retval != NULL); /* We need the return value in this case. */
434  if (r_retval != NULL) {
436  }
437  return false;
438  }
439  }
440 
441  if (r_retval != NULL) {
442  *r_retval = OPERATOR_CANCELLED;
443  }
444  return false;
445 }
446 
448 {
449  char shaderfx_name[MAX_NAME];
450  ShaderFxData *fx;
451  RNA_string_get(op->ptr, "shaderfx", shaderfx_name);
452 
453  fx = BKE_shaderfx_findby_name(ob, shaderfx_name);
454 
455  if (fx && type != 0 && fx->type != type) {
456  fx = NULL;
457  }
458 
459  return fx;
460 }
461 
464 /************************ remove shaderfx operator *********************/
465 
467 {
468  Main *bmain = CTX_data_main(C);
470  ShaderFxData *fx = edit_shaderfx_property_get(op, ob, 0);
471 
472  /* Store name temporarily for report. */
473  char name[MAX_NAME];
474  strcpy(name, fx->name);
475 
476  if (!fx || !ED_object_shaderfx_remove(op->reports, bmain, ob, fx)) {
477  return OPERATOR_CANCELLED;
478  }
479 
480  if (RNA_boolean_get(op->ptr, "report")) {
481  BKE_reportf(op->reports, RPT_INFO, "Removed effect: %s", name);
482  }
483 
485 
486  return OPERATOR_FINISHED;
487 }
488 
489 static int shaderfx_remove_invoke(bContext *C, wmOperator *op, const wmEvent *event)
490 {
491  int retval;
492  if (edit_shaderfx_invoke_properties(C, op, event, &retval)) {
493  return shaderfx_remove_exec(C, op);
494  }
495  return retval;
496 }
497 
499 {
500  ot->name = "Remove Grease Pencil Effect";
501  ot->description = "Remove a effect from the active grease pencil object";
502  ot->idname = "OBJECT_OT_shaderfx_remove";
503 
507 
508  /* flags */
512 }
513 
514 /************************ move up shaderfx operator *********************/
515 
517 {
519  ShaderFxData *fx = edit_shaderfx_property_get(op, ob, 0);
520 
521  if (!fx || !ED_object_shaderfx_move_up(op->reports, ob, fx)) {
522  return OPERATOR_CANCELLED;
523  }
524 
527 
528  return OPERATOR_FINISHED;
529 }
530 
531 static int shaderfx_move_up_invoke(bContext *C, wmOperator *op, const wmEvent *event)
532 {
533  int retval;
534  if (edit_shaderfx_invoke_properties(C, op, event, &retval)) {
535  return shaderfx_move_up_exec(C, op);
536  }
537  return retval;
538 }
539 
541 {
542  ot->name = "Move Up Effect";
543  ot->description = "Move effect up in the stack";
544  ot->idname = "OBJECT_OT_shaderfx_move_up";
545 
549 
550  /* flags */
553 }
554 
555 /************************ move down shaderfx operator *********************/
556 
558 {
560  ShaderFxData *fx = edit_shaderfx_property_get(op, ob, 0);
561 
562  if (!fx || !ED_object_shaderfx_move_down(op->reports, ob, fx)) {
563  return OPERATOR_CANCELLED;
564  }
565 
568 
569  return OPERATOR_FINISHED;
570 }
571 
572 static int shaderfx_move_down_invoke(bContext *C, wmOperator *op, const wmEvent *event)
573 {
574  int retval;
575  if (edit_shaderfx_invoke_properties(C, op, event, &retval)) {
576  return shaderfx_move_down_exec(C, op);
577  }
578  return retval;
579 }
580 
582 {
583  ot->name = "Move Down Effect";
584  ot->description = "Move effect down in the stack";
585  ot->idname = "OBJECT_OT_shaderfx_move_down";
586 
590 
591  /* flags */
594 }
595 
596 /************************ move shaderfx to index operator *********************/
597 
599 {
601 }
602 
604 {
606  ShaderFxData *fx = edit_shaderfx_property_get(op, ob, 0);
607  int index = RNA_int_get(op->ptr, "index");
608 
609  if (!fx || !ED_object_shaderfx_move_to_index(op->reports, ob, fx, index)) {
610  return OPERATOR_CANCELLED;
611  }
612 
613  return OPERATOR_FINISHED;
614 }
615 
617 {
618  int retval;
619  if (edit_shaderfx_invoke_properties(C, op, event, &retval)) {
620  return shaderfx_move_to_index_exec(C, op);
621  }
622  return retval;
623 }
624 
626 {
627  ot->name = "Move Effect to Index";
628  ot->idname = "OBJECT_OT_shaderfx_move_to_index";
629  ot->description =
630  "Change the effect's position in the list so it evaluates after the set number of "
631  "others";
632 
636 
637  /* flags */
640  RNA_def_int(
641  ot->srna, "index", 0, 0, INT_MAX, "Index", "The index to move the effect to", 0, INT_MAX);
642 }
643 
644 /************************ copy shader operator *********************/
645 
647 {
649  ShaderFxData *fx = edit_shaderfx_property_get(op, ob, 0);
650 
651  ShaderFxData *nfx = BKE_shaderfx_new(fx->type);
652  if (!nfx) {
653  return OPERATOR_CANCELLED;
654  }
655 
656  BLI_strncpy(nfx->name, fx->name, sizeof(nfx->name));
657  /* Make sure effect data has unique name. */
659 
660  BKE_shaderfx_copydata(fx, nfx);
661  BLI_insertlinkafter(&ob->shader_fx, fx, nfx);
662 
665 
666  return OPERATOR_FINISHED;
667 }
668 
669 static int shaderfx_copy_invoke(bContext *C, wmOperator *op, const wmEvent *event)
670 {
671  int retval;
672  if (edit_shaderfx_invoke_properties(C, op, event, &retval)) {
673  return shaderfx_copy_exec(C, op);
674  }
675  return retval;
676 }
677 
679 {
681 }
682 
684 {
685  ot->name = "Copy Effect";
686  ot->description = "Duplicate effect at the same position in the stack";
687  ot->idname = "OBJECT_OT_shaderfx_copy";
688 
692 
693  /* flags */
696 }
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1034
PointerRNA CTX_data_pointer_get_type(const bContext *C, const char *member, StructRNA *type)
Definition: context.c:456
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
General operations, lookup, etc. for blender objects.
void BKE_object_free_derived_caches(struct Object *ob)
Definition: object.c:1719
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
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:251
void BKE_shaderfx_free(struct ShaderFxData *fx)
Definition: shader_fx.c:134
void BKE_shaderfx_copydata(struct ShaderFxData *fx, struct ShaderFxData *target)
Definition: shader_fx.c:233
const ShaderFxTypeInfo * BKE_shaderfx_get_info(ShaderFxType type)
Definition: shader_fx.c:157
struct ShaderFxData * BKE_shaderfx_new(int type)
Definition: shader_fx.c:79
struct ShaderFxData * BKE_shaderfx_findby_name(struct Object *ob, const char *name)
Definition: shader_fx.c:277
@ eShaderFxTypeFlag_NoUserAdd
Definition: BKE_shader_fx.h:64
@ eShaderFxTypeFlag_Single
Definition: BKE_shader_fx.h:61
bool BKE_shaderfx_unique_name(struct ListBase *shaderfx, struct ShaderFxData *fx)
Definition: shader_fx.c:140
#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 void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
Definition: listbase.c:547
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(char *__restrict dst, const char *__restrict src, const size_t maxncpy) ATTR_NONNULL()
Definition: string.c:108
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
Definition: string_utf8.c:258
#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:599
@ ID_RECALC_GEOMETRY
Definition: DNA_ID.h:611
#define ID_IS_LINKED(_id)
Definition: DNA_ID.h:426
#define ID_IS_OVERRIDE_LIBRARY(_id)
Definition: DNA_ID.h:445
#define MAX_NAME
Definition: DNA_defs.h:62
Object is a sort of wrapper for general info.
@ OB_GPENCIL
@ eShaderFxFlag_OverrideLibrary_Local
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(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_ShaderFx
@ PROP_SKIP_SAVE
Definition: RNA_types.h:204
@ 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_SHADERFX
Definition: WM_types.h:372
#define NC_OBJECT
Definition: WM_types.h:280
Scene scene
static unsigned a[3]
Definition: RandGen.cpp:92
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 bool edit_shaderfx_poll_generic(bContext *C, StructRNA *rna_type, int obtype_flag)
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 shaderfx_move_to_index_poll(bContext *C)
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 shaderfx_copy_poll(bContext *C)
static ShaderFxData * edit_shaderfx_property_get(wmOperator *op, Object *ob, int type)
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_translation_context(PropertyRNA *prop, const char *context)
Definition: rna_define.c:2870
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_shaderfx_type_items[]
Definition: rna_shader_fx.c:47
const char * identifier
Definition: RNA_types.h:446
char name[66]
Definition: DNA_ID.h:283
void * first
Definition: DNA_listBase.h:47
Definition: BKE_main.h:116
ListBase shader_fx
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
struct ShaderFxData * prev
struct ShaderFxData * next
ShaderFxTypeFlag flags
Definition: BKE_shader_fx.h:89
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
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