[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3901] contrib/py/scripts/addons/ io_mesh_xyz/__init__.py: Security checks also for other operators ( rendering) ...

Clemens Barth barth at root-1.de
Sun Oct 28 22:11:34 CET 2012


Revision: 3901
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3901
Author:   blendphys
Date:     2012-10-28 21:11:31 +0000 (Sun, 28 Oct 2012)
Log Message:
-----------
Security checks also for other operators (rendering) ...

Modified Paths:
--------------
    contrib/py/scripts/addons/io_mesh_xyz/__init__.py

Modified: contrib/py/scripts/addons/io_mesh_xyz/__init__.py
===================================================================
--- contrib/py/scripts/addons/io_mesh_xyz/__init__.py	2012-10-28 19:58:57 UTC (rev 3900)
+++ contrib/py/scripts/addons/io_mesh_xyz/__init__.py	2012-10-28 21:11:31 UTC (rev 3901)
@@ -280,6 +280,27 @@
     bl_label = "Create command"
     bl_description = "Create a shell command for rendering the scene"
 
+    # If no object is in the scene, do nothing (return False).
+    @classmethod
+    def poll(self, context):
+
+        if bpy.context.object == None:
+            return False
+        if len(import_xyz.STRUCTURE) == 0:
+            return False
+        if len(import_xyz.ALL_FRAMES) < 2:
+            return False
+
+        EMPTY = True
+        for element in import_xyz.STRUCTURE:
+            if element.name != '':
+                EMPTY = False
+
+        if EMPTY == True:
+            return False
+
+        return True
+
     def execute(self, context):
         global ATOM_XYZ_ERROR
         global ATOM_XYZ_NOTE
@@ -357,6 +378,27 @@
     bl_label = "Render"
     bl_description = "Render the scene"
 
+    # If no object is in the scene, do nothing (return False).
+    @classmethod
+    def poll(self, context):
+
+        if bpy.context.object == None:
+            return False
+        if len(import_xyz.STRUCTURE) == 0:
+            return False
+        if len(import_xyz.ALL_FRAMES) < 2:
+            return False
+
+        EMPTY = True
+        for element in import_xyz.STRUCTURE:
+            if element.name != '':
+                EMPTY = False
+
+        if EMPTY == True:
+            return False
+
+        return True
+
     def execute(self, context):
         global ATOM_XYZ_ERROR
         scn = bpy.context.scene



More information about the Bf-extensions-cvs mailing list