From 4e1a1821e04aa54d536f49018156e0f9cf95cf7e Mon Sep 17 00:00:00 2001 From: Germano Cavalcante Date: Tue, 3 Aug 2021 11:29:28 -0300 Subject: Fix T90313: Align to Transform Orientation Axis Property Doesn't Work `Orientation Axis` is a property incompatible with `Align` mode and should not be visible. --- source/blender/editors/transform/transform_ops.c | 35 +++++++++++++++--------- 1 file changed, 22 insertions(+), 13 deletions(-) (limited to 'source') diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index 2c424d8ace3..45c077b8a07 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -371,25 +371,24 @@ static void transformops_exit(bContext *C, wmOperator *op) G.moving = 0; } +static int transformops_mode(wmOperator *op) +{ + for (TransformModeItem *tmode = transform_modes; tmode->idname; tmode++) { + if (op->type->idname == tmode->idname) { + return tmode->mode; + } + } + + return RNA_enum_get(op->ptr, "mode"); +} + static int transformops_data(bContext *C, wmOperator *op, const wmEvent *event) { int retval = 1; if (op->customdata == NULL) { TransInfo *t = MEM_callocN(sizeof(TransInfo), "TransInfo data2"); - TransformModeItem *tmode; - int mode = -1; - - for (tmode = transform_modes; tmode->idname; tmode++) { - if (op->type->idname == tmode->idname) { - mode = tmode->mode; - break; - } - } - - if (mode == -1) { - mode = RNA_enum_get(op->ptr, "mode"); - } + int mode = transformops_mode(op); retval = initTransform(C, t, op, event, mode); /* store data */ @@ -556,6 +555,16 @@ static bool transform_poll_property(const bContext *UNUSED(C), } } + /* Orientation Axis. */ + { + if (STREQ(prop_id, "orient_axis")) { + eTfmMode mode = (eTfmMode)transformops_mode(op); + if (mode == TFM_ALIGN) { + return false; + } + } + } + /* Proportional Editing. */ { PropertyRNA *prop_pet = RNA_struct_find_property(op->ptr, "use_proportional_edit"); -- cgit v1.2.3