From 9a4fd6da0f3a6a27780ad868b0d0109ebfff0c8d Mon Sep 17 00:00:00 2001 From: Antonioya Date: Tue, 30 Apr 2019 17:36:58 +0200 Subject: Fix T63864 Duplicate Data options don't exist for Light Probe and Grease Pencil See revision D4766 --- release/scripts/startup/bl_ui/space_userpref.py | 2 ++ source/blender/blenkernel/intern/object.c | 4 ++-- source/blender/blenloader/intern/versioning_userdef.c | 6 ++++++ source/blender/makesdna/DNA_userdef_types.h | 2 ++ source/blender/makesrna/intern/rna_userdef.c | 10 ++++++++++ 5 files changed, 22 insertions(+), 2 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index 7cfcbfe133e..a75bc9ffe99 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -318,6 +318,7 @@ class USERPREF_PT_edit_objects_duplicate_data(PreferencePanel, Panel): col.prop(edit, "use_duplicate_curve", text="Curve") # col.prop(edit, "use_duplicate_fcurve", text="F-Curve") col.prop(edit, "use_duplicate_light", text="Light") + col.prop(edit, "use_duplicate_lightprobe", text="Light Probe") col = flow.column() col.prop(edit, "use_duplicate_material", text="Material") col.prop(edit, "use_duplicate_mesh", text="Mesh") @@ -327,6 +328,7 @@ class USERPREF_PT_edit_objects_duplicate_data(PreferencePanel, Panel): col.prop(edit, "use_duplicate_surface", text="Surface") col.prop(edit, "use_duplicate_text", text="Text") col.prop(edit, "use_duplicate_texture", text="Texture") + col.prop(edit, "use_duplicate_grease_pencil", text="Grease Pencil") class USERPREF_PT_edit_cursor(PreferencePanel, Panel): diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 51d1e65fe17..35e25086924 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1651,7 +1651,7 @@ Object *BKE_object_duplicate(Main *bmain, const Object *ob, const int dupflag) } break; case OB_LIGHTPROBE: - if (dupflag != 0) { + if (dupflag & USER_DUP_LIGHTPROBE) { ID_NEW_REMAP_US2(obn->data) else { @@ -1673,7 +1673,7 @@ Object *BKE_object_duplicate(Main *bmain, const Object *ob, const int dupflag) } break; case OB_GPENCIL: - if (dupflag != 0) { + if (dupflag & USER_DUP_GPENCIL) { ID_NEW_REMAP_US2(obn->data) else { diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c index 91f605460c9..f844a0df4e5 100644 --- a/source/blender/blenloader/intern/versioning_userdef.c +++ b/source/blender/blenloader/intern/versioning_userdef.c @@ -530,6 +530,12 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef) } } + /* patch to set Dupli Lightprobes and Grease Pencil */ + if (!USER_VERSION_ATLEAST(280, 58)) { + userdef->dupflag |= USER_DUP_LIGHTPROBE; + userdef->dupflag |= USER_DUP_GPENCIL; + } + /** * Include next version bump. */ diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 6923619ef91..621aa243d7c 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -993,6 +993,8 @@ typedef enum eDupli_ID_Flags { USER_DUP_ARM = (1 << 9), USER_DUP_ACT = (1 << 10), USER_DUP_PSYS = (1 << 11), + USER_DUP_LIGHTPROBE = (1 << 12), + USER_DUP_GPENCIL = (1 << 13), } eDupli_ID_Flags; /** Max anti alias draw method diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 0236820e4d9..3994cb39f0e 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -4472,6 +4472,16 @@ static void rna_def_userdef_edit(BlenderRNA *brna) RNA_def_property_ui_text( prop, "Duplicate Particle", "Causes particle systems to be duplicated with the object"); + prop = RNA_def_property(srna, "use_duplicate_lightprobe", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_LIGHTPROBE); + RNA_def_property_ui_text( + prop, "Duplicate Light Probe", "Causes light probe data to be duplicated with the object"); + + prop = RNA_def_property(srna, "use_duplicate_grease_pencil", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_GPENCIL); + RNA_def_property_ui_text( + prop, "Duplicate GPencil", "Causes grease pencil data to be duplicated with the object"); + /* Currently only used for insert offset (aka auto-offset), * maybe also be useful for later stuff though. */ prop = RNA_def_property(srna, "node_margin", PROP_INT, PROP_NONE); -- cgit v1.2.3