[Bf-blender-cvs] [e69a25e] wiggly-widgets: Cleanup: Move around functions

Julian Eisel noreply at git.blender.org
Mon Dec 21 20:44:43 CET 2015


Commit: e69a25eb8e4e50091c11713b113e7414a418664a
Author: Julian Eisel
Date:   Mon Dec 21 20:42:15 2015 +0100
Branches: wiggly-widgets
https://developer.blender.org/rBe69a25eb8e4e50091c11713b113e7414a418664a

Cleanup: Move around functions

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

M	source/blender/editors/include/ED_transform.h
M	source/blender/editors/object/object_edit.c
M	source/blender/editors/transform/transform_manipulator.c

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

diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h
index f276483..555fb49 100644
--- a/source/blender/editors/include/ED_transform.h
+++ b/source/blender/editors/include/ED_transform.h
@@ -159,33 +159,11 @@ void Transform_Properties(struct wmOperatorType *ot, int flags);
 
 /* view3d manipulators */
 
-typedef struct ManipulatorGroup {
-	struct wmWidget *translate_x,
-	                *translate_y,
-	                *translate_z,
-	                *translate_xy,
-	                *translate_yz,
-	                *translate_zx,
-	                *translate_c,
-
-	                *rotate_x,
-	                *rotate_y,
-	                *rotate_z,
-	                *rotate_c,
-
-	                *scale_x,
-	                *scale_y,
-	                *scale_z,
-	                *scale_xy,
-	                *scale_yz,
-	                *scale_zx,
-	                *scale_c;
-} ManipulatorGroup;
-
 int WIDGETGROUP_manipulator_poll(const struct bContext *C, struct wmWidgetGroupType *wgrouptype);
 void WIDGETGROUP_manipulator_create(const struct bContext *C, struct wmWidgetGroup *wgroup);
 
 void WIDGETGROUP_object_manipulator_create(const struct bContext *C, struct wmWidgetGroup *wgroup);
+int WIDGETGROUP_object_manipulator_poll(const struct bContext *C, struct wmWidgetGroupType *wgrouptype);
 
 
 /* Snapping */
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 304b8d8..e8e5f7e 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -2134,18 +2134,6 @@ void OBJECT_OT_game_physics_copy(struct wmOperatorType *ot)
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
-static int WIDGETGROUP_object_manipulator_poll(const struct bContext *C, struct wmWidgetGroupType *wgrouptype)
-{
-	Object *ob = ED_object_active_context((bContext *)C);
-
-	if (ED_operator_object_active((bContext *)C)) {
-		if (STREQ(wgrouptype->idname, ob->id.name)) {
-			return true;
-		}
-	}
-	return false;
-}
-
 static int object_widget_add_exec(bContext *C, wmOperator *UNUSED(op))
 {
 	Object *ob = ED_object_active_context((bContext *)C);
diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c
index 8c756970..179d844 100644
--- a/source/blender/editors/transform/transform_manipulator.c
+++ b/source/blender/editors/transform/transform_manipulator.c
@@ -83,6 +83,7 @@
 
 #include "GPU_select.h"
 
+
 /* drawing flags */
 
 #define MAN_TRANS_X  (1 << 0)
@@ -100,6 +101,12 @@
 #define MAN_SCALE_Z  (1 << 10)
 #define MAN_SCALE_C  (MAN_SCALE_X | MAN_SCALE_Y | MAN_SCALE_Z)
 
+/* threshold for testing view aligned manipulator axis */
+#define TW_AXIS_DOT_MIN 0.02f
+#define TW_AXIS_DOT_MAX 0.1f
+
+#define MAN_AXIS_LINE_WIDTH 2.0
+
 /* axes as index */
 enum {
 	MAN_AXIS_TRANS_X = 0,
@@ -137,16 +144,33 @@ enum {
 	MAN_AXES_SCALE,
 };
 
-/* threshold for testing view aligned manipulator axis */
-#define TW_AXIS_DOT_MIN 0.02f
-#define TW_AXIS_DOT_MAX 0.1f
-
-#define MAN_AXIS_LINE_WIDTH 2.0
+typedef struct ManipulatorGroup {
+	struct wmWidget *translate_x,
+	                *translate_y,
+	                *translate_z,
+	                *translate_xy,
+	                *translate_yz,
+	                *translate_zx,
+	                *translate_c,
+
+	                *rotate_x,
+	                *rotate_y,
+	                *rotate_z,
+	                *rotate_c,
+
+	                *scale_x,
+	                *scale_y,
+	                *scale_z,
+	                *scale_xy,
+	                *scale_yz,
+	                *scale_zx,
+	                *scale_c;
+} ManipulatorGroup;
 
 
 /* **************** Utilities **************** */
 
-/* loop over axes of given type */
+/* loop over axes */
 #define MAN_ITER_AXES_BEGIN \
 	{ \
 		wmWidget *axis; \
@@ -1192,6 +1216,15 @@ void WIDGETGROUP_manipulator_create(const struct bContext *C, struct wmWidgetGro
 	MEM_freeN(man);
 }
 
+int WIDGETGROUP_manipulator_poll(const struct bContext *C, struct wmWidgetGroupType *UNUSED(wgrouptype))
+{
+	/* it's a given we only use this in 3D view */
+	const ScrArea *sa = CTX_wm_area(C);
+	const View3D *v3d = sa->spacedata.first;
+
+	return ((v3d->twflag & V3D_USE_MANIPULATOR) != 0);
+}
+
 void WIDGETGROUP_object_manipulator_create(const struct bContext *C, struct wmWidgetGroup *wgroup)
 {
 	Object *ob = ED_object_active_context((bContext *)C);
@@ -1203,12 +1236,16 @@ void WIDGETGROUP_object_manipulator_create(const struct bContext *C, struct wmWi
 	WIDGETGROUP_manipulator_create(C, wgroup);
 }
 
-int WIDGETGROUP_manipulator_poll(const struct bContext *C, struct wmWidgetGroupType *UNUSED(wgrouptype))
+
+int WIDGETGROUP_object_manipulator_poll(const struct bContext *C, struct wmWidgetGroupType *wgrouptype)
 {
-	/* it's a given we only use this in 3D view */
-	const ScrArea *sa = CTX_wm_area(C);
-	const View3D *v3d = sa->spacedata.first;
+	Object *ob = ED_object_active_context((bContext *)C);
 
-	return ((v3d->twflag & V3D_USE_MANIPULATOR) != 0);
+	if (ED_operator_object_active((bContext *)C)) {
+		if (STREQ(wgrouptype->idname, ob->id.name)) {
+			return true;
+		}
+	}
+	return false;
 }




More information about the Bf-blender-cvs mailing list