diff options
Diffstat (limited to 'source/blender/editors/transform/transform_ops.c')
-rw-r--r-- | source/blender/editors/transform/transform_ops.c | 70 |
1 files changed, 31 insertions, 39 deletions
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index 99919c0ed78..82791b2a9f5 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -523,9 +523,7 @@ static int transform_invoke(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_RUNNING_MODAL; } -static bool transform_poll_property(const bContext *UNUSED(C), - wmOperator *op, - const PropertyRNA *prop) +static bool transform_poll_property(const bContext *C, wmOperator *op, const PropertyRNA *prop) { const char *prop_id = RNA_property_identifier(prop); @@ -559,21 +557,28 @@ static bool transform_poll_property(const bContext *UNUSED(C), } /* Proportional Editing. */ - { + if (STRPREFIX(prop_id, "proportional") || STRPREFIX(prop_id, "use_proportional")) { + ScrArea *area = CTX_wm_area(C); + if (area->spacetype == SPACE_NLA) { + /* Hide properties that are not supported in some spaces. */ + return false; + } + PropertyRNA *prop_pet = RNA_struct_find_property(op->ptr, "use_proportional_edit"); - if (prop_pet && (prop_pet != prop) && (RNA_property_boolean_get(op->ptr, prop_pet) == false)) { - if (STRPREFIX(prop_id, "proportional") || STRPREFIX(prop_id, "use_proportional")) { - return false; - } + if ((prop_pet != prop) && (RNA_property_boolean_get(op->ptr, prop_pet) == false)) { + /* If "use_proportional_edit" is false, hide: + * - "proportional_edit_falloff", + * - "proportional_size", + * - "use_proportional_connected", + * - "use_proportional_projected". */ + return false; } } /* Snapping. */ { - PropertyRNA *prop_snap = RNA_struct_find_property(op->ptr, "snap"); - if (prop_snap && (prop_snap != prop) && - (RNA_property_boolean_get(op->ptr, prop_snap) == false)) { - if (STRPREFIX(prop_id, "snap") || STRPREFIX(prop_id, "use_snap")) { + if (STREQ(prop_id, "use_snap_project")) { + if (RNA_boolean_get(op->ptr, "snap") == false) { return false; } } @@ -626,7 +631,7 @@ void Transform_Properties(struct wmOperatorType *ot, int flags) if (flags & P_MIRROR) { prop = RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", ""); - if (flags & P_MIRROR_DUMMY) { + if ((flags & P_MIRROR_DUMMY) == P_MIRROR_DUMMY) { /* only used so macros can disable this option */ RNA_def_property_flag(prop, PROP_HIDDEN); } @@ -660,17 +665,17 @@ void Transform_Properties(struct wmOperatorType *ot, int flags) prop = RNA_def_boolean(ot->srna, "snap", false, "Use Snapping Options", ""); RNA_def_property_flag(prop, PROP_HIDDEN); - prop = RNA_def_enum(ot->srna, - "snap_elements", - rna_enum_snap_element_items, - SCE_SNAP_MODE_INCREMENT, - "Snap to Elements", - ""); - RNA_def_property_flag(prop, PROP_ENUM_FLAG); + if ((flags & P_GEO_SNAP) == P_GEO_SNAP) { + prop = RNA_def_enum(ot->srna, + "snap_elements", + rna_enum_snap_element_items, + SCE_SNAP_MODE_INCREMENT, + "Snap to Elements", + ""); + RNA_def_property_flag(prop, PROP_HIDDEN | PROP_ENUM_FLAG); - RNA_def_boolean(ot->srna, "use_snap_project", false, "Project Individual Elements", ""); + RNA_def_boolean(ot->srna, "use_snap_project", false, "Project Individual Elements", ""); - if (flags & P_GEO_SNAP) { /* TODO(@gfxcoder): Rename `snap_target` to `snap_source` to avoid previous ambiguity of * "target" (now, "source" is geometry to be moved and "target" is geometry to which moved * geometry is snapped). Use "Source snap point" and "Point on source that will snap to @@ -686,22 +691,14 @@ void Transform_Properties(struct wmOperatorType *ot, int flags) prop = RNA_def_boolean(ot->srna, "use_snap_nonedit", true, "Target: Include Non-Edited", ""); RNA_def_property_flag(prop, PROP_HIDDEN); prop = RNA_def_boolean( - ot->srna, "use_snap_selectable_only", false, "Target: Exclude Non-Selectable", ""); - RNA_def_property_flag(prop, PROP_HIDDEN); - - /* Face Nearest options */ - prop = RNA_def_boolean( - ot->srna, "use_snap_to_same_target", false, "Snap to Same Target", ""); - RNA_def_property_flag(prop, PROP_HIDDEN); - prop = RNA_def_int( - ot->srna, "snap_face_nearest_steps", 1, 1, 32767, "Face Nearest Steps", "", 1, 32767); + ot->srna, "use_snap_selectable", false, "Target: Exclude Non-Selectable", ""); RNA_def_property_flag(prop, PROP_HIDDEN); prop = RNA_def_float_vector( ot->srna, "snap_point", 3, NULL, -FLT_MAX, FLT_MAX, "Point", "", -FLT_MAX, FLT_MAX); RNA_def_property_flag(prop, PROP_HIDDEN); - if (flags & P_ALIGN_SNAP) { + if ((flags & P_ALIGN_SNAP) == P_ALIGN_SNAP) { prop = RNA_def_boolean(ot->srna, "snap_align", false, "Align with Point Normal", ""); RNA_def_property_flag(prop, PROP_HIDDEN); prop = RNA_def_float_vector( @@ -709,11 +706,6 @@ void Transform_Properties(struct wmOperatorType *ot, int flags) RNA_def_property_flag(prop, PROP_HIDDEN); } } - else { - prop = RNA_def_boolean( - ot->srna, "use_snap_selectable_only", false, "Target: Exclude Non-Selectable", ""); - RNA_def_property_flag(prop, PROP_HIDDEN); - } } if (flags & P_GPENCIL_EDIT) { @@ -1165,7 +1157,7 @@ static void TRANSFORM_OT_edge_slide(struct wmOperatorType *ot) "When Even mode is active, flips between the two adjacent edge loops"); RNA_def_boolean(ot->srna, "use_clamp", true, "Clamp", "Clamp within the edge extents"); - Transform_Properties(ot, P_MIRROR | P_SNAP | P_CORRECT_UV); + Transform_Properties(ot, P_MIRROR | P_GEO_SNAP | P_CORRECT_UV); } static void TRANSFORM_OT_vert_slide(struct wmOperatorType *ot) @@ -1200,7 +1192,7 @@ static void TRANSFORM_OT_vert_slide(struct wmOperatorType *ot) "When Even mode is active, flips between the two adjacent edge loops"); RNA_def_boolean(ot->srna, "use_clamp", true, "Clamp", "Clamp within the edge extents"); - Transform_Properties(ot, P_MIRROR | P_SNAP | P_CORRECT_UV); + Transform_Properties(ot, P_MIRROR | P_GEO_SNAP | P_CORRECT_UV); } static void TRANSFORM_OT_edge_crease(struct wmOperatorType *ot) |