[Bf-extensions-cvs] [40c00d3] master: add_extra_mesh_objects: new version

Brendon Murphy noreply at git.blender.org
Fri May 1 04:54:28 CEST 2015


Commit: 40c00d312f0cc54485f93e47763eb9cd9b413fee
Author: Brendon Murphy
Date:   Fri May 1 10:52:03 2015 +0800
Branches: master
https://developer.blender.org/rBA40c00d312f0cc54485f93e47763eb9cd9b413fee

add_extra_mesh_objects: new version

Tracker: https://developer.blender.org/T44561

New UI, New Addons, Better organization & removal of 'Lesser Object
Types'

Merged & removed "lesser" & 'larger" add mesh scripts.
Menu updates & re-organization & modernize.
New: Add Vert, Round Cube, Menger Cube, Brilliant Diamond, Parent to
Empty
Removed: Add Mesh: Sqorus, Trapezohedron, Wedge, Polysphere.
Merged add_mesh_symmetrical_empty from contrib
Documentation:
http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Add_Mesh/Add_Mesh_Extra_Objects

===================================================================

M	add_mesh_extra_objects/__init__.py
A	add_mesh_extra_objects/add_empty_as_parent.py
M	add_mesh_extra_objects/add_mesh_3d_function_surface.py
D	add_mesh_extra_objects/add_mesh_extra_objects.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
A	add_mesh_extra_objects/add_mesh_menger_sponge.py
M	add_mesh_extra_objects/add_mesh_pipe_joint.py
D	add_mesh_extra_objects/add_mesh_polysphere.py
M	add_mesh_extra_objects/add_mesh_pyramid.py
A	add_mesh_extra_objects/add_mesh_round_brilliant.py
A	add_mesh_extra_objects/add_mesh_round_cube.py
M	add_mesh_extra_objects/add_mesh_solid.py
A	add_mesh_extra_objects/add_mesh_star.py
M	add_mesh_extra_objects/add_mesh_supertoroid.py
M	add_mesh_extra_objects/add_mesh_teapot.py
M	add_mesh_extra_objects/add_mesh_torusknot.py
M	add_mesh_extra_objects/add_mesh_twisted_torus.py
A	add_mesh_extra_objects/add_mesh_vertex.py

===================================================================

diff --git a/add_mesh_extra_objects/__init__.py b/add_mesh_extra_objects/__init__.py
index 41bebc7..9cd1812 100644
--- a/add_mesh_extra_objects/__init__.py
+++ b/add_mesh_extra_objects/__init__.py
@@ -16,13 +16,13 @@
 #
 # ##### END GPL LICENSE BLOCK #####
 # Contributed to by
-# Pontiac, Fourmadmen, varkenvarken, tuga3d, meta-androcto, metalliandy, dreampainter & cotejrp1#
+# Pontiac, Fourmadmen, varkenvarken, tuga3d, meta-androcto, metalliandy, dreampainter, cotejrp1#
 
 bl_info = {
     "name": "Extra Objects",
     "author": "Multiple Authors",
     "version": (0, 3, 0),
-    "blender": (2, 72, 0),
+    "blender": (2, 74, 0),
     "location": "View3D > Add > Mesh",
     "description": "Add extra mesh object types",
     "warning": "",
@@ -33,12 +33,12 @@ bl_info = {
 
 if "bpy" in locals():
     import importlib
-    importlib.reload(add_mesh_extra_objects)
+    importlib.reload(add_mesh_star)
     importlib.reload(add_mesh_twisted_torus)
     importlib.reload(add_mesh_gemstones)
     importlib.reload(add_mesh_gears)
     importlib.reload(add_mesh_3d_function_surface)
-    importlib.reload(add_mesh_polysphere)
+    importlib.reload(add_mesh_round_cube)
     importlib.reload(add_mesh_supertoroid)
     importlib.reload(add_mesh_pyramid)
     importlib.reload(add_mesh_torusknot)
@@ -46,14 +46,17 @@ if "bpy" in locals():
     importlib.reload(add_mesh_teapot)
     importlib.reload(add_mesh_pipe_joint)
     importlib.reload(add_mesh_solid)
-
+    importlib.reload(add_mesh_round_brilliant)
+    importlib.reload(add_mesh_menger_sponge)
+    importlib.reload(add_mesh_vertex)
+    importlib.reload(add_empty_as_parent)
 else:
-    from . import add_mesh_extra_objects
+    from . import add_mesh_star
     from . import add_mesh_twisted_torus
     from . import add_mesh_gemstones
     from . import add_mesh_gears
     from . import add_mesh_3d_function_surface
-    from . import add_mesh_polysphere
+    from . import add_mesh_round_cube
     from . import add_mesh_supertoroid
     from . import add_mesh_pyramid
     from . import add_mesh_torusknot
@@ -61,9 +64,33 @@ else:
     from . import add_mesh_teapot
     from . import add_mesh_pipe_joint
     from . import add_mesh_solid
+    from . import add_mesh_round_brilliant
+    from . import add_mesh_menger_sponge
+    from . import add_mesh_vertex
+    from . import add_empty_as_parent
+
 
 import bpy
 
+
+class INFO_MT_mesh_vert_add(bpy.types.Menu):
+    # Define the "Pipe Joints" menu
+    bl_idname = "INFO_MT_mesh_vert_add"
+    bl_label = "Single Vert"
+
+    def draw(self, context):
+        layout = self.layout
+        layout.operator_context = 'INVOKE_REGION_WIN'
+        layout.operator("mesh.primitive_vert_add",
+            text="Add Single Vert ")
+        layout.operator("mesh.primitive_emptyvert_add",
+            text="Object Origin Only")
+        layout.operator("mesh.primitive_symmetrical_vert_add",
+            text="Origin & Vert Mirrored")
+        layout.operator("mesh.primitive_symmetrical_empty_add",
+            text="Object Origin Mirrored")
+
+
 class INFO_MT_mesh_gears_add(bpy.types.Menu):
     # Define the "Gears" menu
     bl_idname = "INFO_MT_mesh_gears_add"
@@ -77,6 +104,23 @@ class INFO_MT_mesh_gears_add(bpy.types.Menu):
         layout.operator("mesh.primitive_worm_gear",
             text="Worm")
 
+
+class INFO_MT_mesh_diamonds_add(bpy.types.Menu):
+    # Define the "Gears" menu
+    bl_idname = "INFO_MT_mesh_diamonds_add"
+    bl_label = "Diamonds"
+
+    def draw(self, context):
+        layout = self.layout
+        layout.operator_context = 'INVOKE_REGION_WIN'
+        layout.operator("mesh.primitive_brilliant_add",
+            text="Brilliant Diamond")
+        layout.operator("mesh.primitive_diamond_add",
+            text="Diamond")
+        layout.operator("mesh.primitive_gem_add",
+            text="Gem")
+
+
 class INFO_MT_mesh_math_add(bpy.types.Menu):
     # Define the "Math Function" menu
     bl_idname = "INFO_MT_mesh_math_add"
@@ -89,27 +133,29 @@ class INFO_MT_mesh_math_add(bpy.types.Menu):
             text="Z Math Surface")
         layout.operator("mesh.primitive_xyz_function_surface",
             text="XYZ Math Surface")
-        self.layout.operator("mesh.primitive_solid_add", text="Solid")
+        self.layout.operator("mesh.primitive_solid_add", text="Regular Solid")
+
 
-class INFO_MT_mesh_basic_add(bpy.types.Menu):
+class INFO_MT_mesh_extras_add(bpy.types.Menu):
     # Define the "Simple Objects" menu
-    bl_idname = "INFO_MT_mesh_basic_add"
-    bl_label = "Simple Objects"
+    bl_idname = "INFO_MT_mesh_extras_add"
+    bl_label = "Extras"
 
     def draw(self, context):
         layout = self.layout
         layout.operator_context = 'INVOKE_REGION_WIN'
-        layout.operator("mesh.primitive_diamond_add",
-            text="Diamond")
-        layout.operator("mesh.primitive_gem_add",
-            text="Gem")
-        layout.operator("mesh.primitive_sqorus_add",
-            text="Sqorus")
-        layout.operator("mesh.primitive_wedge_add")
+        layout.menu("INFO_MT_mesh_diamonds_add", text="Diamonds", icon="PMARKER_SEL")
         layout.operator("mesh.primitive_star_add",
-            text="Star")
-        layout.operator("mesh.primitive_trapezohedron_add",
-            text="Trapezohedron")
+            text="Simple Star")
+        layout.operator("mesh.primitive_steppyramid_add",
+            text="Step Pyramid")
+        layout.operator("mesh.honeycomb_add",
+            text="Honeycomb")
+        layout.operator("mesh.primitive_teapot_add",
+            text="Teapot+")
+        layout.operator("mesh.menger_sponge_add",
+            text="Menger Sponge")
+
 
 class INFO_MT_mesh_torus_add(bpy.types.Menu):
     # Define the "Simple Objects" menu
@@ -126,20 +172,6 @@ class INFO_MT_mesh_torus_add(bpy.types.Menu):
         layout.operator("mesh.primitive_torusknot_add",
             text="Torus Knot")
 
-class INFO_MT_mesh_misc_add(bpy.types.Menu):
-    # Define the "Simple Objects" menu
-    bl_idname = "INFO_MT_mesh_misc_add"
-    bl_label = "Misc Objects"
-
-    def draw(self, context):
-        layout = self.layout
-        layout.operator_context = 'INVOKE_REGION_WIN'
-        layout.operator("mesh.primitive_steppyramid_add",
-            text="Step Pyramid")
-        layout.operator("mesh.honeycomb_add",
-            text="Honeycomb")
-        layout.operator("mesh.primitive_teapot_add",
-            text="Teapot+")
 
 class INFO_MT_mesh_pipe_joints_add(bpy.types.Menu):
     # Define the "Pipe Joints" menu
@@ -160,17 +192,22 @@ class INFO_MT_mesh_pipe_joints_add(bpy.types.Menu):
         layout.operator("mesh.primitive_n_joint_add",
             text="Pipe N-Joint")
 
+
 # Register all operators and panels
 
 # Define "Extras" menu
 def menu_func(self, context):
-    self.layout.operator("mesh.primitive_polysphere_add", text="Polysphere")
-    self.layout.menu("INFO_MT_mesh_pipe_joints_add", text="Pipe Joints")
-    self.layout.menu("INFO_MT_mesh_gears_add", text="Gears")
-    self.layout.menu("INFO_MT_mesh_math_add", text="Math Function")
-    self.layout.menu("INFO_MT_mesh_torus_add", text="Torus Objects")
-    self.layout.menu("INFO_MT_mesh_basic_add", text="Basic Objects")
-    self.layout.menu("INFO_MT_mesh_misc_add", text="Misc Objects")
+    self.layout.separator()
+    self.layout.menu("INFO_MT_mesh_vert_add", text="Single Vert", icon="LAYER_ACTIVE")
+    self.layout.menu("INFO_MT_mesh_round_cube_add", text="Round Cube", icon="WIRE")
+    self.layout.menu("INFO_MT_mesh_math_add", text="Math Function", icon="PACKAGE")
+    self.layout.menu("INFO_MT_mesh_pipe_joints_add", text="Pipe Joints", icon="SNAP_PEEL_OBJECT")
+    self.layout.menu("INFO_MT_mesh_gears_add", text="Gears", icon="SCRIPTWIN")
+    self.layout.menu("INFO_MT_mesh_torus_add", text="Torus Objects", icon="MESH_TORUS")
+    self.layout.menu("INFO_MT_mesh_extras_add", text="Extras", icon="MESH_DATA")
+    self.layout.separator()
+    self.layout.operator("object.parent_to_empty", text="Parent To Empty", icon="LINK_AREA")
+    self.layout.separator()
 
 
 def register():
diff --git a/add_mesh_extra_objects/add_empty_as_parent.py b/add_mesh_extra_objects/add_empty_as_parent.py
new file mode 100644
index 0000000..8628055
--- /dev/null
+++ b/add_mesh_extra_objects/add_empty_as_parent.py
@@ -0,0 +1,57 @@
+# GPL # Original Author Liero #
+
+import bpy
+from bpy.props import StringProperty, FloatProperty, BoolProperty, FloatVectorProperty
+
+def centro(objetos):
+    x = sum([obj.location[0] for obj in objetos])/len(objetos)
+    y = sum([obj.location[1] for obj in objetos])/len(objetos)
+    z = sum([obj.location[2] for obj in objetos])/len(objetos)
+    return (x,y,z)
+
+class P2E(bpy.types.Operator):
+    bl_idname = 'object.parent_to_empty'
+    bl_label = 'Parent Selected to Empty'
+    bl_description = 'Parent selected objects to a new Empty'
+    bl_options = {'REGISTER', 'UNDO'}
+
+    nombre = StringProperty(name='', default='OBJECTS', description='Give the empty / group a name')
+    grupo = bpy.props.BoolProperty(name='Create Group', default=False, description='Also link objects to a new group')
+    cursor = bpy.props.BoolProperty(name='Cursor Location', default=False, description='Add the empty at cursor / selection center')
+    renombrar = bpy.props.BoolProperty(name='Rename Objects', default=False, description='Rename child objects')
+
+    @classmethod
+    def poll(cls, context):
+        return (context.object and context.object.select)
+
+    def draw(self, context):
+        layout = self.layout
+        layout.prop(self,'nombre')
+        column = layout.column(align=True)
+        column.prop(self,'grupo')
+        column.prop(self,'cursor')
+        column.prop(self,'renombrar')
+
+    def execute(self, context):
+        objs = bpy.context.selected_objects
+        bpy.ops.object.mode_set()
+        if self.cursor:
+            loc = context.scene.cursor_location
+        else:
+            loc = centro(objs)
+        bpy.ops.object.add(type='EMPTY',location=loc)
+        bpy.context.object.name = self.nombre
+        if self.grupo:
+            bpy.ops.group.create(name=self.nombre)
+            bpy.ops.group.objects_add_active()
+        f

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list