[Bf-extensions-cvs] [6fd569bc] master: *Removed automatic activation of Add Mesh: extra objects used for 3d function surface (exported as pov parametric object) *Replaced by a message and easy menu for user to activate it himself to avoid conflicts with other scripts when deactivating POV would also deactivate extras.

Maurice Raybaud noreply at git.blender.org
Sat Jun 17 20:18:04 CEST 2017


Commit: 6fd569bc7404ad9d7a18f1b90f46075264a6c0cc
Author: Maurice Raybaud
Date:   Sat Jun 17 20:17:44 2017 +0200
Branches: master
https://developer.blender.org/rBA6fd569bc7404ad9d7a18f1b90f46075264a6c0cc

*Removed automatic activation of Add Mesh: extra objects used for 3d function surface (exported as pov parametric object)
*Replaced by a message and easy menu for user to activate it himself to avoid conflicts with other scripts when deactivating POV would also deactivate extras.

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

M	render_povray/__init__.py
M	render_povray/ui.py

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

diff --git a/render_povray/__init__.py b/render_povray/__init__.py
index b95103b9..a04977a4 100644
--- a/render_povray/__init__.py
+++ b/render_povray/__init__.py
@@ -64,7 +64,6 @@ else:
             update_files,
             )
 
-
 def string_strip_hyphen(name):
     return name.replace("-", "")
 
@@ -2176,8 +2175,9 @@ def register():
     bpy.types.INFO_MT_add.prepend(ui.menu_func_add)
     bpy.types.INFO_MT_file_import.append(ui.menu_func_import)
     bpy.types.TEXT_MT_templates.append(ui.menu_func_templates)
-    #used for parametric objects:
-    addon_utils.enable("add_mesh_extra_objects", default_set=False, persistent=True)
+    # was used for parametric objects but made the other addon unreachable on
+    # unregister for other tools to use created a user action call instead
+    #addon_utils.enable("add_mesh_extra_objects", default_set=False, persistent=True)
 
     #bpy.types.TEXTURE_PT_context_texture.prepend(TEXTURE_PT_povray_type)
 
@@ -2203,7 +2203,7 @@ def unregister():
     bpy.types.NODE_HT_header.remove(ui.menu_func_nodes)
 
     #bpy.types.TEXTURE_PT_context_texture.remove(TEXTURE_PT_povray_type)
-    addon_utils.disable("add_mesh_extra_objects", default_set=False)
+    #addon_utils.disable("add_mesh_extra_objects", default_set=False)
     bpy.types.TEXT_MT_templates.remove(ui.menu_func_templates)
     bpy.types.INFO_MT_file_import.remove(ui.menu_func_import)
     bpy.types.INFO_MT_add.remove(ui.menu_func_add)
diff --git a/render_povray/ui.py b/render_povray/ui.py
index 0feecec9..6fa703ee 100644
--- a/render_povray/ui.py
+++ b/render_povray/ui.py
@@ -177,7 +177,11 @@ for member in dir(properties_particle):  # add all "particle" panels from blende
         pass
 del properties_particle
 
-
+def check_add_mesh_extra_objects():
+    if "add_mesh_extra_objects" in bpy.context.user_preferences.addons.keys():
+        return True
+    return False
+    
 class RenderButtonsPanel():
     bl_space_type = 'PROPERTIES'
     bl_region_type = 'WINDOW'
@@ -1586,7 +1590,6 @@ class BasicShapesMenu(bpy.types.Menu):
         layout.operator("pov.cone_add", text="Cone",icon="MESH_CONE")
         layout.operator("pov.addtorus", text="Torus",icon = 'MESH_TORUS')
         layout.separator()
-        layout.operator("pov.addparametric", text="Parametric",icon = 'SCRIPTPLUGINS')
         layout.operator("pov.addrainbow", text="Rainbow",icon="COLOR")
         layout.operator("pov.addlathe", text="Lathe",icon = 'MOD_SCREW')
         layout.operator("pov.addprism", text="Prism",icon = 'MOD_SOLIDIFY')
@@ -1604,7 +1607,22 @@ class BasicShapesMenu(bpy.types.Menu):
         layout.label(text = "Macro based")
         layout.operator("pov.addpolygontocircle", text="Polygon To Circle Blending",icon="RETOPO")
         layout.operator("pov.addloft", text="Loft",icon="SURFACE_NSURFACE")
-
+        layout.separator()
+        # Warning if the Add Advanced Objects addon containing
+        # Add mesh extra objects is not enabled
+        if not check_add_mesh_extra_objects():
+            #col = box.column()
+            layout.label(text="Please enable Add Mesh: Extra Objects addon", icon="INFO")
+            #layout.separator()
+            layout.operator("wm.addon_userpref_show",
+                         text="Go to Add Mesh: Extra Objects addon",
+                         icon="PREFERENCES").module = "add_mesh_extra_objects"
+
+            #layout.separator()
+            return
+        else:
+            layout.operator("pov.addparametric", text="Parametric",icon = 'SCRIPTPLUGINS')
+            
 class ImportMenu(bpy.types.Menu):
     bl_idname = "Importer_calls"
     bl_label = "Import"



More information about the Bf-extensions-cvs mailing list