Cleanup: de-duplicate link/append props

This commit is contained in:
2014-09-05 10:16:11 +10:00
parent b2de885b4e
commit a7f87cfc0d
3 changed files with 23 additions and 26 deletions

View File

@@ -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;

View File

@@ -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) {

View File

@@ -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 **************** */