THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 17/04/2005 at 04:42, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 9.1 Demo
Platform: Windows ;
Language(s) : C++ ;
---------
Hello...
I have a problem with the AutoAddSequence method. I want to check if there is still a sequence. If not, the program should add a sequence to the track. I use the CreateKey method which I have found in the MorphMixer.cpp example. Now, in some cases, this method returns NULL because no sequence could be added.
See this:
static AnimValue* CreateKey(BaseDocument *doc, BaseObject *op, const BaseTime &time;, LONG index, LONG sid, Real value)
{
// check if track exists
BaseTrack *track = op->FindTrack(DescID(DescLevel(index), DescLevel(sid, DTYPE_REAL,0)));
if (!track)
{
track = AllocValueTrack(op,DescID(DescLevel(index), DescLevel(sid, DTYPE_REAL,0))); if (!track) {return NULL;}
op->InsertTrackLast(track);
}
// check for sequence
BaseSequence *seq=NULL;
for (seq = track->GetFirstSequence(); seq; seq=seq->GetNext())
if (time>=seq->GetT1() && time<=seq->GetT2())
break;
if (!seq)
{
seq = track->AutoAddSequence(doc,time);
if (!seq) {/*MessageDialog("no seq" + RealToString(time.Get()));*/return NULL;}
}
BaseKey *key = BaseKey::Alloc(seq->GetType()); if (!key) {return NULL;}
AnimValue *av = GetKeyValue(key); if (!av) {return NULL;}
av->value = value;
key->SetTime(time);
seq->InsertKey(key);
return av;
}
Why doesn't AutoAddSequence() work? Why isn't a sequence added?
Can you help me?
Regards,
jacqui.