Skip to content
Snippets Groups Projects
Commit 6695fc64 authored by Sergey Sharybin's avatar Sergey Sharybin
Browse files

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.
parent dea059d4
Branches
Tags
No related merge requests found
...@@ -1086,7 +1086,7 @@ kmi_defs = ( ...@@ -1086,7 +1086,7 @@ kmi_defs = (
def register(): def register():
import sys import sys
have_cycles = True if "_cycles" in sys.modules else False have_cycles = ("_cycles" in sys.modules)
bpy.utils.register_class(AmaranthToolsetPreferences) bpy.utils.register_class(AmaranthToolsetPreferences)
...@@ -1172,6 +1172,8 @@ def register(): ...@@ -1172,6 +1172,8 @@ def register():
addon_keymaps.append((km, kmi)) addon_keymaps.append((km, kmi))
def unregister(): def unregister():
import sys
have_cycles = ("_cycles" in sys.modules)
bpy.utils.unregister_class(AmaranthToolsetPreferences) bpy.utils.unregister_class(AmaranthToolsetPreferences)
...@@ -1194,13 +1196,15 @@ def unregister(): ...@@ -1194,13 +1196,15 @@ def unregister():
bpy.types.NODE_HT_header.remove(node_templates_pulldown) bpy.types.NODE_HT_header.remove(node_templates_pulldown)
bpy.types.NODE_HT_header.remove(node_stats) bpy.types.NODE_HT_header.remove(node_stats)
bpy.types.CyclesMaterial_PT_settings.remove(material_cycles_settings_extra) if have_cycles:
bpy.types.CyclesRender_PT_sampling.remove(render_cycles_scene_samples) 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.FILEBROWSER_HT_header.remove(button_directory_current_blend)
bpy.types.SCENE_PT_simplify.remove(unsimplify_ui) 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) bpy.types.PARTICLE_PT_render.remove(particles_material_info)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment