[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3899] contrib/py/scripts/addons/ io_mesh_xyz/__init__.py: Some other security checks ...

Clemens Barth barth at root-1.de
Sat Oct 27 15:04:04 CEST 2012


Revision: 3899
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3899
Author:   blendphys
Date:     2012-10-27 13:03:59 +0000 (Sat, 27 Oct 2012)
Log Message:
-----------
Some other security checks ...

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-27 11:34:35 UTC (rev 3898)
+++ contrib/py/scripts/addons/io_mesh_xyz/__init__.py	2012-10-27 13:03:59 UTC (rev 3899)
@@ -430,14 +430,28 @@
 
         if bpy.context.object == None:
             return False
-        else:
-            return True
+        if len(import_xyz.STRUCTURE) == 0:
+            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):
 
         bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
 
         for element in import_xyz.STRUCTURE:
+
+            if element.name == '':
+                continue
+
             if element.data.shape_keys == None:
                 break
         
@@ -463,17 +477,31 @@
 
         if bpy.context.object == None:
             return False
-        else:
-            return True
+        if len(import_xyz.STRUCTURE) == 0:
+            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.atom_xyz[0]
 
         bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
-        
+
         KEYS_PRESENT = False
         for element in import_xyz.STRUCTURE:
+
+            if element.name == '':
+                continue
+
             bpy.ops.object.select_all(action='DESELECT')
             bpy.context.scene.objects.active = element
             element.select = True
@@ -508,7 +536,6 @@
 
         import_xyz.DEF_atom_xyz_custom_datafile(scn.datafile)
 
-        # TODO, move this into 'import_xyz' and call the function
         for obj in bpy.context.selected_objects:
             if len(obj.children) != 0:
                 child = obj.children[0]



More information about the Bf-extensions-cvs mailing list