Amaranth add-on: update to the latest API changes
authorCansecoGPC <CansecoGPC>
Wed, 22 May 2019 14:28:21 +0000 (16:28 +0200)
committerPablo Vazquez <venomgfx@gmail.com>
Wed, 22 May 2019 14:28:21 +0000 (16:28 +0200)
Includes contributions by @nBurn, thanks!

Fixes T63909

Differential Revision: https://developer.blender.org/D4487

amaranth/__init__.py
amaranth/animation/jump_frames.py
amaranth/misc/color_management.py
amaranth/misc/dupli_group_id.py
amaranth/node_editor/display_image.py
amaranth/render/only_render.py [deleted file]
amaranth/render/unsimplify.py [deleted file]
amaranth/scene/debug.py

index e951c0b..463d0a5 100644 (file)
@@ -62,8 +62,6 @@ from amaranth.render import (
     meshlight_add,
     meshlight_select,
     passepartout,
-    only_render,
-    unsimplify,
     final_resolution,
     samples_scene,
     render_output_z,
@@ -88,8 +86,8 @@ from amaranth.misc import (
 # register the addon + modules found in globals()
 bl_info = {
     "name": "Amaranth Toolset",
-    "author": "Pablo Vazquez, Bassam Kurdali, Sergey Sharybin, Lukas Tönne, Cesar Saez",
-    "version": (1, 0, 6),
+    "author": "Pablo Vazquez, Bassam Kurdali, Sergey Sharybin, Lukas Tönne, Cesar Saez, CansecoGPC",
+    "version": (1, 0, 7),
     "blender": (2, 80, 0),
     "location": "Everywhere!",
     "description": "A collection of tools and settings to improve productivity",
index 661dcc8..fb12cb3 100644 (file)
@@ -173,8 +173,8 @@ def label(self, context):
 def register():
     bpy.utils.register_class(AMTH_SCREEN_OT_frame_jump)
     bpy.utils.register_class(AMTH_SCREEN_OT_keyframe_jump_inbetween)
-    bpy.types.USERPREF_PT_edit.append(ui_userpreferences_edit)
-    bpy.types.USERPREF_PT_edit.append(label)
+    bpy.types.USERPREF_PT_animation_timeline.append(ui_userpreferences_edit)
+    bpy.types.USERPREF_PT_animation_timeline.append(label)
 
     # register keyboard shortcuts
     wm = bpy.context.window_manager
@@ -203,7 +203,7 @@ def register():
 def unregister():
     bpy.utils.unregister_class(AMTH_SCREEN_OT_frame_jump)
     bpy.utils.unregister_class(AMTH_SCREEN_OT_keyframe_jump_inbetween)
-    bpy.types.USERPREF_PT_edit.remove(ui_userpreferences_edit)
+    bpy.types.USERPREF_PT_animation_timeline.remove(ui_userpreferences_edit)
     for km, kmi in KEYMAPS:
         km.keymap_items.remove(kmi)
     KEYMAPS.clear()
index a8335ab..72ad4bb 100644 (file)
@@ -66,19 +66,19 @@ def ui_color_management_presets(self, context):
     row = layout.row(align=True)
     row.menu("AMTH_SCENE_MT_color_management_presets",
              text=bpy.types.AMTH_SCENE_MT_color_management_presets.bl_label)
-    row.operator("scene.color_management_preset_add", text="", icon="ZOOMIN")
+    row.operator("scene.color_management_preset_add", text="", icon="ZOOM_IN")
     row.operator("scene.color_management_preset_add",
-                 text="", icon="ZOOMOUT").remove_active = True
+                 text="", icon="ZOOM_OUT").remove_active = True
     layout.separator()
 
 
 def register():
     bpy.utils.register_class(AMTH_AddPresetColorManagement)
     bpy.utils.register_class(AMTH_SCENE_MT_color_management_presets)
-    bpy.types.SCENE_PT_color_management.prepend(ui_color_management_presets)
+    bpy.types.RENDER_PT_color_management.prepend(ui_color_management_presets)
 
 
 def unregister():
     bpy.utils.unregister_class(AMTH_AddPresetColorManagement)
     bpy.utils.unregister_class(AMTH_SCENE_MT_color_management_presets)
-    bpy.types.SCENE_PT_color_management.remove(ui_color_management_presets)
+    bpy.types.RENDER_PT_color_management.remove(ui_color_management_presets)
index b131eef..05fa712 100644 (file)
@@ -186,12 +186,12 @@ def ui_object_id_duplis(self, context):
 def register():
     bpy.utils.register_class(AMTH_OBJECT_OT_id_dupligroup)
     bpy.utils.register_class(AMTH_OBJECT_OT_id_dupligroup_clear)
-    bpy.types.OBJECT_PT_duplication.append(ui_dupli_group_library_path)
+    bpy.types.OBJECT_PT_instancing.append(ui_dupli_group_library_path)
     bpy.types.OBJECT_PT_relations.append(ui_object_id_duplis)
 
 
 def unregister():
     bpy.utils.unregister_class(AMTH_OBJECT_OT_id_dupligroup)
     bpy.utils.unregister_class(AMTH_OBJECT_OT_id_dupligroup_clear)
-    bpy.types.OBJECT_PT_duplication.remove(ui_dupli_group_library_path)
+    bpy.types.OBJECT_PT_instancing.remove(ui_dupli_group_library_path)
     bpy.types.OBJECT_PT_relations.remove(ui_object_id_duplis)
index 66d2f95..0dcefca 100644 (file)
@@ -94,7 +94,7 @@ def register():
     kc = bpy.context.window_manager.keyconfigs.addon
     km = kc.keymaps.new(name="Node Editor", space_type="NODE_EDITOR")
     kmi = km.keymap_items.new("node.show_active_node_image",
-                              "ACTIONMOUSE", "DOUBLE_CLICK")
+                              "LEFTMOUSE", "DOUBLE_CLICK")
     KEYMAPS.append((km, kmi))
 
 
diff --git a/amaranth/render/only_render.py b/amaranth/render/only_render.py
deleted file mode 100644 (file)
index 664051d..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-#  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.
-"""
-3D View Shading Shortcuts
-
-Two new shortcuts have been added to the 3D View.
-Shift+Z Rendered Preview (now in Blender 2.70)
-Alt+Shift+Z Only Render
-"""
-
-import bpy
-
-
-KEYMAPS = list()
-
-
-class AMTH_VIEW3D_OT_show_only_render(bpy.types.Operator):
-    bl_idname = "view3d.show_only_render"
-    bl_label = "Show Only Render"
-
-    def execute(self, context):
-        space = bpy.context.space_data
-
-        if space.show_only_render:
-            space.show_only_render = False
-        else:
-            space.show_only_render = True
-        return {"FINISHED"}
-
-
-def register():
-    bpy.utils.register_class(AMTH_VIEW3D_OT_show_only_render)
-    kc = bpy.context.window_manager.keyconfigs.addon
-    km = kc.keymaps.new(name="3D View", space_type="VIEW_3D")
-    kmi = km.keymap_items.new("view3d.show_only_render", "Z", "PRESS",
-                              shift=True, alt=True)
-    KEYMAPS.append((km, kmi))
-
-
-def unregister():
-    bpy.utils.unregister_class(AMTH_VIEW3D_OT_show_only_render)
-    for km, kmi in KEYMAPS:
-        km.keymap_items.remove(kmi)
-    KEYMAPS.clear()
diff --git a/amaranth/render/unsimplify.py b/amaranth/render/unsimplify.py
deleted file mode 100644 (file)
index 25f9df1..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-#  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.
-"""
-Unsimplify Render
-
-Handy option when you want to simplify the 3D View but unsimplify during
-render. Find it on the Simplify panel under Scene properties.
-"""
-
-import bpy
-from amaranth import utils
-
-
-def init():
-    scene = bpy.types.Scene
-    scene.use_unsimplify_render = bpy.props.BoolProperty(
-        default=False,
-        name="Unsimplify Render",
-        description="Disable Simplify during render")
-    scene.simplify_status = bpy.props.BoolProperty(default=False)
-
-
-def clear():
-    wm = bpy.context.window_manager
-    for p in ("use_unsimplify_render", "simplify_status"):
-        if wm.get(p):
-            del wm[p]
-
-
-@bpy.app.handlers.persistent
-def unsimplify_render_pre(scene):
-    render = scene.render
-    scene.simplify_status = render.use_simplify
-
-    if scene.use_unsimplify_render:
-        render.use_simplify = False
-
-
-@bpy.app.handlers.persistent
-def unsimplify_render_post(scene):
-    render = scene.render
-    render.use_simplify = scene.simplify_status
-
-
-def unsimplify_ui(self, context):
-    scene = bpy.context.scene
-    self.layout.prop(scene, 'use_unsimplify_render')
-
-
-def register():
-    init()
-    bpy.app.handlers.render_pre.append(unsimplify_render_pre)
-    bpy.app.handlers.render_post.append(unsimplify_render_post)
-    bpy.types.SCENE_PT_simplify.append(unsimplify_ui)
-    if utils.cycles_exists():
-        if bpy.app.version >= (2, 79, 1):
-            bpy.types.CYCLES_SCENE_PT_simplify.append(unsimplify_ui)
-        else:
-            bpy.types.CyclesScene_PT_simplify.append(unsimplify_ui)
-
-
-
-def unregister():
-    clear()
-    bpy.app.handlers.render_pre.remove(unsimplify_render_pre)
-    bpy.app.handlers.render_post.remove(unsimplify_render_post)
-    bpy.types.SCENE_PT_simplify.remove(unsimplify_ui)
-    if utils.cycles_exists():
-        if bpy.app.version >= (2, 79, 1):
-            bpy.types.CYCLES_SCENE_PT_simplify.remove(unsimplify_ui)
-        else:
-            bpy.types.CyclesScene_PT_simplify.remove(unsimplify_ui)
index 47b8702..c4962b5 100755 (executable)
@@ -31,8 +31,8 @@ working on it!). It works since 0.8.8!
 Under the "Scene Debug" panel in Scene properties.
 
 * Lighter's Corner
-This is an UI List of Lamps in the scene(s).
-It allows you to quickly see how many lamps you have, select them by
+This is an UI List of Lights in the scene(s).
+It allows you to quickly see how many lights you have, select them by
 clicking on their name, see their type (icon), samples number (if using
 Branched Path Tracing), size, and change their visibility.
 
@@ -72,7 +72,7 @@ class AMTH_store_data():
     users = {
         'OBJECT_DATA': [],         # Store Objects with Material
         'MATERIAL': [],            # Materials (Node tree)
-        'LAMP': [],                # Lamps
+        'LIGHT': [],               # Lights
         'WORLD': [],               # World
         'TEXTURE': [],             # Textures (Psys, Brushes)
         'MODIFIER': [],            # Modifiers
@@ -644,8 +644,8 @@ class AMTH_SCENE_OT_list_users_for_x(Operator):
 
                                     if name not in AMTH_store_data.users['MATERIAL']:
                                         AMTH_store_data.users['MATERIAL'].append(name)
-            # Check Lamps
-            for la in d.lamps:
+            # Check Lights
+            for la in d.lights:
                 # Cycles
                 if utils.cycles_exists():
                     if la and la.node_tree and la.node_tree.nodes:
@@ -653,8 +653,8 @@ class AMTH_SCENE_OT_list_users_for_x(Operator):
                             if no and \
                                    no.type in {'TEX_IMAGE', 'TEX_ENVIRONMENT'} and \
                                    no.image and no.image.name == x:
-                                if la.name not in AMTH_store_data.users['LAMP']:
-                                    AMTH_store_data.users['LAMP'].append(la.name)
+                                if la.name not in AMTH_store_data.users['LIGHT']:
+                                    AMTH_store_data.users['LIGHT'].append(la.name)
             # Check World
             for wo in d.worlds:
                 # Cycles
@@ -880,7 +880,7 @@ class AMTH_SCENE_PT_scene_debug(Panel):
 
     def draw_header(self, context):
         layout = self.layout
-        layout.label(text="", icon="RADIO")
+        layout.label(text="", icon="RADIOBUT_ON")
 
     def draw_label(self, layout, body_text, single, multi, lists, ico="BLANK1"):
         layout.label(
@@ -918,7 +918,7 @@ class AMTH_SCENE_PT_scene_debug(Panel):
             image_state = context.window_manager.amth_missing_images_state
 
             row.label(
-                "{} Image Blocks present in the Data".format(has_images),
+                text="{} Image Blocks present in the Data".format(has_images),
                 icon="IMAGE_DATA"
                 )
             if len(image_state.keys()) > 0:
@@ -1119,7 +1119,7 @@ class AMTH_PT_LightersCorner(Panel):
 
     def draw_header(self, context):
         layout = self.layout
-        layout.label(text="", icon="LAMP_SUN")
+        layout.label(text="", icon="LIGHT_SUN")
 
     def draw(self, context):
         layout = self.layout
@@ -1138,7 +1138,7 @@ class AMTH_PT_LightersCorner(Panel):
 
         if not state_props:
             row = box.row()
-            message = "Please Refresh" if len(bpy.data.lamps) > 0 else "No Lamps in Data"
+            message = "Please Refresh" if len(bpy.data.lights) > 0 else "No Lights in Data"
             row.label(text=message, icon="INFO")
         else:
             row = box.row(align=True)
@@ -1234,7 +1234,7 @@ class AMTH_UL_LightersCorner_UI(UIList):
             splitlampd.alignment = "RIGHT"
 
             if utils.cycles_exists() and engine == "CYCLES":
-                if "LAMP" in icon_type:
+                if "LIGHT" in icon_type:
                     clamp = ob.data.cycles
                     if context.scene.cycles.progressive == "BRANCHED_PATH":
                         splitlampb.prop(clamp, "samples", text="")
@@ -1254,7 +1254,7 @@ class AMTH_UL_LightersCorner_UI(UIList):
                 else:
                     splitlampb.label(text="N/A")
             if engine == "BLENDER_RENDER":
-                if "LAMP" in icon_type:
+                if "LIGHT" in icon_type:
                     lamp = ob.data
                     if lamp.type == "HEMI":
                         splitlampb.label(text="Not Available")
@@ -1317,12 +1317,12 @@ def fill_ligters_corner_props(context, refresh=False):
 
     for ob in bpy.data.objects:
         if ob.name not in light_state.keys() or refresh:
-            is_lamp = ob.type == "LAMP"
+            is_light = ob.type == "LIGHT"
             is_emission = True if utils.cycles_is_emission(
                     context, ob) and list_meshlights else False
 
-            if is_lamp or is_emission:
-                icons = "LAMP_%s" % ob.data.type if is_lamp else "MESH_GRID"
+            if is_light or is_emission:
+                icons = "LIGHT_%s" % ob.data.type if is_light else "MESH_GRID"
                 text_l = "{} {}{}".format(" [L] " if ob.library else "", ob.name,
                         "" if ob.name in context.scene.objects else " [Not in Scene]")
                 prop = light_state.add()