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:
authorlijenstina <lijenstina@gmail.com>2016-08-26 00:35:01 +0300
committerlijenstina <lijenstina@gmail.com>2016-08-26 00:35:01 +0300
commitdbe050deadf3e8d23a647b86b2168fc18d108a36 (patch)
tree1a5b00cfa6c49411018f324d5a79742e702845e7 /add_mesh_extra_objects/__init__.py
parentd20975b80900f4e2a13d792274b989cf5cc4880f (diff)
Cleanup and fixes to mesh_discombobulator
Run Flake8 on __init__ and mesh_discombobulator Clean up the bl_info (the scipt is now a module) Moved the discombobulator props to a separate property group Removed the duplicate entries of props in the script Added poll functions for discombobulator operators Used a prop_dialog instead of popup Moved the execution operator from draw to execute Added a remove all doodads option Moved the list of doodads from the label to a separate menu Expanded on Usage Information to cover more limitations and changed it to a menu Limit the repeat protusions to 4 instead of 10 (There is no RAM and CPU big enough in the world to take all in the hubris of unrealistic ambitions)
Diffstat (limited to 'add_mesh_extra_objects/__init__.py')
-rw-r--r--add_mesh_extra_objects/__init__.py220
1 files changed, 155 insertions, 65 deletions
diff --git a/add_mesh_extra_objects/__init__.py b/add_mesh_extra_objects/__init__.py
index df2531f3..24bc6aab 100644
--- a/add_mesh_extra_objects/__init__.py
+++ b/add_mesh_extra_objects/__init__.py
@@ -15,7 +15,7 @@
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
-# Contributed to by
+# Contributed to by:
# Pontiac, Fourmadmen, varkenvarken, tuga3d, meta-androcto, metalliandy, dreampainter, cotejrp1 #
# liero, Kayo Phoenix, sugiany, dommetysk, Phymec, Anthony D'Agostino, Pablo Vazquez, Richard Wilks #
# xyz presets by elfnor
@@ -85,7 +85,13 @@ else:
from . import add_mesh_beam_builder
from . import Wallfactory
from . import Blocks
+
import bpy
+from bpy.props import (
+ BoolProperty,
+ IntProperty,
+ FloatProperty,
+ )
class INFO_MT_mesh_vert_add(bpy.types.Menu):
@@ -97,13 +103,13 @@ class INFO_MT_mesh_vert_add(bpy.types.Menu):
layout = self.layout
layout.operator_context = 'INVOKE_REGION_WIN'
layout.operator("mesh.primitive_vert_add",
- text="Add Single Vert ")
+ text="Add Single Vert ")
layout.operator("mesh.primitive_emptyvert_add",
- text="Object Origin Only")
+ text="Object Origin Only")
layout.operator("mesh.primitive_symmetrical_vert_add",
- text="Origin & Vert Mirrored")
+ text="Origin & Vert Mirrored")
layout.operator("mesh.primitive_symmetrical_empty_add",
- text="Object Origin Mirrored")
+ text="Object Origin Mirrored")
class INFO_MT_mesh_gears_add(bpy.types.Menu):
@@ -115,9 +121,9 @@ class INFO_MT_mesh_gears_add(bpy.types.Menu):
layout = self.layout
layout.operator_context = 'INVOKE_REGION_WIN'
layout.operator("mesh.primitive_gear",
- text="Gear")
+ text="Gear")
layout.operator("mesh.primitive_worm_gear",
- text="Worm")
+ text="Worm")
class INFO_MT_mesh_diamonds_add(bpy.types.Menu):
@@ -129,11 +135,11 @@ class INFO_MT_mesh_diamonds_add(bpy.types.Menu):
layout = self.layout
layout.operator_context = 'INVOKE_REGION_WIN'
layout.operator("mesh.primitive_brilliant_add",
- text="Brilliant Diamond")
+ text="Brilliant Diamond")
layout.operator("mesh.primitive_diamond_add",
- text="Diamond")
+ text="Diamond")
layout.operator("mesh.primitive_gem_add",
- text="Gem")
+ text="Gem")
class INFO_MT_mesh_math_add(bpy.types.Menu):
@@ -145,9 +151,9 @@ class INFO_MT_mesh_math_add(bpy.types.Menu):
layout = self.layout
layout.operator_context = 'INVOKE_REGION_WIN'
layout.operator("mesh.primitive_z_function_surface",
- text="Z Math Surface")
+ text="Z Math Surface")
layout.operator("mesh.primitive_xyz_function_surface",
- text="XYZ Math Surface")
+ text="XYZ Math Surface")
self.layout.operator("mesh.primitive_solid_add", text="Regular Solid")
@@ -161,19 +167,19 @@ class INFO_MT_mesh_extras_add(bpy.types.Menu):
layout.operator_context = 'INVOKE_REGION_WIN'
layout.menu("INFO_MT_mesh_diamonds_add", text="Diamonds", icon="PMARKER_SEL")
layout.operator("mesh.add_beam",
- text="Beam Builder")
+ text="Beam Builder")
layout.operator("mesh.wall_add",
- text="Wall Factory")
+ text="Wall Factory")
layout.operator("mesh.primitive_star_add",
- text="Simple Star")
+ text="Simple Star")
layout.operator("mesh.primitive_steppyramid_add",
- text="Step Pyramid")
+ text="Step Pyramid")
layout.operator("mesh.honeycomb_add",
- text="Honeycomb")
+ text="Honeycomb")
layout.operator("mesh.primitive_teapot_add",
- text="Teapot+")
+ text="Teapot+")
layout.operator("mesh.menger_sponge_add",
- text="Menger Sponge")
+ text="Menger Sponge")
class INFO_MT_mesh_torus_add(bpy.types.Menu):
@@ -185,11 +191,11 @@ class INFO_MT_mesh_torus_add(bpy.types.Menu):
layout = self.layout
layout.operator_context = 'INVOKE_REGION_WIN'
layout.operator("mesh.primitive_twisted_torus_add",
- text="Twisted Torus")
+ text="Twisted Torus")
layout.operator("mesh.primitive_supertoroid_add",
- text="Supertoroid")
+ text="Supertoroid")
layout.operator("mesh.primitive_torusknot_add",
- text="Torus Knot")
+ text="Torus Knot")
class INFO_MT_mesh_pipe_joints_add(bpy.types.Menu):
@@ -201,64 +207,146 @@ class INFO_MT_mesh_pipe_joints_add(bpy.types.Menu):
layout = self.layout
layout.operator_context = 'INVOKE_REGION_WIN'
layout.operator("mesh.primitive_elbow_joint_add",
- text="Pipe Elbow")
+ text="Pipe Elbow")
layout.operator("mesh.primitive_tee_joint_add",
- text="Pipe T-Joint")
+ text="Pipe T-Joint")
layout.operator("mesh.primitive_wye_joint_add",
- text="Pipe Y-Joint")
+ text="Pipe Y-Joint")
layout.operator("mesh.primitive_cross_joint_add",
- text="Pipe Cross-Joint")
+ text="Pipe Cross-Joint")
layout.operator("mesh.primitive_n_joint_add",
- text="Pipe N-Joint")
+ text="Pipe N-Joint")
+
+
+class discombobulator_scene_props(bpy.types.PropertyGroup):
+
+ DISC_doodads = []
+
+ # Protusions Buttons:
+ repeatprot = IntProperty(
+ name="Repeat protusions",
+ description=("Make several layers of protusion \n"
+ "Use carefully, runs recursively the discombulator"),
+ default=1, min=1, max=4 # set to 4 because it's 2**n reqursive
+ )
+ doprots = BoolProperty(
+ name="Make protusions",
+ description="Check if we want to add protusions to the mesh",
+ default=True
+ )
+ subpolygon1 = BoolProperty(
+ name="1",
+ default=True
+ )
+ subpolygon2 = BoolProperty(
+ name="2",
+ default=True
+ )
+ subpolygon3 = BoolProperty(
+ name="3",
+ default=True
+ )
+ subpolygon4 = BoolProperty(
+ name="4",
+ default=True
+ )
+
+ polygonschangedpercent = FloatProperty(
+ name="Polygon %",
+ description="Percentage of changed polygons",
+ default=1.0
+ )
+ minHeight = FloatProperty(
+ name="Min height",
+ description="Minimal height of the protusions",
+ default=0.2
+ )
+ maxHeight = FloatProperty(
+ name="Max height",
+ description="Maximal height of the protusions",
+ default=0.4
+ )
+ minTaper = FloatProperty(
+ name="Min taper",
+ description="Minimal height of the protusions",
+ default=0.15, min=0.0, max=1.0,
+ subtype='PERCENTAGE'
+ )
+ maxTaper = FloatProperty(
+ name="Max taper",
+ description="Maximal height of the protusions",
+ default=0.35, min=0.0, max=1.0,
+ subtype='PERCENTAGE'
+ )
+ # Doodads buttons:
+ dodoodads = BoolProperty(
+ name="Make doodads",
+ description="Check if we want to generate doodads",
+ default=False
+ )
+ mindoodads = IntProperty(
+ name="Minimum doodads number",
+ description="Ask for the minimum number of doodads to generate per polygon",
+ default=1, min=0, max=50
+ )
+ maxdoodads = IntProperty(
+ name="Maximum doodads number",
+ description="Ask for the maximum number of doodads to generate per polygon",
+ default=6, min=1, max=50
+ )
+ doodMinScale = FloatProperty(
+ name="Scale min", description="Minimum scaling of doodad",
+ default=0.5, min=0.0, max=1.0,
+ subtype='PERCENTAGE'
+ )
+ doodMaxScale = FloatProperty(
+ name="Scale max",
+ description="Maximum scaling of doodad",
+ default=1.0, min=0.0, max=1.0,
+ subtype='PERCENTAGE'
+ )
+ # Materials buttons:
+ sideProtMat = IntProperty(
+ name="Side's prot mat",
+ description="Material of protusion's sides",
+ default=0, min=0
+ )
+ topProtMat = IntProperty(
+ name="Prot's top mat",
+ description="Material of protusion's top",
+ default=0, min=0
+ )
# Register all operators and panels
# Define "Extras" menu
def menu_func(self, context):
- self.layout.separator()
- self.layout.menu("INFO_MT_mesh_vert_add", text="Single Vert", icon="LAYER_ACTIVE")
- self.layout.operator("mesh.primitive_round_cube_add", text="Round Cube", icon="MOD_SUBSURF")
- self.layout.menu("INFO_MT_mesh_math_add", text="Math Function", icon="PACKAGE")
- self.layout.operator("mesh.generate_geodesic_dome", text="Geodesic Dome",icon="MESH_ICOSPHERE")
- self.layout.operator("discombobulate.ops", text="Discombobulator",icon="MESH_ICOSPHERE")
- 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()
+ lay_out = self.layout
+ lay_out.operator_context = 'INVOKE_REGION_WIN'
+ lay_out.separator()
+ lay_out.menu("INFO_MT_mesh_vert_add", text="Single Vert", icon="LAYER_ACTIVE")
+ lay_out.operator("mesh.primitive_round_cube_add", text="Round Cube", icon="MOD_SUBSURF")
+ lay_out.menu("INFO_MT_mesh_math_add", text="Math Function", icon="PACKAGE")
+ lay_out.operator("mesh.generate_geodesic_dome", text="Geodesic Dome", icon="MESH_ICOSPHERE")
+ lay_out.operator("discombobulate.ops", text="Discombobulator", icon="RETOPO")
+ lay_out.menu("INFO_MT_mesh_pipe_joints_add", text="Pipe Joints", icon="SNAP_PEEL_OBJECT")
+ lay_out.menu("INFO_MT_mesh_gears_add", text="Gears", icon="SCRIPTWIN")
+ lay_out.menu("INFO_MT_mesh_torus_add", text="Torus Objects", icon="MESH_TORUS")
+ lay_out.menu("INFO_MT_mesh_extras_add", text="Extras", icon="MESH_DATA")
+ lay_out.separator()
+ lay_out.operator("object.parent_to_empty", text="Parent To Empty", icon="LINK_AREA")
+ lay_out.separator()
def register():
bpy.utils.register_module(__name__)
- # Protusions Buttons:
- bpy.types.Scene.repeatprot = bpy.props.IntProperty(name="Repeat protusions", description="make several layers of protusion", default = 1, min = 1, max = 10)
- bpy.types.Scene.doprots = bpy.props.BoolProperty(name="Make protusions", description = "Check if we want to add protusions to the mesh", default = True)
- bpy.types.Scene.polygonschangedpercent = bpy.props.FloatProperty(name="Polygon %", description = "Percentage of changed polygons", default = 1.0)
- bpy.types.Scene.minHeight = bpy.props.FloatProperty(name="Min height", description="Minimal height of the protusions", default=0.2)
- bpy.types.Scene.maxHeight = bpy.props.FloatProperty(name="Max height", description="Maximal height of the protusions", default = 0.4)
- bpy.types.Scene.minTaper = bpy.props.FloatProperty(name="Min taper", description="Minimal height of the protusions", default=0.15, min = 0.0, max = 1.0, subtype = 'PERCENTAGE')
- bpy.types.Scene.maxTaper = bpy.props.FloatProperty(name="Max taper", description="Maximal height of the protusions", default = 0.35, min = 0.0, max = 1.0, subtype = 'PERCENTAGE')
- bpy.types.Scene.subpolygon1 = bpy.props.BoolProperty(name="1", default = True)
- bpy.types.Scene.subpolygon2 = bpy.props.BoolProperty(name="2", default = True)
- bpy.types.Scene.subpolygon3 = bpy.props.BoolProperty(name="3", default = True)
- bpy.types.Scene.subpolygon4 = bpy.props.BoolProperty(name="4", default = True)
-
- # Doodads buttons:
- bpy.types.Scene.dodoodads = bpy.props.BoolProperty(name="Make doodads", description = "Check if we want to generate doodads", default = True)
- bpy.types.Scene.mindoodads = bpy.props.IntProperty(name="Minimum doodads number", description = "Ask for the minimum number of doodads to generate per polygon", default = 1, min = 0, max = 50)
- bpy.types.Scene.maxdoodads = bpy.props.IntProperty(name="Maximum doodads number", description = "Ask for the maximum number of doodads to generate per polygon", default = 6, min = 1, max = 50)
- bpy.types.Scene.doodMinScale = bpy.props.FloatProperty(name="Scale min", description="Minimum scaling of doodad", default = 0.5, min = 0.0, max = 1.0, subtype = 'PERCENTAGE')
- bpy.types.Scene.doodMaxScale = bpy.props.FloatProperty(name="Scale max", description="Maximum scaling of doodad", default = 1.0, min = 0.0, max = 1.0, subtype = 'PERCENTAGE')
-
- # Materials buttons:
- bpy.types.Scene.sideProtMat = bpy.props.IntProperty(name="Side's prot mat", description = "Material of protusion's sides", default = 0, min = 0)
- bpy.types.Scene.topProtMat = bpy.props.IntProperty(name = "Prot's top mat", description = "Material of protusion's top", default = 0, min = 0)
-
-
+ # Register Discombobulator properties
+ bpy.types.Scene.discomb = bpy.props.PointerProperty(
+ type=discombobulator_scene_props
+ )
+
# Add "Extras" menu to the "Add Mesh" menu
bpy.types.INFO_MT_mesh_add.append(menu_func)
@@ -267,6 +355,8 @@ def unregister():
# Remove "Extras" menu from the "Add Mesh" menu.
bpy.types.INFO_MT_mesh_add.remove(menu_func)
+ del bpy.types.Scene.discomb
+
bpy.utils.unregister_module(__name__)