Commit: 90fcbde62dd37af3ebdcf6910b51bcb017b535c2
Author: Julian Eisel
Date: Tue Nov 8 21:22:12 2016 +0100
Branches: transform-manipulators
https://developer.blender.org/rB90fcbde62dd37af3ebdcf6910b51bcb017b535c2
Remove old transform manipulators code
===================================================================
M source/blender/blenkernel/intern/constraint.c
M source/blender/editors/include/ED_transform.h
M source/blender/editors/transform/CMakeLists.txt
M source/blender/editors/transform/transform.h
D source/blender/editors/transform/transform_manipulator.c
M source/blender/editors/transform/transform_orientations.c
===================================================================
diff --git a/source/blender/blenkernel/intern/constraint.c
b/source/blender/blenkernel/intern/constraint.c
index b85f1b8..5b34dcc 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -451,10 +451,7 @@ static void contarget_get_mesh_mat(Object *ob, const char
*substring, float mat[
}
- /* derive the rotation from the average normal:
- * - code taken from
transform_manipulator.c,
- * calc_manipulator_stats,
V3D_MANIP_NORMAL case
- */
+ /* derive the rotation from the average normal */
/* we need the transpose of the inverse for a
normal... */
copy_m3_m4(imat, ob->obmat);
diff --git a/source/blender/editors/include/ED_transform.h
b/source/blender/editors/include/ED_transform.h
index 9443e59..3dc84da 100644
--- a/source/blender/editors/include/ED_transform.h
+++ b/source/blender/editors/include/ED_transform.h
@@ -154,11 +154,6 @@ int BIF_countTransformOrientation(const struct bContext
*C);
void Transform_Properties(struct wmOperatorType *ot, int flags);
-/* view3d manipulators */
-
-int BIF_do_manipulator(struct bContext *C, const struct wmEvent *event, struct
wmOperator *op);
-void BIF_draw_manipulator(const struct bContext *C);
-
/* Snapping */
typedef enum SnapSelect {
diff --git a/source/blender/editors/transform/CMakeLists.txt
b/source/blender/editors/transform/CMakeLists.txt
index b7de49d..651c936 100644
--- a/source/blender/editors/transform/CMakeLists.txt
+++ b/source/blender/editors/transform/CMakeLists.txt
@@ -45,7 +45,6 @@ set(SRC
transform_conversions.c
transform_generics.c
transform_input.c
- transform_manipulator.c
transform_ops.c
transform_orientations.c
transform_snap.c
diff --git a/source/blender/editors/transform/transform.h
b/source/blender/editors/transform/transform.h
index 24d42c6..6b5eaf0 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -633,9 +633,6 @@ void flushTransMasking(TransInfo *t);
void flushTransPaintCurve(TransInfo *t);
void restoreBones(TransInfo *t);
-/*********************** exported from transform_manipulator.c ********** */
-bool gimbal_axis(struct Object *ob, float gmat[3][3]); /* return 0 when no
gimbal for selection */
-
/*********************** TransData Creation and General Handling *********** */
void createTransData(struct bContext *C, TransInfo *t);
void sort_trans_data_dist(TransInfo *t);
diff --git a/source/blender/editors/transform/transform_manipulator.c
b/source/blender/editors/transform/transform_manipulator.c
deleted file mode 100644
index b03649f..0000000
--- a/source/blender/editors/transform/transform_manipulator.c
+++ /dev/null
@@ -1,1950 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2005 Blender Foundation
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/editors/transform/transform_manipulator.c
- * \ingroup edtransform
- */
-
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <float.h>
-
-#include "DNA_armature_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_gpencil_types.h"
-#include "DNA_lattice_types.h"
-#include "DNA_meta_types.h"
-#include "DNA_object_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_view3d_types.h"
-
-#include "BLI_listbase.h"
-#include "BLI_math.h"
-#include "BLI_utildefines.h"
-
-#include "RNA_access.h"
-
-#include "BKE_action.h"
-#include "BKE_context.h"
-#include "BKE_curve.h"
-#include "BKE_global.h"
-#include "BKE_editmesh.h"
-#include "BKE_lattice.h"
-#include "BKE_gpencil.h"
-
-#include "BIF_gl.h"
-
-#include "WM_api.h"
-#include "WM_types.h"
-
-#include "ED_armature.h"
-#include "ED_curve.h"
-#include "ED_view3d.h"
-#include "ED_gpencil.h"
-
-#include "UI_resources.h"
-
-/* local module include */
-#include "transform.h"
-
-#include "GPU_select.h"
-
-/* return codes for select, and drawing flags */
-
-#define MAN_TRANS_X (1 << 0)
-#define MAN_TRANS_Y (1 << 1)
-#define MAN_TRANS_Z (1 << 2)
-#define MAN_TRANS_C (MAN_TRANS_X | MAN_TRANS_Y | MAN_TRANS_Z)
-
-#define MAN_ROT_X (1 << 3)
-#define MAN_ROT_Y (1 << 4)
-#define MAN_ROT_Z (1 << 5)
-#define MAN_ROT_V (1 << 6)
-#define MAN_ROT_T (1 << 7)
-#define MAN_ROT_C (MAN_ROT_X | MAN_ROT_Y | MAN_ROT_Z | MAN_ROT_V
| MAN_ROT_T)
-
-#define MAN_SCALE_X (1 << 8)
-#define MAN_SCALE_Y (1 << 9)
-#define MAN_SCALE_Z (1 << 10)
-#define MAN_SCALE_C (MAN_SCALE_X | MAN_SCALE_Y | MAN_SCALE_Z)
-
-/* color codes */
-
-#define MAN_RGB 0
-#define MAN_GHOST 1
-#define MAN_MOVECOL 2
-
-/* threshold for testing view aligned manipulator axis */
-#define TW_AXIS_DOT_MIN 0.02f
-#define TW_AXIS_DOT_MAX 0.1f
-
-/* transform widget center calc helper for below */
-static void calc_tw_center(Scene *scene, const float co[3])
-{
- float *twcent = scene->twcent;
- float *min = scene->twmin;
- float *max = scene->twmax;
-
- minmax_v3v3_v3(min, max, co);
- add_v3_v3(twcent, co);
-}
-
-static void protectflag_to_drawflags(short protectflag, short *drawflags)
-{
- if (protectflag & OB_LOCK_LOCX)
- *drawflags &= ~MAN_TRANS_X;
- if (protectflag & OB_LOCK_LOCY)
- *drawflags &= ~MAN_TRANS_Y;
- if (protectflag & OB_LOCK_LOCZ)
- *drawflags &= ~MAN_TRANS_Z;
-
- if (protectflag & OB_LOCK_ROTX)
- *drawflags &= ~MAN_ROT_X;
- if (protectflag & OB_LOCK_ROTY)
- *drawflags &= ~MAN_ROT_Y;
- if (protectflag & OB_LOCK_ROTZ)
- *drawflags &= ~MAN_ROT_Z;
-
- if (protectflag & OB_LOCK_SCALEX)
- *drawflags &= ~MAN_SCALE_X;
- if (protectflag & OB_LOCK_SCALEY)
- *drawflags &= ~MAN_SCALE_Y;
- if (protectflag & OB_LOCK_SCALEZ)
- *drawflags &= ~MAN_SCALE_Z;
-}
-
-/* for pose mode */
-static void stats_pose(Scene *scene, RegionView3D *rv3d, bPoseChannel *pchan)
-{
- Bone *bone = pchan->bone;
-
- if (bone) {
- calc_tw_center(scene, pchan->pose_head);
- protectflag_to_drawflags(pchan->protectflag, &rv3d->twdrawflag);
- }
-}
-
-/* for editmode*/
-static void stats_editbone(RegionView3D *rv3d, EditBone *ebo)
-{
- if (ebo->flag & BONE_EDITMODE_LOCKED)
- protectflag_to_drawflags(OB_LOCK_LOC | OB_LOCK_ROT |
OB_LOCK_SCALE, &rv3d->twdrawflag);
-}
-
-/* could move into BLI_math however this is only useful for display/editing
purposes */
-static void axis_angle_to_gimbal_axis(float gmat[3][3], const float axis[3],
const float angle)
-{
- /* X/Y are arbitrary axies, most importantly Z is the axis of rotation
*/
-
- float cross_vec[3];
- float quat[4];
-
- /* this is an un-scientific method to get a vector to cross with
- * XYZ intentionally YZX */
- cross_vec[0] = axis[1];
- cross_vec[1] = axis[2];
- cross_vec[2] = axis[0];
-
- /* X-axis */
- cross_v3_v3v3(gmat[0], cross_vec, axis);
- normalize_v3(gmat[0]);
- axis_angle_to_quat(quat, axis, angle);
- mul_qt_v3(quat, gmat[0]);
-
- /* Y-axis */
- axis_angle_to_quat(quat, axis, M_PI_2);
- copy_v3_v3(gmat[1], gmat[0]);
- mul_qt_v3(quat, gmat[1]);
-
- /* Z-axis */
- copy_v3_v3(gmat[2], axis);
-
- normalize_m3(gmat);
-}
-
-
-static int test_rotmode_euler(short rotmode)
-{
- return (ELEM(rotmode, ROT_MODE_AXISANGLE, ROT_MODE_QUAT)) ? 0 : 1;
-}
-
-bool gimbal_axis(Object *ob, float gmat[3][3])
-{
- if (ob) {
- if (ob->mode & OB_MODE_POSE) {
- bPoseChannel *pchan = BKE_pose_channel_active(ob);
-
- if (pchan) {
- float mat[3][3], tmat[3][3], obmat[3][3];
- if (test_rotmode_euler(pchan->rotmode)) {
- eulO_to_gimbal_axis(mat, pchan->eul,
pchan->rotmode);
- }
- else if (pchan->rotmode == ROT_MODE_AXISANGLE) {
- axis_angle_to_gimbal_axis(mat,
pchan->rotAxis, pchan->rotAngle);
- }
- else { /* quat */
- return 0;
- }
-
-
- /* apply bone transformation */
- mul_m3_m3m3(tmat, pchan->bone->bone_mat, mat);
-
- if (pchan->parent) {
- float parent_mat[3][3];
-
- copy_m3_m4(parent_mat,
pchan->parent->pose_mat);
- mul_m3_m3m3(mat, parent_mat, tmat);
-
- /* needed if object transformation
isn't identity */
- copy_m3_m4(obmat, ob->obmat);
- mul_m3_m3m3(gmat, obmat, mat);
- }
- else {
- /* needed if object transformation
isn't identity */
- copy_m3_m4(obmat, ob->obmat);
- mul_m3_m3m3(gmat, obmat, tmat);
- }
-
- normalize_m3(gmat);
- return 1;
- }
- }
- else {
- if (test_rotmode_euler(ob->rotmode)) {
- eulO_to_gimbal_axis(gmat, ob->rot, ob->rotmode);
- }
- else if (ob->rotmode == ROT_MODE_AXISANGLE) {
- axis_angle_to_gimbal_axis(gmat, ob->rotAxis,
ob->rotAngle);
- }
- else { /* quat */
- return 0;
- }
-
- if (ob->parent) {
- float parent_mat[3][3];
- copy_m3_m4(parent_mat, ob->parent->obmat);
- normalize_m3(parent_mat);
- mul_m3_m3m3(gmat, parent_mat, gmat);
- }
- return 1;
- }
- }
-
- return 0;
-}
-
-
-/* centroid, boundbox, of selection */
-/* returns total items selected */
-static int calc_manipulator_stats(const bContext *C)
-{
- ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
- Scene *scene = CTX_data_scene(C);
- Object *obedit = CTX_data_edit_object(C);
- View3D *v3d = sa->spacedata.first;
- RegionView3D *rv3d = ar->regiondata;
- Base *base;
- Object *ob = OBACT;
- bGPdata *gpd = CTX_data_gpencil_data(C);
- const bool is_gp_edit = ((gpd) && (gpd->flag &
GP_DATA_STROKE_EDITMODE));
- int a, totsel = 0;
-
- /* transform widget matrix */
- unit_m4(rv3d->twmat);
-
- rv3d->twdrawflag = 0xFFFF;
-
- /* transform widget centroid/center
@@ Diff output truncated at 10240 characters. @@
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs