[Bf-extensions-cvs] [8170b12] master: Cleanup: pep8
Campbell Barton
noreply at git.blender.org
Tue Jul 26 06:37:38 CEST 2016
Commit: 8170b126ea042526dcd909972cdc8e373d4d0c02
Author: Campbell Barton
Date: Tue Jul 26 14:37:04 2016 +1000
Branches: master
https://developer.blender.org/rBAC8170b126ea042526dcd909972cdc8e373d4d0c02
Cleanup: pep8
===================================================================
M mesh_tiny_cad/CCEN.py
M mesh_tiny_cad/CFG.py
M mesh_tiny_cad/VTX.py
M mesh_tiny_cad/__init__.py
M mesh_tiny_cad/cad_module.py
===================================================================
diff --git a/mesh_tiny_cad/CCEN.py b/mesh_tiny_cad/CCEN.py
index d383e1f..d8cef3b 100644
--- a/mesh_tiny_cad/CCEN.py
+++ b/mesh_tiny_cad/CCEN.py
@@ -28,7 +28,6 @@ from mathutils import Vector
def generate_bmesh_repr(p1, v1, axis, num_verts):
-
'''
p1: center of circle (local coordinates)
v1: first vertex of circle in (local coordinates)
@@ -128,6 +127,7 @@ def dispatch(context, mode=0):
''' Operators '''
+
class TCCallBackCCEN(bpy.types.Operator):
bl_idname = 'tinycad.reset_circlescale'
bl_label = 'CCEN circle reset'
@@ -137,6 +137,7 @@ class TCCallBackCCEN(bpy.types.Operator):
context.scene.tinycad_props.rescale = 1
return {'FINISHED'}
+
class TCCircleCenter(bpy.types.Operator):
bl_idname = 'tinycad.circlecenter'
@@ -153,7 +154,6 @@ class TCCircleCenter(bpy.types.Operator):
row.prop(scn.tinycad_props, 'rescale', text='rescale')
row.operator('tinycad.reset_circlescale', text="", icon="LINK")
-
@classmethod
def poll(cls, context):
obj = context.edit_object
@@ -167,5 +167,6 @@ class TCCircleCenter(bpy.types.Operator):
def register():
bpy.utils.register_module(__name__)
+
def unregister():
bpy.utils.unregister_module(__name__)
diff --git a/mesh_tiny_cad/CFG.py b/mesh_tiny_cad/CFG.py
index 3ce93e1..b888fc2 100644
--- a/mesh_tiny_cad/CFG.py
+++ b/mesh_tiny_cad/CFG.py
@@ -43,10 +43,10 @@ class VIEW3D_MT_edit_mesh_tinycad(bpy.types.Menu):
def poll(cls, context):
return bool(context.object)
-
def draw(self, context):
pcoll = icon_collection["main"]
+
def cicon(name):
return pcoll[name].icon_id
@@ -68,6 +68,7 @@ def register_icons():
icon_collection["main"] = pcoll
+
def unregister_icons():
for pcoll in icon_collection.values():
bpy.utils.previews.remove(pcoll)
diff --git a/mesh_tiny_cad/VTX.py b/mesh_tiny_cad/VTX.py
index 35a728f..37a20ad 100644
--- a/mesh_tiny_cad/VTX.py
+++ b/mesh_tiny_cad/VTX.py
@@ -30,6 +30,7 @@ messages = {
'NON_PLANAR_EDGES': 'Non Planar Edges, no clean intersection point'
}
+
def add_edges(bm, pt, idxs, fdp):
'''
this function is a disaster --
@@ -64,10 +65,12 @@ def add_edges(bm, pt, idxs, fdp):
print(sys.exc_info()[-1].tb_frame.f_code)
print('Error on line {}'.format(sys.exc_info()[-1].tb_lineno))
+
def remove_earmarked_edges(bm, earmarked):
edges_select = [e for e in bm.edges if e.index in earmarked]
bmesh.ops.delete(bm, geom=edges_select, context=2)
+
def perform_vtx(bm, pt, edges, pts, vertex_indices):
idx1, idx2 = edges[0].index, edges[1].index
fdp = pt, edges, pts, vertex_indices
diff --git a/mesh_tiny_cad/__init__.py b/mesh_tiny_cad/__init__.py
index cd1de2d..84efbcf 100644
--- a/mesh_tiny_cad/__init__.py
+++ b/mesh_tiny_cad/__init__.py
@@ -37,7 +37,7 @@ if "bpy" in locals():
import importlib
try:
- modules = [CFG, VTX, V2X, XALL, BIX, CCEN, E2F]
+ modules = (CFG, VTX, V2X, XALL, BIX, CCEN, E2F)
for m in modules:
importlib.reload(m)
print("tinyCAD: reloaded modules, all systems operational")
@@ -61,11 +61,13 @@ def menu_func(self, context):
self.layout.separator()
-
def register():
register_icons()
bpy.utils.register_module(__name__)
- bpy.types.Scene.tinycad_props = bpy.props.PointerProperty(name="TinyCAD props", type=TinyCADProperties)
+ bpy.types.Scene.tinycad_props = bpy.props.PointerProperty(
+ name="TinyCAD props",
+ type=TinyCADProperties,
+ )
bpy.types.VIEW3D_MT_edit_mesh_specials.prepend(menu_func)
diff --git a/mesh_tiny_cad/cad_module.py b/mesh_tiny_cad/cad_module.py
index 18ff361..0ebeb82 100644
--- a/mesh_tiny_cad/cad_module.py
+++ b/mesh_tiny_cad/cad_module.py
@@ -38,7 +38,7 @@ def point_on_edge(p, edge):
< returns: True / False if a point happens to lie on an edge
'''
pt, _percent = PtLineIntersect(p, *edge)
- on_line = (pt-p).length < CAD_prefs.VTX_PRECISION
+ on_line = (pt - p).length < CAD_prefs.VTX_PRECISION
return on_line and (0.0 <= _percent <= 1.0)
@@ -70,7 +70,7 @@ def get_intersection_from_idxs(bm, idx1, ixd2):
p1, p2 = coords_tuple_from_edge_idx(bm, idx1)
p3, p4 = coords_tuple_from_edge_idx(bm, idx2)
a, b = LineIntersect(p1, p2, p3, p4)
- if (a-b).length < CAD_prefs.VTX_PRECISION:
+ if (a - b).length < CAD_prefs.VTX_PRECISION:
return a
@@ -83,7 +83,7 @@ def test_coplanar(edge1, edge2):
'''
line = line_from_edge_intersect(edge1, edge2)
if line:
- return (line[0]-line[1]).length < CAD_prefs.VTX_PRECISION
+ return (line[0] - line[1]).length < CAD_prefs.VTX_PRECISION
def closest_idx(pt, e):
@@ -140,6 +140,7 @@ def vertex_indices_from_edges_tuple(bm, edge_tuple):
k = lambda v, w: bm.edges[edge_tuple[v]].verts[w].index
return [k(i >> 1, i % 2) for i in range(4)]
+
def get_vert_indices_from_bmedges(edges):
'''
> bmedges: a list of two bm edges
@@ -152,6 +153,7 @@ def get_vert_indices_from_bmedges(edges):
temp_edges.append(v.index)
return temp_edges
+
def num_edges_point_lies_on(pt, edges):
''' returns the number of edges that a point lies on. '''
res = [point_on_edge(pt, edge) for edge in [edges[:2], edges[2:]]]
More information about the Bf-extensions-cvs
mailing list