[Bf-extensions-cvs] [ea50681] master: adress all ideasman issues
zeffii
noreply at git.blender.org
Wed Jul 27 16:28:51 CEST 2016
Commit: ea5068182c90443f9b3bcd8f2972a2899e75db57
Author: zeffii
Date: Wed Jul 27 16:25:08 2016 +0200
Branches: master
https://developer.blender.org/rBACea5068182c90443f9b3bcd8f2972a2899e75db57
adress all ideasman issues
===================================================================
M mesh_tiny_cad/BIX.py
M mesh_tiny_cad/CCEN.py
M mesh_tiny_cad/CFG.py
M mesh_tiny_cad/E2F.py
M mesh_tiny_cad/V2X.py
M mesh_tiny_cad/VTX.py
M mesh_tiny_cad/XALL.py
M mesh_tiny_cad/__init__.py
M mesh_tiny_cad/cad_module.py
===================================================================
diff --git a/mesh_tiny_cad/BIX.py b/mesh_tiny_cad/BIX.py
index 7d46625..388667d 100644
--- a/mesh_tiny_cad/BIX.py
+++ b/mesh_tiny_cad/BIX.py
@@ -1,25 +1,26 @@
-# ##### BEGIN GPL LICENSE BLOCK #####
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# ##### END GPL LICENSE BLOCK #####
-
-# <pep8 compliant>
+'''
+BEGIN GPL LICENSE BLOCK
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software Foundation,
+Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+END GPL LICENCE BLOCK
+'''
import bpy
import bmesh
+from mathutils import geometry
from . import cad_module as cm
@@ -79,7 +80,7 @@ def add_line_to_bisection(self):
class TCLineOnBisection(bpy.types.Operator):
-
+ '''Generate the bisector of two selected edges'''
bl_idname = 'tinycad.linetobisect'
bl_label = 'BIX line to bisector'
bl_options = {'REGISTER', 'UNDO'}
diff --git a/mesh_tiny_cad/CCEN.py b/mesh_tiny_cad/CCEN.py
index 584446e..375f541 100644
--- a/mesh_tiny_cad/CCEN.py
+++ b/mesh_tiny_cad/CCEN.py
@@ -1,22 +1,22 @@
-# ##### BEGIN GPL LICENSE BLOCK #####
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# ##### END GPL LICENSE BLOCK #####
-
-# <pep8 compliant>
+'''
+BEGIN GPL LICENSE BLOCK
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software Foundation,
+Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+END GPL LICENCE BLOCK
+'''
import math
@@ -28,6 +28,7 @@ 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)
@@ -68,6 +69,7 @@ def generate_bmesh_repr(p1, v1, axis, num_verts):
def generate_3PT(pts, obj, nv, mode=1):
+ origin = obj.location
mw = obj.matrix_world
V = Vector
@@ -126,7 +128,6 @@ def dispatch(context, mode=0):
''' Operators '''
-
class TCCallBackCCEN(bpy.types.Operator):
bl_idname = 'tinycad.reset_circlescale'
bl_label = 'CCEN circle reset'
@@ -136,8 +137,8 @@ class TCCallBackCCEN(bpy.types.Operator):
context.scene.tinycad_props.rescale = 1
return {'FINISHED'}
-
class TCCircleCenter(bpy.types.Operator):
+ '''Recreate a Circle from 3 selected verts, move 3dcursor its center'''
bl_idname = 'tinycad.circlecenter'
bl_label = 'CCEN circle center from selected'
@@ -153,6 +154,7 @@ 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
@@ -166,6 +168,5 @@ 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 b888fc2..ddd2630 100644
--- a/mesh_tiny_cad/CFG.py
+++ b/mesh_tiny_cad/CFG.py
@@ -1,23 +1,3 @@
-# ##### BEGIN GPL LICENSE BLOCK #####
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# ##### END GPL LICENSE BLOCK #####
-
-# <pep8 compliant>
-
import bpy
import os
@@ -43,10 +23,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,7 +48,6 @@ 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/E2F.py b/mesh_tiny_cad/E2F.py
index 26777a3..1a650d9 100644
--- a/mesh_tiny_cad/E2F.py
+++ b/mesh_tiny_cad/E2F.py
@@ -1,29 +1,33 @@
-# ##### BEGIN GPL LICENSE BLOCK #####
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# ##### END GPL LICENSE BLOCK #####
-
-# <pep8 compliant>
+'''
+BEGIN GPL LICENSE BLOCK
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software Foundation,
+Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+END GPL LICENCE BLOCK
+'''
import bpy
import bmesh
from mathutils.geometry import intersect_line_plane
-def extend_vertex():
+def failure_message(self):
+ self.report({"WARNING"}, 'select 1 face and 1 detached edge')
+
+
+def extend_vertex(self):
obj = bpy.context.edit_object
me = obj.data
@@ -31,7 +35,12 @@ def extend_vertex():
verts = bm.verts
faces = bm.faces
- plane = [f for f in faces if f.select][0]
+ planes = [f for f in faces if f.select]
+ if (len(planes) > 1) or (len(planes) == 0):
+ failure_message(self)
+ return
+
+ plane = planes[0]
plane_vert_indices = [v for v in plane.verts[:]]
all_selected_vert_indices = [v for v in verts if v.select]
@@ -39,6 +48,11 @@ def extend_vertex():
N = set(all_selected_vert_indices)
O = N.difference(M)
O = list(O)
+
+ if not len(O) == 2:
+ failure_message(self)
+ return
+
(v1_ref, v1_idx, v1), (v2_ref, v2_idx, v2) = [(i, i.index, i.co) for i in O]
plane_co = plane.calc_center_median()
@@ -57,7 +71,7 @@ def extend_vertex():
class TCEdgeToFace(bpy.types.Operator):
-
+ '''Extend selected edge towards projected intersection with a selected face'''
bl_idname = 'tinycad.edge_to_face'
bl_label = 'E2F edge to face'
bl_options = {'REGISTER', 'UNDO'}
@@ -68,7 +82,7 @@ class TCEdgeToFace(bpy.types.Operator):
return all([bool(ob), ob.type == 'MESH', ob.mode == 'EDIT'])
def execute(self, context):
- extend_vertex()
+ extend_vertex(self)
return {'FINISHED'}
diff --git a/mesh_tiny_cad/V2X.py b/mesh_tiny_cad/V2X.py
index 14f3d93..f77a0ec 100644
--- a/mesh_tiny_cad/
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list