Commit: 61914883ffb7e5aad5b4652cae1085f4565c47f7
Author: Andrea Weikert
Date:   Thu Sep 4 19:35:18 2014 +0200
Branches: master
https://developer.blender.org/rB61914883ffb7e5aad5b4652cae1085f4565c47f7

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

===================================================================

M       release/scripts/startup/bl_ui/space_info.py
M       source/blender/windowmanager/intern/wm_operators.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/space_info.py 
b/release/scripts/startup/bl_ui/space_info.py
index cecddb8..67b2bbe 100644
--- a/release/scripts/startup/bl_ui/space_info.py
+++ b/release/scripts/startup/bl_ui/space_info.py
@@ -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()
 
diff --git a/source/blender/windowmanager/intern/wm_operators.c 
b/source/blender/windowmanager/intern/wm_operators.c
index 2482155..57dcd2e 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -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);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to