- bugfix, operators were getting their properties registered twice.
- operator properties are now converted into python property() class members which bypass the operator 'properties' member. self.properties.mysetting ... can now be written as ... self.mysetting - fix for error reloading rigify
This commit is contained in:
		@@ -701,6 +701,14 @@ class OrderedMeta(RNAMeta):
 | 
				
			|||||||
class Operator(StructRNA, metaclass=OrderedMeta):
 | 
					class Operator(StructRNA, metaclass=OrderedMeta):
 | 
				
			||||||
    __slots__ = ()
 | 
					    __slots__ = ()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @classmethod
 | 
				
			||||||
 | 
					    def easy_getsets(cls):
 | 
				
			||||||
 | 
					        def bypass_attr(attr):
 | 
				
			||||||
 | 
					            setattr(cls, attr, property(lambda self: getattr(self.properties, attr), lambda self, value: setattr(self.properties, attr, value)))
 | 
				
			||||||
 | 
					        for attr, value in list(cls.__dict__.items()):
 | 
				
			||||||
 | 
					            if type(value) == tuple and len(value) == 2 and type(value[1]) == dict:
 | 
				
			||||||
 | 
					                bypass_attr(attr)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class Macro(StructRNA, metaclass=OrderedMeta):
 | 
					class Macro(StructRNA, metaclass=OrderedMeta):
 | 
				
			||||||
    # bpy_types is imported before ops is defined
 | 
					    # bpy_types is imported before ops is defined
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -318,7 +318,7 @@ def register():
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def unregister():
 | 
					def unregister():
 | 
				
			||||||
    bpy.types.Scene.RemoveProperty("pose_templates")
 | 
					    del bpy.types.Scene.pose_templates
 | 
				
			||||||
    space_info.INFO_MT_armature_add.remove(menu_func)
 | 
					    space_info.INFO_MT_armature_add.remove(menu_func)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if __name__ == "__main__":
 | 
					if __name__ == "__main__":
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -840,6 +840,7 @@ static StructRNA *rna_Operator_register(const bContext *C, ReportList *reports,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	/* create a new menu type */
 | 
						/* create a new menu type */
 | 
				
			||||||
	dummyot.ext.srna= RNA_def_struct(&BLENDER_RNA, dummyot.idname, "Operator");
 | 
						dummyot.ext.srna= RNA_def_struct(&BLENDER_RNA, dummyot.idname, "Operator");
 | 
				
			||||||
 | 
						RNA_def_struct_flag(dummyot.ext.srna, STRUCT_NO_IDPROPERTIES); /* operator properties are registered separately */
 | 
				
			||||||
	dummyot.ext.data= data;
 | 
						dummyot.ext.data= data;
 | 
				
			||||||
	dummyot.ext.call= call;
 | 
						dummyot.ext.call= call;
 | 
				
			||||||
	dummyot.ext.free= free;
 | 
						dummyot.ext.free= free;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -45,6 +45,9 @@ static void operator_properties_init(wmOperatorType *ot)
 | 
				
			|||||||
		PyErr_Print(); /* failed to register operator props */
 | 
							PyErr_Print(); /* failed to register operator props */
 | 
				
			||||||
		PyErr_Clear();
 | 
							PyErr_Clear();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						// see bpy_types.py:Operator, May redo this some other way!
 | 
				
			||||||
 | 
						PyObject_CallMethod(py_class, "easy_getsets", NULL);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void operator_wrapper(wmOperatorType *ot, void *userdata)
 | 
					void operator_wrapper(wmOperatorType *ot, void *userdata)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user