[Bf-blender-cvs] [d1236a0] wiggly-widgets: A bunch of minor cleanup
Julian Eisel
noreply at git.blender.org
Thu Apr 9 18:36:02 CEST 2015
Commit: d1236a06b7a397599df74cd9aaf949d819a43e3e
Author: Julian Eisel
Date: Thu Apr 9 18:35:43 2015 +0200
Branches: wiggly-widgets
https://developer.blender.org/rBd1236a06b7a397599df74cd9aaf949d819a43e3e
A bunch of minor cleanup
===================================================================
M source/blender/editors/include/ED_transform.h
M source/blender/editors/transform/manipulator_widget.c
===================================================================
diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h
index dca72dd..1267d85 100644
--- a/source/blender/editors/include/ED_transform.h
+++ b/source/blender/editors/include/ED_transform.h
@@ -156,6 +156,7 @@ int BIF_countTransformOrientation(const struct bContext *C);
void Transform_Properties(struct wmOperatorType *ot, int flags);
+
/* view3d manipulators */
typedef struct ManipulatorGroup {
@@ -168,23 +169,15 @@ typedef struct ManipulatorGroup {
struct wmWidget *rotate_z;
} ManipulatorGroup;
-int WIDGET_manipulator_handler(struct bContext *C, const struct wmEvent *event, struct wmWidget *widget);
-
-int WIDGET_manipulator_handler_trans(struct bContext *C, const struct wmEvent *event, struct wmWidget *widget, struct PointerRNA *ptr);
-int WIDGET_manipulator_handler_rot(struct bContext *C, const struct wmEvent *event, struct wmWidget *widget, struct PointerRNA *ptr);
-
-void WIDGET_manipulator_render_3d_intersect(const struct bContext *C, struct wmWidget *widget, int selectionbase);
-void WIDGET_manipulator_draw(struct wmWidget *widget, const struct bContext *C);
int WIDGETGROUP_manipulator_poll(const struct bContext *C, struct wmWidgetGroupType *wgrouptype);
void WIDGETGROUP_manipulator_update(const struct bContext *C, struct wmWidgetGroup *wgroup);
-void WIDGETGROUP_manipulator_free(struct wmWidgetGroup *wgroup);
-void WIDGETGROUP_manipulator_create(const struct bContext *C, struct wmWidgetGroup *wgroup);
void BIF_draw_manipulator(const struct bContext *C);
int BIF_do_manipulator(struct bContext *C, const struct wmEvent *event, struct wmOperator *op);
-/* Snapping */
+/* Snapping */
+
typedef struct DepthPeel {
struct DepthPeel *next, *prev;
diff --git a/source/blender/editors/transform/manipulator_widget.c b/source/blender/editors/transform/manipulator_widget.c
index db9945b..a068653 100644
--- a/source/blender/editors/transform/manipulator_widget.c
+++ b/source/blender/editors/transform/manipulator_widget.c
@@ -150,7 +150,7 @@ enum {
#define TW_AXIS_DOT_MIN 0.02f
#define TW_AXIS_DOT_MAX 0.1f
-/* loop over all axes */
+/* loop over axes of given type */
#define MAN_ITER_AXES_BEGIN(axis_type) \
for (i = (axis_type == MAN_AXES_ROTATE ? 3 : 0); \
i < (axis_type == MAN_AXES_TRANSLATE ? 3 : 6 ); \
@@ -236,7 +236,7 @@ static void stats_pose(Scene *scene, RegionView3D *rv3d, bPoseChannel *pchan)
}
/* for editmode*/
-static void stats_editbone(RegionView3D *rv3d, EditBone *ebo)
+static void stats_editbone(RegionView3D *rv3d, const EditBone *ebo)
{
if (ebo->flag & BONE_EDITMODE_LOCKED)
protectflag_to_drawflags(OB_LOCK_LOC | OB_LOCK_ROT | OB_LOCK_SCALE, &rv3d->twdrawflag);
@@ -350,15 +350,15 @@ bool gimbal_axis(Object *ob, float gmat[3][3])
/* returns total items selected */
static int calc_manipulator_stats(const bContext *C)
{
- ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ const ScrArea *sa = CTX_wm_area(C);
+ const ARegion *ar = CTX_wm_region(C);
+ const ToolSettings *ts = CTX_data_tool_settings(C);
+ const View3D *v3d = sa->spacedata.first;
+ RegionView3D *rv3d = ar->regiondata;
Scene *scene = CTX_data_scene(C);
Object *obedit = CTX_data_edit_object(C);
- ToolSettings *ts = CTX_data_tool_settings(C);
- View3D *v3d = sa->spacedata.first;
- RegionView3D *rv3d = ar->regiondata;
- Base *base;
Object *ob = OBACT;
+ Base *base;
int a, totsel = 0;
/* transform widget matrix */
@@ -439,7 +439,7 @@ static int calc_manipulator_stats(const bContext *C)
}
} /* end editmesh */
else if (obedit->type == OB_ARMATURE) {
- bArmature *arm = obedit->data;
+ const bArmature *arm = obedit->data;
EditBone *ebo;
if ((v3d->around == V3D_ACTIVE) && (ebo = arm->act_edbone)) {
@@ -486,7 +486,7 @@ static int calc_manipulator_stats(const bContext *C)
Nurb *nu;
BezTriple *bezt;
BPoint *bp;
- ListBase *nurbs = BKE_curve_editNurbs_get(cu);
+ const ListBase *nurbs = BKE_curve_editNurbs_get(cu);
nu = nurbs->first;
while (nu) {
@@ -584,7 +584,7 @@ static int calc_manipulator_stats(const bContext *C)
}
else if (ob && (ob->mode & OB_MODE_POSE)) {
bPoseChannel *pchan;
- int mode = TFM_ROTATION; // mislead counting bones... bah. We don't know the manipulator mode, could be mixed
+ int mode = TFM_ROTATION; /* mislead counting bones... bah. We don't know the manipulator mode, could be mixed */
bool ok = false;
if ((ob->lay & v3d->lay) == 0) return 0;
@@ -624,7 +624,7 @@ static int calc_manipulator_stats(const bContext *C)
/* pass */
}
else if (ob && ob->mode & OB_MODE_PARTICLE_EDIT) {
- PTCacheEdit *edit = PE_get_current(scene, ob);
+ const PTCacheEdit *edit = PE_get_current(scene, ob);
PTCacheEditPoint *point;
PTCacheEditKey *ek;
int k;
@@ -648,7 +648,6 @@ static int calc_manipulator_stats(const bContext *C)
}
}
else {
-
/* we need the one selected object, if its not active */
ob = OBACT;
if (ob && !(ob->flag & SELECT)) ob = NULL;
@@ -671,9 +670,7 @@ static int calc_manipulator_stats(const bContext *C)
/* global, local or normal orientation? */
if (ob && totsel) {
-
switch (v3d->twmode) {
-
case V3D_MANIP_GLOBAL:
{
break; /* nothing to do */
@@ -732,7 +729,6 @@ static int calc_manipulator_stats(const bContext *C)
break;
}
}
-
}
return totsel;
@@ -765,7 +761,7 @@ static void test_manipulator_axis(const bContext *C)
/* ******************** DRAWING STUFFIES *********** */
-static float screen_aligned(RegionView3D *rv3d, float mat[4][4])
+static float screen_aligned(const RegionView3D *rv3d, float mat[4][4])
{
glTranslatef(mat[3][0], mat[3][1], mat[3][2]);
@@ -783,7 +779,8 @@ static float screen_aligned(RegionView3D *rv3d, float mat[4][4])
* nsides = amount of points in ring
* nrigns = amount of rings
*/
-static void partial_doughnut(float radring, float radhole, int start, int end, int nsides, int nrings)
+static void partial_doughnut(const float radring, const float radhole, const int start,
+ const int end, const int nsides, const int nrings)
{
float theta, phi, theta1;
float cos_theta, sin_theta;
@@ -860,7 +857,7 @@ static void partial_doughnut(float radring, float radhole, int start, int end, i
}
}
-static char axisBlendAngle(float idot)
+static char axisBlendAngle(const float idot)
{
if (idot > TW_AXIS_DOT_MAX) {
return 255;
@@ -878,10 +875,12 @@ static char axisBlendAngle(float idot)
* moving: in transform theme color
* else the red/green/blue
*/
-static void manipulator_setcolor(View3D *v3d, char axis, int colcode, unsigned char alpha, bool highlight)
+static void manipulator_setcolor(const View3D *v3d, const char axis, const int colcode,
+ const unsigned char alpha, const bool highlight)
{
unsigned char col[4] = {0};
- int offset = (highlight) ? 80 : 0;
+ const int offset = (highlight) ? 80 : 0;
+
col[3] = alpha;
if (colcode == MAN_GHOST) {
@@ -923,7 +922,7 @@ static void manipulator_setcolor(View3D *v3d, char axis, int colcode, unsigned c
glColor4ubv(col);
}
-static void manipulator_axis_order(RegionView3D *rv3d, int r_axis_order[3])
+static void manipulator_axis_order(const RegionView3D *rv3d, int r_axis_order[3])
{
float axis_values[3];
float vec[3];
@@ -938,9 +937,9 @@ static void manipulator_axis_order(RegionView3D *rv3d, int r_axis_order[3])
}
/* viewmatrix should have been set OK, also no shademode! */
-static void draw_manipulator_axes_single(View3D *v3d, RegionView3D *rv3d, int colcode,
- int flagx, int flagy, int flagz, int axis,
- const int selectionbase, int highlight)
+static void draw_manipulator_axes_single(const View3D *v3d, const RegionView3D *rv3d, const int colcode,
+ const int flagx, const int flagy, const int flagz, const int axis,
+ const int selectionbase, const int highlight)
{
switch (axis) {
case 0:
@@ -991,9 +990,9 @@ static void draw_manipulator_axes_single(View3D *v3d, RegionView3D *rv3d, int co
break;
}
}
-static void draw_manipulator_axes(View3D *v3d, RegionView3D *rv3d, int colcode,
- int flagx, int flagy, int flagz,
- const int axis_order[3], const int selectionbase, int highlight)
+static void draw_manipulator_axes(const View3D *v3d, const RegionView3D *rv3d, const int colcode, const int flagx,
+ const int flagy, const int flagz, const int axis_order[3],
+ const int selectionbase, const int highlight)
{
int i;
for (i = 0; i < 3; i++) {
@@ -1020,17 +1019,16 @@ static void postOrtho(const bool ortho)
}
}
-static void draw_manipulator_rotate(
- View3D *v3d, RegionView3D *rv3d, const int drawflags, int highlight, const int combo,
- const bool is_moving, const int selectionbase)
+static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, const int drawflags, int highlight,
+ const int combo, const int selectionbase, const bool is_moving)
{
+ const float cywid = 0.33f * 0.01f * (float)U.tw_handlesize;
+ const float cusize = cywid * 0.65f;
+ const int arcs = (G.debug_value != 2);
+ const int colcode = (is_moving) ? MAN_MOVECOL : MAN_RGB;
double plane[4];
float matt[4][4];
float size, unitmat[4][4];
- float cywid = 0.33f * 0.01f * (float)U.tw_handlesize;
- float cusize = cywid * 0.65f;
- int arcs = (G.debug_value != 2);
- const int colcode = (is_moving) ? MAN_MOVECOL : MAN_RGB;
bool ortho;
/* when called while moving in mixed mode, do not draw when... */
@@ -1048,7 +1046,7 @@ static void draw_manipulator_rotate(
if (arcs) {
/* clipplane makes nice handles, calc here because of multmatrix but with translate! */
copy_v3db_v3fl(plane, rv3d->viewinv[2]);
- plane[3] = -0.02f * size; // clip just a bit more
+ plane[3] = -0.02f * size; /* clip just a bit more */
glClipPlane(GL_CLIP_PLANE0, plane);
}
/* sets view screen aligned */
@@ -1078,8 +1076,8 @@ static void d
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list