Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2017-11-02 15:05:13 +0300
committerCampbell Barton <ideasman42@gmail.com>2017-11-02 15:05:13 +0300
commit1ca3e1a91dbb4bbd99d8d8275e2a9c8dc0505d1c (patch)
treec638ed870b8b8838592daa29cb079cf5c49fd0c1 /source
parent08141260ffa619fef1871ccd446b8a59a7b111ca (diff)
UI: support nested tools in toolbar
Diffstat (limited to 'source')
-rw-r--r--source/blender/makesdna/DNA_workspace_types.h3
-rw-r--r--source/blender/makesrna/intern/rna_workspace.c5
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c6
3 files changed, 13 insertions, 1 deletions
diff --git a/source/blender/makesdna/DNA_workspace_types.h b/source/blender/makesdna/DNA_workspace_types.h
index 8cd03a5eafa..1e650fcfb6d 100644
--- a/source/blender/makesdna/DNA_workspace_types.h
+++ b/source/blender/makesdna/DNA_workspace_types.h
@@ -58,7 +58,8 @@ typedef struct bToolDef {
char keymap[64];
char manipulator_group[64];
int spacetype;
- int _pad;
+ /* index when a tool is a member of a group */
+ int index;
} bToolDef;
/**
diff --git a/source/blender/makesrna/intern/rna_workspace.c b/source/blender/makesrna/intern/rna_workspace.c
index 8cf5e3e8eaf..e09f7bcbcc1 100644
--- a/source/blender/makesrna/intern/rna_workspace.c
+++ b/source/blender/makesrna/intern/rna_workspace.c
@@ -156,6 +156,11 @@ static void rna_def_workspace(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Active Tool", "Currently active tool manipulator");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ prop = RNA_def_property(srna, "tool_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "tool.index");
+ RNA_def_property_ui_text(prop, "Active Tool Index", "Tool group index");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
prop = RNA_def_property(srna, "orientations", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "transform_orientations", NULL);
RNA_def_property_struct_type(prop, "TransformOrientation");
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index c6884f3da8b..0783d364d48 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -1760,6 +1760,9 @@ static int wm_operator_tool_set_exec(bContext *C, wmOperator *op)
char id_manipulator_group[sizeof(workspace->tool.manipulator_group)];
RNA_string_get(op->ptr, "keymap", id_keymap);
RNA_string_get(op->ptr, "manipulator_group", id_manipulator_group);
+ int index = RNA_int_get(op->ptr, "index");
+
+ workspace->tool.index = index;
if (workspace->tool.manipulator_group[0]) {
wmManipulatorGroupType *wgt = WM_manipulatorgrouptype_find(workspace->tool.manipulator_group, false);
@@ -1780,6 +1783,8 @@ static int wm_operator_tool_set_exec(bContext *C, wmOperator *op)
WM_manipulator_group_type_ensure(workspace->tool.manipulator_group);
}
+ ED_region_tag_redraw(CTX_wm_region(C));
+
return OPERATOR_FINISHED;
}
@@ -1795,6 +1800,7 @@ static void WM_OT_tool_set(wmOperatorType *ot)
RNA_def_string(ot->srna, "keymap", NULL, KMAP_MAX_NAME, "Key Map", "");
RNA_def_string(ot->srna, "manipulator_group", NULL, MAX_NAME, "Manipulator Group", "");
+ RNA_def_int(ot->srna, "index", 0, INT_MIN, INT_MAX, "Index", "", INT_MIN, INT_MAX);
}
#endif /* USE_WORKSPACE_TOOL */