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:
authorSpivak Vladimir (cwolf3d) <cwolf3d@gmail.com>2019-02-01 03:42:15 +0300
committerSpivak Vladimir (cwolf3d) <cwolf3d@gmail.com>2019-02-01 03:42:15 +0300
commit9dcdedcaa6c590b73ec01ec9de331b671d68c8c2 (patch)
treeaa82e2e64eae56e22a77edcee4cead93409afd92 /add_mesh_extra_objects
parentcd7ffdb8441f0a547fb0ab7169d361a3b441198d (diff)
Update addon to Blender 2.8
Diffstat (limited to 'add_mesh_extra_objects')
-rw-r--r--add_mesh_extra_objects/__init__.py211
-rw-r--r--add_mesh_extra_objects/add_mesh_beam_builder.py4
-rw-r--r--add_mesh_extra_objects/add_mesh_gears.py12
-rw-r--r--add_mesh_extra_objects/add_mesh_gemstones.py4
-rw-r--r--add_mesh_extra_objects/add_mesh_honeycomb.py2
-rw-r--r--add_mesh_extra_objects/add_mesh_menger_sponge.py4
-rw-r--r--add_mesh_extra_objects/add_mesh_pyramid.py12
-rw-r--r--add_mesh_extra_objects/add_mesh_round_brilliant.py2
-rw-r--r--add_mesh_extra_objects/add_mesh_star.py4
-rw-r--r--add_mesh_extra_objects/add_mesh_twisted_torus.py2
-rw-r--r--add_mesh_extra_objects/add_mesh_vertex.py12
-rw-r--r--add_mesh_extra_objects/geodesic_domes/__init__.py4
-rw-r--r--add_mesh_extra_objects/geodesic_domes/third_domes_panel_271.py32
-rw-r--r--add_mesh_extra_objects/mesh_discombobulator.py245
14 files changed, 293 insertions, 257 deletions
diff --git a/add_mesh_extra_objects/__init__.py b/add_mesh_extra_objects/__init__.py
index c481d53d..bfc0359e 100644
--- a/add_mesh_extra_objects/__init__.py
+++ b/add_mesh_extra_objects/__init__.py
@@ -25,8 +25,8 @@
bl_info = {
"name": "Extra Objects",
"author": "Multiple Authors",
- "version": (0, 3, 2),
- "blender": (2, 74, 5),
+ "version": (0, 3, 3),
+ "blender": (2, 80, 0),
"location": "View3D > Add > Mesh",
"description": "Add extra mesh object types",
"warning": "",
@@ -181,9 +181,9 @@ class VIEW3D_MT_mesh_mech(Menu):
layout = self.layout
layout.operator_context = 'INVOKE_REGION_WIN'
layout.menu("VIEW3D_MT_mesh_pipe_joints_add",
- text="Pipe Joints", icon="SNAP_PEEL_OBJECT")
+ text="Pipe Joints")
layout.menu("VIEW3D_MT_mesh_gears_add",
- text="Gears", icon="SCRIPTWIN")
+ text="Gears")
class VIEW3D_MT_mesh_extras_add(Menu):
@@ -249,104 +249,6 @@ class VIEW3D_MT_mesh_pipe_joints_add(Menu):
layout.operator("mesh.primitive_n_joint_add",
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
@@ -356,50 +258,83 @@ def menu_func(self, context):
lay_out.separator()
lay_out.menu("VIEW3D_MT_mesh_vert_add",
- text="Single Vert", icon="LAYER_ACTIVE")
+ text="Single Vert")
lay_out.operator("mesh.primitive_round_cube_add",
- text="Round Cube", icon="MOD_SUBSURF")
+ text="Round Cube")
lay_out.menu("VIEW3D_MT_mesh_math_add",
text="Math Function", icon="PACKAGE")
lay_out.menu("VIEW3D_MT_mesh_mech_add",
- text="Mechanical", icon="SCRIPTWIN")
+ text="Mechanical")
lay_out.menu("VIEW3D_MT_mesh_torus_add",
- text="Torus Objects", icon="MESH_TORUS")
+ text="Torus Objects")
lay_out.separator()
lay_out.operator("mesh.generate_geodesic_dome",
- text="Geodesic Dome", icon="MESH_ICOSPHERE")
+ text="Geodesic Dome")
lay_out.operator("discombobulate.ops",
- text="Discombobulator", icon="RETOPO")
+ text="Discombobulator")
lay_out.separator()
lay_out.menu("VIEW3D_MT_mesh_extras_add",
- text="Extras", icon="MESH_DATA")
+ text="Extras")
lay_out.separator()
lay_out.operator("object.parent_to_empty",
- text="Parent To Empty", icon="LINK_AREA")
-
+ text="Parent To Empty")
+
+# Register
+classes = [
+ VIEW3D_MT_mesh_vert_add,
+ VIEW3D_MT_mesh_gears_add,
+ VIEW3D_MT_mesh_diamonds_add,
+ VIEW3D_MT_mesh_math_add,
+ VIEW3D_MT_mesh_mech,
+ VIEW3D_MT_mesh_extras_add,
+ VIEW3D_MT_mesh_torus_add,
+ VIEW3D_MT_mesh_pipe_joints_add,
+ add_mesh_star.AddStar,
+ add_mesh_twisted_torus.AddTwistedTorus,
+ add_mesh_gemstones.AddDiamond,
+ add_mesh_gemstones.AddGem,
+ add_mesh_gears.AddGear,
+ add_mesh_gears.AddWormGear,
+ add_mesh_3d_function_surface.AddZFunctionSurface,
+ add_mesh_3d_function_surface.AddXYZFunctionSurface,
+ add_mesh_round_cube.AddRoundCube,
+ add_mesh_supertoroid.add_supertoroid,
+ add_mesh_pyramid.AddPyramid,
+ add_mesh_torusknot.AddTorusKnot,
+ add_mesh_honeycomb.add_mesh_honeycomb,
+ add_mesh_teapot.AddTeapot,
+ add_mesh_pipe_joint.AddElbowJoint,
+ add_mesh_pipe_joint.AddTeeJoint,
+ add_mesh_pipe_joint.AddWyeJoint,
+ add_mesh_pipe_joint.AddCrossJoint,
+ add_mesh_pipe_joint.AddNJoint,
+ add_mesh_solid.Solids,
+ add_mesh_round_brilliant.MESH_OT_primitive_brilliant_add,
+ add_mesh_menger_sponge.AddMengerSponge,
+ add_mesh_vertex.AddVert,
+ add_mesh_vertex.AddEmptyVert,
+ add_mesh_vertex.AddSymmetricalEmpty,
+ add_mesh_vertex.AddSymmetricalVert,
+ add_empty_as_parent.P2E,
+ add_empty_as_parent.PreFix,
+ mesh_discombobulator.discombobulator,
+ mesh_discombobulator.discombobulator_dodads_list,
+ mesh_discombobulator.discombob_help,
+ mesh_discombobulator.VIEW3D_OT_tools_discombobulate,
+ mesh_discombobulator.chooseDoodad,
+ mesh_discombobulator.unchooseDoodad,
+ add_mesh_beam_builder.addBeam,
+ Wallfactory.add_mesh_wallb,
+ add_shape_geodesic.add_corrective_pose_shape_fast,
+ third_domes_panel_271.GenerateGeodesicDome,
+ third_domes_panel_271.DialogOperator,
+ add_mesh_triangles.MakeTriangle
+]
def register():
- bpy.utils.register_module(__name__)
-
- # Register Discombobulator properties
- bpy.types.Scene.discomb = bpy.props.PointerProperty(
- type=discombobulator_scene_props
- )
- # Error messages for Geodesic Domes
- bpy.types.Scene.error_message = StringProperty(
- name="actual error",
- default=""
- )
- bpy.types.Scene.geodesic_not_yet_called = BoolProperty(
- name="geodesic_not_called",
- default=True
- )
- bpy.types.Scene.gd_help_text_width = IntProperty(
- name="Text Width",
- description="The width above which the text wraps",
- default=60,
- max=180, min=20
- )
+ from bpy.utils import register_class
+ for cls in classes:
+ register_class(cls)
# Add "Extras" menu to the "Add Mesh" menu
bpy.types.VIEW3D_MT_mesh_add.append(menu_func)
@@ -408,14 +343,10 @@ def register():
def unregister():
# Remove "Extras" menu from the "Add Mesh" menu.
bpy.types.VIEW3D_MT_mesh_add.remove(menu_func)
-
- del bpy.types.Scene.discomb
- del bpy.types.Scene.error_message
- del bpy.types.Scene.geodesic_not_yet_called
- del bpy.types.Scene.gd_help_text_width
-
- bpy.utils.unregister_module(__name__)
-
+
+ from bpy.utils import unregister_class
+ for cls in reversed(classes):
+ unregister_class(cls)
if __name__ == "__main__":
register()
diff --git a/add_mesh_extra_objects/add_mesh_beam_builder.py b/add_mesh_extra_objects/add_mesh_beam_builder.py
index 04890507..207883cc 100644
--- a/add_mesh_extra_objects/add_mesh_beam_builder.py
+++ b/add_mesh_extra_objects/add_mesh_beam_builder.py
@@ -742,9 +742,9 @@ class addBeam(Operator):
layout = self.layout
box = layout.box()
- split = box.split(percentage=0.85, align=True)
+ split = box.split(factor=0.85, align=True)
split.prop(self, "Type", text="")
- split.prop(self, "Cursor", text="", icon="CURSOR")
+ split.prop(self, "Cursor", text="")
box.prop(self, "beamZ")
box.prop(self, "beamX")
diff --git a/add_mesh_extra_objects/add_mesh_gears.py b/add_mesh_extra_objects/add_mesh_gears.py
index c631f394..6f5cc985 100644
--- a/add_mesh_extra_objects/add_mesh_gears.py
+++ b/add_mesh_extra_objects/add_mesh_gears.py
@@ -261,7 +261,7 @@ def add_gear(teethNum, radius, Ad, De, base, p_angle,
if rack:
teethNum = 1
- print(radius, width, conangle)
+ #print(radius, width, conangle)
scale = (radius - 2 * width * tan(conangle)) / radius
verts = []
@@ -660,8 +660,7 @@ class AddGear(Operator):
)
# Actually create the mesh object from this geometry data.
- base = create_mesh_object(context, verts, [], faces, "Gear")
- obj = base.object
+ obj = create_mesh_object(context, verts, [], faces, "Gear")
# XXX, supporting adding in editmode is move involved
if obj.mode != 'EDIT':
@@ -784,16 +783,15 @@ class AddWormGear(Operator):
)
# Actually create the mesh object from this geometry data.
- base = create_mesh_object(context, verts, [], faces, "Worm Gear")
- obj = base.object
+ obj = create_mesh_object(context, verts, [], faces, "Worm Gear")
# XXX, supporting adding in editmode is move involved
if obj.mode != 'EDIT':
# Create vertex groups from stored vertices.
- tipGroup = obj.vertex_groups.new(name='Tips')
+ tipGroup = obj.vertex_groups.new(name = 'Tips')
tipGroup.add(verts_tip, 1.0, 'ADD')
- valleyGroup = obj.vertex_groups.new('Valleys')
+ valleyGroup = obj.vertex_groups.new(name = 'Valleys')
valleyGroup.add(verts_valley, 1.0, 'ADD')
return {'FINISHED'}
diff --git a/add_mesh_extra_objects/add_mesh_gemstones.py b/add_mesh_extra_objects/add_mesh_gemstones.py
index a07c9f66..3db2af10 100644
--- a/add_mesh_extra_objects/add_mesh_gemstones.py
+++ b/add_mesh_extra_objects/add_mesh_gemstones.py
@@ -182,12 +182,12 @@ def add_diamond(segments, girdle_radius, table_radius,
# Row for flat side
verts_flat.append(len(verts))
- vec = quat * Vector((table_radius, 0.0, height_flat))
+ vec = quat @ Vector((table_radius, 0.0, height_flat))
verts.append(vec)
# Row for the middle/girdle
verts_girdle.append(len(verts))
- vec = quat * Vector((girdle_radius, 0.0, height_middle))
+ vec = quat @ Vector((girdle_radius, 0.0, height_middle))
verts.append(vec)
# Flat face
diff --git a/add_mesh_extra_objects/add_mesh_honeycomb.py b/add_mesh_extra_objects/add_mesh_honeycomb.py
index 90d69b2d..94c6f63f 100644
--- a/add_mesh_extra_objects/add_mesh_honeycomb.py
+++ b/add_mesh_extra_objects/add_mesh_honeycomb.py
@@ -230,7 +230,7 @@ class add_mesh_honeycomb(bpy.types.Operator):
min=1, max=100,
description='Number of the columns'
)
- layers = BoolVectorProperty(
+ layers: BoolVectorProperty(
name="Layers",
size=20,
subtype='LAYER',
diff --git a/add_mesh_extra_objects/add_mesh_menger_sponge.py b/add_mesh_extra_objects/add_mesh_menger_sponge.py
index df4fcb21..20b0d102 100644
--- a/add_mesh_extra_objects/add_mesh_menger_sponge.py
+++ b/add_mesh_extra_objects/add_mesh_menger_sponge.py
@@ -169,7 +169,7 @@ class AddMengerSponge(bpy.types.Operator):
name="Rotation",
subtype='EULER',
)
- layers = BoolVectorProperty(
+ layers: BoolVectorProperty(
name="Layers",
size=20,
subtype='LAYER',
@@ -184,7 +184,7 @@ class AddMengerSponge(bpy.types.Operator):
mesh = bpy.data.meshes.new(name='Sponge')
mesh.from_pydata(vertices, [], faces)
uvs = [(0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0)]
- mesh.uv_textures.new()
+ mesh.uv_layers.new()
for i, uvloop in enumerate(mesh.uv_layers.active.data):
uvloop.uv = uvs[i % 4]
diff --git a/add_mesh_extra_objects/add_mesh_pyramid.py b/add_mesh_extra_objects/add_mesh_pyramid.py
index ec41cc4f..eccfd358 100644
--- a/add_mesh_extra_objects/add_mesh_pyramid.py
+++ b/add_mesh_extra_objects/add_mesh_pyramid.py
@@ -33,7 +33,7 @@ def create_step(width, base_level, step_height, num_sides):
init_vectors = [Vector([rad, 0, base_level])] * len(quaternions)
quat_vector_pairs = list(zip(quaternions, init_vectors))
- vectors = [quaternion * vec for quaternion, vec in quat_vector_pairs]
+ vectors = [quaternion @ vec for quaternion, vec in quat_vector_pairs]
bottom_list = [(vec.x, vec.y, vec.z) for vec in vectors]
top_list = [(vec.x, vec.y, vec.z + step_height) for vec in vectors]
full_list = bottom_list + top_list
@@ -110,31 +110,31 @@ class AddPyramid(Operator, AddObjectHelper):
num_sides: IntProperty(
name="Number Sides",
description="How many sides each step will have",
- min=3, max=20,
+ min=3,
default=4
)
num_steps: IntProperty(
name="Number of Steps",
description="How many steps for the overall pyramid",
- min=1, max=20,
+ min=1,
default=10
)
width: FloatProperty(
name="Initial Width",
description="Initial base step width",
- min=0.01, max=100.0,
+ min=0.01,
default=2
)
height: FloatProperty(
name="Height",
description="How tall each step will be",
- min=0.01, max=100.0,
+ min=0.01,
default=0.1
)
reduce_by: FloatProperty(
name="Reduce Step By",
description="How much to reduce each succeeding step by",
- min=.01, max=2.0,
+ min=.01,
default=.20
)
diff --git a/add_mesh_extra_objects/add_mesh_round_brilliant.py b/add_mesh_extra_objects/add_mesh_round_brilliant.py
index 7794269e..b8bf393a 100644
--- a/add_mesh_extra_objects/add_mesh_round_brilliant.py
+++ b/add_mesh_extra_objects/add_mesh_round_brilliant.py
@@ -230,7 +230,7 @@ def addBrilliant(context, s, table_w, crown_h, girdle_t, pavi_d, bezel_f,
# Create object and link it into scene.
from bpy_extras import object_utils
- dobj = object_utils.object_data_add(context, dmesh, operator=None, name="dobj").object
+ dobj = object_utils.object_data_add(context, dmesh, operator=None, name="dobj")
# activate and select object
bpy.context.view_layer.objects.active = dobj
diff --git a/add_mesh_extra_objects/add_mesh_star.py b/add_mesh_extra_objects/add_mesh_star.py
index 411fa91d..265f9a80 100644
--- a/add_mesh_extra_objects/add_mesh_star.py
+++ b/add_mesh_extra_objects/add_mesh_star.py
@@ -123,11 +123,11 @@ def add_star(points, outer_radius, inner_radius, height):
radius = inner_radius
edgeloop_top.append(len(verts))
- vec = quat * Vector((radius, 0, half_height))
+ vec = quat @ Vector((radius, 0, half_height))
verts.append(vec)
edgeloop_bottom.append(len(verts))
- vec = quat * Vector((radius, 0, -half_height))
+ vec = quat @ Vector((radius, 0, -half_height))
verts.append(vec)
faces_top = createFaces([vert_idx_top], edgeloop_top, closed=True)
diff --git a/add_mesh_extra_objects/add_mesh_twisted_torus.py b/add_mesh_extra_objects/add_mesh_twisted_torus.py
index 17d3f1a9..f9a4cc70 100644
--- a/add_mesh_extra_objects/add_mesh_twisted_torus.py
+++ b/add_mesh_extra_objects/add_mesh_twisted_torus.py
@@ -110,7 +110,7 @@ def add_twisted_torus(major_rad, minor_rad, major_seg, minor_seg, twists):
major_rad + (cos(angle) * minor_rad),
0.0,
sin(angle) * minor_rad))
- vec = quat * vec
+ vec = quat @ vec
edgeloop.append(len(verts))
verts.append(vec)
diff --git a/add_mesh_extra_objects/add_mesh_vertex.py b/add_mesh_extra_objects/add_mesh_vertex.py
index da4eb33a..88b9d345 100644
--- a/add_mesh_extra_objects/add_mesh_vertex.py
+++ b/add_mesh_extra_objects/add_mesh_vertex.py
@@ -106,9 +106,9 @@ class AddSymmetricalEmpty(Operator):
layout.label(text="Mirror Axis")
row = layout.row(align=True)
- row.prop(mirror, "use_x")
- row.prop(mirror, "use_y")
- row.prop(mirror, "use_z")
+ row.prop(mirror, "use_axis")
+ row.prop(mirror, "use_axis")
+ row.prop(mirror, "use_axis")
def execute(self, context):
Add_Symmetrical_Empty()
@@ -130,9 +130,9 @@ class AddSymmetricalVert(Operator):
layout.label(text="Mirror Axis")
row = layout.row(align=True)
- row.prop(mirror, "use_x")
- row.prop(mirror, "use_y")
- row.prop(mirror, "use_z")
+ row.prop(mirror, "use_axis")
+ row.prop(mirror, "use_axis")
+ row.prop(mirror, "use_axis")
def execute(self, context):
Add_Symmetrical_Vert()
diff --git a/add_mesh_extra_objects/geodesic_domes/__init__.py b/add_mesh_extra_objects/geodesic_domes/__init__.py
index 54ad464a..e183dfa5 100644
--- a/add_mesh_extra_objects/geodesic_domes/__init__.py
+++ b/add_mesh_extra_objects/geodesic_domes/__init__.py
@@ -19,8 +19,8 @@
bl_info = {
"name": "Geodesic Domes2",
"author": "Noctumsolis, PKHG, Meta Androcto, Andy Houston",
- "version": (0, 3, 2),
- "blender": (2, 71, 0),
+ "version": (0, 3, 3),
+ "blender": (2, 80, 0),
"location": "Toolshelf > Create Tab",
"description": "Create geodesic dome type objects.",
"warning": "",
diff --git a/add_mesh_extra_objects/geodesic_domes/third_domes_panel_271.py b/add_mesh_extra_objects/geodesic_domes/third_domes_panel_271.py
index 5b51c1f2..3cf1e063 100644
--- a/add_mesh_extra_objects/geodesic_domes/third_domes_panel_271.py
+++ b/add_mesh_extra_objects/geodesic_domes/third_domes_panel_271.py
@@ -16,12 +16,13 @@ from bpy.props import (
from math import pi
from mathutils import Vector # used for vertex.vector values
-
# global #
last_generated_object = None
last_imported_mesh = None
basegeodesic = None
imported_hubmesh_to_use = None
+error_message = ""
+geodesic_not_yet_called = True
# global end #
# ###### EIND FOR SHAPEKEYS ######
@@ -1087,14 +1088,14 @@ class GenerateGeodesicDome(Operator):
multi_label(help_text, box, text_width)
def execute(self, context):
- global last_generated_object, last_imported_mesh, basegeodesic, imported_hubmesh_to_use
+ global last_generated_object, last_imported_mesh, basegeodesic, imported_hubmesh_to_use, error_message
# default superformparam = [3, 10, 10, 10, 1, 1, 4, 10, 10, 10, 1, 1, 0, 0, 0.0, 0.0, 0, 0]]
superformparam = [self.um, self.un1, self.un2, self.un3, self.ua,
self.ub, self.vm, self.vn1, self.vn2, self.vn3,
self.va, self.vb, self.uact, self.vact,
self.uturn * pi, self.vturn * pi,
self.utwist, self.vtwist]
- context.scene.error_message = ""
+ error_message = ""
if self.mainpages == 'Main':
if self.geodesic_types == "Geodesic":
tmp_fs = self.tri_hex_star
@@ -1170,7 +1171,7 @@ class GenerateGeodesicDome(Operator):
obj_name = self.import_mesh_name
if obj_name == "None":
message = "Fill in a name \nof an existing mesh\nto be imported"
- context.scene.error_message = message
+ error_message = message
self.report({"INFO"}, message)
print("***INFO*** You have to fill in the name of an existing mesh")
else:
@@ -1185,7 +1186,7 @@ class GenerateGeodesicDome(Operator):
bpy.context.active_object.location = (0, 0, 0)
else:
message = obj_name + " does not exist \nor is not a Mesh"
- context.scene.error_message = message
+ error_message = message
bpy.ops.object.dialog_operator('INVOKE_DEFAULT')
self.report({'ERROR'}, message)
print("***ERROR***" + obj_name + " does not exist or is not a Mesh")
@@ -1218,12 +1219,12 @@ class GenerateGeodesicDome(Operator):
except:
message = "***ERROR*** \nEither no mesh for hub\nor " + \
hmeshname + " available"
- context.scene.error_message = message
+ error_message = message
bpy.ops.object.dialog_operator('INVOKE_DEFAULT')
print(message)
else:
message = "***INFO***\nEnable Hubs first"
- context.scene.error_message = message
+ error_message = message
print("\n***INFO*** Enable Hubs first")
elif self.mainpages == "Struts":
struttype = self.struttype
@@ -1255,7 +1256,7 @@ class GenerateGeodesicDome(Operator):
last_generated_object.location = (0, 0, 0)
else:
message = "***ERROR***\nStrut object " + strutimpmesh + "\nis not a Mesh"
- context.scene.error_message = message
+ error_message = message
bpy.ops.object.dialog_operator('INVOKE_DEFAULT')
print("***ERROR*** Strut object is not a Mesh")
else:
@@ -1287,7 +1288,7 @@ class GenerateGeodesicDome(Operator):
)
else:
message = "***ERROR***\nNo imported message available\n" + "last geodesic used"
- context.scene.error_message = message
+ error_message = message
bpy.ops.object.dialog_operator('INVOKE_DEFAULT')
print("\n***ERROR*** No imported mesh available \nLast geodesic used!")
faceobject = vefm_271.facetype(
@@ -1325,7 +1326,7 @@ class GenerateGeodesicDome(Operator):
except:
message = "***ERROR***\n Contakt PKHG, something wrong happened"
- context.scene.error_message = message
+ error_message = message
bpy.ops.object.dialog_operator('INVOKE_DEFAULT')
if self.load_parameters:
@@ -1352,17 +1353,16 @@ class GenerateGeodesicDome(Operator):
# bpy.context.scene.instant_filenames = filenames
except:
message = "***ERROR***\n Contakt PKHG,\nsomething went wrong reading params happened"
- context.scene.error_message = message
+ error_message = message
bpy.ops.object.dialog_operator('INVOKE_DEFAULT')
return {'FINISHED'}
def invoke(self, context, event):
- global basegeodesic
+ global basegeodesic, geodesic_not_yet_called
bpy.ops.view3d.snap_cursor_to_center()
- tmp = context.scene.geodesic_not_yet_called
- if tmp:
- context.scene.geodesic_not_yet_called = False
+ if geodesic_not_yet_called:
+ geodesic_not_yet_called = False
self.execute(context)
return {'FINISHED'}
@@ -1436,7 +1436,7 @@ class DialogOperator(Operator):
def draw(self, context):
layout = self.layout
- message = context.scene.error_message
+ message = error_message
col = layout.column()
tmp = message.split("\n")
for el in tmp:
diff --git a/add_mesh_extra_objects/mesh_discombobulator.py b/add_mesh_extra_objects/mesh_discombobulator.py
index f31c3e62..f1d564ac 100644
--- a/add_mesh_extra_objects/mesh_discombobulator.py
+++ b/add_mesh_extra_objects/mesh_discombobulator.py
@@ -11,6 +11,12 @@ from mathutils import (
Vector,
Quaternion,
)
+from bpy.props import (
+ BoolProperty,
+ IntProperty,
+ FloatProperty,
+ StringProperty,
+ )
# ################### Globals #################### #
@@ -23,7 +29,7 @@ Verts = []
Polygons = []
dVerts = []
dPolygons = []
-i_prots = [] # index of the top polygons on which we'll generate the doodads
+i_prots = [] # index of the top polygons on which we"ll generate the doodads
i_dood_type = [] # type of doodad (given by index of the doodad obj)
@@ -332,18 +338,18 @@ def doodads(object1, mesh1, dmin, dmax):
while(j <= doods_nbr):
origin_dood = randVertex(object1.data.polygons[i].vertices[0], object1.data.polygons[i].vertices[1],
object1.data.polygons[i].vertices[2], object1.data.polygons[i].vertices[3], Verts)
- type_dood = random.randint(0, len(bpy.context.scene.discomb.DISC_doodads) - 1)
+ type_dood = random.randint(0, len(self.DISC_doodads) - 1)
polygons_add = []
verts_add = []
# First we have to apply scaling and rotation to the mesh
- bpy.ops.object.select_pattern(pattern=bpy.context.scene.discomb.DISC_doodads[type_dood], extend=False)
- bpy.context.view_layer.objects.active = bpy.data.objects[bpy.context.scene.discomb.DISC_doodads[type_dood]]
+ bpy.ops.object.select_pattern(pattern=self.DISC_doodads[type_dood], extend=False)
+ bpy.context.view_layer.objects.active = bpy.data.objects[self.DISC_doodads[type_dood]]
bpy.ops.object.transform_apply(location=False, rotation=True, scale=True)
- for polygon in bpy.data.objects[bpy.context.scene.discomb.DISC_doodads[type_dood]].data.polygons:
+ for polygon in bpy.data.objects[self.DISC_doodads[type_dood]].data.polygons:
polygons_add.append(polygon.vertices)
- for vertex in bpy.data.objects[bpy.context.scene.discomb.DISC_doodads[type_dood]].data.vertices:
+ for vertex in bpy.data.objects[self.DISC_doodads[type_dood]].data.vertices:
verts_add.append(vertex.co.copy())
normal_original_polygon = object1.data.polygons[i].normal
@@ -361,7 +367,7 @@ def doodads(object1, mesh1, dmin, dmax):
for polygon in polygons_add:
dPolygons.append([polygon[0] + findex, polygon[1] + findex, polygon[2] + findex, polygon[3] + findex])
- i_dood_type.append(bpy.data.objects[bpy.context.scene.discomb.DISC_doodads[type_dood]].name)
+ i_dood_type.append(bpy.data.objects[self.DISC_doodads[type_dood]].name)
for vertex in verts_add:
dVerts.append(vertex)
@@ -402,11 +408,11 @@ def setMatProt(discObj, origObj, sideProtMat, topProtMat):
polygon.material_index = 1
-def setMatDood(doodObj):
+def setMatDood(self, doodObj):
# First we add the materials slots
bpy.ops.object.select_pattern(pattern=doodObj.name, extend=False)
bpy.context.view_layer.objects.active = doodObj
- for name in bpy.context.scene.discomb.DISC_doodads:
+ for name in self.DISC_doodads:
try:
bpy.ops.object.material_slot_add()
doodObj.material_slots[-1].material = bpy.data.objects[name].material_slots[0].material
@@ -417,15 +423,15 @@ def setMatDood(doodObj):
print()
-def clean_doodads():
- current_doodads = list(bpy.context.scene.discomb.DISC_doodads)
+def clean_doodads(self):
+ current_doodads = list(self.DISC_doodads)
for name in current_doodads:
if name not in bpy.data.objects:
- bpy.context.scene.discomb.DISC_doodads.remove(name)
+ self.DISC_doodads.remove(name)
-def discombobulate(minHeight, maxHeight, minTaper, maxTaper, sf1, sf2, sf3, sf4,
+def discombobulate(self, minHeight, maxHeight, minTaper, maxTaper, sf1, sf2, sf3, sf4,
dmin, dmax, r_prot, sideProtMat, topProtMat, isLast):
global doprots
global nVerts
@@ -438,8 +444,8 @@ def discombobulate(minHeight, maxHeight, minTaper, maxTaper, sf1, sf2, sf3, sf4,
bpy.ops.object.mode_set(mode="OBJECT")
- # start by cleaning up doodads that don't exist anymore
- clean_doodads()
+ # start by cleaning up doodads that don"t exist anymore
+ clean_doodads(self)
# Create the discombobulated mesh
mesh = bpy.data.meshes.new("tmp")
@@ -490,27 +496,27 @@ def discombobulate(minHeight, maxHeight, minTaper, maxTaper, sf1, sf2, sf3, sf4,
mesh1.from_pydata(Verts, [], Polygons)
mesh1.update(calc_edges=True)
- # Set the material's of discombobulated object
+ # Set the material"s of discombobulated object
setMatProt(object1, origObj, sideProtMat, topProtMat)
bpy.ops.object.select_pattern(pattern=object1.name, extend=False)
bpy.context.view_layer.objects.active = bpy.data.objects[object1.name]
- bpy.ops.object.mode_set(mode='EDIT')
+ bpy.ops.object.mode_set(mode="EDIT")
bpy.ops.mesh.normals_make_consistent(inside=False)
- bpy.ops.mesh.select_all(action='DESELECT')
- bpy.ops.object.mode_set(mode='OBJECT')
+ bpy.ops.mesh.select_all(action="DESELECT")
+ bpy.ops.object.mode_set(mode="OBJECT")
# if(bpy.context.scene.repeatprot):
protusions_repeat(object1, mesh1, r_prot)
- if(len(bpy.context.scene.discomb.DISC_doodads) != 0 and bpy.context.scene.discomb.dodoodads and isLast):
+ if(len(self.DISC_doodads) != 0 and self.dodoodads and isLast):
doodads(object1, mesh1, dmin, dmax)
mesh2 = bpy.data.meshes.new("dood_mesh")
object2 = bpy.data.objects.new("dood_obj", mesh2)
bpy.context.collection.objects.link(object2)
mesh2.from_pydata(dVerts, [], dPolygons)
mesh2.update(calc_edges=True)
- setMatDood(object2)
+ setMatDood(self, object2)
object2.location = to_translate
object2.rotation_euler = to_rotate
object2.scale = to_scale
@@ -540,7 +546,7 @@ class chooseDoodad(Operator):
bl_label = "Discombobulate set doodad object"
bl_description = ("Save the Active Object as Doodad \n"
"Object has to be quads only")
- bl_options = {'REGISTER'}
+ bl_options = {"REGISTER"}
@classmethod
def poll(cls, context):
@@ -560,22 +566,22 @@ class chooseDoodad(Operator):
obj_name = bpy.context.active_object.name
msg = "Object with this name already saved"
- if obj_name not in bpy.context.scene.discomb.DISC_doodads:
- bpy.context.scene.discomb.DISC_doodads.append(obj_name)
+ if obj_name not in self.DISC_doodads:
+ self.DISC_doodads.append(obj_name)
msg = "Saved Doodad object: {}".format(obj_name)
- self.report({'INFO'}, message=msg)
+ self.report({"INFO"}, message=msg)
def invoke(self, context, event):
self.execute(context)
- return {'FINISHED'}
+ return {"FINISHED"}
class unchooseDoodad(Operator):
bl_idname = "object.discombobulate_unset_doodad"
bl_label = "Discombobulate unset doodad object"
bl_description = "Remove the saved Doodad Object(s)"
- bl_options = {'REGISTER'}
+ bl_options = {"REGISTER"}
remove_all: bpy.props.BoolProperty(
name="Remove all Doodads",
@@ -584,24 +590,24 @@ class unchooseDoodad(Operator):
def execute(self, context):
msg = ("No doodads to remove")
- doodadery = bpy.context.scene.discomb.DISC_doodads
+ doodadery = self.DISC_doodads
if len(doodadery) > 0:
if not self.remove_all:
name = bpy.context.active_object.name
if name in doodadery:
- bpy.context.scene.discomb.DISC_doodads.remove(name)
+ self.DISC_doodads.remove(name)
msg = ("Removed Doodad object: {}".format(name))
else:
- bpy.context.scene.discomb.DISC_doodads[:] = []
+ self.DISC_doodads[:] = []
msg = "Removed all Doodads"
else:
msg = "No Doodads to Remove"
- self.report({'INFO'}, message=msg)
+ self.report({"INFO"}, message=msg)
def invoke(self, context, event):
self.execute(context)
- return {'FINISHED'}
+ return {"FINISHED"}
# ################## Interpolygon ################## #
@@ -610,36 +616,35 @@ class discombobulator(Operator):
bl_idname = "object.discombobulate"
bl_label = "Discombobulate"
bl_description = "Apply"
- bl_options = {'REGISTER', 'UNDO'}
+ bl_options = {"REGISTER", "UNDO"}
def execute(self, context):
- scn = context.scene.discomb
i = 0
- while i < bpy.context.scene.discomb.repeatprot:
+ while i < self.repeatprot:
isLast = False
- if i == scn.repeatprot - 1:
+ if i == self.repeatprot - 1:
isLast = True
- discombobulate(scn.minHeight, scn.maxHeight, scn.minTaper, scn.maxTaper, scn.subpolygon1,
- scn.subpolygon2, scn.subpolygon3, scn.subpolygon4, scn.mindoodads, scn.maxdoodads,
- scn.repeatprot, scn.sideProtMat, scn.topProtMat, isLast)
+ discombobulate(self.minHeight, self.maxHeight, self.minTaper, self.maxTaper, self.subpolygon1,
+ self.subpolygon2, self.subpolygon3, self.subpolygon4, self.mindoodads, self.maxdoodads,
+ self.repeatprot, self.sideProtMat, self.topProtMat, isLast)
i += 1
- return {'FINISHED'}
+ return {"FINISHED"}
class discombobulator_dodads_list(Menu):
bl_idname = "OBJECT_MT_discombobulator_dodad_list"
bl_label = "List of saved Doodads"
bl_description = "List of the saved Doodad Object Names"
- bl_options = {'REGISTER'}
+ bl_options = {"REGISTER"}
def draw(self, context):
layout = self.layout
- doodle = len(bpy.context.scene.discomb.DISC_doodads)
+ doodle = len(self.DISC_doodads)
layout.label(text="Saved doodads : {}".format(doodle))
layout.separator()
if doodle > 0:
- for name in bpy.context.scene.discomb.DISC_doodads:
+ for name in self.DISC_doodads:
layout.label(text=name)
@@ -647,7 +652,7 @@ class discombob_help(Menu):
bl_idname = "HELP_MT_discombobulator"
bl_label = "Usage Information"
bl_description = "Help"
- bl_options = {'REGISTER'}
+ bl_options = {"REGISTER"}
def draw(self, context):
layout = self.layout
@@ -669,15 +674,109 @@ class discombob_help(Menu):
layout.label(text="If possible, avoid using on a high polycount base mesh")
layout.label("(It can run out of memory and take a long time to compute)")
-
class VIEW3D_OT_tools_discombobulate(Operator):
bl_idname = "discombobulate.ops"
bl_label = "Discombobulator"
bl_description = ("Easily add sci-fi details to a surface \n"
"Needs an existing active Mesh with Faces")
- bl_options = {'REGISTER'}
+ bl_options = {"REGISTER"}
executing = False
+
+ 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
+ )
@classmethod
def poll(cls, context):
@@ -688,48 +787,48 @@ class VIEW3D_OT_tools_discombobulate(Operator):
layout = self.layout
row = layout.row()
- row.menu('HELP_MT_discombobulator', icon='INFO')
+ row.menu("HELP_MT_discombobulator", icon="INFO")
box = layout.box()
box.label(text="Protusions settings")
row = box.row()
- row.prop(context.scene.discomb, 'doprots')
+ row.prop(self, "doprots")
row = box.row()
- row.prop(context.scene.discomb, 'minHeight')
+ row.prop(self, "minHeight")
row = box.row()
- row.prop(context.scene.discomb, 'maxHeight')
+ row.prop(self, "maxHeight")
row = box.row()
- row.prop(context.scene.discomb, 'minTaper')
+ row.prop(self, "minTaper")
row = box.row()
- row.prop(context.scene.discomb, 'maxTaper')
+ row.prop(self, "maxTaper")
row = box.row()
col1 = row.column(align=True)
- col1.prop(context.scene.discomb, "subpolygon1")
+ col1.prop(self, "subpolygon1")
col2 = row.column(align=True)
- col2.prop(context.scene.discomb, "subpolygon2")
+ col2.prop(self, "subpolygon2")
col3 = row.column(align=True)
- col3.prop(context.scene.discomb, "subpolygon3")
+ col3.prop(self, "subpolygon3")
col4 = row.column(align=True)
- col4.prop(context.scene.discomb, "subpolygon4")
+ col4.prop(self, "subpolygon4")
row = box.row()
- row.prop(context.scene.discomb, "repeatprot")
+ row.prop(self, "repeatprot")
box = layout.box()
box.label(text="Doodads settings")
row = box.row()
- is_doodad = context.scene.discomb.dodoodads
- row.prop(context.scene.discomb, 'dodoodads')
+ is_doodad = self.dodoodads
+ row.prop(self, "dodoodads")
row = box.row()
row.enabled = is_doodad
- row.prop(context.scene.discomb, "mindoodads")
+ row.prop(self, "mindoodads")
row = box.row()
row.enabled = is_doodad
- row.prop(context.scene.discomb, "maxdoodads")
+ row.prop(self, "maxdoodads")
row = box.row()
row.enabled = is_doodad
- row.operator("object.discombobulate_set_doodad", text="Pick doodad")
+ oper = row.operator("object.discombobulate_set_doodad", text="Pick doodad")
row = box.row()
- splits = row.split(0.5)
+ splits = row.split(factor = 0.5)
splits.enabled = is_doodad
splits.operator("object.discombobulate_unset_doodad",
text="Remove active doodad").remove_all = False
@@ -737,7 +836,7 @@ class VIEW3D_OT_tools_discombobulate(Operator):
text="Remove all doodads").remove_all = True
col = box.column(align=True)
- doodle = len(bpy.context.scene.discomb.DISC_doodads)
+ doodle = len(self.DISC_doodads)
col.enabled = (True if doodle > 0 else False)
col.menu("OBJECT_MT_discombobulator_dodad_list",
@@ -746,9 +845,9 @@ class VIEW3D_OT_tools_discombobulate(Operator):
box = layout.box()
box.label(text="Materials settings")
row = box.row()
- row.prop(context.scene.discomb, 'topProtMat')
+ row.prop(self, "topProtMat")
row = box.row()
- row.prop(context.scene.discomb, "sideProtMat")
+ row.prop(self, "sideProtMat")
def invoke(self, context, event):
return context.window_manager.invoke_props_dialog(self, width=300)
@@ -758,6 +857,14 @@ class VIEW3D_OT_tools_discombobulate(Operator):
def execute(self, context):
self.executing = True
- bpy.ops.object.discombobulate('INVOKE_DEFAULT')
-
- return {'FINISHED'}
+ i = 0
+ while i < self.repeatprot:
+ isLast = False
+ if i == self.repeatprot - 1:
+ isLast = True
+ discombobulate(self, self.minHeight, self.maxHeight, self.minTaper, self.maxTaper, self.subpolygon1,
+ self.subpolygon2, self.subpolygon3, self.subpolygon4, self.mindoodads, self.maxdoodads,
+ self.repeatprot, self.sideProtMat, self.topProtMat, isLast)
+ i += 1
+ return {"FINISHED"}
+ #bpy.ops.object.discombobulate("INVOKE_DEFAULT")