- rna attribute setting problem, class instances could not set their own attributes because they are blocked by our own internal setattr.
this could be supported again easily however it leads typo's & api changes not showing any errors. This broke povray export. Solution for now is to allow setting private properties starting with '_' eg, ob = bpy.context.object ob._foo = [1,2,3] # this is a python list, it will stay only as long as this PyObject is active ob.foo = 1 # raises an error!, only for rna properties ob["foo"] = 1 # converts to an ID property and is saved using the underscore like this should really be used for classes internally. - povray failed on armatures - menu key wasn't using WM_keymap_add_menu
This commit is contained in:
@@ -1625,11 +1625,10 @@ static int pyrna_struct_setattro( BPy_StructRNA *self, PyObject *pyname, PyObjec
|
||||
if (prop==NULL) {
|
||||
// XXX - This currently allows anything to be assigned to an rna prop, need to see how this should be used
|
||||
// but for now it makes porting scripts confusing since it fails silently.
|
||||
#if 0
|
||||
if (!BPy_StructRNA_CheckExact(self) && PyObject_GenericSetAttr((PyObject *)self, pyname, value) >= 0) {
|
||||
// edit: allowing this for setting classes internal attributes.
|
||||
if (name[0]=='_' && !BPy_StructRNA_CheckExact(self) && PyObject_GenericSetAttr((PyObject *)self, pyname, value) >= 0) {
|
||||
return 0;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
PyErr_Format( PyExc_AttributeError, "StructRNA - Attribute \"%.200s\" not found", name);
|
||||
return -1;
|
||||
|
Reference in New Issue
Block a user