[Bf-extensions-cvs] [a9af6a75] master: initial commit Mesh Tools: Rebuild of mesh edit tools in release.
meta-androcto
noreply at git.blender.org
Sun Apr 28 03:39:31 CEST 2019
Commit: a9af6a75337bad26d0030fc6e1472d36c6b468f1
Author: meta-androcto
Date: Sun Apr 28 11:38:52 2019 +1000
Branches: master
https://developer.blender.org/rBACa9af6a75337bad26d0030fc6e1472d36c6b468f1
initial commit Mesh Tools: Rebuild of mesh edit tools in release.
===================================================================
A mesh_tools/__init__.py
A mesh_tools/mesh_edge_roundifier.py
A mesh_tools/mesh_extrude_and_reshape.py
A mesh_tools/mesh_filletplus.py
A mesh_tools/mesh_offset_edges.py
A mesh_tools/mesh_vertex_chamfer.py
A mesh_tools/random_vertices.py
A mesh_tools/split_solidify.py
===================================================================
diff --git a/mesh_tools/__init__.py b/mesh_tools/__init__.py
new file mode 100644
index 00000000..56486fd3
--- /dev/null
+++ b/mesh_tools/__init__.py
@@ -0,0 +1,1101 @@
+# ##### 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 #####
+# Contributed to by:
+# meta-androcto, Hidesato Ikeya, zmj100, Gert De Roost, TrumanBlending, PKHG, #
+# Oscurart, Greg, Stanislav Blinov, komi3D, BlenderLab, Paul Marshall (brikbot), #
+# metalliandy, macouno, CoDEmanX, dustractor, Liero, lijenstina, Germano Cavalcante #
+# Pistiwique, Jimmy Hazevoet #
+
+bl_info = {
+ "name": "Edit Tools",
+ "author": "Meta-Androcto",
+ "version": (0, 3, 5),
+ "blender": (2, 80, 0),
+ "location": "View3D > Toolbar and View3D > Specials Menu",
+ "warning": "",
+ "description": "Mesh modelling toolkit. Several tools to aid modelling",
+ "wiki_url": "https://wiki.blender.org/index.php/Extensions:2.6/"
+ "Py/Scripts/Modeling/Extra_Tools",
+ "category": "Mesh",
+}
+
+# Import From Files
+if "bpy" in locals():
+ import importlib
+ importlib.reload(mesh_offset_edges)
+ importlib.reload(split_solidify)
+ importlib.reload(mesh_filletplus)
+ importlib.reload(mesh_vertex_chamfer)
+ importlib.reload(random_vertices)
+ importlib.reload(mesh_extrude_and_reshape)
+ importlib.reload(mesh_edge_roundifier)
+
+else:
+ from . import mesh_offset_edges
+ from . import split_solidify
+ from . import mesh_filletplus
+ from . import mesh_vertex_chamfer
+ from . import random_vertices
+ from . import mesh_extrude_and_reshape
+ from . import mesh_edge_roundifier
+
+import bmesh
+import bpy
+import collections
+import mathutils
+import random
+from math import (
+ sin, cos, tan,
+ degrees, radians, pi,
+ )
+from random import gauss
+from mathutils import Matrix, Euler, Vector
+from bpy_extras import view3d_utils
+from bpy.types import (
+ Operator,
+ Menu,
+ Panel,
+ PropertyGroup,
+ AddonPreferences,
+ )
+from bpy.props import (
+ BoolProperty,
+ BoolVectorProperty,
+ EnumProperty,
+ FloatProperty,
+ FloatVectorProperty,
+ IntVectorProperty,
+ PointerProperty,
+ StringProperty,
+ IntProperty
+ )
+
+# ########################################
+# ##### General functions ################
+# ########################################
+
+
+# Multi extrude
+def gloc(self, r):
+ return Vector((self.offx, self.offy, self.offz))
+
+
+def vloc(self, r):
+ random.seed(self.ran + r)
+ return self.off * (1 + gauss(0, self.var1 / 3))
+
+
+def nrot(self, n):
+ return Euler((radians(self.nrotx) * n[0],
+ radians(self.nroty) * n[1],
+ radians(self.nrotz) * n[2]), 'XYZ')
+
+
+def vrot(self, r):
+ random.seed(self.ran + r)
+ return Euler((radians(self.rotx) + gauss(0, self.var2 / 3),
+ radians(self.roty) + gauss(0, self.var2 / 3),
+ radians(self.rotz) + gauss(0, self.var2 / 3)), 'XYZ')
+
+
+def vsca(self, r):
+ random.seed(self.ran + r)
+ return self.sca * (1 + gauss(0, self.var3 / 3))
+
+
+class ME_OT_MExtrude(Operator):
+ bl_idname = "object.mextrude"
+ bl_label = "Multi Extrude"
+ bl_description = ("Extrude selected Faces with Rotation,\n"
+ "Scaling, Variation, Randomization")
+ bl_options = {"REGISTER", "UNDO", "PRESET"}
+
+ off : FloatProperty(
+ name="Offset",
+ soft_min=0.001, soft_max=10,
+ min=-100, max=100,
+ default=1.0,
+ description="Translation"
+ )
+ offx : FloatProperty(
+ name="Loc X",
+ soft_min=-10.0, soft_max=10.0,
+ min=-100.0, max=100.0,
+ default=0.0,
+ description="Global Translation X"
+ )
+ offy : FloatProperty(
+ name="Loc Y",
+ soft_min=-10.0, soft_max=10.0,
+ min=-100.0, max=100.0,
+ default=0.0,
+ description="Global Translation Y"
+ )
+ offz : FloatProperty(
+ name="Loc Z",
+ soft_min=-10.0, soft_max=10.0,
+ min=-100.0, max=100.0,
+ default=0.0,
+ description="Global Translation Z"
+ )
+ rotx : FloatProperty(
+ name="Rot X",
+ min=-85, max=85,
+ soft_min=-30, soft_max=30,
+ default=0,
+ description="X Rotation"
+ )
+ roty : FloatProperty(
+ name="Rot Y",
+ min=-85, max=85,
+ soft_min=-30,
+ soft_max=30,
+ default=0,
+ description="Y Rotation"
+ )
+ rotz : FloatProperty(
+ name="Rot Z",
+ min=-85, max=85,
+ soft_min=-30, soft_max=30,
+ default=-0,
+ description="Z Rotation"
+ )
+ nrotx : FloatProperty(
+ name="N Rot X",
+ min=-85, max=85,
+ soft_min=-30, soft_max=30,
+ default=0,
+ description="Normal X Rotation"
+ )
+ nroty : FloatProperty(
+ name="N Rot Y",
+ min=-85, max=85,
+ soft_min=-30, soft_max=30,
+ default=0,
+ description="Normal Y Rotation"
+ )
+ nrotz : FloatProperty(
+ name="N Rot Z",
+ min=-85, max=85,
+ soft_min=-30, soft_max=30,
+ default=-0,
+ description="Normal Z Rotation"
+ )
+ sca : FloatProperty(
+ name="Scale",
+ min=0.01, max=10,
+ soft_min=0.5, soft_max=1.5,
+ default=1.0,
+ description="Scaling of the selected faces after extrusion"
+ )
+ var1 : FloatProperty(
+ name="Offset Var", min=-10, max=10,
+ soft_min=-1, soft_max=1,
+ default=0,
+ description="Offset variation"
+ )
+ var2 : FloatProperty(
+ name="Rotation Var",
+ min=-10, max=10,
+ soft_min=-1, soft_max=1,
+ default=0,
+ description="Rotation variation"
+ )
+ var3 : FloatProperty(
+ name="Scale Noise",
+ min=-10, max=10,
+ soft_min=-1, soft_max=1,
+ default=0,
+ description="Scaling noise"
+ )
+ var4 : IntProperty(
+ name="Probability",
+ min=0, max=100,
+ default=100,
+ description="Probability, chance of extruding a face"
+ )
+ num : IntProperty(
+ name="Repeat",
+ min=1, max=500,
+ soft_max=100,
+ default=1,
+ description="Repetitions"
+ )
+ ran : IntProperty(
+ name="Seed",
+ min=-9999, max=9999,
+ default=0,
+ description="Seed to feed random values"
+ )
+ opt1 : BoolProperty(
+ name="Polygon coordinates",
+ default=True,
+ description="Polygon coordinates, Object coordinates"
+ )
+ opt2 : BoolProperty(
+ name="Proportional offset",
+ default=False,
+ description="Scale * Offset"
+ )
+ opt3 : BoolProperty(
+ name="Per step rotation noise",
+ default=False,
+ description="Per step rotation noise, Initial rotation noise"
+ )
+ opt4 : BoolProperty(
+ name="Per step scale noise",
+ default=False,
+ description="Per step scale noise, Initial scale noise"
+ )
+
+ @classmethod
+ def poll(cls, context):
+ obj = context.object
+ return (obj and obj.type == 'MESH')
+
+ def draw(self, context):
+ layout = self.layout
+ col = layout.column(align=True)
+ col.label(text="Transformations:")
+ col.prop(self, "off", slider=True)
+ col.prop(self, "offx", slider=True)
+ col.prop(self, "offy", slider=True)
+ col.prop(self, "offz", slider=True)
+
+ col = layout.column(align=True)
+ col.prop(self, "rotx", slider=True)
+ col.prop(self, "roty", slider=True)
+ col.prop(self, "rotz", slider=True)
+ col.prop(self, "nrotx", slider=True)
+ col.prop(self, "nroty", slider=True)
+ col.prop(self, "nrotz", slider=True)
+ col = layout.column(align=True)
+ col.prop(self, "sca", slider=True)
+
+ col = layout.column(align=True)
+ col.label(text="Variation settings:")
+ col.prop(self, "var1", slider=True)
+ col.prop(self, "var2", slider=True)
+ col.prop(self, "var3", slider=True)
+ col.prop(self, "var4", slider=True)
+ col.prop(self, "ran")
+ col = layout.column(align=False)
+ col.prop(self, 'num')
+
+ col = layout.column(align=True)
+ col.label(text="Options:")
+ col.prop(self, "opt1")
+ col.prop(self, "opt2")
+ col.prop(self, "opt3")
+ col.prop(self, "opt4")
+
+ def execute(self, context):
+ obj = bpy.context.object
+ om = obj.mode
+ bpy.context.tool_settings.mesh_select_mode = [False, False, True]
+ origin = Vector([0.0, 0.0, 0.0])
+
+ # bmesh operations
+ bpy.ops.object.mode_set()
+ bm = bmesh.new()
+ bm.from_mesh(obj.data)
+ sel = [f for f in bm.faces if f.
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list