forked from bartvdbraak/blender
py error fix and minor changes to rna info class
This commit is contained in:
parent
8f3a529585
commit
5bdcb2dff2
@ -20,6 +20,13 @@
|
|||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
|
|
||||||
|
def range_str(val):
|
||||||
|
if val < -10000000: return '-inf'
|
||||||
|
if val > 10000000: return 'inf'
|
||||||
|
if type(val)==float:
|
||||||
|
return '%g' % val
|
||||||
|
else:
|
||||||
|
return str(val)
|
||||||
|
|
||||||
class InfoStructRNA:
|
class InfoStructRNA:
|
||||||
global_lookup = {}
|
global_lookup = {}
|
||||||
@ -43,7 +50,7 @@ class InfoStructRNA:
|
|||||||
def build(self):
|
def build(self):
|
||||||
rna_type = self.bl_rna
|
rna_type = self.bl_rna
|
||||||
parent_id = self.identifier
|
parent_id = self.identifier
|
||||||
self.properties[:] = [GetInfoPropertyRNA(rna_prop, parent_id) for rna_prop in rna_type.properties.values()]
|
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()]
|
self.functions[:] = [GetInfoFunctionRNA(rna_prop, parent_id) for rna_prop in rna_type.functions.values()]
|
||||||
|
|
||||||
def getNestedProperties(self, ls = None):
|
def getNestedProperties(self, ls = None):
|
||||||
@ -84,12 +91,20 @@ class InfoPropertyRNA:
|
|||||||
rna_prop = self.bl_prop
|
rna_prop = self.bl_prop
|
||||||
|
|
||||||
self.enum_items = []
|
self.enum_items = []
|
||||||
self.min = -1
|
self.min = getattr(rna_prop, "hard_min", -1)
|
||||||
self.max = -1
|
self.max = getattr(rna_prop, "hard_max", -1)
|
||||||
self.array_length = getattr(rna_prop, "array_length", 0)
|
self.array_length = getattr(rna_prop, "array_length", 0)
|
||||||
|
|
||||||
self.type = rna_prop.type.lower()
|
self.type = rna_prop.type.lower()
|
||||||
self.fixed_type = GetInfoStructRNA(rna_prop.fixed_type) # valid for pointer/collections
|
fixed_type = getattr(rna_prop, "fixed_type", "")
|
||||||
|
if fixed_type:
|
||||||
|
self.fixed_type = GetInfoStructRNA(fixed_type) # valid for pointer/collections
|
||||||
|
else:
|
||||||
|
self.fixed_type = None
|
||||||
|
|
||||||
|
if self.type == "enum":
|
||||||
|
self.enum_items[:] = rna_prop.items.keys()
|
||||||
|
|
||||||
self.srna = GetInfoStructRNA(rna_prop.srna) # valid for pointer/collections
|
self.srna = GetInfoStructRNA(rna_prop.srna) # valid for pointer/collections
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
@ -347,9 +362,11 @@ def BuildRNAInfo():
|
|||||||
|
|
||||||
for rna_info in InfoStructRNA.global_lookup.values():
|
for rna_info in InfoStructRNA.global_lookup.values():
|
||||||
rna_info.build()
|
rna_info.build()
|
||||||
|
for prop in rna_info.properties:
|
||||||
|
prop.build()
|
||||||
|
|
||||||
for rna_info in InfoStructRNA.global_lookup.values():
|
#for rna_info in InfoStructRNA.global_lookup.values():
|
||||||
print(rna_info)
|
# print(rna_info)
|
||||||
|
|
||||||
return InfoStructRNA.global_lookup, InfoFunctionRNA.global_lookup, InfoPropertyRNA.global_lookup
|
return InfoStructRNA.global_lookup, InfoFunctionRNA.global_lookup, InfoPropertyRNA.global_lookup
|
||||||
|
|
||||||
|
@ -87,8 +87,8 @@ class SubdivisionSet(bpy.types.Operator):
|
|||||||
default=1, min=0, max=100, soft_min=0, soft_max=6)
|
default=1, min=0, max=100, soft_min=0, soft_max=6)
|
||||||
|
|
||||||
def poll(self, context):
|
def poll(self, context):
|
||||||
ob = context.active_object
|
obs = context.selected_editable_objects
|
||||||
return (ob and ob.type == 'MESH')
|
return (obs is not None)
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
level = self.properties.level
|
level = self.properties.level
|
||||||
|
Loading…
Reference in New Issue
Block a user