Addon: Discombobulator: Fixed Doodads Menu section broken
This commit is contained in:
parent
1462828a21
commit
6027fe00c3
|
@ -25,7 +25,7 @@
|
|||
bl_info = {
|
||||
"name": "Discombobulator",
|
||||
"author": "Multiple Authors",
|
||||
"version": (0, 0, 8),
|
||||
"version": (0, 0, 9),
|
||||
"blender": (2, 80, 0),
|
||||
"location": "View3D > Add > Mesh",
|
||||
"description": "Add Discombobulator",
|
||||
|
@ -45,7 +45,13 @@ else:
|
|||
from . import mesh_discombobulator
|
||||
|
||||
import bpy
|
||||
from bpy.types import Menu
|
||||
from bpy.types import (
|
||||
Menu,
|
||||
PropertyGroup,
|
||||
)
|
||||
from bpy.props import (
|
||||
PointerProperty,
|
||||
)
|
||||
|
||||
# Register all operators and panels
|
||||
|
||||
|
@ -58,22 +64,28 @@ def menu_func(self, context):
|
|||
lay_out.operator("discombobulate.ops",
|
||||
text="Discombobulator")
|
||||
|
||||
# Register
|
||||
classes = [
|
||||
|
||||
# Properties
|
||||
class DISCProps(PropertyGroup):
|
||||
DISC_doodads = []
|
||||
|
||||
# Register
|
||||
classes = (
|
||||
mesh_discombobulator.discombobulator,
|
||||
mesh_discombobulator.discombobulator_dodads_list,
|
||||
mesh_discombobulator.discombob_help,
|
||||
mesh_discombobulator.VIEW3D_OT_tools_discombobulate,
|
||||
mesh_discombobulator.chooseDoodad,
|
||||
mesh_discombobulator.unchooseDoodad
|
||||
]
|
||||
mesh_discombobulator.unchooseDoodad,
|
||||
DISCProps
|
||||
)
|
||||
|
||||
def register():
|
||||
from bpy.utils import register_class
|
||||
for cls in classes:
|
||||
register_class(cls)
|
||||
|
||||
bpy.types.Scene.discombobulator = PointerProperty(type=DISCProps)
|
||||
# Add "Extras" menu to the "Add Mesh" menu
|
||||
bpy.types.VIEW3D_MT_mesh_add.append(menu_func)
|
||||
|
||||
|
@ -85,6 +97,8 @@ def unregister():
|
|||
from bpy.utils import unregister_class
|
||||
for cls in reversed(classes):
|
||||
unregister_class(cls)
|
||||
|
||||
del bpy.types.Scene.discombobulator
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
|
|
@ -321,7 +321,7 @@ def angle_between_nor(nor_orig, nor_result):
|
|||
return q
|
||||
|
||||
|
||||
def doodads(object1, mesh1, dmin, dmax):
|
||||
def doodads(self, object1, mesh1, dmin, dmax):
|
||||
"""function to generate the doodads"""
|
||||
global dVerts
|
||||
global dPolygons
|
||||
|
@ -510,7 +510,7 @@ def discombobulate(self, minHeight, maxHeight, minTaper, maxTaper, sf1, sf2, sf3
|
|||
protusions_repeat(object1, mesh1, r_prot)
|
||||
|
||||
if(len(self.DISC_doodads) != 0 and self.dodoodads and isLast):
|
||||
doodads(object1, mesh1, dmin, dmax)
|
||||
doodads(self, 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)
|
||||
|
@ -566,8 +566,10 @@ class chooseDoodad(Operator):
|
|||
obj_name = bpy.context.active_object.name
|
||||
msg = "Object with this name already saved"
|
||||
|
||||
if obj_name not in self.DISC_doodads:
|
||||
self.DISC_doodads.append(obj_name)
|
||||
DISC_doodads = context.scene.discombobulator.DISC_doodads
|
||||
|
||||
if obj_name not in DISC_doodads:
|
||||
DISC_doodads.append(obj_name)
|
||||
msg = "Saved Doodad object: {}".format(obj_name)
|
||||
|
||||
self.report({"INFO"}, message=msg)
|
||||
|
@ -590,15 +592,15 @@ class unchooseDoodad(Operator):
|
|||
|
||||
def execute(self, context):
|
||||
msg = ("No doodads to remove")
|
||||
doodadery = self.DISC_doodads
|
||||
if len(doodadery) > 0:
|
||||
DISC_doodads = context.scene.discombobulator.DISC_doodads
|
||||
if len(DISC_doodads) > 0:
|
||||
if not self.remove_all:
|
||||
name = bpy.context.active_object.name
|
||||
if name in doodadery:
|
||||
self.DISC_doodads.remove(name)
|
||||
if name in DISC_doodads:
|
||||
DISC_doodads.remove(name)
|
||||
msg = ("Removed Doodad object: {}".format(name))
|
||||
else:
|
||||
self.DISC_doodads[:] = []
|
||||
DISC_doodads[:] = []
|
||||
msg = "Removed all Doodads"
|
||||
else:
|
||||
msg = "No Doodads to Remove"
|
||||
|
@ -639,12 +641,14 @@ class discombobulator_dodads_list(Menu):
|
|||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
DISC_doodads = context.scene.discombobulator.DISC_doodads
|
||||
|
||||
doodle = len(self.DISC_doodads)
|
||||
doodle = len(DISC_doodads)
|
||||
layout.label(text="Saved doodads : {}".format(doodle))
|
||||
layout.separator()
|
||||
if doodle > 0:
|
||||
for name in self.DISC_doodads:
|
||||
for name in DISC_doodads:
|
||||
layout.label(text=name)
|
||||
|
||||
|
||||
|
@ -682,8 +686,7 @@ class VIEW3D_OT_tools_discombobulate(Operator):
|
|||
bl_options = {"REGISTER"}
|
||||
|
||||
executing = False
|
||||
|
||||
DISC_doodads = []
|
||||
|
||||
# Protusions Buttons:
|
||||
repeatprot: IntProperty(
|
||||
name="Repeat protusions",
|
||||
|
@ -785,6 +788,8 @@ class VIEW3D_OT_tools_discombobulate(Operator):
|
|||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
self.DISC_doodads = bpy.context.scene.discombobulator.DISC_doodads
|
||||
|
||||
row = layout.row()
|
||||
row.menu("HELP_MT_discombobulator", icon="INFO")
|
||||
|
|
Loading…
Reference in New Issue