Skip to content
Snippets Groups Projects
Commit 556c218a authored by Doug Hammond's avatar Doug Hammond
Browse files

extensions_framework: update property creation code to support new property types and their options

parent 879788ca
No related branches found
No related tags found
No related merge requests found
...@@ -68,43 +68,54 @@ def init_properties(obj, props, cache=True): ...@@ -68,43 +68,54 @@ def init_properties(obj, props, cache=True):
if prop['type'] == 'bool': if prop['type'] == 'bool':
t = bpy.props.BoolProperty t = bpy.props.BoolProperty
a = {k: v for k,v in prop.items() if k in ['name', a = {k: v for k,v in prop.items() if k in ["name",
'description','default']} "description","default","options","subtype","update"]}
elif prop['type'] == 'bool_vector':
t = bpy.props.BoolVectorProperty
a = {k: v for k,v in prop.items() if k in ["name",
"description","default","options","subtype","size",
"update"]}
elif prop['type'] == 'collection': elif prop['type'] == 'collection':
t = bpy.props.CollectionProperty t = bpy.props.CollectionProperty
a = {k: v for k,v in prop.items() if k in ["ptype", "name", a = {k: v for k,v in prop.items() if k in ["ptype","name",
"description"]} "description","default","options"]}
a['type'] = a['ptype'] a['type'] = a['ptype']
del a['ptype'] del a['ptype']
elif prop['type'] == 'enum': elif prop['type'] == 'enum':
t = bpy.props.EnumProperty t = bpy.props.EnumProperty
a = {k: v for k,v in prop.items() if k in ["items", "name", a = {k: v for k,v in prop.items() if k in ["items","name",
"description", "default"]} "description","default","options","update"]}
elif prop['type'] == 'float': elif prop['type'] == 'float':
t = bpy.props.FloatProperty t = bpy.props.FloatProperty
a = {k: v for k,v in prop.items() if k in ["name", a = {k: v for k,v in prop.items() if k in ["name",
"description", "min", "max", "soft_min", "soft_max", "description","default","min","max","soft_min","soft_max",
"default", "precision"]} "step","precision","options","subtype","unit","update"]}
elif prop['type'] == 'float_vector': elif prop['type'] == 'float_vector':
t = bpy.props.FloatVectorProperty t = bpy.props.FloatVectorProperty
a = {k: v for k,v in prop.items() if k in ["name", a = {k: v for k,v in prop.items() if k in ["name",
"description", "min", "max", "soft_min", "soft_max", "description","default","min","max","soft_min","soft_max",
"default", "precision", "size", "subtype"]} "step","precision","options","subtype","size","update"]}
elif prop['type'] == 'int': elif prop['type'] == 'int':
t = bpy.props.IntProperty t = bpy.props.IntProperty
a = {k: v for k,v in prop.items() if k in ["name", a = {k: v for k,v in prop.items() if k in ["name",
"description", "min", "max", "soft_min", "soft_max", "description","default","min","max","soft_min","soft_max",
"default"]} "step","options","subtype","update"]}
elif prop['type'] == 'int_vector':
t = bpy.props.IntVectorProperty
a = {k: v for k,v in prop.items() if k in ["name",
"description","default","min","max","soft_min","soft_max",
"options","subtype","size","update"]}
elif prop['type'] == 'pointer': elif prop['type'] == 'pointer':
t = bpy.props.PointerProperty t = bpy.props.PointerProperty
a = {k: v for k,v in prop.items() if k in ["ptype", "name", a = {k: v for k,v in prop.items() if k in ["ptype", "name",
"description"]} "description","options","update"]}
a['type'] = a['ptype'] a['type'] = a['ptype']
del a['ptype'] del a['ptype']
elif prop['type'] == 'string': elif prop['type'] == 'string':
t = bpy.props.StringProperty t = bpy.props.StringProperty
a = {k: v for k,v in prop.items() if k in ["name", a = {k: v for k,v in prop.items() if k in ["name",
"description", "maxlen", "default", "subtype"]} "description","default","maxlen","options","subtype",
"update"]}
else: else:
continue continue
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment