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_info.py33
-rw-r--r--source/blender/makesrna/intern/rna_rna.c9
2 files changed, 36 insertions, 6 deletions
diff --git a/release/scripts/modules/rna_info.py b/release/scripts/modules/rna_info.py
index 84171335c64..abb7bb35af0 100644
--- a/release/scripts/modules/rna_info.py
+++ b/release/scripts/modules/rna_info.py
@@ -53,12 +53,23 @@ class InfoStructRNA:
self.properties[:] = [GetInfoPropertyRNA(rna_prop, parent_id) for rna_id, rna_prop in rna_type.properties.items() if rna_id != "rna_type"]
self.functions[:] = [GetInfoFunctionRNA(rna_prop, parent_id) for rna_prop in rna_type.functions.values()]
- def getNestedProperties(self, ls = None):
+ def get_bases(self):
+ bases = []
+ item = self
+
+ while item:
+ item = item.base
+ if item:
+ bases.append(item)
+
+ return bases
+
+ def get_nested_properties(self, ls = None):
if not ls:
ls = self.properties[:]
if self.nested:
- self.nested.getNestedProperties(ls)
+ self.nested.get_nested_properties(ls)
return ls
@@ -86,6 +97,7 @@ class InfoPropertyRNA:
self.identifier = rna_prop.identifier
self.name = rna_prop.name
self.description = rna_prop.description.strip()
+ self.default_str = "<UNKNOWN>"
def build(self):
rna_prop = self.bl_prop
@@ -105,6 +117,11 @@ class InfoPropertyRNA:
if self.type == "enum":
self.enum_items[:] = rna_prop.items.keys()
+ if self.array_length:
+ self.default_str = str(getattr(rna_prop, "default_array", ""))
+ else:
+ self.default_str = str(getattr(rna_prop, "default", ""))
+
self.srna = GetInfoStructRNA(rna_prop.srna) # valid for pointer/collections
def __repr__(self):
@@ -125,9 +142,10 @@ class InfoFunctionRNA:
self.return_value = None
def build(self):
- rna_prop = self.bl_prop
+ rna_func = self.bl_func
+ parent_id = rna_func
- for rna_id, rna_prop in rna_type.parameters.items():
+ for rna_id, rna_prop in rna_func.parameters.items():
prop = GetInfoPropertyRNA(rna_prop, parent_id)
if rna_prop.use_return:
self.return_value = prop
@@ -370,6 +388,13 @@ def BuildRNAInfo():
rna_info.build()
for prop in rna_info.properties:
prop.build()
+ for func in rna_info.functions:
+ func.build()
+ for prop in func.args:
+ prop.build()
+ if func.return_value:
+ func.return_value.build()
+
#for rna_info in InfoStructRNA.global_lookup.values():
# print(rna_info)
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c
index 5997867030d..5fd87728fb8 100644
--- a/source/blender/makesrna/intern/rna_rna.c
+++ b/source/blender/makesrna/intern/rna_rna.c
@@ -641,13 +641,18 @@ static EnumPropertyItem *rna_EnumProperty_default_itemf(bContext *C, PointerRNA
rna_idproperty_check(&prop, ptr);
eprop= (EnumPropertyRNA*)prop;
- if(eprop->itemf==NULL || eprop->itemf==rna_EnumProperty_default_itemf || !C)
+ if( (eprop->itemf == NULL) ||
+ (eprop->itemf == rna_EnumProperty_default_itemf) ||
+ (ptr->type == &RNA_EnumProperty) ||
+ (C == NULL))
+ {
return eprop->item;
+ }
return eprop->itemf(C, ptr, free);
}
-/* XXX - not sore this is needed? */
+/* XXX - not sure this is needed? */
static int rna_EnumProperty_default_get(PointerRNA *ptr)
{
PropertyRNA *prop= (PropertyRNA*)ptr->data;