Tool System: enable fallback tool by default

This defaults to selection when not using a gizmo.
The previous behavior to drag anywhere can be set in the tool settings
or by selecting the fallback tool (Alt-W).

See: T66304
This commit is contained in:
Campbell Barton 2020-01-03 14:04:11 +11:00
parent a8ce9a143a
commit b423b89127
9 changed files with 12 additions and 53 deletions

View File

@ -1804,9 +1804,6 @@ class WM_OT_toolbar_fallback_pie(Operator):
return context.space_data is not None
def invoke(self, context, event):
if not context.preferences.experimental.use_tool_fallback:
return {'PASS_THROUGH'}
from bl_ui.space_toolsystem_common import ToolSelectPanelHelper
space_type = context.space_data.type
cls = ToolSelectPanelHelper._tool_class_from_space_type(space_type)

View File

@ -709,11 +709,7 @@ class ToolSelectPanelHelper:
if draw_settings is not None:
draw_settings(context, layout, tool)
if context.preferences.experimental.use_tool_fallback:
idname_fallback = tool.idname_fallback
else:
idname_fallback = None
idname_fallback = tool.idname_fallback
if idname_fallback and idname_fallback != item.idname:
tool_settings = context.tool_settings

View File

@ -298,10 +298,9 @@ class _defs_transform:
layout.label(text="Gizmos:")
show_drag = True
if context.preferences.experimental.use_tool_fallback:
tool_settings = context.tool_settings
if tool_settings.workspace_tool_type == 'FALLBACK':
show_drag = False
tool_settings = context.tool_settings
if tool_settings.workspace_tool_type == 'FALLBACK':
show_drag = False
if show_drag:
props = tool.gizmo_group_properties("VIEW3D_GGT_xform_gizmo")

View File

@ -2087,9 +2087,12 @@ class ExperimentalPanel:
url_prefix = "https://developer.blender.org/"
"""
# Example panel, leave it here so we always have a template to follow even
# after the features are gone from the experimental panel.
class USERPREF_PT_experimental_ui(ExperimentalPanel, Panel):
bl_label = "User Interface"
class USERPREF_PT_experimental_virtual_reality(ExperimentalPanel, Panel):
bl_label = "Virtual Reality"
def draw(self, context):
prefs = context.preferences
@ -2099,25 +2102,6 @@ class USERPREF_PT_experimental_ui(ExperimentalPanel, Panel):
layout.use_property_split = True
layout.use_property_decorate = False
task = "T66304"
split = layout.split(factor=0.66)
col = split.column()
col.prop(experimental, "use_tool_fallback", text="Use Tool Fallback")
col = split.column()
col.operator("wm.url_open", text=task, icon='URL').url = self.url_prefix + task
"""
# Example panel, leave it here so we always have a template to follow even
# after the features are gone from the experimental panel.
class USERPREF_PT_experimental_virtual_reality(ExperimentalPanel, Panel):
bl_label = "Virtual Reality"
def draw_centered(self, context, layout):
prefs = context.preferences
experimental = prefs.experimental
task = "T71347"
split = layout.split(factor=0.66)
col = split.split()
@ -2242,7 +2226,6 @@ classes = (
USERPREF_PT_studiolight_matcaps,
USERPREF_PT_studiolight_world,
USERPREF_PT_experimental_ui,
USERPREF_PT_experimental_usd,
# Popovers.

View File

@ -52,10 +52,6 @@ static const char *handle_free_id;
static bool WIDGETGROUP_tool_generic_poll(const bContext *C, wmGizmoGroupType *gzgt)
{
if (!USER_EXPERIMENTAL_TEST(&U, use_tool_fallback)) {
return false;
}
if (!ED_gizmo_poll_or_unlink_delayed_from_tool(C, gzgt)) {
return false;
}

View File

@ -601,10 +601,9 @@ typedef struct UserDef_FileSpaceData {
} UserDef_FileSpaceData;
typedef struct UserDef_Experimental {
char use_tool_fallback;
char use_usd_exporter;
char _pad0[6];
char _pad0[7];
} UserDef_Experimental;
#define USER_EXPERIMENTAL_TEST(userdef, member) \

View File

@ -580,7 +580,6 @@ static void rna_userdef_autosave_update(Main *bmain, Scene *scene, PointerRNA *p
return USER_EXPERIMENTAL_TEST(userdef, member); \
}
RNA_USERDEF_EXPERIMENTAL_BOOLEAN_GET(use_tool_fallback)
RNA_USERDEF_EXPERIMENTAL_BOOLEAN_GET(use_usd_exporter)
static bAddon *rna_userdef_addon_new(void)
@ -5858,12 +5857,6 @@ static void rna_def_userdef_experimental(BlenderRNA *brna)
RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
RNA_def_struct_ui_text(srna, "Experimental", "Experimental features");
prop = RNA_def_property(srna, "use_tool_fallback", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "use_tool_fallback", 1);
RNA_def_property_boolean_funcs(prop, "rna_userdef_experimental_use_tool_fallback_get", NULL);
RNA_def_property_ui_text(prop, "Fallback Tool Support", "Allow selection with an active tool");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "use_usd_exporter", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "use_usd_exporter", 1);
RNA_def_property_boolean_funcs(prop, "rna_userdef_experimental_use_usd_exporter_get", NULL);

View File

@ -3751,10 +3751,6 @@ wmEventHandler_Keymap *WM_event_add_keymap_handler(ListBase *handlers, wmKeyMap
wmKeyMap *WM_event_get_keymap_from_toolsystem_fallback(wmWindowManager *wm,
wmEventHandler_Keymap *handler)
{
if (!USER_EXPERIMENTAL_TEST(&U, use_tool_fallback)) {
return NULL;
}
ScrArea *sa = handler->dynamic.user_data;
handler->keymap_tool = NULL;
bToolRef_Runtime *tref_rt = sa->runtime.tool ? sa->runtime.tool->runtime : NULL;

View File

@ -351,11 +351,11 @@ void WM_toolsystem_ref_set_from_runtime(struct bContext *C,
*tref->runtime = *tref_rt;
}
/* FIXME: ideally Python could check this gizmo group flag and not
/* Ideally Python could check this gizmo group flag and not
* pass in the argument to begin with. */
bool use_fallback_keymap = false;
if (USER_EXPERIMENTAL_TEST(&U, use_tool_fallback)) {
if (tref->idname_fallback[0] || tref->runtime->keymap_fallback[0]) {
if (tref_rt->gizmo_group[0]) {
wmGizmoGroupType *gzgt = WM_gizmogrouptype_find(tref_rt->gizmo_group, false);
if (gzgt) {