Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeffii <tetha.z@gmail.com>2016-08-01 00:23:44 +0300
committerzeffii <tetha.z@gmail.com>2016-08-01 00:23:44 +0300
commit3ce78656947b1b03125f5ca588a50878dc1a0e2a (patch)
treeb3521b7606997ed1c33e8bd84e81d748f7ef00c4 /mesh_tiny_cad/CFG.py
parent96a957faf31e15ed4922b9cb544fd154b01dee5e (diff)
move to release
Diffstat (limited to 'mesh_tiny_cad/CFG.py')
-rw-r--r--mesh_tiny_cad/CFG.py84
1 files changed, 84 insertions, 0 deletions
diff --git a/mesh_tiny_cad/CFG.py b/mesh_tiny_cad/CFG.py
new file mode 100644
index 00000000..ed703a2f
--- /dev/null
+++ b/mesh_tiny_cad/CFG.py
@@ -0,0 +1,84 @@
+# ##### 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 os
+import bpy
+
+ICONS = 'BIX CCEN V2X VTX XALL E2F'.split(' ')
+icon_collection = {}
+
+
+class TinyCADProperties(bpy.types.PropertyGroup):
+
+ num_verts = bpy.props.IntProperty(
+ min=3, max=60, default=12)
+
+ rescale = bpy.props.FloatProperty(
+ default=1.0,
+ precision=4,
+ min=0.0001)
+
+
+class VIEW3D_MT_edit_mesh_tinycad(bpy.types.Menu):
+ bl_label = "TinyCAD"
+
+ @classmethod
+ def poll(cls, context):
+ return bool(context.object)
+
+ def draw(self, context):
+
+ pcoll = icon_collection["main"]
+
+ def cicon(name):
+ return pcoll[name].icon_id
+
+ op = self.layout.operator
+ op('tinycad.autovtx', text='VTX | AUTO', icon_value=cicon('VTX'))
+ op('tinycad.vertintersect', text='V2X | Vertex at intersection', icon_value=cicon('V2X'))
+ op('tinycad.intersectall', text='XALL | Intersect selected edges', icon_value=cicon('XALL'))
+ op('tinycad.linetobisect', text='BIX | Bisector of 2 planar edges', icon_value=cicon('BIX'))
+ op('tinycad.circlecenter', text='CCEN | Resurrect circle center', icon_value=cicon('CCEN'))
+ op('tinycad.edge_to_face', text='E2F | Extend Edge to Face', icon_value=cicon('E2F'))
+
+
+def register_icons():
+ import bpy.utils.previews
+ pcoll = bpy.utils.previews.new()
+ icons_dir = os.path.join(os.path.dirname(__file__), "icons")
+ for icon_name in ICONS:
+ pcoll.load(icon_name, os.path.join(icons_dir, icon_name + '.png'), 'IMAGE')
+
+ icon_collection["main"] = pcoll
+
+
+def unregister_icons():
+ for pcoll in icon_collection.values():
+ bpy.utils.previews.remove(pcoll)
+ icon_collection.clear()
+
+
+def register():
+ bpy.utils.register_module(__name__)
+
+
+def unregister():
+ bpy.utils.unregister_module(__name__)