[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [552] trunk/py/scripts/addons/ add_mesh_3d_function_surface.py: * Updated to version 0.3.2
Martin Buerbaum
martin.buerbaum at gmx.at
Tue Apr 6 12:36:32 CEST 2010
Revision: 552
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-extensions&revision=552
Author: pontiac
Date: 2010-04-06 12:36:32 +0200 (Tue, 06 Apr 2010)
Log Message:
-----------
* Updated to version 0.3.2
* Fixed an error Campbell overlooked (appending tuples to an array, not single values) Thanks for the report wild_doogy.
* Made the script PEP8 compatible again.
Modified Paths:
--------------
trunk/py/scripts/addons/add_mesh_3d_function_surface.py
Modified: trunk/py/scripts/addons/add_mesh_3d_function_surface.py
===================================================================
--- trunk/py/scripts/addons/add_mesh_3d_function_surface.py 2010-04-05 22:06:19 UTC (rev 551)
+++ trunk/py/scripts/addons/add_mesh_3d_function_surface.py 2010-04-06 10:36:32 UTC (rev 552)
@@ -24,7 +24,7 @@
bl_addon_info = {
'name': 'Add Mesh: 3D Function Surfaces',
'author': 'Buerbaum Martin (Pontiac)',
- 'version': '0.3.1',
+ 'version': '0.3.2',
'blender': (2, 5, 3),
'location': 'View3D > Add > Mesh > Z Function Surface &' \
' XYZ Function Surface',
@@ -63,6 +63,15 @@
menu.
Version history:
+v0.3.2 - Various fixes&streamlining by ideasman42/Campbell Barton.
+ r544 Compile expressions for faster execution
+ r544 Use operator reports for errors too
+ r544 Avoid type checks by converting to a float, errors
+ converting to a float are reported too.
+ Fixed an error Campbell overlooked (appending tuples to an
+ array, not single values) Thamnks for the report wild_doogy.
+ Added 'description' field, updated 'url'.
+ Made the script PEP8 compatible again.
v0.3.1 - Use hidden "edit" property for "recall" operator.
Bugfix: Z Function was mixing up div_x and div_y
v0.3 - X,Y,Z Function Surface (by Ed Mackey & tuga3d).
@@ -292,10 +301,14 @@
edgeloop_prev = []
try:
- expr_args = (compile(equation, __file__, 'eval'), {"__builtins__": None}, safe_dict)
+ expr_args = (
+ compile(equation, __file__, 'eval'),
+ {"__builtins__": None},
+ safe_dict)
except:
import traceback
- self.report({'ERROR'}, "Error parsing expression: " + traceback.format_exc(limit=1))
+ self.report({'ERROR'}, "Error parsing expression: "
+ + traceback.format_exc(limit=1))
return {'CANCELLED'}
for row_x in range(div_x):
@@ -314,7 +327,8 @@
z = float(eval(*expr_args))
except:
import traceback
- self.report({'ERROR'}, "Error evaluating expression: " + traceback.format_exc(limit=1))
+ self.report({'ERROR'}, "Error evaluating expression: "
+ + traceback.format_exc(limit=1))
return {'CANCELLED'}
edgeloop_cur.append(len(verts))
@@ -360,14 +374,23 @@
vRange = vRange + 1
try:
- expr_args_x = (compile(x_eq, __file__.replace(".py", "_x.py"), 'eval'), {"__builtins__": None}, safe_dict)
- expr_args_y = (compile(y_eq, __file__.replace(".py", "_y.py"), 'eval'), {"__builtins__": None}, safe_dict)
- expr_args_z = (compile(z_eq, __file__.replace(".py", "_z.py"), 'eval'), {"__builtins__": None}, safe_dict)
+ expr_args_x = (
+ compile(x_eq, __file__.replace(".py", "_x.py"), 'eval'),
+ {"__builtins__": None},
+ safe_dict)
+ expr_args_y = (
+ compile(y_eq, __file__.replace(".py", "_y.py"), 'eval'),
+ {"__builtins__": None},
+ safe_dict)
+ expr_args_z = (
+ compile(z_eq, __file__.replace(".py", "_z.py"), 'eval'),
+ {"__builtins__": None},
+ safe_dict)
except:
import traceback
- self.report({'ERROR'}, "Error parsing expression: " + traceback.format_exc(limit=1))
+ self.report({'ERROR'}, "Error parsing expression: "
+ + traceback.format_exc(limit=1))
return [], []
-
for vN in range(vRange):
v = range_v_min + (vN * vStep)
@@ -380,10 +403,15 @@
# Try to evaluate the equation.
try:
- verts.append(float(eval(*expr_args_x)), float(eval(*expr_args_y)), float(eval(*expr_args_z)))
+ verts.append((
+ float(eval(*expr_args_x)),
+ float(eval(*expr_args_y)),
+ float(eval(*expr_args_z))))
+
except:
import traceback
- self.report({'ERROR'}, "Error evaluating expression: " + traceback.format_exc(limit=1))
+ self.report({'ERROR'}, "Error evaluating expression: "
+ + traceback.format_exc(limit=1))
return [], []
for vN in range(1, range_v_step + 1):
@@ -517,7 +545,6 @@
props.range_v_step,
props.wrap_v)
-
if not verts:
return {'CANCELLED'}
More information about the Bf-extensions-cvs
mailing list