[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3897] contrib/py/scripts/addons/ io_mesh_xyz/__init__.py: If no object is present in the scene no action follows.

Clemens Barth barth at root-1.de
Sat Oct 27 13:32:31 CEST 2012


Revision: 3897
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3897
Author:   blendphys
Date:     2012-10-27 11:32:28 +0000 (Sat, 27 Oct 2012)
Log Message:
-----------
If no object is present in the scene no action follows. This change in the
code was done upon a suggestion from CoDEmanX1.

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-26 22:11:10 UTC (rev 3896)
+++ contrib/py/scripts/addons/io_mesh_xyz/__init__.py	2012-10-27 11:32:28 UTC (rev 3897)
@@ -25,7 +25,7 @@
 #
 #  Start of project              : 2011-12-01 by Clemens Barth
 #  First publication in Blender  : 2011-12-18
-#  Last modified                 : 2012-10-25
+#  Last modified                 : 2012-10-27
 #
 #  Acknowledgements: Thanks to ideasman, meta_androcto, truman, kilon,
 #  dairin0d, PKHG, Valter, etc
@@ -424,6 +424,15 @@
     bl_label = "Delete keys"
     bl_description = "Delete the shape keys"
 
+    # If no object is in the scene, do nothing (return False).
+    @classmethod
+    def poll(self, context):
+
+        if bpy.context.object == None:
+            return False
+        else:
+            return True
+
     def execute(self, context):
 
         bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
@@ -448,6 +457,15 @@
     bl_label = "Load frames"
     bl_description = "Load the frames"
 
+    # If no object is in the scene, do nothing (return False).
+    @classmethod
+    def poll(self, context):
+
+        if bpy.context.object == None:
+            return False
+        else:
+            return True
+
     def execute(self, context):
         global ATOM_XYZ_ERROR
         scn = bpy.context.scene.atom_xyz[0]



More information about the Bf-extensions-cvs mailing list