Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-02-06 08:34:11 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-02-06 10:03:28 +0300
commitef11113399e3273ee647b3710b346356a2b5f8f0 (patch)
treeab2a0d19651915b45fa9db2f0a188054fcbbefc6 /source/blender/editors/transform/transform_manipulator.c
parent91db372b486807cec87a7ae3ccfc7bae0af62264 (diff)
Object Mode: use eval_ctx mode in transform code
This adds EvaluationContext into TransInfo
Diffstat (limited to 'source/blender/editors/transform/transform_manipulator.c')
-rw-r--r--source/blender/editors/transform/transform_manipulator.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c
index 0643687c29a..556f47d86a7 100644
--- a/source/blender/editors/transform/transform_manipulator.c
+++ b/source/blender/editors/transform/transform_manipulator.c
@@ -63,6 +63,8 @@
#include "BIF_gl.h"
+#include "DEG_depsgraph.h"
+
#include "WM_api.h"
#include "WM_types.h"
#include "WM_message.h"
@@ -518,9 +520,9 @@ static bool 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])
+bool gimbal_axis(Object *ob, float gmat[3][3], const short object_mode)
{
- if (ob->mode & OB_MODE_POSE) {
+ if (object_mode & OB_MODE_POSE) {
bPoseChannel *pchan = BKE_pose_channel_active(ob);
if (pchan) {
@@ -589,6 +591,8 @@ static int calc_manipulator_stats(
const bContext *C, bool use_only_center,
struct TransformBounds *tbounds)
{
+ EvaluationContext eval_ctx;
+ CTX_data_eval_ctx(C, &eval_ctx);
ScrArea *sa = CTX_wm_area(C);
ARegion *ar = CTX_wm_region(C);
Scene *scene = CTX_data_scene(C);
@@ -626,7 +630,7 @@ static int calc_manipulator_stats(
case V3D_MANIP_GIMBAL:
{
float mat[3][3];
- if (gimbal_axis(ob, mat)) {
+ if (gimbal_axis(ob, mat, eval_ctx.object_mode)) {
copy_m4_m3(rv3d->twmat, mat);
break;
}
@@ -635,7 +639,7 @@ static int calc_manipulator_stats(
}
case V3D_MANIP_NORMAL:
{
- if (obedit || ob->mode & OB_MODE_POSE) {
+ if (obedit || eval_ctx.object_mode & OB_MODE_POSE) {
float mat[3][3];
ED_getTransformOrientationMatrix(C, mat, v3d->around);
copy_m4_m3(rv3d->twmat, mat);
@@ -646,7 +650,7 @@ static int calc_manipulator_stats(
}
case V3D_MANIP_LOCAL:
{
- if (ob->mode & OB_MODE_POSE) {
+ if (eval_ctx.object_mode & OB_MODE_POSE) {
/* each bone moves on its own local axis, but to avoid confusion,
* use the active pones axis for display [#33575], this works as expected on a single bone
* and users who select many bones will understand whats going on and what local means
@@ -688,7 +692,7 @@ static int calc_manipulator_stats(
#ifdef USE_AXIS_BOUNDS
copy_m3_m4(tbounds->axis, rv3d->twmat);
- if (ob && ob->mode & OB_MODE_EDIT) {
+ if (ob && eval_ctx.object_mode & OB_MODE_EDIT) {
float diff_mat[3][3];
copy_m3_m4(diff_mat, ob->obmat);
normalize_m3(diff_mat);
@@ -931,7 +935,7 @@ static int calc_manipulator_stats(
mul_m4_v3(obedit->obmat, tbounds->max);
}
}
- else if (ob && (ob->mode & OB_MODE_POSE)) {
+ else if (ob && (eval_ctx.object_mode & OB_MODE_POSE)) {
bPoseChannel *pchan;
int mode = TFM_ROTATION; // mislead counting bones... bah. We don't know the manipulator mode, could be mixed
bool ok = false;
@@ -969,10 +973,10 @@ static int calc_manipulator_stats(
mul_m4_v3(ob->obmat, tbounds->max);
}
}
- else if (ob && (ob->mode & OB_MODE_ALL_PAINT)) {
+ else if (ob && (eval_ctx.object_mode & OB_MODE_ALL_PAINT)) {
/* pass */
}
- else if (ob && ob->mode & OB_MODE_PARTICLE_EDIT) {
+ else if (ob && eval_ctx.object_mode & OB_MODE_PARTICLE_EDIT) {
PTCacheEdit *edit = PE_get_current(scene, view_layer, ob);
PTCacheEditPoint *point;
PTCacheEditKey *ek;
@@ -1062,12 +1066,14 @@ static void manipulator_prepare_mat(
case V3D_AROUND_CENTER_BOUNDS:
case V3D_AROUND_ACTIVE:
{
+ EvaluationContext eval_ctx;
+ CTX_data_eval_ctx(C, &eval_ctx);
bGPdata *gpd = CTX_data_gpencil_data(C);
Object *ob = OBACT(view_layer);
if (((v3d->around == V3D_AROUND_ACTIVE) && (scene->obedit == NULL)) &&
((gpd == NULL) || !(gpd->flag & GP_DATA_STROKE_EDITMODE)) &&
- (!(ob->mode & OB_MODE_POSE)))
+ (!(eval_ctx.object_mode & OB_MODE_POSE)))
{
copy_v3_v3(rv3d->twmat[3], ob->obmat[3]);
}
@@ -1657,9 +1663,11 @@ static void WIDGETGROUP_xform_cage_draw_prepare(const bContext *C, wmManipulator
struct XFormCageWidgetGroup *xmgroup = mgroup->customdata;
wmManipulator *mpr = xmgroup->manipulator;
+ EvaluationContext eval_ctx;
+ CTX_data_eval_ctx(C, &eval_ctx);
ViewLayer *view_layer = CTX_data_view_layer(C);
Object *ob = OBACT(view_layer);
- if (ob && ob->mode & OB_MODE_EDIT) {
+ if (ob && eval_ctx.object_mode & OB_MODE_EDIT) {
copy_m4_m4(mpr->matrix_space, ob->obmat);
}
else {