Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Craddock <nzcraddock@gmail.com>2020-09-15 23:50:21 +0300
committerNathan Craddock <nzcraddock@gmail.com>2020-09-16 00:29:19 +0300
commit18701c19fa91572cb44643de31853335a6737925 (patch)
tree73e97db5da83847f7ffc0e3c77251893974021dc /source/blender/editors/object/object_shader_fx.c
parent1c5d0deb2ac352a37be3b39d0f5e20321cdd0942 (diff)
GPencil: Add link and copy functions for shaderfx
Adds two functions: one to copy a shaderfx between two gpencil objects, and another to link all shaderfx between two gpencil objects. Added in preparation for outliner shaderfx drag and drop. Differential Revision: https://developer.blender.org/D8642
Diffstat (limited to 'source/blender/editors/object/object_shader_fx.c')
-rw-r--r--source/blender/editors/object/object_shader_fx.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/source/blender/editors/object/object_shader_fx.c b/source/blender/editors/object/object_shader_fx.c
index e2a30c4ce98..2dbde095e39 100644
--- a/source/blender/editors/object/object_shader_fx.c
+++ b/source/blender/editors/object/object_shader_fx.c
@@ -34,6 +34,7 @@
#include "DNA_shader_fx_types.h"
#include "BLI_listbase.h"
+#include "BLI_string.h"
#include "BLI_string_utf8.h"
#include "BLI_utildefines.h"
@@ -237,6 +238,26 @@ bool ED_object_shaderfx_move_to_index(ReportList *reports,
return true;
}
+void ED_object_shaderfx_link(Object *dst, Object *src)
+{
+ BLI_freelistN(&dst->shader_fx);
+ BKE_shaderfx_copy(&dst->shader_fx, &src->shader_fx);
+
+ DEG_id_tag_update(&dst->id, ID_RECALC_GEOMETRY);
+ WM_main_add_notifier(NC_OBJECT | ND_SHADERFX, dst);
+}
+
+void ED_object_shaderfx_copy(Object *dst, ShaderFxData *fx)
+{
+ ShaderFxData *nfx = BKE_shaderfx_new(fx->type);
+ BLI_strncpy(nfx->name, fx->name, sizeof(nfx->name));
+ BKE_shaderfx_copydata(fx, nfx);
+ BLI_addtail(&dst->shader_fx, nfx);
+
+ DEG_id_tag_update(&dst->id, ID_RECALC_GEOMETRY);
+ WM_main_add_notifier(NC_OBJECT | ND_SHADERFX, dst);
+}
+
/************************ add effect operator *********************/
static int shaderfx_add_exec(bContext *C, wmOperator *op)