[Bf-blender-cvs] [e3d6d9d3ac9] temp-dynamic-overrides: Dynamic Override: Share a tiny bit more code betzeen dynamic and static overrides.
Bastien Montagne
noreply at git.blender.org
Thu May 17 13:52:35 CEST 2018
Commit: e3d6d9d3ac9f23f583ed8d9b8476b90e51b95885
Author: Bastien Montagne
Date: Thu May 17 12:56:32 2018 +0200
Branches: temp-dynamic-overrides
https://developer.blender.org/rBe3d6d9d3ac9f23f583ed8d9b8476b90e51b95885
Dynamic Override: Share a tiny bit more code betzeen dynamic and static overrides.
Renamed dynamic's override_mode to 'operation' (same as with static) and
made it use same enum values.
Note that ultimately/ideally both would only use one data structure,
this should be manageable and will simplify RNA apply code (which is to
be shared by both), but that kind of cleanup/refactor we can do once we
have a working system, just before merging into blender2.8.
===================================================================
M source/blender/blenkernel/intern/layer.c
M source/blender/makesdna/DNA_layer_types.h
M source/blender/makesrna/intern/rna_dynamic_override.c
===================================================================
diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c
index 81fa66b034e..c0a9aaa3da3 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -1600,7 +1600,7 @@ DynamicOverrideProperty *BKE_view_layer_override_property_add(
DynamicOverrideProperty *dyn_prop = MEM_callocN(sizeof(DynamicOverrideProperty), __func__);
dyn_prop->flag = DYN_OVERRIDE_PROP_USE;
dyn_prop->multiply_factor = 1.0f;
- dyn_prop->override_mode = DYN_OVERRIDE_MODE_REPLACE;
+ dyn_prop->operation = IDOVERRIDESTATIC_OP_REPLACE;
/* TODO: We want to store the id only when the rna path is only relevant to
* this particular object (e.g., modifiers of an object) .*/
dyn_prop->root = owner_id;
diff --git a/source/blender/makesdna/DNA_layer_types.h b/source/blender/makesdna/DNA_layer_types.h
index a750d117d36..a022dd0e6de 100644
--- a/source/blender/makesdna/DNA_layer_types.h
+++ b/source/blender/makesdna/DNA_layer_types.h
@@ -78,7 +78,7 @@ typedef struct DynamicOverrideProperty {
float multiply_factor;
short flag;
short property_type; /* eDynamicOverridePropertyType */
- short override_mode; /* eDynamicOverrideMode */
+ short operation; /* See IDOVERRIDESTATIC_OP_ enums in DNA_ID.h */
short id_type;
short array_len;
short pad;
@@ -182,12 +182,6 @@ typedef enum eDynamicOverridePropertyType {
DYN_OVERRIDE_PROP_TYPE_COLLECTION = 1,
} eDynamicOverridePropertyType;
-/* DynamicOverrideProperty->override_mode */
-typedef enum eDynamicOverrideMode {
- DYN_OVERRIDE_MODE_REPLACE = 0,
- DYN_OVERRIDE_MODE_MULTIPLY = 1,
-} eDynamicOverrideMode;
-
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/makesrna/intern/rna_dynamic_override.c b/source/blender/makesrna/intern/rna_dynamic_override.c
index b40ecef66e2..ca12dfd87f4 100644
--- a/source/blender/makesrna/intern/rna_dynamic_override.c
+++ b/source/blender/makesrna/intern/rna_dynamic_override.c
@@ -28,6 +28,7 @@
#include "BLI_math.h"
+#include "DNA_ID.h"
#include "DNA_layer_types.h"
#include "WM_types.h"
@@ -189,8 +190,8 @@ void RNA_def_dynamic_override(BlenderRNA *brna)
PropertyRNA *prop;
static const EnumPropertyItem rna_enum_dynamic_override_mode_items[] = {
- {DYN_OVERRIDE_MODE_REPLACE, "REPLACE", 0, "Replace", ""},
- {DYN_OVERRIDE_MODE_MULTIPLY, "MULTIPLY", 0, "Multiply", ""},
+ {IDOVERRIDESTATIC_OP_REPLACE, "REPLACE", 0, "Replace", ""},
+ {IDOVERRIDESTATIC_OP_MULTIPLY, "MULTIPLY", 0, "Multiply", ""},
{0, NULL, 0, NULL, NULL}
};
@@ -230,6 +231,7 @@ void RNA_def_dynamic_override(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
prop = RNA_def_property(srna, "override_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "operation");
RNA_def_property_enum_items(prop, rna_enum_dynamic_override_mode_items);
RNA_def_property_ui_text(prop, "Override Mode",
"Method of override the original values");
More information about the Bf-blender-cvs
mailing list