diff options
author | meta-androcto <meta.androcto1@gmail.com> | 2017-06-15 15:06:00 +0300 |
---|---|---|
committer | meta-androcto <meta.androcto1@gmail.com> | 2017-06-15 15:06:00 +0300 |
commit | c6676127556e5756e4c94f39784d27149f2eb86d (patch) | |
tree | a97b100b59224a3c3b8954b891968c4afa9bea79 | |
parent | 17d293687324e86b2e94e6ca3574e294f3da3667 (diff) |
add advanced objects: split to 2 folders menu and panel
-rw-r--r-- | add_advanced_objects/delaunay_voronoi/__init__.py | 51 | ||||
-rw-r--r-- | add_advanced_objects_menu/__init__.py (renamed from add_advanced_objects/__init__.py) | 222 | ||||
-rw-r--r-- | add_advanced_objects_menu/add_light_template.py (renamed from add_advanced_objects/add_light_template.py) | 0 | ||||
-rw-r--r-- | add_advanced_objects_menu/add_mesh_aggregate.py (renamed from add_advanced_objects/add_mesh_aggregate.py) | 0 | ||||
-rw-r--r-- | add_advanced_objects_menu/arrange_on_curve.py (renamed from add_advanced_objects/arrange_on_curve.py) | 0 | ||||
-rw-r--r-- | add_advanced_objects_menu/circle_array.py (renamed from add_advanced_objects/circle_array.py) | 0 | ||||
-rw-r--r-- | add_advanced_objects_menu/copy2.py (renamed from add_advanced_objects/copy2.py) | 0 | ||||
-rw-r--r-- | add_advanced_objects_menu/cubester.py (renamed from add_advanced_objects/cubester.py) | 0 | ||||
-rw-r--r-- | add_advanced_objects_menu/make_struts.py (renamed from add_advanced_objects/make_struts.py) | 0 | ||||
-rw-r--r-- | add_advanced_objects_menu/mesh_easylattice.py (renamed from add_advanced_objects/mesh_easylattice.py) | 0 | ||||
-rw-r--r-- | add_advanced_objects_menu/object_add_chain.py (renamed from add_advanced_objects/object_add_chain.py) | 0 | ||||
-rw-r--r-- | add_advanced_objects_menu/oscurart_chain_maker.py (renamed from add_advanced_objects/oscurart_chain_maker.py) | 0 | ||||
-rw-r--r-- | add_advanced_objects_menu/pixelate_3d.py (renamed from add_advanced_objects/pixelate_3d.py) | 0 | ||||
-rw-r--r-- | add_advanced_objects_menu/random_box_structure.py (renamed from add_advanced_objects/random_box_structure.py) | 0 | ||||
-rw-r--r-- | add_advanced_objects_menu/rope_alpha.py (renamed from add_advanced_objects/rope_alpha.py) | 0 | ||||
-rw-r--r-- | add_advanced_objects_menu/scene_objects_bi.py (renamed from add_advanced_objects/scene_objects_bi.py) | 0 | ||||
-rw-r--r-- | add_advanced_objects_menu/scene_objects_cycles.py (renamed from add_advanced_objects/scene_objects_cycles.py) | 0 | ||||
-rw-r--r-- | add_advanced_objects_menu/scene_texture_render.py (renamed from add_advanced_objects/scene_texture_render.py) | 0 | ||||
-rw-r--r-- | add_advanced_objects_menu/trilighting.py (renamed from add_advanced_objects/trilighting.py) | 0 | ||||
-rw-r--r-- | add_advanced_objects_panels/DelaunayVoronoi.py (renamed from add_advanced_objects/delaunay_voronoi/DelaunayVoronoi.py) | 0 | ||||
-rw-r--r-- | add_advanced_objects_panels/__init__.py | 467 | ||||
-rw-r--r-- | add_advanced_objects_panels/delaunay_voronoi.py (renamed from add_advanced_objects/delaunay_voronoi/delaunayVoronoiBlender.py) | 56 | ||||
-rw-r--r-- | add_advanced_objects_panels/drop_to_ground.py (renamed from add_advanced_objects/drop_to_ground.py) | 3 | ||||
-rw-r--r-- | add_advanced_objects_panels/object_laplace_lightning.py (renamed from add_advanced_objects/object_laplace_lightning.py) | 2 | ||||
-rw-r--r-- | add_advanced_objects_panels/object_mangle_tools.py (renamed from add_advanced_objects/object_mangle_tools.py) | 1 | ||||
-rw-r--r-- | add_advanced_objects_panels/oscurart_constellation.py (renamed from add_advanced_objects/delaunay_voronoi/oscurart_constellation.py) | 26 | ||||
-rw-r--r-- | add_advanced_objects_panels/unfold_transition.py (renamed from add_advanced_objects/unfold_transition.py) | 16 |
27 files changed, 551 insertions, 293 deletions
diff --git a/add_advanced_objects/delaunay_voronoi/__init__.py b/add_advanced_objects/delaunay_voronoi/__init__.py deleted file mode 100644 index c32eb374..00000000 --- a/add_advanced_objects/delaunay_voronoi/__init__.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding:utf-8 -*- - -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -bl_info = { - "name": "Delaunay Voronoi", - "description": "Points cloud Delaunay triangulation in 2.5D " - "(suitable for terrain modelling) or Voronoi diagram in 2D", - "author": "Domlysz, Oscurart", - "version": (1, 3), - "blender": (2, 7, 0), - "location": "View3D > Tools > GIS", - "warning": "", - "wiki_url": "https://github.com/domlysz/BlenderGIS/wiki", - "category": "" - } - -if "bpy" in locals(): - import importlib - importlib.reload(oscurart_constellation) - -else: - from . import oscurart_constellation - -import bpy -from .delaunayVoronoiBlender import ToolsPanelDelaunay - - -# Register -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) diff --git a/add_advanced_objects/__init__.py b/add_advanced_objects_menu/__init__.py index 4a70f83d..b1d86454 100644 --- a/add_advanced_objects/__init__.py +++ b/add_advanced_objects_menu/__init__.py @@ -44,23 +44,16 @@ if "bpy" in locals(): importlib.reload(trilighting) importlib.reload(pixelate_3d) importlib.reload(object_add_chain) - importlib.reload(drop_to_ground) importlib.reload(circle_array) - importlib.reload(unfold_transition) importlib.reload(copy2) importlib.reload(make_struts) importlib.reload(random_box_structure) importlib.reload(cubester) importlib.reload(rope_alpha) importlib.reload(add_mesh_aggregate) - importlib.reload(object_mangle_tools) importlib.reload(arrange_on_curve) - importlib.reload(object_laplace_lightning) importlib.reload(mesh_easylattice) - importlib.reload(DelaunayVoronoi) - importlib.reload(delaunayVoronoiBlender) - importlib.reload(oscurart_constellation) - importlib.reload(oscurart_chain_maker) + else: from . import add_light_template @@ -70,24 +63,16 @@ else: from . import trilighting from . import pixelate_3d from . import object_add_chain - from . import oscurart_chain_maker - from . import drop_to_ground from . import circle_array - from . import unfold_transition from . import copy2 from . import make_struts from . import random_box_structure from . import cubester from . import rope_alpha from . import add_mesh_aggregate - from . import object_mangle_tools from . import arrange_on_curve - from . import object_laplace_lightning from . import mesh_easylattice - from .delaunay_voronoi import DelaunayVoronoi - from .delaunay_voronoi import delaunayVoronoiBlender - from .delaunay_voronoi import oscurart_constellation import bpy from bpy.types import ( @@ -256,6 +241,7 @@ class AdvancedObjPreferences(AddonPreferences): box.label(text="Physics Tools:", icon="LAYER_ACTIVE") box.label(text="Drop to Ground, Wrecking Ball and Cloth Rope", icon="LAYER_USED") + icon_2 = "TRIA_RIGHT" if not self.show_panel_list else "TRIA_DOWN" box = layout.box() box.prop(self, "show_panel_list", emboss=False, icon=icon_2) @@ -263,14 +249,8 @@ class AdvancedObjPreferences(AddonPreferences): if self.show_panel_list: box.label(text="Panels located in 3D View Tools Region > Create", icon="LAYER_ACTIVE") - box.label(text="Drop to Ground", icon="LAYER_USED") - box.label(text="Unfold Transition", icon="LAYER_USED") box.label(text="CubeSter", icon="LAYER_USED") - box.label(text="Mangle tools", icon="LAYER_USED") - box.label(text="Laplacian Lighting", icon="LAYER_USED") - box.label(text="Delaunay Voronoi", icon="LAYER_USED") - box.label(text="Duplicate on Curve (Shown if an Active Curve Object is it the 3D View)", - icon="LAYER_USED") + # Cubester update functions @@ -556,202 +536,6 @@ class AdvancedObjProperties(PropertyGroup): ], default='O', ) - # object_laplace_lighting props - ORIGIN = FloatVectorProperty( - name="Origin charge" - ) - GROUNDZ = IntProperty( - name="Ground Z coordinate" - ) - HORDER = IntProperty( - name="Secondary paths orders", - default=1 - ) - # object_laplace_lighting UI props - TSTEPS = IntProperty( - name="Iterations", - default=350, - description="Number of cells to create\n" - "Will end early if hits ground plane or cloud" - ) - GSCALE = FloatProperty( - name="Grid unit size", - default=0.12, - description="scale of cells, .25 = 4 cells per blenderUnit" - ) - BIGVAR = FloatProperty( - name="Straightness", - default=6.3, - description="Straightness/branchiness of bolt, \n" - "<2 is mush, >12 is staight line, 6.3 is good" - ) - GROUNDBOOL = BoolProperty( - name="Use Ground object", - description="Use ground plane or not", - default=True - ) - GROUNDC = IntProperty( - name="Ground charge", - default=-250, - description="Charge of the ground plane" - ) - CLOUDBOOL = BoolProperty( - name="Use Cloud object", - default=False, - description="Use cloud object - attracts and terminates like ground but\n" - "any obj instead of z plane\n" - "Can slow down loop if obj is large, overrides ground" - ) - CLOUDC = IntProperty( - name="Cloud charge", - default=-1, - description="Charge of a cell in cloud object\n" - "(so total charge also depends on obj size)" - ) - VMMESH = BoolProperty( - name="Multi mesh", - default=True, - description="Output to multi-meshes for different materials on main/sec/side branches" - ) - VSMESH = BoolProperty( - name="Single mesh", - default=False, - description="Output to single mesh for using build modifier and particles for effects" - ) - VCUBE = BoolProperty( - name="Cubes", - default=False, - description="CTRL-J after run to JOIN\n" - "Outputs a bunch of cube objects, mostly for testing" - ) - VVOX = BoolProperty( - name="Voxel (experimental)", - default=False, - description="Output to a voxel file to bpy.data.filepath\FSLGvoxels.raw\n" - "(doesn't work well right now)" - ) - IBOOL = BoolProperty( - name="Use Insulator object", - default=False, - description="Use insulator mesh object to prevent growth of bolt in areas" - ) - OOB = StringProperty( - name="Select", - default="", - description="Origin of bolt, can be an Empty\n" - "if object is a mesh will use all verts as charges") - GOB = StringProperty( - name="Select", - default="", - description="Object to use as ground plane, uses z coord only" - ) - COB = StringProperty( - name="Select", - default="", - description="Object to use as cloud, best to use a cube" - ) - IOB = StringProperty( - name="Select", - default="", - description="Object to use as insulator, 'voxelized'\n" - "before generating bolt (can be slow)" - ) - # object_mangle_tools properties - mangle_constraint_vector = BoolVectorProperty( - name="Mangle Constraint", - default=(True, True, True), - subtype='XYZ', - description="Constrains Mangle Direction" - ) - mangle_random_magnitude = IntProperty( - name="Mangle Severity", - default=5, - min=1, max=30, - description="Severity of mangling" - ) - mangle_name = StringProperty( - name="Shape Key Name", - default="mangle", - description="Name given for mangled shape keys" - ) - # unfold_transition properties - unfold_arm_name = StringProperty( - default="" - ) - unfold_modo = EnumProperty( - name="", - items=[("cursor", "3D Cursor", "Use the Distance to 3D Cursor"), - ("weight", "Weight Map", "Use a Painted Weight map"), - ("index", "Mesh Indices", "Use Faces and Vertices index")], - description="How to Sort Bones for animation", default="cursor" - ) - unfold_flip = BoolProperty( - name="Flipping Faces", - default=False, - description="Rotate faces around the Center and skip Scaling - " - "keep checked for both operators" - ) - unfold_fold_duration = IntProperty( - name="Total Time", - min=5, soft_min=25, - max=10000, soft_max=2500, - default=200, - description="Total animation length" - ) - unfold_sca_time = IntProperty( - name="Scale Time", - min=1, - max=5000, soft_max=500, - default=10, - description="Faces scaling time" - ) - unfold_rot_time = IntProperty( - name="Rotation Time", - min=1, soft_min=5, - max=5000, soft_max=500, - default=15, - description="Faces rotation time" - ) - unfold_rot_max = IntProperty( - name="Angle", - min=-180, - max=180, - default=135, - description="Faces rotation angle" - ) - unfold_fold_noise = IntProperty( - name="Noise", - min=0, - max=500, soft_max=50, - default=0, - description="Offset some faces animation" - ) - unfold_bounce = FloatProperty( - name="Bounce", - min=0, - max=10, soft_max=2.5, - default=0, - description="Add some bounce to rotation" - ) - unfold_from_point = BoolProperty( - name="Point", - default=False, - description="Scale faces from a Point instead of from an Edge" - ) - unfold_wiggle_rot = BoolProperty( - name="Wiggle", - default=False, - description="Use all Axis + Random Rotation instead of X Aligned" - ) - # oscurart_constellation - constellation_limit = FloatProperty( - name="Inital Threshold", - description="Edges will be created only if the distance\n" - "between vertices is smaller than this value\n" - "This is a starting value on Operator Invoke", - default=2, - min=0 - ) def register(): diff --git a/add_advanced_objects/add_light_template.py b/add_advanced_objects_menu/add_light_template.py index 9e2c139f..9e2c139f 100644 --- a/add_advanced_objects/add_light_template.py +++ b/add_advanced_objects_menu/add_light_template.py diff --git a/add_advanced_objects/add_mesh_aggregate.py b/add_advanced_objects_menu/add_mesh_aggregate.py index 6072cb9c..6072cb9c 100644 --- a/add_advanced_objects/add_mesh_aggregate.py +++ b/add_advanced_objects_menu/add_mesh_aggregate.py diff --git a/add_advanced_objects/arrange_on_curve.py b/add_advanced_objects_menu/arrange_on_curve.py index 14017480..14017480 100644 --- a/add_advanced_objects/arrange_on_curve.py +++ b/add_advanced_objects_menu/arrange_on_curve.py diff --git a/add_advanced_objects/circle_array.py b/add_advanced_objects_menu/circle_array.py index af5a6a0a..af5a6a0a 100644 --- a/add_advanced_objects/circle_array.py +++ b/add_advanced_objects_menu/circle_array.py diff --git a/add_advanced_objects/copy2.py b/add_advanced_objects_menu/copy2.py index 489f6dee..489f6dee 100644 --- a/add_advanced_objects/copy2.py +++ b/add_advanced_objects_menu/copy2.py diff --git a/add_advanced_objects/cubester.py b/add_advanced_objects_menu/cubester.py index 1a516bd0..1a516bd0 100644 --- a/add_advanced_objects/cubester.py +++ b/add_advanced_objects_menu/cubester.py diff --git a/add_advanced_objects/make_struts.py b/add_advanced_objects_menu/make_struts.py index 58e149ab..58e149ab 100644 --- a/add_advanced_objects/make_struts.py +++ b/add_advanced_objects_menu/make_struts.py diff --git a/add_advanced_objects/mesh_easylattice.py b/add_advanced_objects_menu/mesh_easylattice.py index 91a167dc..91a167dc 100644 --- a/add_advanced_objects/mesh_easylattice.py +++ b/add_advanced_objects_menu/mesh_easylattice.py diff --git a/add_advanced_objects/object_add_chain.py b/add_advanced_objects_menu/object_add_chain.py index 8b182c82..8b182c82 100644 --- a/add_advanced_objects/object_add_chain.py +++ b/add_advanced_objects_menu/object_add_chain.py diff --git a/add_advanced_objects/oscurart_chain_maker.py b/add_advanced_objects_menu/oscurart_chain_maker.py index 6dcd6f80..6dcd6f80 100644 --- a/add_advanced_objects/oscurart_chain_maker.py +++ b/add_advanced_objects_menu/oscurart_chain_maker.py diff --git a/add_advanced_objects/pixelate_3d.py b/add_advanced_objects_menu/pixelate_3d.py index d2b28971..d2b28971 100644 --- a/add_advanced_objects/pixelate_3d.py +++ b/add_advanced_objects_menu/pixelate_3d.py diff --git a/add_advanced_objects/random_box_structure.py b/add_advanced_objects_menu/random_box_structure.py index fa4b6497..fa4b6497 100644 --- a/add_advanced_objects/random_box_structure.py +++ b/add_advanced_objects_menu/random_box_structure.py diff --git a/add_advanced_objects/rope_alpha.py b/add_advanced_objects_menu/rope_alpha.py index 904168a1..904168a1 100644 --- a/add_advanced_objects/rope_alpha.py +++ b/add_advanced_objects_menu/rope_alpha.py diff --git a/add_advanced_objects/scene_objects_bi.py b/add_advanced_objects_menu/scene_objects_bi.py index f189bb11..f189bb11 100644 --- a/add_advanced_objects/scene_objects_bi.py +++ b/add_advanced_objects_menu/scene_objects_bi.py diff --git a/add_advanced_objects/scene_objects_cycles.py b/add_advanced_objects_menu/scene_objects_cycles.py index 85e85867..85e85867 100644 --- a/add_advanced_objects/scene_objects_cycles.py +++ b/add_advanced_objects_menu/scene_objects_cycles.py diff --git a/add_advanced_objects/scene_texture_render.py b/add_advanced_objects_menu/scene_texture_render.py index 02d6490b..02d6490b 100644 --- a/add_advanced_objects/scene_texture_render.py +++ b/add_advanced_objects_menu/scene_texture_render.py diff --git a/add_advanced_objects/trilighting.py b/add_advanced_objects_menu/trilighting.py index e0068e66..e0068e66 100644 --- a/add_advanced_objects/trilighting.py +++ b/add_advanced_objects_menu/trilighting.py diff --git a/add_advanced_objects/delaunay_voronoi/DelaunayVoronoi.py b/add_advanced_objects_panels/DelaunayVoronoi.py index dcce7f68..dcce7f68 100644 --- a/add_advanced_objects/delaunay_voronoi/DelaunayVoronoi.py +++ b/add_advanced_objects_panels/DelaunayVoronoi.py diff --git a/add_advanced_objects_panels/__init__.py b/add_advanced_objects_panels/__init__.py new file mode 100644 index 00000000..81950727 --- /dev/null +++ b/add_advanced_objects_panels/__init__.py @@ -0,0 +1,467 @@ +# ##### BEGIN GPL LICENSE BLOCK ##### +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# ##### END GPL LICENSE BLOCK ##### + +# Contributed to by: +# meta-androcto, Bill Currie, Jorge Hernandez - Melenedez Jacob Morris, Oscurart # +# Rebellion, Antonis Karvelas, Eleanor Howick, lijenstina, Daniel Schalla, Domlysz # +# Unnikrishnan(kodemax), Florian Meyer, Omar ahmed, Brian Hinton (Nichod), liero # +# Atom, Dannyboy, Mano-Wii, Kursad Karatas, teldredge, Phil Cote # + +bl_info = { + "name": "Add Advanced Object Panels", + "author": "meta-androcto,", + "version": (1, 1, 4), + "blender": (2, 7, 7), + "description": "Individual Create Panel Activation List", + "location": "Addons Preferences", + "warning": "", + "wiki_url": "https://wiki.blender.org/index.php/Extensions:2.6/Py/" + "Scripts/3D_interaction/viewport_pies", + "category": "Object" + } + +import bpy +from bpy.types import ( + Menu, + AddonPreferences, + PropertyGroup, + ) +from bpy.props import ( + BoolProperty, + BoolVectorProperty, + EnumProperty, + FloatProperty, + FloatVectorProperty, + IntProperty, + StringProperty, + PointerProperty, + ) + +sub_modules_names = ( + "drop_to_ground", + "object_laplace_lightning", + "object_mangle_tools", + "unfold_transition", + "delaunay_voronoi", + "oscurart_constellation", + ) + + +sub_modules = [__import__(__package__ + "." + submod, {}, {}, submod) for submod in sub_modules_names] +sub_modules.sort(key=lambda mod: (mod.bl_info['category'], mod.bl_info['name'])) + + +#Addons Preferences +def _get_pref_class(mod): + import inspect + + for obj in vars(mod).values(): + if inspect.isclass(obj) and issubclass(obj, PropertyGroup): + if hasattr(obj, 'bl_idname') and obj.bl_idname == mod.__name__: + return obj + + +def get_addon_preferences(name=''): + """Acquisition and registration""" + addons = bpy.context.user_preferences.addons + if __name__ not in addons: # wm.read_factory_settings() + return None + addon_prefs = addons[__name__].preferences + if name: + if not hasattr(addon_prefs, name): + for mod in sub_modules: + if mod.__name__.split('.')[-1] == name: + cls = _get_pref_class(mod) + if cls: + prop = PointerProperty(type=cls) + setattr(AdvancedObjPreferences1, name, prop) + bpy.utils.unregister_class(AdvancedObjPreferences1) + bpy.utils.register_class(AdvancedObjPreferences1) + return getattr(addon_prefs, name, None) + else: + return addon_prefs + + +def register_submodule(mod): + if not hasattr(mod, '__addon_enabled__'): + mod.__addon_enabled__ = False + if not mod.__addon_enabled__: + mod.register() + mod.__addon_enabled__ = True + + +def unregister_submodule(mod): + if mod.__addon_enabled__: + mod.unregister() + mod.__addon_enabled__ = False + + prefs = get_addon_preferences() + name = mod.__name__.split('.')[-1] + if hasattr(AdvancedObjPreferences1, name): + delattr(AdvancedObjPreferences1, name) + if prefs: + bpy.utils.unregister_class(AdvancedObjPreferences1) + bpy.utils.register_class(AdvancedObjPreferences1) + if name in prefs: + del prefs[name] + + +class AdvancedObjPreferences1(AddonPreferences): + bl_idname = __name__ + + def draw(self, context): + layout = self.layout + + for mod in sub_modules: + mod_name = mod.__name__.split('.')[-1] + info = mod.bl_info + column = layout.column() + box = column.box() + + # first stage + expand = getattr(self, 'show_expanded_' + mod_name) + icon = 'TRIA_DOWN' if expand else 'TRIA_RIGHT' + col = box.column() + row = col.row() + sub = row.row() + sub.context_pointer_set('addon_prefs', self) + op = sub.operator('wm.context_toggle', text='', icon=icon, + emboss=False) + op.data_path = 'addon_prefs.show_expanded_' + mod_name + sub.label('{}: {}'.format(info['category'], info['name'])) + sub = row.row() + sub.alignment = 'RIGHT' + if info.get('warning'): + sub.label('', icon='ERROR') + sub.prop(self, 'use_' + mod_name, text='') + + # The second stage + if expand: + if info.get('description'): + split = col.row().split(percentage=0.15) + split.label('Description:') + split.label(info['description']) + if info.get('location'): + split = col.row().split(percentage=0.15) + split.label('Location:') + split.label(info['location']) + if info.get('author') and info.get('author') != 'chromoly': + split = col.row().split(percentage=0.15) + split.label('Author:') + split.label(info['author']) + if info.get('version'): + split = col.row().split(percentage=0.15) + split.label('Version:') + split.label('.'.join(str(x) for x in info['version']), + translate=False) + if info.get('warning'): + split = col.row().split(percentage=0.15) + split.label('Warning:') + split.label(' ' + info['warning'], icon='ERROR') + + tot_row = int(bool(info.get('wiki_url'))) + if tot_row: + split = col.row().split(percentage=0.15) + split.label(text='Internet:') + if info.get('wiki_url'): + op = split.operator('wm.url_open', + text='Documentation', icon='HELP') + op.url = info.get('wiki_url') + for i in range(4 - tot_row): + split.separator() + + # Details and settings + if getattr(self, 'use_' + mod_name): + prefs = get_addon_preferences(mod_name) + + if prefs and hasattr(prefs, 'draw'): + box = box.column() + prefs.layout = box + try: + prefs.draw(context) + except: + traceback.print_exc() + box.label(text='Error (see console)', icon='ERROR') + del prefs.layout + + row = layout.row() + row.label("End of Panel Activations") + + +for mod in sub_modules: + info = mod.bl_info + mod_name = mod.__name__.split('.')[-1] + + def gen_update(mod): + def update(self, context): + if getattr(self, 'use_' + mod.__name__.split('.')[-1]): + if not mod.__addon_enabled__: + register_submodule(mod) + else: + if mod.__addon_enabled__: + unregister_submodule(mod) + return update + + prop = BoolProperty( + name=info['name'], + description=info.get('description', ''), + update=gen_update(mod), + ) + setattr(AdvancedObjPreferences1, 'use_' + mod_name, prop) + prop = BoolProperty() + setattr(AdvancedObjPreferences1, 'show_expanded_' + mod_name, prop) + + +class AdvancedObjProperties1(PropertyGroup): + + # main properties + + # object_laplace_lighting props + ORIGIN = FloatVectorProperty( + name="Origin charge" + ) + GROUNDZ = IntProperty( + name="Ground Z coordinate" + ) + HORDER = IntProperty( + name="Secondary paths orders", + default=1 + ) + # object_laplace_lighting UI props + TSTEPS = IntProperty( + name="Iterations", + default=350, + description="Number of cells to create\n" + "Will end early if hits ground plane or cloud" + ) + GSCALE = FloatProperty( + name="Grid unit size", + default=0.12, + description="scale of cells, .25 = 4 cells per blenderUnit" + ) + BIGVAR = FloatProperty( + name="Straightness", + default=6.3, + description="Straightness/branchiness of bolt, \n" + "<2 is mush, >12 is staight line, 6.3 is good" + ) + GROUNDBOOL = BoolProperty( + name="Use Ground object", + description="Use ground plane or not", + default=True + ) + GROUNDC = IntProperty( + name="Ground charge", + default=-250, + description="Charge of the ground plane" + ) + CLOUDBOOL = BoolProperty( + name="Use Cloud object", + default=False, + description="Use cloud object - attracts and terminates like ground but\n" + "any obj instead of z plane\n" + "Can slow down loop if obj is large, overrides ground" + ) + CLOUDC = IntProperty( + name="Cloud charge", + default=-1, + description="Charge of a cell in cloud object\n" + "(so total charge also depends on obj size)" + ) + VMMESH = BoolProperty( + name="Multi mesh", + default=True, + description="Output to multi-meshes for different materials on main/sec/side branches" + ) + VSMESH = BoolProperty( + name="Single mesh", + default=False, + description="Output to single mesh for using build modifier and particles for effects" + ) + VCUBE = BoolProperty( + name="Cubes", + default=False, + description="CTRL-J after run to JOIN\n" + "Outputs a bunch of cube objects, mostly for testing" + ) + VVOX = BoolProperty( + name="Voxel (experimental)", + default=False, + description="Output to a voxel file to bpy.data.filepath\FSLGvoxels.raw\n" + "(doesn't work well right now)" + ) + IBOOL = BoolProperty( + name="Use Insulator object", + default=False, + description="Use insulator mesh object to prevent growth of bolt in areas" + ) + OOB = StringProperty( + name="Select", + default="", + description="Origin of bolt, can be an Empty\n" + "if object is a mesh will use all verts as charges") + GOB = StringProperty( + name="Select", + default="", + description="Object to use as ground plane, uses z coord only" + ) + COB = StringProperty( + name="Select", + default="", + description="Object to use as cloud, best to use a cube" + ) + IOB = StringProperty( + name="Select", + default="", + description="Object to use as insulator, 'voxelized'\n" + "before generating bolt (can be slow)" + ) + # object_mangle_tools properties + mangle_constraint_vector = BoolVectorProperty( + name="Mangle Constraint", + default=(True, True, True), + subtype='XYZ', + description="Constrains Mangle Direction" + ) + mangle_random_magnitude = IntProperty( + name="Mangle Severity", + default=5, + min=1, max=30, + description="Severity of mangling" + ) + mangle_name = StringProperty( + name="Shape Key Name", + default="mangle", + description="Name given for mangled shape keys" + ) + # unfold_transition properties + unfold_arm_name = StringProperty( + default="" + ) + unfold_modo = EnumProperty( + name="", + items=[("cursor", "3D Cursor", "Use the Distance to 3D Cursor"), + ("weight", "Weight Map", "Use a Painted Weight map"), + ("index", "Mesh Indices", "Use Faces and Vertices index")], + description="How to Sort Bones for animation", default="cursor" + ) + unfold_flip = BoolProperty( + name="Flipping Faces", + default=False, + description="Rotate faces around the Center and skip Scaling - " + "keep checked for both operators" + ) + unfold_fold_duration = IntProperty( + name="Total Time", + min=5, soft_min=25, + max=10000, soft_max=2500, + default=200, + description="Total animation length" + ) + unfold_sca_time = IntProperty( + name="Scale Time", + min=1, + max=5000, soft_max=500, + default=10, + description="Faces scaling time" + ) + unfold_rot_time = IntProperty( + name="Rotation Time", + min=1, soft_min=5, + max=5000, soft_max=500, + default=15, + description="Faces rotation time" + ) + unfold_rot_max = IntProperty( + name="Angle", + min=-180, + max=180, + default=135, + description="Faces rotation angle" + ) + unfold_fold_noise = IntProperty( + name="Noise", + min=0, + max=500, soft_max=50, + default=0, + description="Offset some faces animation" + ) + unfold_bounce = FloatProperty( + name="Bounce", + min=0, + max=10, soft_max=2.5, + default=0, + description="Add some bounce to rotation" + ) + unfold_from_point = BoolProperty( + name="Point", + default=False, + description="Scale faces from a Point instead of from an Edge" + ) + unfold_wiggle_rot = BoolProperty( + name="Wiggle", + default=False, + description="Use all Axis + Random Rotation instead of X Aligned" + ) + # oscurart_constellation + constellation_limit = FloatProperty( + name="Inital Threshold", + description="Edges will be created only if the distance\n" + "between vertices is smaller than this value\n" + "This is a starting value on Operator Invoke", + default=2, + min=0 + ) + + +# Class list +classes = ( + AdvancedObjPreferences1, + AdvancedObjProperties1, + ) + + +def register(): + for cls in classes: + bpy.utils.register_class(cls) + + bpy.types.Scene.advanced_objects1 = PointerProperty( + type=AdvancedObjProperties1 + ) + + prefs = get_addon_preferences() + for mod in sub_modules: + if not hasattr(mod, '__addon_enabled__'): + mod.__addon_enabled__ = False + name = mod.__name__.split('.')[-1] + if getattr(prefs, 'use_' + name): + register_submodule(mod) + + +def unregister(): + for mod in sub_modules: + if mod.__addon_enabled__: + unregister_submodule(mod) + del bpy.types.Scene.advanced_objects1 + + for cls in reversed(classes): + bpy.utils.unregister_class(cls) + + +if __name__ == "__main__": + register() diff --git a/add_advanced_objects/delaunay_voronoi/delaunayVoronoiBlender.py b/add_advanced_objects_panels/delaunay_voronoi.py index 707c45b4..ec8f330a 100644 --- a/add_advanced_objects/delaunay_voronoi/delaunayVoronoiBlender.py +++ b/add_advanced_objects_panels/delaunay_voronoi.py @@ -1,5 +1,38 @@ # -*- coding:utf-8 -*- +# ##### BEGIN GPL LICENSE BLOCK ##### +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# ##### END GPL LICENSE BLOCK ##### + +bl_info = { + "name": "Delaunay Voronoi", + "description": "Points cloud Delaunay triangulation in 2.5D " + "(suitable for terrain modelling) or Voronoi diagram in 2D", + "author": "Domlysz, Oscurart", + "version": (1, 3), + "blender": (2, 7, 0), + "location": "View3D > Tools > GIS", + "warning": "", + "wiki_url": "https://github.com/domlysz/BlenderGIS/wiki", + "category": "Add Mesh" + } + + + import bpy from .DelaunayVoronoi import ( computeVoronoiDiagram, @@ -75,12 +108,6 @@ class ToolsPanelDelaunay(Panel): col.operator("delaunay.triangulation") col.operator("voronoi.tesselation") - box = layout.box() - col = box.column(align=True) - col.label("Constellation:") - col.operator("mesh.constellation", text="Cross Section") - col.prop(adv_obj, "constellation_limit") - class OBJECT_OT_TriangulateButton(Operator): bl_idname = "delaunay.triangulation" @@ -266,3 +293,20 @@ class OBJECT_OT_VoronoiButton(Operator): self.report({"INFO"}, "Mesh created (" + str(len(polyIdx)) + " polygons)") return {'FINISHED'} + +# Register +def register(): + bpy.utils.register_class(OBJECT_OT_VoronoiButton) + bpy.utils.register_class(OBJECT_OT_TriangulateButton) + bpy.utils.register_class(ToolsPanelDelaunay) + + +def unregister(): + bpy.utils.unregister_class(OBJECT_OT_VoronoiButton) + bpy.utils.unregister_class(OBJECT_OT_TriangulateButton) + bpy.utils.unregister_class(ToolsPanelDelaunay) + + +if __name__ == "__main__": + register() + diff --git a/add_advanced_objects/drop_to_ground.py b/add_advanced_objects_panels/drop_to_ground.py index 744a2d6b..35020020 100644 --- a/add_advanced_objects/drop_to_ground.py +++ b/add_advanced_objects_panels/drop_to_ground.py @@ -19,13 +19,10 @@ bl_info = { "name": "Drop to Ground1", "author": "Unnikrishnan(kodemax), Florian Meyer(testscreenings)", - "version": (1, 2, 1), "blender": (2, 71, 0), "location": "3D View > Toolshelf > Tools Tab", "description": "Drop selected objects on active object", "warning": "", - "wiki_url": "https://wiki.blender.org/index.php/Extensions:2.6/Py/" - "Scripts/Object/Drop_to_ground", "category": "Object"} diff --git a/add_advanced_objects/object_laplace_lightning.py b/add_advanced_objects_panels/object_laplace_lightning.py index 857682b0..2f3b2498 100644 --- a/add_advanced_objects/object_laplace_lightning.py +++ b/add_advanced_objects_panels/object_laplace_lightning.py @@ -22,12 +22,10 @@ bl_info = { "name": "Laplacian Lightning", "author": "teldredge", - "version": (0, 2, 9), "blender": (2, 78, 0), "location": "View3D > Toolshelf > Create Tab", "description": "Lightning mesh generator using laplacian growth algorithm", "warning": "", - "wiki_url": "http://www.funkboxing.com/wordpress/?p=301", "category": "Object"} # BLENDER LAPLACIAN LIGHTNING diff --git a/add_advanced_objects/object_mangle_tools.py b/add_advanced_objects_panels/object_mangle_tools.py index 9f5b44ee..c36bb224 100644 --- a/add_advanced_objects/object_mangle_tools.py +++ b/add_advanced_objects_panels/object_mangle_tools.py @@ -23,7 +23,6 @@ bl_info = { "name": "Mangle Tools", "author": "Phil Cote", - "version": (0, 2, 2), "blender": (2, 71, 0), "location": "View3D > Toolshelf > Tools Tab", "description": "Set of tools to mangle curves, meshes, and shape keys", diff --git a/add_advanced_objects/delaunay_voronoi/oscurart_constellation.py b/add_advanced_objects_panels/oscurart_constellation.py index adde96c0..6e840974 100644 --- a/add_advanced_objects/delaunay_voronoi/oscurart_constellation.py +++ b/add_advanced_objects_panels/oscurart_constellation.py @@ -19,7 +19,6 @@ bl_info = { "name": "Mesh: Constellation", "author": "Oscurart", - "version": (1, 1, 1), "blender": (2, 67, 0), "location": "Add > Mesh > Constellation", "description": "Create a new Mesh From Selected", @@ -31,10 +30,12 @@ bl_info = { # the adv_obj and advanced_objects patterns import bpy -from bpy.types import Operator from bpy.props import FloatProperty from math import sqrt - +from bpy.types import ( + Operator, + Panel, + ) def VertDis(a, b): dst = sqrt(pow(a.co.x - b.co.x, 2) + @@ -108,16 +109,33 @@ class Oscurart_Constellation(Operator): return {'FINISHED'} +class Constellation_Operator_Panel(Panel): + bl_label = "Constellation" + bl_region_type = "TOOLS" + bl_space_type = "VIEW_3D" + bl_options = {'DEFAULT_CLOSED'} + bl_context = "objectmode" + bl_category = "Create" + def draw(self, context): + layout = self.layout + adv_obj = context.scene.advanced_objects + + box = layout.box() + col = box.column(align=True) + col.label("Constellation:") + col.operator("mesh.constellation", text="Cross Section") + col.prop(adv_obj, "constellation_limit") # Register def register(): bpy.utils.register_class(Oscurart_Constellation) + bpy.utils.register_class(Constellation_Operator_Panel) def unregister(): bpy.utils.unregister_class(Oscurart_Constellation) - + bpy.utils.unregister_class(Constellation_Operator_Panel) if __name__ == "__main__": register() diff --git a/add_advanced_objects/unfold_transition.py b/add_advanced_objects_panels/unfold_transition.py index 769386f5..60e612dd 100644 --- a/add_advanced_objects/unfold_transition.py +++ b/add_advanced_objects_panels/unfold_transition.py @@ -3,7 +3,6 @@ bl_info = { "name": "Unfold transition", "author": "Liero, Atom", - "version": (0, 1, 2), "location": "Tool bar > Animation tab > UnFold Transition", "description": "Simple unfold transition / animation, will " "separate faces and set up an armature", @@ -327,17 +326,20 @@ class PanelFOLD(Panel): if not adv_obj.unfold_flip: row.prop(adv_obj, "unfold_from_point") +classes = ( + Set_Up_Fold, + Animate_Fold, + PanelFOLD, + ) def register(): - bpy.utils.register_class(Set_Up_Fold) - bpy.utils.register_class(Animate_Fold) - bpy.utils.register_class(PanelFOLD) + for cls in classes: + bpy.utils.register_class(cls) def unregister(): - bpy.utils.unregister_class(Set_Up_Fold) - bpy.utils.unregister_class(Animate_Fold) - bpy.utils.unregister_class(PanelFOLD) + for cls in classes: + bpy.utils.unregister_class(cls) if __name__ == "__main__": |