[Bf-blender-cvs] [4e1a1821e04] master: Fix T90313: Align to Transform Orientation Axis Property Doesn't Work

Germano Cavalcante noreply at git.blender.org
Tue Aug 3 16:30:42 CEST 2021


Commit: 4e1a1821e04aa54d536f49018156e0f9cf95cf7e
Author: Germano Cavalcante
Date:   Tue Aug 3 11:29:28 2021 -0300
Branches: master
https://developer.blender.org/rB4e1a1821e04aa54d536f49018156e0f9cf95cf7e

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.

===================================================================

M	source/blender/editors/transform/transform_ops.c

===================================================================

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");



More information about the Bf-blender-cvs mailing list