diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-07-06 13:19:59 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-07-06 13:21:21 +0300 |
commit | 9d71ec5f8d8c74d4ae2dbec075d193ac0958de13 (patch) | |
tree | 2b047bd3dca2e2fec1e6cbd04e69c4b2b9c49ca1 /source/blender | |
parent | f67c331bedd5bfd0a70f3d9774cf71c8267f7081 (diff) | |
parent | a7a5c20fbc8de036992e50f6e399fa041dab7328 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/space_info/info_ops.c | 1 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_conversions.c | 34 |
2 files changed, 27 insertions, 8 deletions
diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c index 0e427623840..b87a0de23b9 100644 --- a/source/blender/editors/space_info/info_ops.c +++ b/source/blender/editors/space_info/info_ops.c @@ -162,7 +162,6 @@ static int pack_all_exec(bContext *C, wmOperator *op) Main *bmain = CTX_data_main(C); packAll(bmain, op->reports, true); - G.fileflags |= G_AUTOPACK; return OPERATOR_FINISHED; } diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index cfc648e1fd0..5b48f4326e8 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -772,34 +772,43 @@ int count_set_pose_transflags(int *out_mode, short around, Object *ob) /* -------- Auto-IK ---------- */ /* adjust pose-channel's auto-ik chainlen */ -static void pchan_autoik_adjust(bPoseChannel *pchan, short chainlen) +static bool pchan_autoik_adjust(bPoseChannel *pchan, short chainlen) { bConstraint *con; + bool changed = false; /* don't bother to search if no valid constraints */ - if ((pchan->constflag & (PCHAN_HAS_IK | PCHAN_HAS_TARGET)) == 0) - return; + if ((pchan->constflag & (PCHAN_HAS_IK | PCHAN_HAS_TARGET)) == 0) { + return changed; + } /* check if pchan has ik-constraint */ for (con = pchan->constraints.first; con; con = con->next) { if (con->type == CONSTRAINT_TYPE_KINEMATIC && (con->enforce != 0.0f)) { bKinematicConstraint *data = con->data; - + /* only accept if a temporary one (for auto-ik) */ if (data->flag & CONSTRAINT_IK_TEMP) { /* chainlen is new chainlen, but is limited by maximum chainlen */ - if ((chainlen == 0) || (chainlen > data->max_rootbone)) + const int old_rootbone = data->rootbone; + if ((chainlen == 0) || (chainlen > data->max_rootbone)) { data->rootbone = data->max_rootbone; - else + } + else { data->rootbone = chainlen; + } + changed |= (data->rootbone != old_rootbone); } } } + + return changed; } /* change the chain-length of auto-ik */ void transform_autoik_update(TransInfo *t, short mode) { + const short old_len = t->settings->autoik_chainlen; short *chainlen = &t->settings->autoik_chainlen; bPoseChannel *pchan; @@ -813,13 +822,24 @@ void transform_autoik_update(TransInfo *t, short mode) if (*chainlen > 0) (*chainlen)--; } + /* IK length did not change, skip any updates. */ + if (old_len == *chainlen) { + return; + } + /* sanity checks (don't assume t->poseobj is set, or that it is an armature) */ if (ELEM(NULL, t->poseobj, t->poseobj->pose)) return; /* apply to all pose-channels */ + bool changed = false; for (pchan = t->poseobj->pose->chanbase.first; pchan; pchan = pchan->next) { - pchan_autoik_adjust(pchan, *chainlen); + changed |= pchan_autoik_adjust(pchan, *chainlen); + } + + if (changed) { + /* TODO(sergey): Consider doing partial update only. */ + DEG_relations_tag_update(G.main); } } |