allow unregistered rna classes to have rna properties assigned before registration.

this is useful for the register() class method which is called before the class gets structRNA assigned.

eg:

class MyClass(bpy.types.PropertyGroup):
    @classmethod
    def register(cls):
        cls.name = StringProperty()  # assigned but registration is delayed.
This commit is contained in:
2011-03-23 12:44:22 +00:00
parent f35c396676
commit f87b37b3ef

View File

@@ -2993,11 +2993,13 @@ static int pyrna_struct_meta_idprop_setattro(PyObject *cls, PyObject *attr, PyOb
}
if(srna == NULL) {
/* allow setting on unregistered classes which can be registered later on */
/*
if(value && is_deferred_prop) {
PyErr_Format(PyExc_AttributeError, "pyrna_struct_meta_idprop_setattro() unable to get srna from class '%.200s'", ((PyTypeObject *)cls)->tp_name);
return -1;
}
*/
/* srna_from_self may set an error */
PyErr_Clear();
return PyType_Type.tp_setattro(cls, attr, value);