Separate operators for Link and Append.

Since the choice to link or append has been removed in the file browser operator panel,
there was no way to tell whether as a user you were linking or appending.
To fix this the proposed patch separates the operators.

Reviewers: campbellbarton, carter2422, venomgfx

Subscribers: fsiddi

Maniphest Tasks: T41593

Differential Revision: https://developer.blender.org/D770
This commit is contained in:
Andrea Weikert 2014-09-04 19:35:18 +02:00
parent 94b29cd8b4
commit 61914883ff
2 changed files with 41 additions and 13 deletions

View File

@ -127,10 +127,8 @@ class INFO_MT_file(Menu):
layout.separator()
layout.operator_context = 'INVOKE_AREA'
layout.operator("wm.link_append", text="Link", icon='LINK_BLEND')
props = layout.operator("wm.link_append", text="Append", icon='APPEND_BLEND')
props.link = False
props.instance_groups = False
layout.operator("wm.link", text="Link", icon='LINK_BLEND')
layout.operator("wm.append", text="Append", icon='APPEND_BLEND')
layout.separator()

View File

@ -2601,13 +2601,13 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
static void WM_OT_link_append(wmOperatorType *ot)
static void WM_OT_link(wmOperatorType *ot)
{
PropertyRNA *prop;
ot->name = "Link/Append from Library";
ot->idname = "WM_OT_link_append";
ot->description = "Link or Append from a Library .blend file";
ot->name = "Link from Library";
ot->idname = "WM_OT_link";
ot->description = "Link from a Library .blend file";
ot->invoke = wm_link_append_invoke;
ot->exec = wm_link_append_exec;
@ -2632,6 +2632,37 @@ static void WM_OT_link_append(wmOperatorType *ot)
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
static void WM_OT_append(wmOperatorType *ot)
{
PropertyRNA *prop;
ot->name = "Append from Library";
ot->idname = "WM_OT_append";
ot->description = "Append from a Library .blend file";
ot->invoke = wm_link_append_invoke;
ot->exec = wm_link_append_exec;
ot->poll = wm_link_append_poll;
ot->flag |= OPTYPE_UNDO;
WM_operator_properties_filesel(
ot, FOLDERFILE | BLENDERFILE, FILE_LOADLIB, FILE_OPENFILE,
WM_FILESEL_FILEPATH | WM_FILESEL_DIRECTORY | WM_FILESEL_FILENAME | WM_FILESEL_FILES,
FILE_DEFAULTDISPLAY);
/* better not save _any_ settings for this operator */
/* properties */
prop = RNA_def_boolean(ot->srna, "link", 0, "Link", "Link the objects or datablocks rather than appending");
RNA_def_property_flag(prop, PROP_SKIP_SAVE | PROP_HIDDEN);
prop = RNA_def_boolean(ot->srna, "autoselect", 1, "Select", "Select the appended objects");
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
prop = RNA_def_boolean(ot->srna, "active_layer", 1, "Active Layer", "Put the appended objects on the active layer");
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
prop = RNA_def_boolean(ot->srna, "instance_groups", 0, "Instance Groups", "Create instances for each group as a DupliGroup");
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
/* *************** recover last session **************** */
void WM_recover_last_session(bContext *C, ReportList *reports)
@ -4536,7 +4567,8 @@ void wm_operatortype_init(void)
WM_operatortype_append(WM_OT_quit_blender);
WM_operatortype_append(WM_OT_open_mainfile);
WM_operatortype_append(WM_OT_revert_mainfile);
WM_operatortype_append(WM_OT_link_append);
WM_operatortype_append(WM_OT_link);
WM_operatortype_append(WM_OT_append);
WM_operatortype_append(WM_OT_recover_last_session);
WM_operatortype_append(WM_OT_recover_auto_save);
WM_operatortype_append(WM_OT_save_as_mainfile);
@ -4763,10 +4795,8 @@ void wm_window_keymap(wmKeyConfig *keyconf)
WM_keymap_add_menu(keymap, "INFO_MT_file_open_recent", OKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
WM_keymap_add_item(keymap, "WM_OT_open_mainfile", OKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "WM_OT_open_mainfile", F1KEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "WM_OT_link_append", OKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
kmi = WM_keymap_add_item(keymap, "WM_OT_link_append", F1KEY, KM_PRESS, KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "link", false);
RNA_boolean_set(kmi->ptr, "instance_groups", false);
WM_keymap_add_item(keymap, "WM_OT_link", OKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
WM_keymap_add_item(keymap, "WM_OT_append", F1KEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "WM_OT_save_mainfile", SKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "WM_OT_save_mainfile", WKEY, KM_PRESS, KM_CTRL, 0);