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:
-rw-r--r--release/scripts/modules/rna_prop_ui.py2
-rw-r--r--release/scripts/startup/bl_operators/wm.py2
-rw-r--r--source/blender/makesrna/intern/rna_access.c34
3 files changed, 36 insertions, 2 deletions
diff --git a/release/scripts/modules/rna_prop_ui.py b/release/scripts/modules/rna_prop_ui.py
index 8dda8c90f85..662c1d908fc 100644
--- a/release/scripts/modules/rna_prop_ui.py
+++ b/release/scripts/modules/rna_prop_ui.py
@@ -130,7 +130,7 @@ def rna_idprop_ui_prop_default_set(item, prop, value):
try:
prop_type, is_array = rna_idprop_value_item_type(item[prop])
- if prop_type in {int, float}:
+ if prop_type in {int, float, str}:
if is_array and isinstance(value, ARRAY_TYPES):
value = [prop_type(item) for item in value]
if any(value):
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py
index 04bd5687364..a543ea6685c 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -1457,7 +1457,7 @@ class WM_OT_properties_edit(Operator):
proptype, is_array = rna_idprop_value_item_type(value)
row = layout.row()
- row.enabled = proptype in {int, float}
+ row.enabled = proptype in {int, float, str}
row.prop(self, "default")
row = layout.row(align=True)
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index cb9679ad925..79cf993e0cc 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -3473,6 +3473,24 @@ void RNA_property_string_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop,
{
StringPropertyRNA *sprop = (StringPropertyRNA *)rna_ensure_property(prop);
+ if (prop->magic != RNA_MAGIC) {
+ /* attempt to get the local ID values */
+ const IDProperty *idp_ui = rna_idproperty_ui(prop);
+
+ if (idp_ui) {
+ IDProperty *item;
+
+ item = IDP_GetPropertyTypeFromGroup(idp_ui, "default", IDP_STRING);
+ if (item) {
+ strcpy(value, IDP_String(item));
+ return;
+ }
+ }
+
+ strcpy(value, "");
+ return;
+ }
+
BLI_assert(RNA_property_type(prop) == PROP_STRING);
strcpy(value, sprop->defaultvalue);
@@ -3507,6 +3525,22 @@ int RNA_property_string_default_length(PointerRNA *UNUSED(ptr), PropertyRNA *pro
{
StringPropertyRNA *sprop = (StringPropertyRNA *)rna_ensure_property(prop);
+ if (prop->magic != RNA_MAGIC) {
+ /* attempt to get the local ID values */
+ const IDProperty *idp_ui = rna_idproperty_ui(prop);
+
+ if (idp_ui) {
+ IDProperty *item;
+
+ item = IDP_GetPropertyTypeFromGroup(idp_ui, "default", IDP_STRING);
+ if (item) {
+ return strlen(IDP_String(item));
+ }
+ }
+
+ return 0;
+ }
+
BLI_assert(RNA_property_type(prop) == PROP_STRING);
return strlen(sprop->defaultvalue);