- rna py-api bug fix, a NULL item in a collection was raising an error
authorCampbell Barton <ideasman42@gmail.com>
Sun, 22 Aug 2010 17:23:08 +0000 (17:23 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 22 Aug 2010 17:23:08 +0000 (17:23 +0000)
 eg: mesh.materials[0]
 ... when this was an empty slot.

- game world mist panel wasnt updated for rna renaming.

release/scripts/ui/properties_game.py
source/blender/python/intern/bpy_rna.c

index 7735db8228c67c85e14353cd0da7a09573735035..8d2f075fce08af3b5a6c1d532827fd5cc43f6964 100644 (file)
@@ -425,21 +425,21 @@ class WORLD_PT_game_mist(WorldButtonsPanel, bpy.types.Panel):
     def draw_header(self, context):
         world = context.world
 
-        self.layout.prop(world.mist, "use_mist", text="")
+        self.layout.prop(world.mist_settings, "use_mist", text="")
 
     def draw(self, context):
         layout = self.layout
 
         world = context.world
 
-        layout.active = world.mist.use_mist
+        layout.active = world.mist_settings.use_mist
         split = layout.split()
 
         col = split.column()
-        col.prop(world.mist, "start")
+        col.prop(world.mist_settings, "start")
 
         col = split.column()
-        col.prop(world.mist, "depth")
+        col.prop(world.mist_settings, "depth")
 
 
 class WORLD_PT_game_physics(WorldButtonsPanel, bpy.types.Panel):
index fd3b59a97f762b7958f65d65862a415c3d6a80ea..07b237a40f8eb6cbc0e37d457c46d8303246b12d 100644 (file)
@@ -1250,10 +1250,11 @@ static PyObject *pyrna_prop_collection_subscript_int(BPy_PropertyRNA *self, Py_s
                if(RNA_property_collection_lookup_int(&self->ptr, self->prop, keynum, &newptr)) {
                        return pyrna_struct_CreatePyObject(&newptr);
                }
-               PyErr_Format(PyExc_IndexError, "bpy_prop_collection[index]: index %d could not be found", keynum);
-               return NULL;
+               else { /* fail's if ptr.data == NULL, valid for mesh.materials */
+                       Py_RETURN_NONE;
+               }
        }
-       PyErr_Format(PyExc_IndexError, "bpy_prop_collection[index]: index %d out of range", keynum);
+       PyErr_Format(PyExc_IndexError, "bpy_prop_collection[index]: index %d out of range, size %d", keynum, len);
        return NULL;
 }