diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-09-05 04:16:11 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-09-05 04:16:11 +0400 |
commit | a7f87cfc0d87b8ebbcdef6ec2aa665fd56bcd2cf (patch) | |
tree | f0c5aee6acff4b80dfc899e581f62bd482c940ea /source/blender/windowmanager | |
parent | b2de885b4ed508cfde94bdd592a307c40e56066d (diff) |
Cleanup: de-duplicate link/append props
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 57dcd2eea1a..1fef23e98f7 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -2601,10 +2601,28 @@ static int wm_link_append_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static void WM_OT_link(wmOperatorType *ot) +static void wm_link_append_properties_common(wmOperatorType *ot, bool is_link) { PropertyRNA *prop; + /* better not save _any_ settings for this operator */ + /* properties */ + prop = RNA_def_boolean(ot->srna, "link", is_link, + "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", true, + "Select", "Select new objects"); + RNA_def_property_flag(prop, PROP_SKIP_SAVE); + prop = RNA_def_boolean(ot->srna, "active_layer", true, + "Active Layer", "Put new objects on the active layer"); + RNA_def_property_flag(prop, PROP_SKIP_SAVE); + prop = RNA_def_boolean(ot->srna, "instance_groups", is_link, + "Instance Groups", "Create Dupli-Group instances for each group"); + RNA_def_property_flag(prop, PROP_SKIP_SAVE); +} + +static void WM_OT_link(wmOperatorType *ot) +{ ot->name = "Link from Library"; ot->idname = "WM_OT_link"; ot->description = "Link from a Library .blend file"; @@ -2620,22 +2638,11 @@ static void WM_OT_link(wmOperatorType *ot) WM_FILESEL_FILEPATH | WM_FILESEL_DIRECTORY | WM_FILESEL_FILENAME | WM_FILESEL_RELPATH | WM_FILESEL_FILES, FILE_DEFAULTDISPLAY); - /* better not save _any_ settings for this operator */ - /* properties */ - prop = RNA_def_boolean(ot->srna, "link", 1, "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 linked objects"); - RNA_def_property_flag(prop, PROP_SKIP_SAVE); - prop = RNA_def_boolean(ot->srna, "active_layer", 1, "Active Layer", "Put the linked objects on the active layer"); - RNA_def_property_flag(prop, PROP_SKIP_SAVE); - prop = RNA_def_boolean(ot->srna, "instance_groups", 1, "Instance Groups", "Create instances for each group as a DupliGroup"); - RNA_def_property_flag(prop, PROP_SKIP_SAVE); + wm_link_append_properties_common(ot, true); } 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"; @@ -2651,16 +2658,7 @@ static void WM_OT_append(wmOperatorType *ot) 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); + wm_link_append_properties_common(ot, false); } /* *************** recover last session **************** */ |