[Bf-blender-cvs] [f4fb329808a] master: RNA/PyAPI: Expose Py classes in bpy.types

Campbell Barton noreply at git.blender.org
Mon Sep 4 08:32:27 CEST 2017


Commit: f4fb329808a7e7d5b3e452c95c768298f3824bf0
Author: Campbell Barton
Date:   Mon Sep 4 14:49:27 2017 +1000
Branches: master
https://developer.blender.org/rBf4fb329808a7e7d5b3e452c95c768298f3824bf0

RNA/PyAPI: Expose Py classes in bpy.types

Operators and their properties are two different types

Previously both operators and their properties are added
causing C operators to access the properties, Python the classes.

Favor consistency in this case so only Python classes are added.

===================================================================

M	source/blender/makesrna/intern/rna_wm.c
M	source/blender/python/intern/bpy_operator_wrap.c

===================================================================

diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index 678d3dd2f08..df3eae4f221 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -1461,6 +1461,7 @@ static void rna_def_operator(BlenderRNA *brna)
 	RNA_def_struct_register_funcs(srna, "rna_Operator_register", "rna_Operator_unregister", "rna_Operator_instance");
 #endif
 	RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
+	RNA_def_struct_flag(srna, STRUCT_PUBLIC_NAMESPACE_INHERIT);
 
 	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
@@ -1546,7 +1547,7 @@ static void rna_def_operator(BlenderRNA *brna)
 	RNA_def_struct_ui_text(srna, "Operator Properties", "Input properties of an Operator");
 	RNA_def_struct_refine_func(srna, "rna_OperatorProperties_refine");
 	RNA_def_struct_idprops_func(srna, "rna_OperatorProperties_idprops");
-	RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES | STRUCT_PUBLIC_NAMESPACE_INHERIT);
+	RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES);
 }
 
 static void rna_def_macro_operator(BlenderRNA *brna)
@@ -1564,6 +1565,7 @@ static void rna_def_macro_operator(BlenderRNA *brna)
 	                              "rna_Operator_instance");
 #endif
 	RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
+	RNA_def_struct_flag(srna, STRUCT_PUBLIC_NAMESPACE_INHERIT);
 
 	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
diff --git a/source/blender/python/intern/bpy_operator_wrap.c b/source/blender/python/intern/bpy_operator_wrap.c
index 3afde45195c..9d57adca946 100644
--- a/source/blender/python/intern/bpy_operator_wrap.c
+++ b/source/blender/python/intern/bpy_operator_wrap.c
@@ -53,7 +53,7 @@ static void operator_properties_init(wmOperatorType *ot)
 	 *
 	 * Note the 'no_struct_map' function is used since the actual struct name is already used by the operator.
 	 */
-	RNA_def_struct_identifier(&BLENDER_RNA, ot->srna, ot->idname);
+	RNA_def_struct_identifier_no_struct_map(ot->srna, ot->idname);
 
 	if (pyrna_deferred_register_class(ot->srna, py_class) != 0) {
 		PyErr_Print(); /* failed to register operator props */



More information about the Bf-blender-cvs mailing list