Tool System: store the fallback tool for re-use

The fallback tool was run-time only data,
now it's stored in the blend file.
This commit is contained in:
2020-01-03 12:26:36 +11:00
parent a854840e76
commit a8ce9a143a
5 changed files with 34 additions and 30 deletions

View File

@@ -192,18 +192,6 @@ static int rna_WorkSpaceTool_widget_length(PointerRNA *ptr)
return tref->runtime ? strlen(tref->runtime->gizmo_group) : 0;
}
static void rna_WorkSpaceTool_tool_fallback_get(PointerRNA *ptr, char *value)
{
bToolRef *tref = ptr->data;
strcpy(value, tref->runtime ? tref->runtime->idname_fallback : "");
}
static int rna_WorkSpaceTool_tool_fallback_length(PointerRNA *ptr)
{
bToolRef *tref = ptr->data;
return tref->runtime ? strlen(tref->runtime->idname_fallback) : 0;
}
#else /* RNA_RUNTIME */
static void rna_def_workspace_owner(BlenderRNA *brna)
@@ -270,6 +258,10 @@ static void rna_def_workspace_tool(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Identifier", "");
RNA_def_struct_name_property(srna, prop);
prop = RNA_def_property(srna, "idname_fallback", PROP_STRING, PROP_NONE);
RNA_def_property_ui_text(prop, "Identifier Fallback", "");
RNA_def_struct_name_property(srna, prop);
prop = RNA_def_property(srna, "index", PROP_INT, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Index", "");
@@ -300,14 +292,6 @@ static void rna_def_workspace_tool(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Widget", "");
RNA_def_property_string_funcs(
prop, "rna_WorkSpaceTool_widget_get", "rna_WorkSpaceTool_widget_length", NULL);
RNA_define_verify_sdna(1);
prop = RNA_def_property(srna, "tool_fallback", PROP_STRING, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Fallback", "");
RNA_def_property_string_funcs(
prop, "rna_WorkSpaceTool_tool_fallback_get", "rna_WorkSpaceTool_tool_fallback_length", NULL);
RNA_define_verify_sdna(1);
RNA_api_workspace_tool(srna);
}