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:
authormano-wii <germano.costa@ig.com.br>2018-10-30 06:11:22 +0300
committermano-wii <germano.costa@ig.com.br>2018-10-30 06:11:22 +0300
commit7fb1a1ca26c519d12ffb3973f68fa50f306d7456 (patch)
tree1361e10460c179f353f2b85059b8446aaa6940c9 /mesh_snap_utilities_line/__init__.py
parent747c0a3731f10972eb373a119171d75a35b95b7c (diff)
Addon Snap Utilities Line: Update to work in blender2.8
Changes: - The operator follows the same style of the tools in the toolbar; - Now a new "Make Line" tool appears next to "Add Cube"; - The operator only works in edit mode; - The "create new object" option has been removed;
Diffstat (limited to 'mesh_snap_utilities_line/__init__.py')
-rw-r--r--mesh_snap_utilities_line/__init__.py103
1 files changed, 103 insertions, 0 deletions
diff --git a/mesh_snap_utilities_line/__init__.py b/mesh_snap_utilities_line/__init__.py
new file mode 100644
index 00000000..390cbcd0
--- /dev/null
+++ b/mesh_snap_utilities_line/__init__.py
@@ -0,0 +1,103 @@
+### 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 3
+# 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, see <http://www.gnu.org/licenses/>.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# Contact for more information about the Addon:
+# Email: germano.costa@ig.com.br
+# Twitter: wii_mano @mano_wii
+
+bl_info = {
+ "name": "Snap_Utilities_Line",
+ "author": "Germano Cavalcante",
+ "version": (5, 8, 22),
+ "blender": (2, 80, 0),
+ "location": "View3D > TOOLS > Snap Utilities > snap utilities",
+ "description": "Extends Blender Snap controls",
+ "wiki_url" : "http://blenderartists.org/forum/showthread.php?363859-Addon-CAD-Snap-Utilities",
+ "category": "Mesh"}
+
+if "bpy" in locals():
+ import importlib
+ importlib.reload(preferences)
+ importlib.reload(ops_line)
+else:
+ from . import preferences
+ from . import ops_line
+
+import bpy
+from bpy.utils.toolsystem import ToolDef
+
+@ToolDef.from_fn
+def tool_make_line():
+ import os
+ def draw_settings(context, layout, tool):
+ addon_prefs = context.user_preferences.addons["mesh_snap_utilities_line"].preferences
+
+ layout.prop(addon_prefs, "incremental")
+ layout.prop(addon_prefs, "increments_grid")
+ if addon_prefs.increments_grid:
+ layout.prop(addon_prefs, "relative_scale")
+ layout.prop(addon_prefs, "create_face")
+ layout.prop(addon_prefs, "outer_verts")
+ #props = tool.operator_properties("mesh.snap_utilities_line")
+ #layout.prop(props, "radius")
+
+ icons_dir = os.path.join(os.path.dirname(__file__), "icons")
+
+ return dict(
+ text="Make Line",
+ description=(
+ "Make Lines\n"
+ "Connect them to split faces"
+ ),
+ icon=os.path.join(icons_dir, "ops.mesh.make_line"),
+ widget=None,
+ operator="mesh.make_line",
+ keymap=(
+ ("mesh.make_line", None, dict(type='ACTIONMOUSE', value='PRESS')),
+ ),
+ draw_settings=draw_settings,
+ )
+
+
+def get_tool_list(space_type, context_mode):
+ from bl_ui.space_toolsystem_common import ToolSelectPanelHelper
+ cls = ToolSelectPanelHelper._tool_class_from_space_type(space_type)
+ return cls._tools[context_mode]
+
+def register():
+ bpy.utils.register_class(preferences.SnapUtilitiesLinePreferences)
+ bpy.utils.register_class(ops_line.SnapUtilitiesLine)
+
+ bpy.utils.register_tool('VIEW_3D', 'EDIT_MESH', tool_make_line)
+
+ # Move tool to after 'Add Cube'
+ tools = get_tool_list('VIEW_3D', 'EDIT_MESH')
+ for index, tool in enumerate(tools):
+ if isinstance(tool, ToolDef) and tool.text == "Add Cube":
+ break
+ tools.insert(index + 1, tools.pop(-1))
+
+def unregister():
+ bpy.utils.unregister_tool('VIEW_3D', 'EDIT_MESH', tool_make_line)
+
+ bpy.utils.unregister_class(ops_line.SnapUtilitiesLine)
+ bpy.utils.unregister_class(preferences.SnapUtilitiesLinePreferences)
+
+if __name__ == "__main__":
+ __name__ = "mesh_snap_utilities_line"
+ __package__ = "mesh_snap_utilities_line"
+ register()