[Bf-blender-cvs] [7e9d2fd9845] temp-dynamic-overrides: ID Type needs to be stored
Dalai Felinto
noreply at git.blender.org
Fri May 11 16:25:22 CEST 2018
Commit: 7e9d2fd9845d476878d1dd3c81e61c67a1ff36f3
Author: Dalai Felinto
Date: Fri May 11 16:06:40 2018 +0200
Branches: temp-dynamic-overrides
https://developer.blender.org/rB7e9d2fd9845d476878d1dd3c81e61c67a1ff36f3
ID Type needs to be stored
===================================================================
M release/scripts/startup/bl_ui/properties_view_layer.py
M source/blender/blenkernel/intern/layer.c
M source/blender/makesdna/DNA_layer_types.h
M source/blender/makesrna/intern/rna_layer.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_view_layer.py b/release/scripts/startup/bl_ui/properties_view_layer.py
index f62a6cfc8eb..be4b9fd2603 100644
--- a/release/scripts/startup/bl_ui/properties_view_layer.py
+++ b/release/scripts/startup/bl_ui/properties_view_layer.py
@@ -150,6 +150,10 @@ class VIEWLAYER_OT_overrides(ViewLayerButtonsPanel, Panel):
else:
layout.label(text="No collection property")
+ @staticmethod
+ def _icon_from_id_type(id_type):
+ return id_type + '_DATA'
+
def _draw_property(self, layout, dyn_prop, index, property_type):
box = layout.box()
row = box.row()
@@ -157,9 +161,7 @@ class VIEWLAYER_OT_overrides(ViewLayerButtonsPanel, Panel):
subrow = row.row()
subrow.active = dyn_prop.use
- # TODO: Show different cons depending on the ID.
- icon = 'NONE'
- subrow.label(text=dyn_prop.name, icon=icon)
+ subrow.label(text=dyn_prop.name, icon=self._icon_from_id_type(dyn_prop.id_type))
# TODO: Only show override_mode and multiply_factor if property is not ID.
subrow.prop(dyn_prop, "override_mode", text="")
diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c
index c2a454ee110..34a32e4de60 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -1987,8 +1987,9 @@ DynamicOverrideProperty *BKE_view_layer_override_property_add(
{
ID *owner_id = ptr->id.data;
eDynamicOverridePropertyType property_type;
+ const short id_type = GS(owner_id->name);
- switch (GS(owner_id->name)) {
+ switch (id_type) {
case ID_OB:
case ID_ME:
case ID_MA:
@@ -2008,6 +2009,7 @@ DynamicOverrideProperty *BKE_view_layer_override_property_add(
dyn_prop->multiply_factor = 1.0f;
dyn_prop->override_mode = DYN_OVERRIDE_MODE_REPLACE;
dyn_prop->root = owner_id;
+ dyn_prop->id_type = id_type;
dyn_prop->property_type = property_type;
dyn_prop->rna_path = RNA_path_from_ID_to_property_index(ptr, prop, 0, index);
diff --git a/source/blender/makesdna/DNA_layer_types.h b/source/blender/makesdna/DNA_layer_types.h
index 128185336b0..a5be96784b6 100644
--- a/source/blender/makesdna/DNA_layer_types.h
+++ b/source/blender/makesdna/DNA_layer_types.h
@@ -77,8 +77,10 @@ typedef struct DynamicOverrideProperty {
struct ListBase data_path; /* runtime: (RNAProperty *)LinkData->data */
float multiply_factor;
short flag;
- char property_type; /* eDynamicOverridePropertyType */
- char override_mode; /* eDynamicOverrideMode */
+ short property_type; /* eDynamicOverridePropertyType */
+ short override_mode; /* eDynamicOverrideMode */
+ short id_type;
+ short pad[2];
} DynamicOverrideProperty;
typedef struct OverrideSet {
diff --git a/source/blender/makesrna/intern/rna_layer.c b/source/blender/makesrna/intern/rna_layer.c
index 94a297bc58e..5858ea0b37b 100644
--- a/source/blender/makesrna/intern/rna_layer.c
+++ b/source/blender/makesrna/intern/rna_layer.c
@@ -44,6 +44,7 @@
#include "WM_types.h"
#include "RNA_define.h"
+#include "RNA_enum_types.h"
#include "rna_internal.h"
@@ -2113,6 +2114,13 @@ static void rna_def_dynamic_override_property(BlenderRNA *brna)
"Whether the property affects the entire scene or the collection objects only");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ prop = RNA_def_property(srna, "id_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, rna_enum_id_type_items);
+ RNA_def_property_ui_text(prop, "ID Type",
+ "Type of ID block that owns this property");
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_ID);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
prop = RNA_def_property(srna, "override_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, rna_enum_dynamic_override_mode_items);
RNA_def_property_ui_text(prop, "Override Mode",
More information about the Bf-blender-cvs
mailing list