[Bf-extensions-cvs] [e7594d45] master: Add Clockmender's Precision Drawing Tools v1.1.5
Rune Morling
noreply at git.blender.org
Mon Dec 9 00:52:45 CET 2019
Commit: e7594d45b1dd3d38a795bcafd9c0221ce7922a8d
Author: Rune Morling
Date: Mon Dec 9 00:52:27 2019 +0100
Branches: master
https://developer.blender.org/rBAe7594d45b1dd3d38a795bcafd9c0221ce7922a8d
Add Clockmender's Precision Drawing Tools v1.1.5
Accepted for inclusion per T70238
===================================================================
A precision_drawing_tools/__init__.py
A precision_drawing_tools/pdt_bix.py
A precision_drawing_tools/pdt_cad_module.py
A precision_drawing_tools/pdt_command.py
A precision_drawing_tools/pdt_design.py
A precision_drawing_tools/pdt_etof.py
A precision_drawing_tools/pdt_functions.py
A precision_drawing_tools/pdt_library.py
A precision_drawing_tools/pdt_menus.py
A precision_drawing_tools/pdt_msg_strings.py
A precision_drawing_tools/pdt_pivot_point.py
A precision_drawing_tools/pdt_view.py
A precision_drawing_tools/pdt_xall.py
===================================================================
diff --git a/precision_drawing_tools/__init__.py b/precision_drawing_tools/__init__.py
new file mode 100644
index 00000000..b3c3024d
--- /dev/null
+++ b/precision_drawing_tools/__init__.py
@@ -0,0 +1,539 @@
+# ##### 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>
+#
+# -----------------------------------------------------------------------
+# Author: Alan Odom (Clockmender), Rune Morling (ermo) Copyright (c) 2019
+# -----------------------------------------------------------------------
+#
+# ----------------------------------------------
+# Define Addon info
+# ----------------------------------------------
+#
+bl_info = {
+ "name": "Precision Drawing Tools (PDT)",
+ "author": "Alan Odom (Clockmender), Rune Morling (ermo)",
+ "version": (1, 1, 5),
+ "blender": (2, 80, 0),
+ "location": "View3D > UI > PDT",
+ "description": "Precision Drawing Tools for Acccurate Modelling",
+ "warning": "",
+ "wiki_url": "https://github.com/Clockmender/Precision-Drawing-Tools/wiki",
+ "category": "3D View",
+}
+
+
+# ----------------------------------------------
+# Import modules
+# ----------------------------------------------
+if "bpy" in locals():
+ import importlib
+
+ importlib.reload(pdt_design)
+ importlib.reload(pdt_pivot_point)
+ importlib.reload(pdt_menus)
+ importlib.reload(pdt_library)
+ importlib.reload(pdt_view)
+ importlib.reload(pdt_xall)
+ importlib.reload(pdt_bix)
+ importlib.reload(pdt_etof)
+else:
+ from . import pdt_design
+ from . import pdt_pivot_point
+ from . import pdt_menus
+ from . import pdt_library
+ from . import pdt_view
+ from . import pdt_xall
+ from . import pdt_bix
+ from . import pdt_etof
+
+import bpy
+import os
+from pathlib import Path
+from bpy.types import AddonPreferences, PropertyGroup, Scene, WindowManager
+from bpy.props import (
+ BoolProperty,
+ CollectionProperty,
+ EnumProperty,
+ FloatProperty,
+ FloatVectorProperty,
+ IntProperty,
+ PointerProperty,
+ StringProperty,
+)
+from .pdt_msg_strings import (
+ PDT_DES_COORDS,
+ PDT_DES_FILLETPROF,
+ PDT_DES_FILLETRAD,
+ PDT_DES_FILLETSEG,
+ PDT_DES_FILLETVERTS,
+ PDT_DES_FLIPANG,
+ PDT_DES_FLIPPER,
+ PDT_DES_LIBCOLS,
+ PDT_DES_LIBMATS,
+ PDT_DES_LIBMODE,
+ PDT_DES_LIBOBS,
+ PDT_DES_LIBSER,
+ PDT_DES_MOVESEL,
+ PDT_DES_OBORDER,
+ PDT_DES_OFFANG,
+ PDT_DES_OFFDIS,
+ PDT_DES_OFFPER,
+ PDT_DES_OPMODE,
+ PDT_DES_PIVOTDIS,
+ PDT_DES_PPLOC,
+ PDT_DES_PPSCALEFAC,
+ PDT_DES_PPSIZE,
+ PDT_DES_PPTRANS,
+ PDT_DES_PPWIDTH,
+ PDT_DES_ROTMOVAX,
+ PDT_DES_TRIM,
+ PDT_DES_VALIDLET,
+ PDT_DES_WORPLANE
+)
+from .pdt_command import command_run
+from .pdt_functions import scale_set
+
+
+# Declare enum items variables
+#
+_pdt_obj_items = []
+_pdt_col_items = []
+_pdt_mat_items = []
+
+
+def enumlist_objects(self, context):
+ """Populate Objects List from Parts Library.
+
+ Creates list of objects that optionally have search string contained in them
+ to populate variable pdt_lib_objects enumerator.
+
+ Args:
+ context: Blender bpy.context instance.
+
+ Returns:
+ list of Object Names.
+ """
+
+ scene = context.scene
+ pg = scene.pdt_pg
+ file_path = context.preferences.addons[__package__].preferences.pdt_library_path
+ path = Path(file_path)
+ _pdt_obj_items.clear()
+
+ if path.is_file() and ".blend" in str(path):
+ with bpy.data.libraries.load(str(path)) as (data_from, _):
+ if len(pg.object_search_string) == 0:
+ object_names = [ob for ob in data_from.objects]
+ else:
+ object_names = [ob for ob in data_from.objects if pg.object_search_string in ob]
+ for object_name in object_names:
+ _pdt_obj_items.append((object_name, object_name, ""))
+ else:
+ _pdt_obj_items.append(("MISSING", "Library is Missing", ""))
+ return _pdt_obj_items
+
+
+def enumlist_collections(self, context):
+ """Populate Collections List from Parts Library.
+
+ Creates list of collections that optionally have search string contained in them
+ to populate variable pg.lib_collections enumerator
+
+ Args:
+ context: Blender bpy.context instance.
+
+ Returns:
+ list of Collections Names.
+ """
+
+ scene = context.scene
+ pg = scene.pdt_pg
+ file_path = context.preferences.addons[__package__].preferences.pdt_library_path
+ path = Path(file_path)
+ _pdt_col_items.clear()
+
+ if path.is_file() and ".blend" in str(path):
+ with bpy.data.libraries.load(str(path)) as (data_from, _):
+ if len(pg.collection_search_string) == 0:
+ object_names = [ob for ob in data_from.collections]
+ else:
+ object_names = [ob for ob in data_from.collections if pg.collection_search_string in ob]
+ for object_name in object_names:
+ _pdt_col_items.append((object_name, object_name, ""))
+ else:
+ _pdt_col_items.append(("MISSING", "Library is Missing", ""))
+ return _pdt_col_items
+
+
+def enumlist_materials(self, context):
+ """Populate Materials List from Parts Library.
+
+ Creates list of materials that optionally have search string contained in them
+ to populate variable pg.lib_materials enumerator.
+
+ Args:
+ context: Blender bpy.context instance.
+
+ Returns:
+ list of Object Names.
+ """
+
+ scene = context.scene
+ pg = scene.pdt_pg
+ file_path = context.preferences.addons[__package__].preferences.pdt_library_path
+ path = Path(file_path)
+ _pdt_mat_items.clear()
+
+ if path.is_file() and ".blend" in str(path):
+ with bpy.data.libraries.load(str(path)) as (data_from, _):
+ if len(pg.material_search_string) == 0:
+ object_names = [ob for ob in data_from.materials]
+ else:
+ object_names = [ob for ob in data_from.materials if pg.material_search_string in ob]
+ for object_name in object_names:
+ _pdt_mat_items.append((object_name, object_name, ""))
+ else:
+ _pdt_mat_items.append(("MISSING", "Library is Missing", ""))
+ return _pdt_mat_items
+
+
+class PDTSceneProperties(PropertyGroup):
+ """Contains all PDT related properties."""
+
+ object_search_string : StringProperty(
+ name="Search", default="", description=PDT_DES_LIBSER
+ )
+ collection_search_string : StringProperty(
+ name="Search", default="", description=PDT_DES_LIBSER
+ )
+ material_search_string : StringProperty(
+ name="Search", default="", description=PDT_DES_LIBSER
+ )
+
+ cartesian_coords : FloatVectorProperty(
+ name="Coords",
+ default=(0.0, 0.0, 0.0),
+ subtype="XYZ",
+ description=PDT_DES_COORDS
+ )
+ distance : FloatProperty(
+ name="Distance", default=0.0, precision=5, description=PDT_DES_OFFDIS, unit="LENGTH"
+ )
+ angle : FloatProperty(
+ name="Angle", min=-180, max=180, default=0.0, precision=5, description=PDT_DES_OFFANG
+ )
+ percent : FloatProperty(
+ name="Percent", default=0.0, precision=5, description=PDT_DES_OFFPER
+ )
+ plane : EnumProperty(
+ items=(
+ ("XZ", "Front(X-Z)", "Use X-Z Plane"),
+ ("XY", "Top(X-Y)", "Use X-Y Plane"),
+ ("YZ", "Right(Y-Z)", "Use Y-Z Plane"),
+ ("LO", "View", "Use View Plane"),
+ ),
+ name="Working Plane",
+ default="XZ",
+ description=PDT_DES_WORPLANE,
+ )
+ select : EnumProperty(
+ items=(
+ ("REL", "Current", "Moved Relative to Current Position"),
+ (
+ "SEL",
+ "Selected",
+ "Moved Relative to Selected Object, or Vertex, Cursor & Pivot Only",
+ ),
+ ),
+ name="Move Mode",
+ default="SEL",
+ description=PDT_DES_MOVESEL,
+ )
+ operation : EnumProperty(
+ items=(
+ ("CU", "Cursor", "This Function will Move the Cursor"),
+ ("PP", "Pivot", "This Function will Move the Pivot Point"),
+ ("MV", "Move", "This function will Move Vertices, or Objects"),
+ ("NV", "New Vertex", "This function will Add a New Vertex"),
+ ("EV", "Extrude Vertices", "This function will Extrude Vertices Only in EDIT Mode"),
+ ("SE", "Split Edges", "This function will Split Edges Only in EDIT Mode"),
+ (
+ "DG",
+ "Duplicate Geometry",
+ "This function will Duplicate Geometry in EDIT Mode (Delta & Direction Only)",
+ ),
+ (
+ "EG",
+ "Extrude Geometry",
+ "This function will Extrude Geometry in EDIT Mode (Delta & Direction Only)",
+ ),
+ ),
+ name="Operation",
+ default="CU",
+ description=PDT_DES_OPMODE,
+ )
+ taper : EnumProperty(
+ items=(
+ ("RX-MY", "RotX-MovY", "Rotate X - Move Y"),
+ ("RX-MZ", "RotX-MovZ", "Rotate X - Move Z"),
+ ("RY-MX", "RotY-MovX", "Rotate Y - Move X"),
+ ("RY-MZ", "RotY-MovZ", "Rotate Y - Move Z"),
+ ("RZ-MX", "RotZ-MovX", "Rotate Z - Move X"),
+ ("RZ-MY", "RotZ-MovY", "Rotate Z - Move Y"),
+ ),
+ name="Axes",
+ default="RX-MY",
+
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list