From a7f87cfc0d87b8ebbcdef6ec2aa665fd56bcd2cf Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 5 Sep 2014 10:16:11 +1000 Subject: Cleanup: de-duplicate link/append props --- source/blender/editors/sculpt_paint/paint_stroke.c | 3 +- source/blender/editors/space_file/filesel.c | 2 +- source/blender/windowmanager/intern/wm_operators.c | 44 +++++++++++----------- 3 files changed, 23 insertions(+), 26 deletions(-) diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index 59a85b299ef..8f189b49aa6 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -396,8 +396,7 @@ static void paint_brush_stroke_add_step(bContext *C, wmOperator *op, const float copy_v2_v2(stroke->last_mouse_position, mouse_in); stroke->last_pressure = pressure; - if (paint_stroke_use_jitter(mode, brush, stroke->stroke_mode == BRUSH_STROKE_INVERT)) - { + if (paint_stroke_use_jitter(mode, brush, stroke->stroke_mode == BRUSH_STROKE_INVERT)) { float delta[2]; float factor = stroke->zoom_2d; diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index 3e210af5d50..afe3f29e9bc 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -288,7 +288,7 @@ int ED_fileselect_layout_numfiles(FileLayout *layout, ARegion *ar) * - *_over: extra pixels, to take into account, when the fit isnt exact * (needed since you may see the end of the previous column and the beginning of the next). * - * Could be more clever and take scorlling into account, + * Could be more clever and take scrolling into account, * but for now don't bother. */ if (layout->flag & FILE_LAYOUT_HOR) { 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 **************** */ -- cgit v1.2.3