Commit: 77eadbede493cb2a02b82981ad71af3da86b2d0c
Author: Campbell Barton
Date:   Fri Jun 24 17:45:07 2022 +1000
Branches: master
https://developer.blender.org/rB77eadbede493cb2a02b82981ad71af3da86b2d0c

Fix T99037: bpy.ops.transform.rotate fails in background mode

This reverts commit c503c5f756aab850e8afe2513b2dc7b645cf84af,
alternate fix for T82244.

Scripts that run in background mode expected rotation to be usable,
defaulting to the 3D viewport when there is no active windowing data.

Also resolves T88610.

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

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

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

diff --git a/source/blender/editors/transform/transform_mode_rotate.c 
b/source/blender/editors/transform/transform_mode_rotate.c
index 94caaa288e5..f75c65448df 100644
--- a/source/blender/editors/transform/transform_mode_rotate.c
+++ b/source/blender/editors/transform/transform_mode_rotate.c
@@ -11,6 +11,7 @@
 #include "BLI_task.h"
 
 #include "BKE_context.h"
+#include "BKE_report.h"
 #include "BKE_unit.h"
 
 #include "ED_screen.h"
@@ -343,6 +344,11 @@ static void applyRotationMatrix(TransInfo *t, float 
mat_xform[4][4])
 
 void initRotation(TransInfo *t)
 {
+  if (t->spacetype == SPACE_ACTION) {
+    BKE_report(t->reports, RPT_ERROR, "Rotation is not supported in the Dope 
Sheet Editor");
+    t->state = TRANS_CANCEL;
+  }
+
   t->mode = TFM_ROTATION;
   t->transform = applyRotation;
   t->transform_matrix = applyRotationMatrix;
diff --git a/source/blender/editors/transform/transform_ops.c 
b/source/blender/editors/transform/transform_ops.c
index cd8a2f17554..a64eff8f981 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -849,17 +849,6 @@ static void TRANSFORM_OT_trackball(struct wmOperatorType 
*ot)
   Transform_Properties(ot, P_PROPORTIONAL | P_MIRROR | P_SNAP | P_GPENCIL_EDIT 
| P_CENTER);
 }
 
-/* Similar to #transform_shear_poll. */
-static bool transform_rotate_poll(bContext *C)
-{
-  if (!ED_operator_screenactive(C)) {
-    return false;
-  }
-
-  ScrArea *area = CTX_wm_area(C);
-  return area && !ELEM(area->spacetype, SPACE_ACTION);
-}
-
 static void TRANSFORM_OT_rotate(struct wmOperatorType *ot)
 {
   /* identifiers */
@@ -873,7 +862,7 @@ static void TRANSFORM_OT_rotate(struct wmOperatorType *ot)
   ot->exec = transform_exec;
   ot->modal = transform_modal;
   ot->cancel = transform_cancel;
-  ot->poll = transform_rotate_poll;
+  ot->poll = ED_operator_screenactive;
   ot->poll_property = transform_poll_property;
 
   RNA_def_float_rotation(
@@ -938,7 +927,6 @@ static void TRANSFORM_OT_bend(struct wmOperatorType *ot)
   Transform_Properties(ot, P_PROPORTIONAL | P_MIRROR | P_SNAP | P_GPENCIL_EDIT 
| P_CENTER);
 }
 
-/* Similar to #transform_rotate_poll. */
 static bool transform_shear_poll(bContext *C)
 {
   if (!ED_operator_screenactive(C)) {

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to