[Bf-extensions-cvs] [34a4438b] master: Amaranth: Update to 1.0.5, Refactor the scene debug script, fixes

lijenstina noreply at git.blender.org
Mon Dec 25 04:10:45 CET 2017


Commit: 34a4438b4fb982082d6c216cec6d12affff69104
Author: lijenstina
Date:   Mon Dec 25 04:09:57 2017 +0100
Branches: master
https://developer.blender.org/rBAC34a4438b4fb982082d6c216cec6d12affff69104

Amaranth: Update to 1.0.5, Refactor the scene debug script, fixes

Bumped version to 1.0.5
Pep 8 cleanup
Imports as tuples

Apply the patch bellow. Thanks to the author
Differential Revision: https://developer.blender.org/D1288

Refactor the scene\debug.py script:
- Use a separate class for storage (AMTH_store_data) instead in Operators
  # Don't store object data in it (can cause issues with undo)
  # AMTH_SCENE_OT_list_users_debug_clear is now one operator for all data

- Add some printing helper functions

- Use UI lists for Images and Lighter's corner panel:
  # As they need collections, fill the collections with data
  # Performance difference is noticable in scene with 2000 lights
  # The only downside is that they need to be refreshed manually
  # Remove the poll and the toggle in preferences

- Change the logic of the AMTH_SCENE_OT_list_users_for_x_type:
  # Always have a default entry USER_X_NAME_EMPTY
  # Add check around it, deduplicate code
  # add an update call to the amth_datablock_types prop (weak)

To do:
  # Maybe use collections and UI Lists for everything
  # Refactor the AMTH_SCENE_OT_list_users_for_x

Fix check for add-on preferences props calls (crashes on unregister)
Fix  button_camera_passepartout with camera missing, object as camera

Notes:
- The UnicodeDecodeError should be solved (garbage strings in enum)
- T48042 crash still happens in 2.76.10 version
  # The problem arises from nested groups code search in that version
  !!if nd and nd.type == 'GROUP'!! in AMTH_SCENE_OT_list_users_for_x_type
  # Could not be recreated in current master nor 2.79, consider it solved

===================================================================

M	amaranth/__init__.py
M	amaranth/animation/frame_current.py
M	amaranth/animation/jump_frames.py
M	amaranth/animation/timeline_extra_info.py
M	amaranth/node_editor/display_image.py
M	amaranth/prefs.py
M	amaranth/render/passepartout.py
M	amaranth/render/remember_layers.py
M	amaranth/scene/debug.py
M	amaranth/scene/refresh.py
M	amaranth/scene/save_reload.py
M	amaranth/scene/stats.py

===================================================================

diff --git a/amaranth/__init__.py b/amaranth/__init__.py
index a40a1058..8a579f20 100644
--- a/amaranth/__init__.py
+++ b/amaranth/__init__.py
@@ -90,7 +90,7 @@ from amaranth.misc import (
 bl_info = {
     "name": "Amaranth Toolset",
     "author": "Pablo Vazquez, Bassam Kurdali, Sergey Sharybin, Lukas Tönne, Cesar Saez",
-    "version": (1, 0, 4),
+    "version": (1, 0, 5),
     "blender": (2, 74),
     "location": "Everywhere!",
     "description": "A collection of tools and settings to improve productivity",
diff --git a/amaranth/animation/frame_current.py b/amaranth/animation/frame_current.py
index 538931c1..24bd3953 100644
--- a/amaranth/animation/frame_current.py
+++ b/amaranth/animation/frame_current.py
@@ -25,9 +25,12 @@ import bpy
 
 
 def button_frame_current(self, context):
-    preferences = context.user_preferences.addons["amaranth"].preferences
+    get_addon = "amaranth" in context.user_preferences.addons.keys()
+    if not get_addon:
+        return
+
     scene = context.scene
-    if preferences.use_frame_current:
+    if context.user_preferences.addons["amaranth"].preferences.use_frame_current:
         self.layout.separator()
         self.layout.prop(scene, "frame_current", text="Set Current Frame")
 
diff --git a/amaranth/animation/jump_frames.py b/amaranth/animation/jump_frames.py
index 5f4ca0cb..2d93e804 100644
--- a/amaranth/animation/jump_frames.py
+++ b/amaranth/animation/jump_frames.py
@@ -28,6 +28,8 @@ Find it on the User Preferences, Editing.
 """
 
 import bpy
+from bpy.types import Operator
+from bpy.props import BoolProperty
 
 KEYMAPS = list()
 
@@ -40,17 +42,18 @@ def is_keyframe(ob, frame):
                 return True
     return False
 
+
 # monkey path is_keyframe function
 bpy.types.Object.is_keyframe = is_keyframe
 
 
 # FEATURE: Jump to frame in-between next and previous keyframe
-class AMTH_SCREEN_OT_keyframe_jump_inbetween(bpy.types.Operator):
-
+class AMTH_SCREEN_OT_keyframe_jump_inbetween(Operator):
     """Jump to half in-between keyframes"""
     bl_idname = "screen.amth_keyframe_jump_inbetween"
     bl_label = "Jump to Keyframe In-between"
-    backwards = bpy.props.BoolProperty()
+
+    backwards = BoolProperty()
 
     def execute(self, context):
         back = self.backwards
@@ -110,16 +113,20 @@ class AMTH_SCREEN_OT_keyframe_jump_inbetween(bpy.types.Operator):
 
 
 # FEATURE: Jump forward/backward every N frames
-class AMTH_SCREEN_OT_frame_jump(bpy.types.Operator):
-
+class AMTH_SCREEN_OT_frame_jump(Operator):
     """Jump a number of frames forward/backwards"""
     bl_idname = "screen.amaranth_frame_jump"
     bl_label = "Jump Frames"
 
-    forward = bpy.props.BoolProperty(default=True)
+    forward = BoolProperty(default=True)
 
     def execute(self, context):
         scene = context.scene
+
+        get_addon = "amaranth" in context.user_preferences.addons.keys()
+        if not get_addon:
+            return {"CANCELLED"}
+
         preferences = context.user_preferences.addons["amaranth"].preferences
 
         if preferences.use_framerate:
@@ -135,6 +142,10 @@ class AMTH_SCREEN_OT_frame_jump(bpy.types.Operator):
 
 
 def ui_userpreferences_edit(self, context):
+    get_addon = "amaranth" in context.user_preferences.addons.keys()
+    if not get_addon:
+        return
+
     preferences = context.user_preferences.addons["amaranth"].preferences
 
     col = self.layout.column()
@@ -144,11 +155,13 @@ def ui_userpreferences_edit(self, context):
 
 
 def label(self, context):
+    get_addon = "amaranth" in context.user_preferences.addons.keys()
+    if not get_addon:
+        return
 
-    preferences = context.user_preferences.addons["amaranth"].preferences
     layout = self.layout
 
-    if preferences.use_timeline_extra_info:
+    if context.user_preferences.addons["amaranth"].preferences.use_timeline_extra_info:
         row = layout.row(align=True)
 
         row.operator(AMTH_SCREEN_OT_keyframe_jump_inbetween.bl_idname,
diff --git a/amaranth/animation/timeline_extra_info.py b/amaranth/animation/timeline_extra_info.py
index c1a64497..7e494ee6 100644
--- a/amaranth/animation/timeline_extra_info.py
+++ b/amaranth/animation/timeline_extra_info.py
@@ -23,12 +23,14 @@ import bpy
 
 
 def label_timeline_extra_info(self, context):
+    get_addon = "amaranth" in context.user_preferences.addons.keys()
+    if not get_addon:
+        return
 
-    preferences = context.user_preferences.addons["amaranth"].preferences
     layout = self.layout
     scene = context.scene
 
-    if preferences.use_timeline_extra_info:
+    if context.user_preferences.addons["amaranth"].preferences.use_timeline_extra_info:
         row = layout.row(align=True)
 
         # Check for preview range
diff --git a/amaranth/node_editor/display_image.py b/amaranth/node_editor/display_image.py
index 322e4d1c..5cc2e949 100644
--- a/amaranth/node_editor/display_image.py
+++ b/amaranth/node_editor/display_image.py
@@ -36,7 +36,6 @@ image_nodes = ("CompositorNodeRLayers",
 
 
 class AMTH_NODE_OT_show_active_node_image(bpy.types.Operator):
-
     """Show active image node image in the image editor"""
     bl_idname = "node.show_active_node_image"
     bl_label = "Show Active Node Node"
@@ -51,6 +50,10 @@ class AMTH_NODE_OT_show_active_node_image(bpy.types.Operator):
         select_node = bpy.ops.node.select(mouse_x=mlocx, mouse_y=mlocy, extend=False)
 
         if 'FINISHED' in select_node:  # Only run if we're clicking on a node
+            get_addon = "amaranth" in context.user_preferences.addons.keys()
+            if not get_addon:
+                return {"CANCELLED"}
+
             preferences = context.user_preferences.addons["amaranth"].preferences
             if preferences.use_image_node_display:
                 if context.active_node:
diff --git a/amaranth/prefs.py b/amaranth/prefs.py
index 81625211..59281f48 100644
--- a/amaranth/prefs.py
+++ b/amaranth/prefs.py
@@ -13,66 +13,61 @@
 #  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
 import bpy
+from bpy.props import (
+        BoolProperty,
+        IntProperty,
+        )
 
 
 class AmaranthToolsetPreferences(bpy.types.AddonPreferences):
     bl_idname = "amaranth"
-    use_frame_current = bpy.props.BoolProperty(
+    use_frame_current = BoolProperty(
         name="Current Frame Slider",
         description="Set the current frame from the Specials menu in the 3D View",
         default=True,
     )
-    use_file_save_reload = bpy.props.BoolProperty(
+    use_file_save_reload = BoolProperty(
         name="Save & Reload File",
         description="File menu > Save & Reload, or Ctrl + Shift + W",
         default=True,
     )
-
-    use_scene_refresh = bpy.props.BoolProperty(
+    use_scene_refresh = BoolProperty(
         name="Refresh Scene",
         description="Specials Menu [W], or hit F5",
         default=True,
     )
-    use_timeline_extra_info = bpy.props.BoolProperty(
+    use_timeline_extra_info = BoolProperty(
         name="Timeline Extra Info",
         description="Timeline Header",
         default=True,
     )
-    use_image_node_display = bpy.props.BoolProperty(
+    use_image_node_display = BoolProperty(
         name="Active Image Node in Editor",
         description="Display active node image in image editor",
         default=True,
     )
-    use_scene_stats = bpy.props.BoolProperty(
+    use_scene_stats = BoolProperty(
         name="Extra Scene Statistics",
         description="Display extra scene statistics in Info header (may be slow in heavy scenes)",
         default=False,
     )
-
-    frames_jump = bpy.props.IntProperty(
+    frames_jump = IntProperty(
         name="Frames",
         description="Number of frames to jump forward/backward",
         default=10,
-        min=1)
-
-    use_framerate = bpy.props.BoolProperty(
+        min=1
+    )
+    use_framerate = BoolProperty(
         name="Framerate Jump",
         description="Jump the amount of frames forward/backward that you have set as your framerate",
         default=False,
     )
-
-    use_layers_for_render = bpy.props.BoolProperty(
+    use_layers_for_render = BoolProperty(
         name="Current Layers for Render",
         description="Save the layers that should be enabled for render",
         default=True,
     )
 
-    use_lighters_corner = bpy.props.BoolProperty(
-        name="Lighter's Corner",
-        description="Display the Lighter's Corner panel on Scene properties",
-        default=False,
-    )
-
     def draw(self, context):
         layout = self.layout
 
@@ -96,7 +91,6 @@ class AmaranthToolsetPreferences(bpy.types.AddonPreferences):
         sub.prop(self, "use_scene_stats")
         sub.prop(self, "use_layers_for_render")
         sub.prop(self, "use_framerate")
-        sub.prop(self, "use_lighters_corner")
 
         sub.separator()
 
@@ -124,8 +118,6 @@ class AmaranthToolsetPreferences(bpy.types.AddonPreferences):
             text="Save the set of layers that should be activated for a final render")
         sub.label(
             text="Jump the amount of frames forward/backward that you've set as your framerate")
-        sub.label(
-            text="Display the Lighter's Corner panel on Scene properties")
 
         sub.separator()
         sub.label(text="")  # Nodes
diff --git a/amaranth/render/passepartout.py b/amaranth/render/passepartout.py
index 525cfe05..dfc4205c 100644
--- a/amaranth/render/passepartout.py
+++ b/amaranth/render/passepartout.py
@@ -23,16 +23,18 @@ import bpy
 
 
 def button_camera_passepartout(self, context):
-
     view3d = context.space_data.region_3d
-    cam = context.scene.camera.data
+    cam = context.scene.camera
 
     if view3d.view_perspective == "CAMERA":
+        if cam is None or not hasattr(cam, "data") or cam.type != "CAMERA":
+            return
+
         layout = self.layout
-        if cam.show_passepartout:
-            layout.prop(cam, "passepartout_alpha", text="Passepartout")
+        if cam.data.show_passepartout:
+            layout.prop(cam.data, "passepartout_alpha", text="Passepartout")
         else:
-            layout.prop(cam, "show_passepartout")
+            layout.prop(cam.data, "show_passepartout")
 
 
 def register():
diff --git a/amaranth/rende

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list