[Bf-extensions-cvs] [1072d96b] master: Addon Mesh Extra Objects: Added Object Helper. Fixed World orientation.
Spivak Vladimir cwolf3d
noreply at git.blender.org
Mon Jan 13 23:12:47 CET 2020
Commit: 1072d96b7d6779470728c70c94d7a7589003db64
Author: Spivak Vladimir (cwolf3d)
Date: Tue Jan 14 00:12:10 2020 +0200
Branches: master
https://developer.blender.org/rBA1072d96b7d6779470728c70c94d7a7589003db64
Addon Mesh Extra Objects: Added Object Helper. Fixed World orientation.
===================================================================
M add_mesh_extra_objects/Wallfactory.py
M add_mesh_extra_objects/__init__.py
M add_mesh_extra_objects/add_mesh_beam_builder.py
M add_mesh_extra_objects/add_mesh_gears.py
M add_mesh_extra_objects/add_mesh_gemstones.py
M add_mesh_extra_objects/add_mesh_honeycomb.py
M add_mesh_extra_objects/add_mesh_pipe_joint.py
M add_mesh_extra_objects/add_mesh_pyramid.py
M add_mesh_extra_objects/add_mesh_round_brilliant.py
M add_mesh_extra_objects/add_mesh_round_cube.py
M add_mesh_extra_objects/add_mesh_star.py
M add_mesh_extra_objects/add_mesh_supertoroid.py
M add_mesh_extra_objects/add_mesh_torusknot.py
M add_mesh_extra_objects/add_mesh_twisted_torus.py
D add_mesh_extra_objects/utils.py
===================================================================
diff --git a/add_mesh_extra_objects/Wallfactory.py b/add_mesh_extra_objects/Wallfactory.py
index 865f9150..4aaeae9b 100644
--- a/add_mesh_extra_objects/Wallfactory.py
+++ b/add_mesh_extra_objects/Wallfactory.py
@@ -55,7 +55,6 @@ from .Blocks import (
stepBack,
)
from bpy_extras import object_utils
-from . import utils
class add_mesh_wallb(Operator, object_utils.AddObjectHelper):
bl_idname = "mesh.wall_add"
@@ -643,9 +642,9 @@ class add_mesh_wallb(Operator, object_utils.AddObjectHelper):
if self.change == False:
# generic transform props
box = layout.box()
- box.prop(self, 'align')
- box.prop(self, 'location')
- box.prop(self, 'rotation')
+ box.prop(self, 'align', expand=True)
+ box.prop(self, 'location', expand=True)
+ box.prop(self, 'rotation', expand=True)
# Respond to UI - get the properties set by user.
# Check and process UI settings to generate masonry
@@ -896,9 +895,7 @@ class add_mesh_wallb(Operator, object_utils.AddObjectHelper):
else:
mesh = bpy.data.meshes.new("Wall")
mesh.from_pydata(verts_array, [], faces_array)
- obj = object_utils.object_data_add(context, mesh, operator=None)
-
- utils.setlocation(self, context)
+ obj = object_utils.object_data_add(context, mesh, operator=self)
mesh.update()
@@ -913,15 +910,13 @@ class add_mesh_wallb(Operator, object_utils.AddObjectHelper):
bpy.ops.object.mode_set(mode='OBJECT')
mesh = bpy.data.meshes.new("TMP")
mesh.from_pydata(verts_array, [], faces_array)
- obj = object_utils.object_data_add(context, mesh, operator=None)
+ obj = object_utils.object_data_add(context, mesh, operator=self)
obj.select_set(True)
active_object.select_set(True)
bpy.ops.object.join()
context.active_object.name = name_active_object
bpy.ops.object.mode_set(mode='EDIT')
- utils.setlocation(self, context)
-
return {'FINISHED'}
def WallParameters():
diff --git a/add_mesh_extra_objects/__init__.py b/add_mesh_extra_objects/__init__.py
index d009f0a5..b3b2f682 100644
--- a/add_mesh_extra_objects/__init__.py
+++ b/add_mesh_extra_objects/__init__.py
@@ -170,8 +170,11 @@ class VIEW3D_MT_mesh_extras_add(Menu):
oper.change = False
layout.separator()
oper = layout.operator("mesh.primitive_star_add", text="Simple Star")
+ oper.change = False
oper = layout.operator("mesh.primitive_steppyramid_add", text="Step Pyramid")
+ oper.change = False
oper = layout.operator("mesh.honeycomb_add", text="Honeycomb")
+ oper.change = False
oper = layout.operator("mesh.primitive_teapot_add", text="Teapot+")
oper = layout.operator("mesh.menger_sponge_add", text="Menger Sponge")
@@ -184,9 +187,12 @@ class VIEW3D_MT_mesh_torus_add(Menu):
def draw(self, context):
layout = self.layout
layout.operator_context = 'INVOKE_REGION_WIN'
- layout.operator("mesh.primitive_twisted_torus_add", text="Twisted Torus")
- layout.operator("mesh.primitive_supertoroid_add", text="Supertoroid")
- layout.operator("mesh.primitive_torusknot_add", text="Torus Knot")
+ oper = layout.operator("mesh.primitive_twisted_torus_add", text="Twisted Torus")
+ oper.change = False
+ oper = layout.operator("mesh.primitive_supertoroid_add", text="Supertoroid")
+ oper.change = False
+ oper = layout.operator("mesh.primitive_torusknot_add", text="Torus Knot")
+ oper.change = False
class VIEW3D_MT_mesh_pipe_joints_add(Menu):
@@ -197,11 +203,16 @@ class VIEW3D_MT_mesh_pipe_joints_add(Menu):
def draw(self, context):
layout = self.layout
layout.operator_context = 'INVOKE_REGION_WIN'
- layout.operator("mesh.primitive_elbow_joint_add", text="Pipe Elbow")
- layout.operator("mesh.primitive_tee_joint_add", text="Pipe T-Joint")
- layout.operator("mesh.primitive_wye_joint_add", text="Pipe Y-Joint")
- layout.operator("mesh.primitive_cross_joint_add", text="Pipe Cross-Joint")
- layout.operator("mesh.primitive_n_joint_add", text="Pipe N-Joint")
+ oper = layout.operator("mesh.primitive_elbow_joint_add", text="Pipe Elbow")
+ oper.change = False
+ oper = layout.operator("mesh.primitive_tee_joint_add", text="Pipe T-Joint")
+ oper.change = False
+ oper = layout.operator("mesh.primitive_wye_joint_add", text="Pipe Y-Joint")
+ oper.change = False
+ oper = layout.operator("mesh.primitive_cross_joint_add", text="Pipe Cross-Joint")
+ oper.change = False
+ oper = layout.operator("mesh.primitive_n_joint_add", text="Pipe N-Joint")
+ oper.change = False
# Register all operators and panels
@@ -213,8 +224,9 @@ def menu_func(self, context):
layout.separator()
layout.menu("VIEW3D_MT_mesh_vert_add",
text="Single Vert", icon="DECORATE")
- layout.operator("mesh.primitive_round_cube_add",
+ oper = layout.operator("mesh.primitive_round_cube_add",
text="Round Cube", icon="SPHERE")
+ oper.change = False
layout.menu("VIEW3D_MT_mesh_torus_add",
text="Torus Objects", icon="MESH_TORUS")
layout.separator()
@@ -321,6 +333,55 @@ def Extras_contex_menu(self, context):
for prm in add_mesh_round_brilliant.BrilliantParameters():
setattr(props, prm, obj.data[prm])
layout.separator()
+
+ if 'Roundcube' in obj.data.keys():
+ props = layout.operator("mesh.primitive_round_cube_add", text="Change Roundcube")
+ props.change = True
+ for prm in add_mesh_round_cube.RoundCubeParameters():
+ setattr(props, prm, obj.data[prm])
+ layout.separator()
+
+ if 'TorusKnot' in obj.data.keys():
+ props = layout.operator("mesh.primitive_torusknot_add", text="Change TorusKnot")
+ props.change = True
+ for prm in add_mesh_torusknot.TorusKnotParameters():
+ setattr(props, prm, obj.data[prm])
+ layout.separator()
+
+ if 'SuperToroid' in obj.data.keys():
+ props = layout.operator("mesh.primitive_supertoroid_add", text="Change SuperToroid")
+ props.change = True
+ for prm in add_mesh_supertoroid.SuperToroidParameters():
+ setattr(props, prm, obj.data[prm])
+ layout.separator()
+
+ if 'TwistedTorus' in obj.data.keys():
+ props = layout.operator("mesh.primitive_twisted_torus_add", text="Change TwistedTorus")
+ props.change = True
+ for prm in add_mesh_twisted_torus.TwistedTorusParameters():
+ setattr(props, prm, obj.data[prm])
+ layout.separator()
+
+ if 'Star' in obj.data.keys():
+ props = layout.operator("mesh.primitive_star_add", text="Change Star")
+ props.change = True
+ for prm in add_mesh_star.StarParameters():
+ setattr(props, prm, obj.data[prm])
+ layout.separator()
+
+ if 'Pyramid' in obj.data.keys():
+ props = layout.operator("mesh.primitive_steppyramid_add", text="Change Pyramid")
+ props.change = True
+ for prm in add_mesh_pyramid.PyramidParameters():
+ setattr(props, prm, obj.data[prm])
+ layout.separator()
+
+ if 'HoneyComb' in obj.data.keys():
+ props = layout.operator("mesh.honeycomb_add", text="Change HoneyComb")
+ props.change = True
+ for prm in add_mesh_honeycomb.HoneyCombParameters():
+ setattr(props, prm, obj.data[prm])
+ layout.separator()
# Register
classes = [
diff --git a/add_mesh_extra_objects/add_mesh_beam_builder.py b/add_mesh_extra_objects/add_mesh_beam_builder.py
index 4650e37a..db932baf 100644
--- a/add_mesh_extra_objects/add_mesh_beam_builder.py
+++ b/add_mesh_extra_objects/add_mesh_beam_builder.py
@@ -13,7 +13,6 @@ from bpy.props import (
StringProperty,
)
from bpy_extras import object_utils
-from . import utils
# #####################
# Create vertices for end of mesh
@@ -685,11 +684,6 @@ class addBeam(Operator, object_utils.AddObjectHelper):
Beam : BoolProperty(name = "Beam",
default = True,
description = "Beam")
-
- #### change properties
- name : StringProperty(name = "Name",
- description = "Name")
-
change : BoolProperty(name = "Change",
default = False,
description = "change Beam")
@@ -761,9 +755,9 @@ class addBeam(Operator, object_utils.AddObjectHelper):
if self.change == False:
# generic transform props
box = layout.box()
- box.prop(self, 'align')
- box.prop(self, 'location')
- box.prop(self, 'rotation')
+ box.prop(self, 'align', expand=True)
+ box.prop(self, 'location', expand=True)
+ box.prop(self, 'rotation', expand=True)
def execute(self, context):
if bpy.context.mode == "OBJECT":
@@ -781,9 +775,7 @@ class addBeam(Operator, object_utils.AddObjectHelper):
obj.data.name = oldmeshname
else:
mesh = addBeamMesh(self, context)
- obj = object_utils.object_data_add(context, mesh, operator=None)
-
- utils.setlocation(self, context)
+ obj = object_utils.object_data_add(context, mesh, operator=self)
if self.Type == '2': # Rotate C shape
bpy.ops.transform.rotate(value=1.570796, constraint_axis=[False, True, False])
@@ -809,15 +801,13 @@ class addBeam(Operator, object_utils.AddObjectHelper):
name_active_object = active_object.name
bpy.ops.object.mode_set(mode='OBJECT')
mesh = addBeamMesh(self, context)
- obj = object_utils.object_data_add(context, mesh, operator=None)
+ obj = object_utils.object_data_add(context, mesh, operator=self)
obj.select_set(True)
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list