[Bf-blender-cvs] [732f70a151c] master: RNA: existing type check used wrong identifier

Campbell Barton noreply at git.blender.org
Thu Aug 31 10:38:56 CEST 2017


Commit: 732f70a151c47dc55e9da33c0bf346764bb54ab6
Author: Campbell Barton
Date:   Thu Aug 31 18:42:48 2017 +1000
Branches: master
https://developer.blender.org/rB732f70a151c47dc55e9da33c0bf346764bb54ab6

RNA: existing type check used wrong identifier

Own error in recent type checks, in many cases the 'idname'
is used for the struct identifier, not the 'identifier'
which is the Python class name in this context.

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

M	source/blender/makesrna/intern/rna_animation.c
M	source/blender/makesrna/intern/rna_nodetree.c
M	source/blender/makesrna/intern/rna_render.c
M	source/blender/makesrna/intern/rna_ui.c
M	source/blender/makesrna/intern/rna_wm.c

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

diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c
index b0a51fd8c73..cc3c140c5c6 100644
--- a/source/blender/makesrna/intern/rna_animation.c
+++ b/source/blender/makesrna/intern/rna_animation.c
@@ -273,7 +273,7 @@ static StructRNA *rna_KeyingSetInfo_register(Main *bmain, ReportList *reports, v
 	if (ksi && ksi->ext.srna) {
 		rna_KeyingSetInfo_unregister(bmain, ksi->ext.srna);
 	}
-	if (!RNA_struct_available_or_report(reports, identifier)) {
+	if (!RNA_struct_available_or_report(reports, dummyksi.idname)) {
 		return NULL;
 	}
 
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index f15605d0f83..1c7d7816f0f 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -633,7 +633,7 @@ static StructRNA *rna_NodeTree_register(
 	if (nt) {
 		rna_NodeTree_unregister(bmain, nt->ext.srna);
 	}
-	if (!RNA_struct_available_or_report(reports, identifier)) {
+	if (!RNA_struct_available_or_report(reports, dummynt.idname)) {
 		return NULL;
 	}
 
@@ -1393,16 +1393,13 @@ static bNodeType *rna_Node_register_base(Main *bmain, ReportList *reports, Struc
 		            identifier, (int)sizeof(dummynt.idname));
 		return NULL;
 	}
-	if (!RNA_struct_available_or_report(reports, identifier)) {
-		return NULL;
-	}
 
 	/* check if we have registered this node type before, and remove it */
 	nt = nodeTypeFind(dummynt.idname);
 	if (nt) {
 		rna_Node_unregister(bmain, nt->ext.srna);
 	}
-	if (!RNA_struct_available_or_report(reports, identifier)) {
+	if (!RNA_struct_available_or_report(reports, dummynt.idname)) {
 		return NULL;
 	}
 	
diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c
index 0c0484e633b..360b8831f8c 100644
--- a/source/blender/makesrna/intern/rna_render.c
+++ b/source/blender/makesrna/intern/rna_render.c
@@ -321,7 +321,7 @@ static StructRNA *rna_RenderEngine_register(Main *bmain, ReportList *reports, vo
 			break;
 		}
 	}
-	if (!RNA_struct_available_or_report(reports, identifier)) {
+	if (!RNA_struct_available_or_report(reports, dummyet.idname)) {
 		return NULL;
 	}
 	
diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c
index 0fc0739f860..84e446ef330 100644
--- a/source/blender/makesrna/intern/rna_ui.c
+++ b/source/blender/makesrna/intern/rna_ui.c
@@ -229,7 +229,7 @@ static StructRNA *rna_Panel_register(Main *bmain, ReportList *reports, void *dat
 			break;
 		}
 	}
-	if (!RNA_struct_available_or_report(reports, identifier)) {
+	if (!RNA_struct_available_or_report(reports, dummypt.idname)) {
 		return NULL;
 	}
 	
@@ -494,7 +494,7 @@ static StructRNA *rna_UIList_register(Main *bmain, ReportList *reports, void *da
 	if (ult && ult->ext.srna) {
 		rna_UIList_unregister(bmain, ult->ext.srna);
 	}
-	if (!RNA_struct_available_or_report(reports, identifier)) {
+	if (!RNA_struct_available_or_report(reports, dummyult.idname)) {
 		return NULL;
 	}
 
@@ -599,7 +599,7 @@ static StructRNA *rna_Header_register(Main *bmain, ReportList *reports, void *da
 			break;
 		}
 	}
-	if (!RNA_struct_available_or_report(reports, identifier)) {
+	if (!RNA_struct_available_or_report(reports, dummyht.idname)) {
 		return NULL;
 	}
 	
@@ -725,7 +725,7 @@ static StructRNA *rna_Menu_register(Main *bmain, ReportList *reports, void *data
 	if (mt && mt->ext.srna) {
 		rna_Menu_unregister(bmain, mt->ext.srna);
 	}
-	if (!RNA_struct_available_or_report(reports, identifier)) {
+	if (!RNA_struct_available_or_report(reports, dummymt.idname)) {
 		return NULL;
 	}
 	
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index 2114c22b428..8547c50f78e 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -1157,15 +1157,17 @@ static StructRNA *rna_Operator_register(
 	if (!RNA_struct_available_or_report(reports, identifier)) {
 		return NULL;
 	}
-	if (!WM_operator_py_idname_ok_or_report(reports, identifier, temp_buffers.idname)) {
+
+	char idname_conv[sizeof(dummyop.idname)];
+	WM_operator_bl_idname(idname_conv, temp_buffers.idname); /* convert the idname from python */
+
+	if (!WM_operator_py_idname_ok_or_report(reports, idname_conv, temp_buffers.idname)) {
 		return NULL;
 	}
 
 	/* Convert foo.bar to FOO_OT_bar
 	 * allocate all strings at once. */
 	{
-		char idname_conv[sizeof(dummyop.idname)];
-		WM_operator_bl_idname(idname_conv, temp_buffers.idname); /* convert the idname from python */
 		const char *strings[] = {
 			idname_conv,
 			temp_buffers.name,
@@ -1292,18 +1294,21 @@ static StructRNA *rna_MacroOperator_register(
 		if (ot && ot->ext.srna)
 			rna_Operator_unregister(bmain, ot->ext.srna);
 	}
-	if (!RNA_struct_available_or_report(reports, identifier)) {
+
+	if (!WM_operator_py_idname_ok_or_report(reports, identifier, temp_buffers.idname)) {
 		return NULL;
 	}
-	if (!WM_operator_py_idname_ok_or_report(reports, identifier, temp_buffers.idname)) {
+
+	char idname_conv[sizeof(dummyop.idname)];
+	WM_operator_bl_idname(idname_conv, temp_buffers.idname); /* convert the idname from python */
+
+	if (!RNA_struct_available_or_report(reports, idname_conv)) {
 		return NULL;
 	}
 
 	/* Convert foo.bar to FOO_OT_bar
 	 * allocate all strings at once. */
 	{
-		char idname_conv[sizeof(dummyop.idname)];
-		WM_operator_bl_idname(idname_conv, temp_buffers.idname); /* convert the idname from python */
 		const char *strings[] = {
 			idname_conv,
 			temp_buffers.name,



More information about the Bf-blender-cvs mailing list