[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [1802] contrib/py/scripts/addons/ gpencil_retopo: pedantic pep8 & style commits
Campbell Barton
ideasman42 at gmail.com
Sat Apr 9 14:02:46 CEST 2011
Revision: 1802
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=1802
Author: campbellbarton
Date: 2011-04-09 12:02:45 +0000 (Sat, 09 Apr 2011)
Log Message:
-----------
pedantic pep8 & style commits
Modified Paths:
--------------
contrib/py/scripts/addons/gpencil_retopo/__init__.py
contrib/py/scripts/addons/gpencil_retopo/retopo.py
Modified: contrib/py/scripts/addons/gpencil_retopo/__init__.py
===================================================================
--- contrib/py/scripts/addons/gpencil_retopo/__init__.py 2011-04-09 11:53:10 UTC (rev 1801)
+++ contrib/py/scripts/addons/gpencil_retopo/__init__.py 2011-04-09 12:02:45 UTC (rev 1802)
@@ -20,39 +20,40 @@
bl_info = {
- 'name': "Grease Pencil Retopology",
- 'author': "Campbell Barton, Bart Crouch",
- 'version': (1, 0, 0),
- 'blender': (2, 5, 7),
- 'api': 36007,
- 'location': "View3D > Properties > Grease Pencil",
- 'warning': "",
- 'description': "Use Grease Pencil to retopologise a mesh.",
- 'wiki_url': "",
- 'tracker_url': "",
- 'category': 'Mesh'}
+ "name": "Grease Pencil Retopology",
+ "author": "Campbell Barton, Bart Crouch",
+ "version": (1, 0, 0),
+ "blender": (2, 5, 7),
+ "api": 36007,
+ "location": "View3D > Properties > Grease Pencil",
+ "warning": "",
+ "description": "Use Grease Pencil to retopologise a mesh.",
+ "wiki_url": "",
+ "tracker_url": "",
+ "category": "Mesh"}
import bpy
+
# retopo operator
class Retopo(bpy.types.Operator):
- bl_idname = 'mesh.gp_retopo'
+ bl_idname = "mesh.gp_retopo"
bl_label = "Retopo"
bl_description = "Convert Grease Pencil drawings to a mesh"
bl_options = {'REGISTER', 'UNDO'}
-
+
precision = bpy.props.IntProperty(name="Precision",
- description="Lower values result in more removed doubles and "\
- "smoother less precise results",
+ description="Lower values result in more removed doubles and "
+ "smoother less precise results",
default=15,
min=2,
- soft_max = 100)
-
+ soft_max=100)
+
@classmethod
def poll(cls, context):
return context.object
-
+
def execute(self, context):
from . import retopo
scene, gp = retopo.initialise(context)
@@ -61,16 +62,16 @@
return {'CANCELLED'}
obj_new = retopo.calculate(gp, self.precision)
-
+
bpy.ops.object.select_all(action='DESELECT')
scene.objects.active = obj_new
obj_new.select = True
-
+
# nasty, recalc normals
bpy.ops.object.mode_set(mode='EDIT', toggle=False)
bpy.ops.mesh.normals_make_consistent(inside=False)
bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
-
+
return {'FINISHED'}
Modified: contrib/py/scripts/addons/gpencil_retopo/retopo.py
===================================================================
--- contrib/py/scripts/addons/gpencil_retopo/retopo.py 2011-04-09 11:53:10 UTC (rev 1801)
+++ contrib/py/scripts/addons/gpencil_retopo/retopo.py 2011-04-09 12:02:45 UTC (rev 1802)
@@ -33,7 +33,7 @@
gp = obj.grease_pencil
if not gp:
gp = scene.grease_pencil
-
+
if gp:
bpy.ops.object.mode_set(mode='OBJECT')
@@ -300,11 +300,11 @@
xsect = intersect_line_line(pt_a, pt_a_prev, pt_b, pt_b_prev)
if xsect is not None:
if (xsect[0] - xsect[1]).length <= EPS_SPLINE:
- f = intersect_point_line (xsect[1], pt_a, pt_a_prev)[1]
+ f = intersect_point_line(xsect[1], pt_a, pt_a_prev)[1]
# if f >= 0.0-EPS_SPLINE and f <= 1.0+EPS_SPLINE:
# for some reason doesnt work so well, same below
if f >= 0.0 and f <= 1.0:
- f = intersect_point_line (xsect[0], pt_b, pt_b_prev)[1]
+ f = intersect_point_line(xsect[0], pt_b, pt_b_prev)[1]
# if f >= 0.0-EPS_SPLINE and f <= 1.0+EPS_SPLINE:
if f >= 0.0 and f <= 1.0:
# This wont happen often
@@ -351,8 +351,8 @@
v1 = p1a - p1b
v2 = p2b - p2a
-
- if v1.angle(v2, ANG_LIMIT+1) > ANG_LIMIT:
+
+ if v1.angle(v2, ANG_LIMIT) >= ANG_LIMIT:
return False
# print("joining!")
@@ -481,10 +481,10 @@
mesh = bpy.data.meshes.new("Retopo")
mesh.from_pydata(verts, [], faces)
-
+
scene = bpy.context.scene
mesh.update()
obj_new = bpy.data.objects.new(name="Retopo", object_data=mesh)
scene.objects.link(obj_new)
-
+
return obj_new
More information about the Bf-extensions-cvs
mailing list