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:
authorJoseph Eagar <joeedh@gmail.com>2009-08-06 13:56:14 +0400
committerJoseph Eagar <joeedh@gmail.com>2009-08-06 13:56:14 +0400
commit38de6d14e4e7a55a4109313942df3ae9211b1aeb (patch)
tree83288d248bc7a4794b8b34e607f3e319e905b381 /source/blender/editors/transform
parent416a3bf4a14a951642cace5ee8033c4c20dd9f66 (diff)
parent1e4fb484001994f4e164aab7b44c9578df59f67d (diff)
merge with 2.5 (not trunk, last merge message said that on accident) at r22252
Diffstat (limited to 'source/blender/editors/transform')
-rw-r--r--source/blender/editors/transform/transform.c11
-rw-r--r--source/blender/editors/transform/transform_conversions.c86
-rw-r--r--source/blender/editors/transform/transform_generics.c90
-rw-r--r--source/blender/editors/transform/transform_input.c2
-rw-r--r--source/blender/editors/transform/transform_manipulator.c5
5 files changed, 123 insertions, 71 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 35915c96f3c..510193fdade 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -93,6 +93,7 @@
//#include "BSE_view.h"
#include "ED_image.h"
+#include "ED_keyframing.h"
#include "ED_screen.h"
#include "ED_space_api.h"
#include "ED_markers.h"
@@ -298,6 +299,10 @@ static void viewRedrawForce(bContext *C, TransInfo *t)
{
/* Do we need more refined tags? */
WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
+
+ /* for realtime animation record - send notifiers recognised by animation editors */
+ if ((t->animtimer) && IS_AUTOKEY_ON(t->scene))
+ WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, NULL);
}
else if (t->spacetype == SPACE_ACTION) {
//SpaceAction *saction= (SpaceAction *)t->sa->spacedata.first;
@@ -1947,7 +1952,7 @@ int handleEventWarp(TransInfo *t, wmEvent *event)
{
int status = 0;
- if (event->type == MIDDLEMOUSE && event->val)
+ if (event->type == MIDDLEMOUSE && event->val==KM_PRESS)
{
// Use customData pointer to signal warp direction
if (t->customData == 0)
@@ -2081,7 +2086,7 @@ int handleEventShear(TransInfo *t, wmEvent *event)
{
int status = 0;
- if (event->type == MIDDLEMOUSE && event->val)
+ if (event->type == MIDDLEMOUSE && event->val==KM_PRESS)
{
// Use customData pointer to signal Shear direction
if (t->customData == 0)
@@ -3514,7 +3519,7 @@ void initBevel(TransInfo *t)
int handleEventBevel(TransInfo *t, wmEvent *event)
{
- if (event->val) {
+ if (event->val==KM_PRESS) {
if(!G.editBMesh) return 0;
switch (event->type) {
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 623c6bb24c3..783d98e4c6f 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -1219,8 +1219,7 @@ static void createTransArmatureVerts(bContext *C, TransInfo *t)
static void createTransMBallVerts(bContext *C, TransInfo *t)
{
- // TRANSFORM_FIX_ME
-#if 0
+ MetaBall *mb = (MetaBall*)t->obedit->data;
MetaElem *ml;
TransData *td;
TransDataExtension *tx;
@@ -1229,7 +1228,7 @@ static void createTransMBallVerts(bContext *C, TransInfo *t)
int propmode = t->flag & T_PROP_EDIT;
/* count totals */
- for(ml= editelems.first; ml; ml= ml->next) {
+ for(ml= mb->editelems->first; ml; ml= ml->next) {
if(ml->flag & SELECT) countsel++;
if(propmode) count++;
}
@@ -1246,7 +1245,7 @@ static void createTransMBallVerts(bContext *C, TransInfo *t)
Mat3CpyMat4(mtx, t->obedit->obmat);
Mat3Inv(smtx, mtx);
- for(ml= editelems.first; ml; ml= ml->next) {
+ for(ml= mb->editelems->first; ml; ml= ml->next) {
if(propmode || (ml->flag & SELECT)) {
td->loc= &ml->x;
VECCOPY(td->iloc, td->loc);
@@ -1287,7 +1286,6 @@ static void createTransMBallVerts(bContext *C, TransInfo *t)
tx++;
}
}
-#endif
}
/* ********************* curve/surface ********* */
@@ -2451,7 +2449,7 @@ static void UVsToTransData(SpaceImage *sima, TransData *td, TransData2D *td2d, f
static void createTransUVs(bContext *C, TransInfo *t)
{
- SpaceImage *sima = (SpaceImage*)CTX_wm_space_data(C);
+ SpaceImage *sima = CTX_wm_space_image(C);
Image *ima = CTX_data_edit_image(C);
Scene *scene = CTX_data_scene(C);
TransData *td = NULL;
@@ -4680,34 +4678,34 @@ void special_aftertrans_update(TransInfo *t)
SpaceAction *saction= (SpaceAction *)t->sa->spacedata.first;
Scene *scene;
bAnimContext ac;
-
+
/* initialise relevant anim-context 'context' data from TransInfo data */
/* NOTE: sync this with the code in ANIM_animdata_get_context() */
memset(&ac, 0, sizeof(bAnimContext));
-
+
scene= ac.scene= t->scene;
ob= ac.obact= OBACT;
ac.sa= t->sa;
ac.ar= t->ar;
ac.spacetype= (t->sa)? t->sa->spacetype : 0;
ac.regiontype= (t->ar)? t->ar->regiontype : 0;
-
+
if (ANIM_animdata_context_getdata(&ac) == 0)
return;
-
+
if (ac.datatype == ANIMCONT_DOPESHEET) {
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
short filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
-
+
/* get channels to work on */
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
-
+
/* these should all be ipo-blocks */
for (ale= anim_data.first; ale; ale= ale->next) {
AnimData *adt= ANIM_nla_mapping_get(&ac, ale);
FCurve *fcu= (FCurve *)ale->key_data;
-
+
if ( (saction->flag & SACTION_NOTRANSKEYCULL)==0 &&
((cancelled == 0) || (duplicate)) )
{
@@ -4720,7 +4718,7 @@ void special_aftertrans_update(TransInfo *t)
posttrans_fcurve_clean(fcu);
}
}
-
+
/* free temp memory */
BLI_freelistN(&anim_data);
}
@@ -4729,13 +4727,13 @@ void special_aftertrans_update(TransInfo *t)
// fixme... some of this stuff is not good
if (ob) {
ob->ctime= -1234567.0f;
-
+
if (ob->pose || ob_get_key(ob))
DAG_object_flush_update(scene, ob, OB_RECALC);
else
DAG_object_flush_update(scene, ob, OB_RECALC_OB);
}
-
+
/* Do curve cleanups? */
if ( (saction->flag & SACTION_NOTRANSKEYCULL)==0 &&
((cancelled == 0) || (duplicate)) )
@@ -4747,7 +4745,7 @@ void special_aftertrans_update(TransInfo *t)
#if 0 // XXX old animation system
/* fix up the Ipocurves and redraw stuff */
Key *key= (Key *)ac.data;
-
+
if (key->ipo) {
if ( (saction->flag & SACTION_NOTRANSKEYCULL)==0 &&
((cancelled == 0) || (duplicate)) )
@@ -4756,7 +4754,7 @@ void special_aftertrans_update(TransInfo *t)
}
}
#endif // XXX old animation system
-
+
DAG_object_flush_update(scene, OBACT, OB_RECALC_DATA);
}
#if 0 // XXX future of this is still not clear
@@ -4766,23 +4764,23 @@ void special_aftertrans_update(TransInfo *t)
{
bScreen *sc= (bScreen *)ac.data;
ScrArea *sa;
-
+
/* BAD... we need to loop over all screen areas for current screen...
* - sync this with actdata_filter_gpencil() in editaction.c
*/
for (sa= sc->areabase.first; sa; sa= sa->next) {
bGPdata *gpd= gpencil_data_getactive(sa);
-
+
if (gpd)
posttrans_gpd_clean(gpd);
}
}
}
#endif // XXX future of this is still not clear
-
+
/* make sure all F-Curves are set correctly */
ANIM_editkeyframes_refresh(&ac);
-
+
/* clear flag that was set for time-slide drawing */
saction->flag &= ~SACTION_MOVING;
}
@@ -4790,35 +4788,34 @@ void special_aftertrans_update(TransInfo *t)
SpaceIpo *sipo= (SpaceIpo *)t->sa->spacedata.first;
Scene *scene;
bAnimContext ac;
-
+
/* initialise relevant anim-context 'context' data from TransInfo data */
/* NOTE: sync this with the code in ANIM_animdata_get_context() */
memset(&ac, 0, sizeof(bAnimContext));
-
+
scene= ac.scene= t->scene;
ob= ac.obact= OBACT;
ac.sa= t->sa;
ac.ar= t->ar;
ac.spacetype= (t->sa)? t->sa->spacetype : 0;
ac.regiontype= (t->ar)? t->ar->regiontype : 0;
-
+
if (ANIM_animdata_context_getdata(&ac) == 0)
return;
-
+
if (ac.datatype)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
short filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_CURVEVISIBLE);
-
+
/* get channels to work on */
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
-
- /* these should all be ipo-blocks */
+
for (ale= anim_data.first; ale; ale= ale->next) {
AnimData *adt= ANIM_nla_mapping_get(&ac, ale);
FCurve *fcu= (FCurve *)ale->key_data;
-
+
if ( (sipo->flag & SIPO_NOTRANSKEYCULL)==0 &&
((cancelled == 0) || (duplicate)) )
{
@@ -4831,58 +4828,57 @@ void special_aftertrans_update(TransInfo *t)
posttrans_fcurve_clean(fcu);
}
}
-
+
/* free temp memory */
BLI_freelistN(&anim_data);
}
-
+
/* make sure all F-Curves are set correctly */
ANIM_editkeyframes_refresh(&ac);
}
else if (t->spacetype == SPACE_NLA) {
Scene *scene;
bAnimContext ac;
-
+
/* initialise relevant anim-context 'context' data from TransInfo data */
/* NOTE: sync this with the code in ANIM_animdata_get_context() */
memset(&ac, 0, sizeof(bAnimContext));
-
+
scene= ac.scene= t->scene;
ob= ac.obact= OBACT;
ac.sa= t->sa;
ac.ar= t->ar;
ac.spacetype= (t->sa)? t->sa->spacetype : 0;
ac.regiontype= (t->ar)? t->ar->regiontype : 0;
-
+
if (ANIM_animdata_context_getdata(&ac) == 0)
return;
-
+
if (ac.datatype)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
short filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NLATRACKS);
-
+
/* get channels to work on */
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
-
+
for (ale= anim_data.first; ale; ale= ale->next) {
NlaTrack *nlt= (NlaTrack *)ale->data;
-
+
/* make sure strips are in order again */
BKE_nlatrack_sort_strips(nlt);
-
+
/* remove the temp metas */
BKE_nlastrips_clear_metas(&nlt->strips, 0, 1);
}
-
+
/* free temp memory */
BLI_freelistN(&anim_data);
+
+ /* perform after-transfrom validation */
+ ED_nla_postop_refresh(&ac);
}
-
- // XXX check on the calls below... we need some of these sanity checks
- //synchronize_action_strips();
- //ANIM_editkeyframes_refresh(&ac);
}
else if (t->obedit) {
// TRANSFORM_FIX_ME
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 14128c42981..fe3e7b08685 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -93,6 +93,7 @@
#include "ED_markers.h"
#include "ED_mesh.h"
#include "ED_retopo.h"
+#include "ED_screen_types.h"
#include "ED_space_api.h"
#include "ED_uvedit.h"
#include "ED_view3d.h"
@@ -272,21 +273,71 @@ static void editbmesh_apply_to_mirror(TransInfo *t)
*/
static void animedit_refresh_id_tags (ID *id)
{
- AnimData *adt= BKE_animdata_from_id(id);
-
- /* tag AnimData for refresh so that other views will update in realtime with these changes */
- if (adt)
- adt->recalc |= ADT_RECALC_ANIM;
+ if (id) {
+ AnimData *adt= BKE_animdata_from_id(id);
- /* if ID-block is Object, set recalc flags */
- // TODO: this should probably go through the depsgraph instead... but for now, let's be lazy
- switch (GS(id->name)) {
- case ID_OB:
- {
- Object *ob= (Object *)id;
- ob->recalc |= OB_RECALC;
+ /* tag AnimData for refresh so that other views will update in realtime with these changes */
+ if (adt)
+ adt->recalc |= ADT_RECALC_ANIM;
+
+ /* if ID-block is Object, set recalc flags */
+ // TODO: this should probably go through the depsgraph instead... but for now, let's be lazy
+ switch (GS(id->name)) {
+ case ID_OB:
+ {
+ Object *ob= (Object *)id;
+ ob->recalc |= OB_RECALC;
+ }
+ break;
+ }
+ }
+}
+
+/* for the realtime animation recording feature, handle overlapping data */
+static void animrecord_check_state (Scene *scene, ID *id, wmTimer *animtimer)
+{
+ ScreenAnimData *sad= (animtimer) ? animtimer->customdata : NULL;
+
+ /* sanity checks */
+ if ELEM3(NULL, scene, id, sad)
+ return;
+
+ /* check if we need a new strip if:
+ * - if animtimer is running
+ * - we're not only keying for available channels
+ * - the option to add new actions for each round is not enabled
+ */
+ if (IS_AUTOKEY_FLAG(INSERTAVAIL)==0 && (scene->toolsettings->autokey_flag & ANIMRECORD_FLAG_WITHNLA)) {
+ /* if playback has just looped around, we need to add a new NLA track+strip to allow a clean pass to occur */
+ if ((sad) && (sad->flag & ANIMPLAY_FLAG_JUMPED)) {
+ AnimData *adt= BKE_animdata_from_id(id);
+
+ /* perform push-down manually with some differences
+ * NOTE: BKE_nla_action_pushdown() sync warning...
+ */
+ if ((adt->action) && !(adt->flag & ADT_NLA_EDIT_ON)) {
+ float astart, aend;
+
+ /* only push down if action is more than 1-2 frames long */
+ calc_action_range(adt->action, &astart, &aend, 1);
+ if (aend > astart+2.0f) {
+ NlaStrip *strip= add_nlastrip_to_stack(adt, adt->action);
+
+ /* clear reference to action now that we've pushed it onto the stack */
+ adt->action->id.us--;
+ adt->action= NULL;
+
+ /* adjust blending + extend so that they will behave correctly */
+ strip->extendmode= NLASTRIP_EXTEND_NOTHING;
+ strip->flag &= ~(NLASTRIP_FLAG_AUTO_BLENDS|NLASTRIP_FLAG_SELECT|NLASTRIP_FLAG_ACTIVE);
+
+ /* also, adjust the AnimData's action extend mode to be on
+ * 'nothing' so that previous result still play
+ */
+ adt->act_extendmode= NLASTRIP_EXTEND_NOTHING;
+ }
+ }
}
- break;
}
}
@@ -308,7 +359,7 @@ void recalcData(TransInfo *t)
flushTransSeq(t);
}
else if (t->spacetype == SPACE_ACTION) {
- Scene *scene;
+ Scene *scene= t->scene;
bAnimContext ac;
ListBase anim_data = {NULL, NULL};
@@ -319,7 +370,7 @@ void recalcData(TransInfo *t)
/* NOTE: sync this with the code in ANIM_animdata_get_context() */
memset(&ac, 0, sizeof(bAnimContext));
- scene= ac.scene= t->scene;
+ ac.scene= t->scene;
ac.obact= OBACT;
ac.sa= t->sa;
ac.ar= t->ar;
@@ -716,9 +767,10 @@ void recalcData(TransInfo *t)
* (i.e. uneditable animation values)
*/
// TODO: autokeyframe calls need some setting to specify to add samples (FPoints) instead of keyframes?
- // TODO: maybe the ob->adt check isn't really needed? makes it too difficult to use...
- if (/*(ob->adt) && */(t->animtimer) && IS_AUTOKEY_ON(t->scene)) {
+ if ((t->animtimer) && IS_AUTOKEY_ON(t->scene)) {
short targetless_ik= (t->flag & T_AUTOIK); // XXX this currently doesn't work, since flags aren't set yet!
+
+ animrecord_check_state(t->scene, &ob->id, t->animtimer);
autokeyframe_pose_cb_func(t->scene, (View3D *)t->view, ob, t->mode, targetless_ik);
}
@@ -746,8 +798,8 @@ void recalcData(TransInfo *t)
* (i.e. uneditable animation values)
*/
// TODO: autokeyframe calls need some setting to specify to add samples (FPoints) instead of keyframes?
- // TODO: maybe the ob->adt check isn't really needed? makes it too difficult to use...
- if (/*(ob->adt) && */(t->animtimer) && IS_AUTOKEY_ON(t->scene)) {
+ if ((t->animtimer) && IS_AUTOKEY_ON(t->scene)) {
+ animrecord_check_state(t->scene, &ob->id, t->animtimer);
autokeyframe_ob_cb_func(t->scene, (View3D *)t->view, ob, t->mode);
}
}
diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c
index ae8aacb3477..6bd0a8c8d42 100644
--- a/source/blender/editors/transform/transform_input.c
+++ b/source/blender/editors/transform/transform_input.c
@@ -317,7 +317,7 @@ int handleMouseInput(TransInfo *t, MouseInput *mi, wmEvent *event)
{
case LEFTSHIFTKEY:
case RIGHTSHIFTKEY:
- if (event->val)
+ if (event->val==KM_PRESS)
{
t->modifiers |= MOD_PRECISION;
/* shift is modifier for higher precision transform
diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c
index 4a27a7864b7..b999053bc1f 100644
--- a/source/blender/editors/transform/transform_manipulator.c
+++ b/source/blender/editors/transform/transform_manipulator.c
@@ -304,11 +304,10 @@ int calc_manipulator_stats(const bContext *C)
}
}
else if(obedit->type==OB_MBALL) {
- /* editmball.c */
- ListBase editelems= {NULL, NULL}; /* XXX */
+ MetaBall *mb = (MetaBall*)obedit->data;
MetaElem *ml, *ml_sel=NULL;
- ml= editelems.first;
+ ml= mb->editelems->first;
while(ml) {
if(ml->flag & SELECT) {
calc_tw_center(scene, &ml->x);