forked from bartvdbraak/blender
NLA Transform Bugfixes:
* Scaling NLA-strips now resets their scale setting correctly at all times * Added safe-guards against negative scaling being created through the use of the transform tools. Note: at scale 0 or thereabouts, there will still be a little blip, when keyframes are scaled as if scale were 1.0f. It's quite harmless.
This commit is contained in:
parent
2d96d1189f
commit
97e72570d1
@ -2726,10 +2726,11 @@ static void createTransNlaData(TransInfo *t)
|
|||||||
if (base->object->action) {
|
if (base->object->action) {
|
||||||
/* exclude if strip is selected too */
|
/* exclude if strip is selected too */
|
||||||
for (strip=base->object->nlastrips.first; strip; strip=strip->next) {
|
for (strip=base->object->nlastrips.first; strip; strip=strip->next) {
|
||||||
if (strip->flag & ACTSTRIP_SELECT)
|
if (strip->flag & ACTSTRIP_SELECT) {
|
||||||
if (strip->act == base->object->action)
|
if (strip->act == base->object->action)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (strip==NULL) {
|
if (strip==NULL) {
|
||||||
cfra = get_action_frame(base->object, CFRA);
|
cfra = get_action_frame(base->object, CFRA);
|
||||||
|
|
||||||
@ -2790,10 +2791,11 @@ static void createTransNlaData(TransInfo *t)
|
|||||||
if (base->object->action) {
|
if (base->object->action) {
|
||||||
/* exclude if strip that active action belongs to is selected too */
|
/* exclude if strip that active action belongs to is selected too */
|
||||||
for (strip=base->object->nlastrips.first; strip; strip=strip->next) {
|
for (strip=base->object->nlastrips.first; strip; strip=strip->next) {
|
||||||
if (strip->flag & ACTSTRIP_SELECT)
|
if (strip->flag & ACTSTRIP_SELECT) {
|
||||||
if (strip->act == base->object->action)
|
if (strip->act == base->object->action)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* can include if no strip found */
|
/* can include if no strip found */
|
||||||
if (strip==NULL) {
|
if (strip==NULL) {
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
#include "DNA_lattice_types.h"
|
#include "DNA_lattice_types.h"
|
||||||
#include "DNA_mesh_types.h"
|
#include "DNA_mesh_types.h"
|
||||||
#include "DNA_modifier_types.h"
|
#include "DNA_modifier_types.h"
|
||||||
|
#include "DNA_nla_types.h"
|
||||||
#include "DNA_object_types.h"
|
#include "DNA_object_types.h"
|
||||||
#include "DNA_object_force.h"
|
#include "DNA_object_force.h"
|
||||||
#include "DNA_particle_types.h"
|
#include "DNA_particle_types.h"
|
||||||
@ -303,10 +304,50 @@ void recalcData(TransInfo *t)
|
|||||||
|
|
||||||
if (base->object->recalc)
|
if (base->object->recalc)
|
||||||
base->object->ctime= -1234567.0f; // eveil!
|
base->object->ctime= -1234567.0f; // eveil!
|
||||||
|
|
||||||
|
/* recalculate scale of selected nla-strips */
|
||||||
|
if (base->object->nlastrips.first) {
|
||||||
|
Object *bob= base->object;
|
||||||
|
bActionStrip *strip;
|
||||||
|
|
||||||
|
for (strip= bob->nlastrips.first; strip; strip= strip->next) {
|
||||||
|
if (strip->flag & ACTSTRIP_SELECT) {
|
||||||
|
float actlen= strip->actend - strip->actstart;
|
||||||
|
float len= strip->end - strip->start;
|
||||||
|
|
||||||
|
strip->scale= len / (actlen * strip->repeat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DAG_scene_flush_update(G.scene, screen_view3d_layers(), 0);
|
DAG_scene_flush_update(G.scene, screen_view3d_layers(), 0);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
for (base=G.scene->base.first; base; base=base->next) {
|
||||||
|
/* recalculate scale of selected nla-strips */
|
||||||
|
if (base->object->nlastrips.first) {
|
||||||
|
Object *bob= base->object;
|
||||||
|
bActionStrip *strip;
|
||||||
|
|
||||||
|
for (strip= bob->nlastrips.first; strip; strip= strip->next) {
|
||||||
|
if (strip->flag & ACTSTRIP_SELECT) {
|
||||||
|
float actlen= strip->actend - strip->actstart;
|
||||||
|
float len= strip->end - strip->start;
|
||||||
|
|
||||||
|
/* prevent 'negative' scaling */
|
||||||
|
if (len < 0) {
|
||||||
|
SWAP(float, strip->start, strip->end);
|
||||||
|
len= fabs(len);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* calculate new scale */
|
||||||
|
strip->scale= len / (actlen * strip->repeat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (t->spacetype == SPACE_IPO) {
|
else if (t->spacetype == SPACE_IPO) {
|
||||||
EditIpo *ei;
|
EditIpo *ei;
|
||||||
|
Loading…
Reference in New Issue
Block a user