[Bf-blender-cvs] [2e14b7fb977] master: RNA: remove Layout.introspect

Campbell Barton noreply at git.blender.org
Sat Jun 9 18:57:37 CEST 2018


Commit: 2e14b7fb9770ba5d7ca75f8125c73b81be8f632c
Author: Campbell Barton
Date:   Sat Jun 9 18:55:51 2018 +0200
Branches: master
https://developer.blender.org/rB2e14b7fb9770ba5d7ca75f8125c73b81be8f632c

RNA: remove Layout.introspect

This was added as an experiment to extract information for docs
but this was never all that useful for its intended purpose.

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

M	source/blender/editors/include/UI_interface.h
M	source/blender/editors/interface/interface_layout.c
M	source/blender/makesrna/intern/rna_ui_api.c

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

diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 0fd253e9fec..94a0013d96b 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -886,7 +886,6 @@ uiBlock *uiLayoutGetBlock(uiLayout *layout);
 void uiLayoutSetFunc(uiLayout *layout, uiMenuHandleFunc handlefunc, void *argv);
 void uiLayoutSetContextPointer(uiLayout *layout, const char *name, struct PointerRNA *ptr);
 void uiLayoutContextCopy(uiLayout *layout, struct bContextStore *context);
-const char *uiLayoutIntrospect(uiLayout *layout); // XXX - testing
 struct MenuType *UI_but_menutype_get(uiBut *but);
 void UI_menutype_draw(struct bContext *C, struct MenuType *mt, struct uiLayout *layout);
 
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index e267661ec21..ce9c4d14b0a 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -3547,93 +3547,6 @@ void uiLayoutSetContextFromBut(uiLayout *layout, uiBut *but)
 	}
 }
 
-/* introspect funcs */
-#include "BLI_dynstr.h"
-
-static void ui_intro_button(DynStr *ds, uiButtonItem *bitem)
-{
-	uiBut *but = bitem->but;
-	BLI_dynstr_appendf(ds, "'type':%d, ", (int)but->type);
-	BLI_dynstr_appendf(ds, "'draw_string':'''%s''', ", but->drawstr);
-	BLI_dynstr_appendf(ds, "'tip':'''%s''', ", but->tip ? but->tip : "");  /* not exactly needed, rna has this */
-
-	if (but->optype) {
-		char *opstr = WM_operator_pystring_ex(but->block->evil_C, NULL, false, true, but->optype, but->opptr);
-		BLI_dynstr_appendf(ds, "'operator':'''%s''', ", opstr ? opstr : "");
-		MEM_freeN(opstr);
-	}
-
-	if (but->rnaprop) {
-		BLI_dynstr_appendf(ds, "'rna':'%s.%s[%d]', ", RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop), but->rnaindex);
-	}
-
-}
-
-static void ui_intro_items(DynStr *ds, ListBase *lb)
-{
-	uiItem *item;
-
-	BLI_dynstr_append(ds, "[");
-
-	for (item = lb->first; item; item = item->next) {
-
-		BLI_dynstr_append(ds, "{");
-
-		/* could also use the INT but this is nicer*/
-		switch (item->type) {
-			case ITEM_BUTTON:             BLI_dynstr_append(ds, "'type':'BUTTON', "); break;
-			case ITEM_LAYOUT_ROW:         BLI_dynstr_append(ds, "'type':'UI_BTYPE_ROW', "); break;
-			case ITEM_LAYOUT_COLUMN:      BLI_dynstr_append(ds, "'type':'COLUMN', "); break;
-			case ITEM_LAYOUT_COLUMN_FLOW: BLI_dynstr_append(ds, "'type':'COLUMN_FLOW', "); break;
-			case ITEM_LAYOUT_ROW_FLOW:    BLI_dynstr_append(ds, "'type':'ROW_FLOW', "); break;
-			case ITEM_LAYOUT_BOX:         BLI_dynstr_append(ds, "'type':'BOX', "); break;
-			case ITEM_LAYOUT_ABSOLUTE:    BLI_dynstr_append(ds, "'type':'ABSOLUTE', "); break;
-			case ITEM_LAYOUT_SPLIT:       BLI_dynstr_append(ds, "'type':'SPLIT', "); break;
-			case ITEM_LAYOUT_OVERLAP:     BLI_dynstr_append(ds, "'type':'OVERLAP', "); break;
-			case ITEM_LAYOUT_ROOT:        BLI_dynstr_append(ds, "'type':'ROOT', "); break;
-			default:                      BLI_dynstr_append(ds, "'type':'UNKNOWN', "); break;
-		}
-
-		switch (item->type) {
-			case ITEM_BUTTON:
-				ui_intro_button(ds, (uiButtonItem *)item);
-				break;
-			default:
-				BLI_dynstr_append(ds, "'items':");
-				ui_intro_items(ds, &((uiLayout *)item)->items);
-				break;
-		}
-
-		BLI_dynstr_append(ds, "}");
-
-		if (item != lb->last)
-			BLI_dynstr_append(ds, ", ");
-	}
-	BLI_dynstr_append(ds, "], ");
-}
-
-static void ui_intro_uiLayout(DynStr *ds, uiLayout *layout)
-{
-	ui_intro_items(ds, &layout->items);
-}
-
-static char *str = NULL;  /* XXX, constant re-freeing, far from ideal. */
-const char *uiLayoutIntrospect(uiLayout *layout)
-{
-	DynStr *ds = BLI_dynstr_new();
-
-	if (str) {
-		MEM_freeN(str);
-	}
-
-	ui_intro_uiLayout(ds, layout);
-
-	str = BLI_dynstr_get_cstring(ds);
-	BLI_dynstr_free(ds);
-
-	return str;
-}
-
 /* this is a bit of a hack but best keep it in one place at least */
 MenuType *UI_but_menutype_get(uiBut *but)
 {
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c
index 35e64805e57..bf5ffa20986 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@ -949,10 +949,6 @@ void RNA_api_ui_layout(StructRNA *srna)
 	RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
 	RNA_def_string(func, "name", NULL, 0, "", "");
 
-	func = RNA_def_function(srna, "introspect", "uiLayoutIntrospect");
-	parm = RNA_def_string(func, "string", NULL, 1024 * 1024, "Descr", "DESCR");
-	RNA_def_function_return(func, parm);
-
 	/* color management templates */
 	func = RNA_def_function(srna, "template_colorspace_settings", "uiTemplateColorspaceSettings");
 	RNA_def_function_ui_description(func, "Item. A widget to control input color space settings.");



More information about the Bf-blender-cvs mailing list