Skip to content
Snippets Groups Projects
Commit 58928e9b authored by Martin Buerbaum's avatar Martin Buerbaum
Browse files

* Version 0.1.4

* Recall data is now stored as ob['recall'] = {'op': op_idname, 'args': op_args}
parent 22358f56
No related branches found
No related tags found
No related merge requests found
...@@ -27,7 +27,9 @@ bl_addon_info = { ...@@ -27,7 +27,9 @@ bl_addon_info = {
'version': '0.1.3', 'version': '0.1.3',
'blender': (2, 5, 3), 'blender': (2, 5, 3),
'location': 'View3D > Tool Shelf > Edit Object Parameters', 'location': 'View3D > Tool Shelf > Edit Object Parameters',
'description': 're-call an object menu that was created with a Add Mesh operator', 'description': 'Re-call an object menu that was created' \
' with an Add Mesh operator. This operator must have stored'\
' the recall data though.',
'url': 'http://wiki.blender.org/index.php/Extensions:2.5/Py/' \ 'url': 'http://wiki.blender.org/index.php/Extensions:2.5/Py/' \
'Scripts/3D_interaction/Edit_Object_Parameters', 'Scripts/3D_interaction/Edit_Object_Parameters',
'category': '3D View'} 'category': '3D View'}
...@@ -125,11 +127,12 @@ class VIEW3D_OT_recall_object_operator(bpy.types.Operator): ...@@ -125,11 +127,12 @@ class VIEW3D_OT_recall_object_operator(bpy.types.Operator):
and ob.items()): and ob.items()):
if 'recall' in ob: if 'recall' in ob:
r = ob['recall'].convert_to_pyobject() recall_props = ob['recall'].convert_to_pyobject()
# Check if an operator string was defined. # Check if an operator string was defined.
if "recall_op" in r: if 'op' in recall_props:
op_idname = r["recall_op"] op_idname = recall_props['op']
op_args = recall_props['args']
print("Recalling operator: " + op_idname) print("Recalling operator: " + op_idname)
...@@ -137,10 +140,7 @@ class VIEW3D_OT_recall_object_operator(bpy.types.Operator): ...@@ -137,10 +140,7 @@ class VIEW3D_OT_recall_object_operator(bpy.types.Operator):
op = get_operator_by_idname(op_idname) op = get_operator_by_idname(op_idname)
if op: if op:
# Prepare the stored data as arguments for the op. # Prepare the stored data as arguments for the op.
args = dict([(k[0], k[1]) for k in r.items()]) args = dict([(k[0], k[1]) for k in op_args.items()])
# We need to remove the "recall_op" string.
del args["recall_op"]
# Execute the operator with the unpacked parameters. # Execute the operator with the unpacked parameters.
op(**args) op(**args)
...@@ -150,7 +150,7 @@ class VIEW3D_OT_recall_object_operator(bpy.types.Operator): ...@@ -150,7 +150,7 @@ class VIEW3D_OT_recall_object_operator(bpy.types.Operator):
return {'CANCELLED'} return {'CANCELLED'}
else: else:
print("No operator found in recall data!") print("No operator prop found in recall data!")
return {'CANCELLED'} return {'CANCELLED'}
else: else:
...@@ -197,35 +197,35 @@ class VIEW3D_OT_edit_object_parameters(bpy.types.Panel): ...@@ -197,35 +197,35 @@ class VIEW3D_OT_edit_object_parameters(bpy.types.Panel):
scene = context.scene scene = context.scene
ob = scene.objects.active ob = scene.objects.active
r = ob['recall'] if ob:
row = layout.row()
row = layout.row()
if "recall_op" in r:
op_idname = r["recall_op"]
# Find and recall operator
type = get_operator_class_by_idname(op_idname)
if type: recall_props = ob['recall']
row.label(text="Operator:") if 'op' in recall_props:
op_idname = recall_props['op']
op_args = recall_props['args']
box = layout.column().box() # Find and recall operator
column = box.column() type = get_operator_class_by_idname(op_idname)
row = column.row()
row.label(text=type.bl_label) if type:
row.label(text="Operator:")
if len(r) > 1:
row = layout.row()
row.label(text="Properties:")
box = layout.column().box() box = layout.column().box()
column = box.column() column = box.column()
row = column.row() row = column.row()
for prop_name in r: row.label(text=type.bl_label)
if prop_name != "recall_op":
if op_args:
row = layout.row()
row.label(text="Properties:")
box = layout.column().box()
column = box.column()
row = column.row()
for prop_name, prop_val in op_args.items():
row = column.row() row = column.row()
name = prop_name name = prop_name
if hasattr(type, prop_name): if hasattr(type, prop_name):
...@@ -235,14 +235,15 @@ class VIEW3D_OT_edit_object_parameters(bpy.types.Panel): ...@@ -235,14 +235,15 @@ class VIEW3D_OT_edit_object_parameters(bpy.types.Panel):
name = prop_full_name name = prop_full_name
row.label(text=name) row.label(text=name)
row.label(text=str(r[prop_name])) row.label(text=str(prop_val))
else:
row.label(text="Could not find operator "
+ op_idname + "!",
icon='ERROR')
else: else:
row.label(text="Could not find operator " + op_idname + "!", row.label(text="Could not find operatorID in object.",
icon='ERROR') icon='ERROR')
else:
row.label(text="Could not find operator info.",
icon='ERROR')
################################ ################################
......
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