[Bf-blender-cvs] [0be9d8db658] blender2.8: RNA/Override: Move override-related property flags to own variable.
Bastien Montagne
noreply at git.blender.org
Tue Jun 5 11:11:51 CEST 2018
Commit: 0be9d8db6582e32d7f7f3b097be12b2763524157
Author: Bastien Montagne
Date: Tue Jun 5 11:10:05 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB0be9d8db6582e32d7f7f3b097be12b2763524157
RNA/Override: Move override-related property flags to own variable.
We are already running out of available flags in main, generic int, and
everytime I work on static override I find new special cases that will
need new specific propflag, so...
===================================================================
M source/blender/makesrna/RNA_access.h
M source/blender/makesrna/RNA_define.h
M source/blender/makesrna/RNA_types.h
M source/blender/makesrna/intern/makesrna.c
M source/blender/makesrna/intern/rna_access.c
M source/blender/makesrna/intern/rna_animation.c
M source/blender/makesrna/intern/rna_constraint.c
M source/blender/makesrna/intern/rna_define.c
M source/blender/makesrna/intern/rna_fcurve.c
M source/blender/makesrna/intern/rna_group.c
M source/blender/makesrna/intern/rna_image.c
M source/blender/makesrna/intern/rna_internal_types.h
M source/blender/makesrna/intern/rna_mesh.c
M source/blender/makesrna/intern/rna_modifier.c
M source/blender/makesrna/intern/rna_object.c
M source/blender/makesrna/intern/rna_particle.c
M source/blender/makesrna/intern/rna_pose.c
M source/blender/makesrna/intern/rna_rna.c
M source/blender/makesrna/intern/rna_scene.c
===================================================================
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index 4b88cace319..1c752d45228 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -806,6 +806,7 @@ PropertyType RNA_property_type(PropertyRNA *prop);
PropertySubType RNA_property_subtype(PropertyRNA *prop);
PropertyUnit RNA_property_unit(PropertyRNA *prop);
int RNA_property_flag(PropertyRNA *prop);
+int RNA_property_override_flag(PropertyRNA *prop);
int RNA_property_tags(PropertyRNA *prop);
bool RNA_property_builtin(PropertyRNA *prop);
void *RNA_property_py_data_get(PropertyRNA *prop);
diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h
index 4e32651d356..d56ccbcfa01 100644
--- a/source/blender/makesrna/RNA_define.h
+++ b/source/blender/makesrna/RNA_define.h
@@ -149,6 +149,8 @@ void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname,
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag);
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag);
+void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag);
+void RNA_def_property_override_clear_flag(PropertyRNA *prop, PropertyOverrideFlag flag);
void RNA_def_property_tags(PropertyRNA *prop, int tags);
void RNA_def_property_subtype(PropertyRNA *prop, PropertySubType subtype);
void RNA_def_property_array(PropertyRNA *prop, int length);
diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h
index 5d6f309ad65..1e7b8605c76 100644
--- a/source/blender/makesrna/RNA_types.h
+++ b/source/blender/makesrna/RNA_types.h
@@ -158,7 +158,7 @@ typedef enum PropertySubType {
/* Make sure enums are updated with these */
/* HIGHEST FLAG IN USE: 1 << 31
- * FREE FLAGS: 11, 13, 14, 15, 30 */
+ * FREE FLAGS: 2, 9, 11, 13, 14, 15, 30 */
typedef enum PropertyFlag {
/* editable means the property is editable in the user
* interface, properties are editable by default except
@@ -176,15 +176,6 @@ typedef enum PropertyFlag {
* and collections */
PROP_ANIMATABLE = (1 << 1),
- /* Means the property can be overriden by a local 'proxy' of some linked datablock. */
- PROP_OVERRIDABLE_STATIC = (1 << 2),
- /* The property supports insertion (collections only). */
- PROP_OVERRIDABLE_STATIC_INSERTION = (1 << 9),
-
- /* Forbid usage of this property in comparison (& hence override) code.
- * Useful e.g. for collections of data like mesh's geometry, particles, etc. */
- PROP_NO_COMPARISON = (1 << 3),
-
/* This flag means when the property's widget is in 'textedit' mode, it will be updated
* after every typed char, instead of waiting final validation. Used e.g. for text searchbox.
* It will also cause UI_BUT_VALUE_CLEAR to be set for text buttons. We could add an own flag
@@ -253,6 +244,27 @@ typedef enum PropertyFlag {
PROP_ENUM_NO_TRANSLATE = (1 << 29), /* for enums not to be translated (e.g. viewlayers' names in nodes) */
} PropertyFlag;
+/* Flags related to comparing and overriding RNA properties. Make sure enums are updated with these */
+/* FREE FLAGS: 2, 3, 4, 5, 6, 7, 8, 9, 12 and above. */
+typedef enum PropertyOverrideFlag {
+ /* Means the property can be overriden by a local 'proxy' of some linked datablock. */
+ PROPOVERRIDE_OVERRIDABLE_STATIC = (1 << 0),
+
+ /* Forbid usage of this property in comparison (& hence override) code.
+ * Useful e.g. for collections of data like mesh's geometry, particles, etc. */
+ PROPOVERRIDE_NO_COMPARISON = (1 << 1),
+
+ /*** Collections-related ***/
+
+ /* The property supports insertion (collections only). */
+ PROPOVERRIDE_STATIC_INSERTION = (1 << 10),
+
+ /* Only use indices to compare items in the property, never names (collections only). */
+ /* Useful when nameprop of the items is generated from other data
+ * (e.g. name of material slots is actually name of assigned material). */
+ PROPOVERRIDE_INDEX_ONLY = (1 << 11),
+} PropertyOverrideFlag;
+
/* Function parameters flags.
* WARNING: 16bits only. */
typedef enum ParameterFlag {
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index 80d1897f604..4d5a644faa2 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -3056,7 +3056,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
else fprintf(f, "NULL,\n");
fprintf(f, "\t%d, ", prop->magic);
rna_print_c_string(f, prop->identifier);
- fprintf(f, ", %d, %d, %d, %d, ", prop->flag, prop->flag_parameter, prop->flag_internal, prop->tags);
+ fprintf(f, ", %d, %d, %d, %d, %d, ", prop->flag, prop->flag_override, prop->flag_parameter, prop->flag_internal, prop->tags);
rna_print_c_string(f, prop->name); fprintf(f, ",\n\t");
rna_print_c_string(f, prop->description); fprintf(f, ",\n\t");
fprintf(f, "%d, ", prop->icon);
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 5a0dec28324..df09e5c68b5 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -1005,6 +1005,11 @@ int RNA_property_flag(PropertyRNA *prop)
return rna_ensure_property(prop)->flag;
}
+int RNA_property_override_flag(PropertyRNA *prop)
+{
+ return rna_ensure_property(prop)->flag_override;
+}
+
/**
* Get the tags set for \a prop as int bitfield.
* \note Doesn't perform any validity check on the set bits. #RNA_def_property_tags does this
@@ -1976,11 +1981,11 @@ bool RNA_property_overridable_get(PointerRNA *ptr, PropertyRNA *prop)
}
}
/* If this is a RNA-defined property (real or 'virtual' IDProp), we want to use RNA prop flag. */
- return !(prop->flag & PROP_NO_COMPARISON) && (prop->flag & PROP_OVERRIDABLE_STATIC);
+ return !(prop->flag_override & PROPOVERRIDE_NO_COMPARISON) && (prop->flag_override & PROPOVERRIDE_OVERRIDABLE_STATIC);
}
else {
/* If this is a real 'pure' IDProp (aka custom property), we want to use the IDProp flag. */
- return !(prop->flag & PROP_NO_COMPARISON) && (((IDProperty *)prop)->flag & IDP_FLAG_OVERRIDABLE_STATIC);
+ return !(prop->flag_override & PROPOVERRIDE_NO_COMPARISON) && (((IDProperty *)prop)->flag & IDP_FLAG_OVERRIDABLE_STATIC);
}
}
@@ -2016,7 +2021,7 @@ bool RNA_property_comparable(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
{
prop = rna_ensure_property(prop);
- return !(prop->flag & PROP_NO_COMPARISON);
+ return !(prop->flag_override & PROPOVERRIDE_NO_COMPARISON);
}
/* this function is to check if its possible to create a valid path from the ID
diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c
index 84764187b62..0b928e63545 100644
--- a/source/blender/makesrna/intern/rna_animation.c
+++ b/source/blender/makesrna/intern/rna_animation.c
@@ -1027,7 +1027,7 @@ void rna_def_animdata_common(StructRNA *srna)
prop = RNA_def_property(srna, "animation_data", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "adt");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_flag(prop, PROP_OVERRIDABLE_STATIC);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
RNA_def_property_override_funcs(prop, NULL, NULL, "rna_AnimaData_override_apply");
RNA_def_property_ui_text(prop, "Animation Data", "Animation data for this data-block");
}
@@ -1052,7 +1052,8 @@ static void rna_def_animdata(BlenderRNA *brna)
/* Active Action */
prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
/* this flag as well as the dynamic test must be defined for this to be editable... */
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT | PROP_OVERRIDABLE_STATIC);
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
RNA_def_property_pointer_funcs(prop, NULL, "rna_AnimData_action_set", NULL, "rna_Action_id_poll");
RNA_def_property_editable_func(prop, "rna_AnimData_action_editable");
RNA_def_property_ui_text(prop, "Action", "Active Action for this data-block");
@@ -1085,7 +1086,7 @@ static void rna_def_animdata(BlenderRNA *brna)
prop = RNA_def_property(srna, "drivers", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "drivers", NULL);
RNA_def_property_struct_type(prop, "FCurve");
- RNA_def_property_flag(prop, PROP_OVERRIDABLE_STATIC);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
RNA_def_property_ui_text(prop, "Drivers", "The Drivers/Expressions for this data-block");
rna_api_animdata_drivers(brna, prop);
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index 7c53a3b54c0..e01ca97dfac 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -2361,12 +2361,12 @@ void RNA_def_constraint(BlenderRNA *brna)
/* flags */
prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_OFF);
- RNA_def_property_flag(prop, PROP_OVERRIDABLE_STATIC);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
RNA_def_property_ui_text(prop, "Disable", "Enable/Disable Constraint");
prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_EXPAND);
- RNA_def_property_flag(prop, PROP_OVERRIDABLE_STATIC);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
RNA_def_property_ui_text(prop, "Expanded", "Constraint's panel is expanded in UI");
RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c
index 03e58f8f78e..b8387263932 100644
--- a/source/blender/makesrna/intern/rna_define.c
+++ b/source/blender/makesrna/intern/rna_define.c
@@ -1293,6 +1293,16 @@ void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
prop->flag &= ~flag;
}
+void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOv
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list