[Bf-extensions-cvs] [6695fc6] master: Tweaks to previous commit

Sergey Sharybin noreply at git.blender.org
Mon Nov 25 09:48:09 CET 2013


Commit: 6695fc64a51fcc64c96bc31c5b209a54d8ea9ba6
Author: Sergey Sharybin
Date:   Mon Nov 25 14:46:36 2013 +0600
http://developer.blender.org/rBAC6695fc64a51fcc64c96bc31c5b209a54d8ea9ba6

Tweaks to previous commit

- Use simplified expression for checking whether Cycles present or not
- Need to check for Cycles in unregister() as well

TODO: Keymap unregister still gives issues, but that's nothing to do
      with Cycles.

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

M	scene_amaranth_toolset.py

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

diff --git a/scene_amaranth_toolset.py b/scene_amaranth_toolset.py
index b590f99..d4f46e5 100644
--- a/scene_amaranth_toolset.py
+++ b/scene_amaranth_toolset.py
@@ -1086,7 +1086,7 @@ kmi_defs = (
 
 def register():
     import sys
-    have_cycles = True if "_cycles" in sys.modules else False
+    have_cycles = ("_cycles" in sys.modules)
 
     bpy.utils.register_class(AmaranthToolsetPreferences)
 
@@ -1172,6 +1172,8 @@ def register():
             addon_keymaps.append((km, kmi))
 
 def unregister():
+    import sys
+    have_cycles = ("_cycles" in sys.modules)
 
     bpy.utils.unregister_class(AmaranthToolsetPreferences)
 
@@ -1194,13 +1196,15 @@ def unregister():
     bpy.types.NODE_HT_header.remove(node_templates_pulldown)
     bpy.types.NODE_HT_header.remove(node_stats)
 
-    bpy.types.CyclesMaterial_PT_settings.remove(material_cycles_settings_extra)
-    bpy.types.CyclesRender_PT_sampling.remove(render_cycles_scene_samples)
+    if have_cycles:
+        bpy.types.CyclesMaterial_PT_settings.remove(material_cycles_settings_extra)
+        bpy.types.CyclesRender_PT_sampling.remove(render_cycles_scene_samples)
 
     bpy.types.FILEBROWSER_HT_header.remove(button_directory_current_blend)
 
     bpy.types.SCENE_PT_simplify.remove(unsimplify_ui)
-    bpy.types.CyclesScene_PT_simplify.remove(unsimplify_ui)
+    if have_cycles:
+        bpy.types.CyclesScene_PT_simplify.remove(unsimplify_ui)
 
     bpy.types.PARTICLE_PT_render.remove(particles_material_info)



More information about the Bf-extensions-cvs mailing list