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>2017-04-12 01:57:41 +0300
committerlijenstina <lijenstina@gmail.com>2017-04-12 01:57:41 +0300
commit5d5098af42dbaa631f6a90de5a327523f92bdc45 (patch)
treec7a703fef9fd9df2a282fcdb4cf907abd94da299 /btrace/__init__.py
parent1af1c0963a14fba18f642a87394df05f6c8d3128 (diff)
Btrace: Major cleanup, reorganization
Bumped version to 1.2.1 Remove star imports Split the bTrace file into two Move the Panel and props code into the new file Pep8 cleanup Change the complicated switcher UI code Bools replace them with one EnumProperty This makes the second PropertyGroup not needed Make optional layout configuration in the preferences Fix the crashes with the Drawing operator Fix several crashes with wrong contexts Some small UI fixes More graceful error handling
Diffstat (limited to 'btrace/__init__.py')
-rw-r--r--btrace/__init__.py123
1 files changed, 90 insertions, 33 deletions
diff --git a/btrace/__init__.py b/btrace/__init__.py
index 40ff4df1..c1f62512 100644
--- a/btrace/__init__.py
+++ b/btrace/__init__.py
@@ -1,43 +1,96 @@
-#BEGIN GPL LICENSE BLOCK
+# ##### 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 #####
-#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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#END GPL LICENCE BLOCK
bl_info = {
"name": "Btrace",
"author": "liero, crazycourier, Atom, Meta-Androcto, MacKracken",
- "version": (1, 1, ),
- "blender": (2, 68, 0),
+ "version": (1, 2, 1),
+ "blender": (2, 78, 0),
"location": "View3D > Tools",
"description": "Tools for converting/animating objects/particles into curves",
"warning": "",
"wiki_url": "https://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Curve/Btrace",
- "tracker_url": "https://developer.blender.org/maniphest/task/edit/form/2/",
"category": "Add Curve"}
+if "bpy" in locals():
+ import importlib
+ importlib.reload(bTrace_props)
+ importlib.reload(bTrace)
+else:
+ from . import bTrace_props
+ from . import bTrace
import bpy
-from .bTrace import *
-import selection_utils
-from bpy.props import FloatProperty, EnumProperty, IntProperty, BoolProperty, FloatVectorProperty
+from bpy.types import AddonPreferences
+from .bTrace_props import (
+ TracerProperties,
+ addTracerObjectPanel,
+ )
+from .bTrace import (
+ OBJECT_OT_convertcurve,
+ OBJECT_OT_objecttrace,
+ OBJECT_OT_objectconnect,
+ OBJECT_OT_writing,
+ OBJECT_OT_particletrace,
+ OBJECT_OT_traceallparticles,
+ OBJECT_OT_curvegrow,
+ OBJECT_OT_reset,
+ OBJECT_OT_fcnoise,
+ OBJECT_OT_meshfollow,
+ OBJECT_OT_materialChango,
+ OBJECT_OT_clearColorblender,
+ )
+from bpy.props import (
+ EnumProperty,
+ PointerProperty,
+ )
+
+
+# Add-on Preferences
+class btrace_preferences(AddonPreferences):
+ bl_idname = __name__
+
+ expand_enum = EnumProperty(
+ name="UI Options",
+ items=[
+ ('list', "Drop down list",
+ "Show all the items as dropdown list in the Tools Region"),
+ ('col', "Enable Expanded UI Panel",
+ "Show all the items expanded in the Tools Region in a column"),
+ ('row', "Icons only in a row",
+ "Show all the items as icons expanded in a row in the Tools Region")
+ ],
+ description="",
+ default='list'
+ )
+
+ def draw(self, context):
+ layout = self.layout
+ layout.label("UI Options:")
-### Define Classes to register
-classes = [
+ row = layout.row(align=True)
+ row.prop(self, "expand_enum", text="UI Options", expand=True)
+
+
+# Define Classes to register
+classes = (
TracerProperties,
- TracerPropertiesMenu,
addTracerObjectPanel,
OBJECT_OT_convertcurve,
OBJECT_OT_objecttrace,
@@ -50,18 +103,22 @@ classes = [
OBJECT_OT_fcnoise,
OBJECT_OT_meshfollow,
OBJECT_OT_materialChango,
- OBJECT_OT_clearColorblender
- ]
+ OBJECT_OT_clearColorblender,
+ btrace_preferences,
+ )
+
def register():
- for c in classes:
- bpy.utils.register_class(c)
- bpy.types.WindowManager.curve_tracer = bpy.props.PointerProperty(type=TracerProperties)
- bpy.types.WindowManager.btrace_menu = bpy.props.PointerProperty(type=TracerPropertiesMenu, update=deselect_others)
+ for cls in classes:
+ bpy.utils.register_class(cls)
+ bpy.types.WindowManager.curve_tracer = PointerProperty(type=TracerProperties)
+
def unregister():
- for c in classes:
- bpy.utils.unregister_class(c)
+ for cls in classes:
+ bpy.utils.unregister_class(cls)
del bpy.types.WindowManager.curve_tracer
+
+
if __name__ == "__main__":
register()