diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-03-15 06:18:21 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-03-15 08:48:01 +0300 |
commit | d4156b46d7a4acb22f3abfde14b05c46ead34b43 (patch) | |
tree | 3db542558bd8dbf44b94998df90f62ec7b5d0e13 /source | |
parent | 3400fe3ecee99cb6a74455943f2755e6f22ef047 (diff) |
Tool System: use categories for tool identifiers
Tools that come with Blender use 'builtin' or 'builtin_brush' prefix.
Diffstat (limited to 'source')
4 files changed, 26 insertions, 17 deletions
diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h index 75104999402..031e4deb1a8 100644 --- a/source/blender/blenkernel/BKE_blender_version.h +++ b/source/blender/blenkernel/BKE_blender_version.h @@ -24,7 +24,7 @@ * and keep comment above the defines. * Use STRINGIFY() rather than defining with quotes */ #define BLENDER_VERSION 280 -#define BLENDER_SUBVERSION 48 +#define BLENDER_SUBVERSION 49 /* Several breakages with 280, e.g. collections vs layers */ #define BLENDER_MINVERSION 280 #define BLENDER_MINSUBVERSION 0 diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index 9adab610530..7005ae2302c 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -2893,6 +2893,15 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) } } + if (!MAIN_VERSION_ATLEAST(bmain, 280, 49)) { + /* All tool names changed, reset to defaults. */ + for (WorkSpace *workspace = bmain->workspaces.first; workspace; workspace = workspace->id.next) { + while (!BLI_listbase_is_empty(&workspace->tools)) { + BKE_workspace_tool_remove(workspace, workspace->tools.first); + } + } + } + { /* Versioning code until next subversion bump goes here. */ } diff --git a/source/blender/editors/transform/transform_gizmo_3d.c b/source/blender/editors/transform/transform_gizmo_3d.c index 2e6a399d0ea..435590cbecb 100644 --- a/source/blender/editors/transform/transform_gizmo_3d.c +++ b/source/blender/editors/transform/transform_gizmo_3d.c @@ -1620,18 +1620,18 @@ static void WIDGETGROUP_gizmo_setup(const bContext *C, wmGizmoGroup *gzgroup) ScrArea *sa = CTX_wm_area(C); const bToolRef *tref = sa->runtime.tool; - if (tref == NULL || STREQ(tref->idname, "Transform")) { + if (tref == NULL || STREQ(tref->idname, "builtin.transform")) { /* Setup all gizmos, they can be toggled via 'ToolSettings.gizmo_flag' */ ggd->twtype = SCE_GIZMO_SHOW_TRANSLATE | SCE_GIZMO_SHOW_ROTATE | SCE_GIZMO_SHOW_SCALE; ggd->use_twtype_refresh = true; } - else if (STREQ(tref->idname, "Move")) { + else if (STREQ(tref->idname, "builtin.move")) { ggd->twtype |= SCE_GIZMO_SHOW_TRANSLATE; } - else if (STREQ(tref->idname, "Rotate")) { + else if (STREQ(tref->idname, "builtin.rotate")) { ggd->twtype |= SCE_GIZMO_SHOW_ROTATE; } - else if (STREQ(tref->idname, "Scale")) { + else if (STREQ(tref->idname, "builtin.scale")) { ggd->twtype |= SCE_GIZMO_SHOW_SCALE; } BLI_assert(ggd->twtype != 0); diff --git a/source/blender/windowmanager/intern/wm_toolsystem.c b/source/blender/windowmanager/intern/wm_toolsystem.c index 75bcee562a0..806bd028295 100644 --- a/source/blender/windowmanager/intern/wm_toolsystem.c +++ b/source/blender/windowmanager/intern/wm_toolsystem.c @@ -475,7 +475,7 @@ void WM_toolsystem_ref_sync_from_context( const EnumPropertyItem *item = &items[i]; if (!STREQ(tref_rt->data_block, item->identifier)) { STRNCPY(tref_rt->data_block, item->identifier); - STRNCPY(tref->idname, item->name); + SNPRINTF(tref->idname, "builtin_brush.%s", item->name); } } } @@ -488,7 +488,7 @@ void WM_toolsystem_ref_sync_from_context( const EnumPropertyItem *item = &items[i]; if (!STREQ(tref_rt->data_block, item->identifier)) { STRNCPY(tref_rt->data_block, item->identifier); - STRNCPY(tref->idname, item->name); + SNPRINTF(tref->idname, "builtin_brush.%s", item->name); } } } @@ -501,7 +501,7 @@ void WM_toolsystem_ref_sync_from_context( const EnumPropertyItem *item = &items[i]; if (!STREQ(tref_rt->data_block, item->identifier)) { STRNCPY(tref_rt->data_block, item->identifier); - STRNCPY(tref->idname, item->name); + SNPRINTF(tref->idname, "builtin_brush.%s", item->name); } } } @@ -514,7 +514,7 @@ void WM_toolsystem_ref_sync_from_context( const EnumPropertyItem *item = &items[i]; if (!STREQ(tref_rt->data_block, item->identifier)) { STRNCPY(tref_rt->data_block, item->identifier); - STRNCPY(tref->idname, item->name); + SNPRINTF(tref->idname, "builtin_brush.%s", item->name); } } } @@ -532,7 +532,7 @@ void WM_toolsystem_ref_sync_from_context( const char *identifier = items[i].identifier; if (!STREQ(tref_rt->data_block, identifier)) { STRNCPY(tref_rt->data_block, identifier); - STRNCPY(tref->idname, name); + SNPRINTF(tref->idname, "builtin_brush.%s", name); } } } @@ -790,31 +790,31 @@ static const char *toolsystem_default_tool(const bToolKey *tkey) case CTX_MODE_WEIGHT_GPENCIL: case CTX_MODE_PAINT_TEXTURE: case CTX_MODE_PAINT_GPENCIL: - return "Draw"; + return "builtin_brush.Draw"; case CTX_MODE_SCULPT_GPENCIL: - return "Push"; + return "builtin_brush.Push"; /* end temporary hack. */ case CTX_MODE_PARTICLE: - return "Comb"; + return "builtin_brush.Comb"; case CTX_MODE_EDIT_TEXT: - return "Cursor"; + return "builtin.cursor"; } break; case SPACE_IMAGE: switch (tkey->mode) { case SI_MODE_PAINT: - return "Draw"; + return "builtin_brush.draw"; } break; case SPACE_NODE: { /* 'Select Box' interferes with cut-links which is handy. */ - return "Select"; + return "builtin.select"; } } - return "Select Box"; + return "builtin.select_box"; } /** |