add keyframe
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 09/10/2007 at 10:07, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 10
Platform: Windows ;
Language(s) : C.O.F.F.E.E ;---------
Hi.
I searched forum and other places to figure out how to add keyframe to not animated object, but i still don't understand.
For example i need to create cube and set key on "visible in editor" on frame number 10. how can i do that with COFFEE?
I tried "obj->SetRenderMode(MODE_off);" with "auto keing" on. but it doesn't work just as other methods.
I also can't add user data. Awww -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 09/10/2007 at 10:52, xxxxxxxx wrote:
You cannot create keys with COFFEE. Is that simple enough?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 09/10/2007 at 23:55, xxxxxxxx wrote:
As Robert said it's currently not possible to create keys with COFFEE. The BaseTrack, BaseSequence and BaseKey classes are not working since Cinema 4D R10.
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/10/2007 at 03:56, xxxxxxxx wrote:
Thanks for reply. I'll have to study C++ SDK.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/10/2007 at 14:53, xxxxxxxx wrote:
ok I almost finished my plugin but i still can't set key in C++. I saw MorphMixer example but I don't understand.
What would be the minimum amount of code needed to say... set key on "visible in editor" on frame number 10.
I wish where was something like:
SetKey( object, parameter, value, time); -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/10/2007 at 16:49, xxxxxxxx wrote:
Don't we all!
Here's my standard fare which is pretty close:
_//*---------------------------------------------------------------------------*
Bool SetKey(BaseDocument* doc, const BaseTime & insert, BaseObject* base, const DescID& descID, Real value)
//*---------------------------------------------------------------------------*
{
// *** TRACK ***
CTrack* track = base->FindCTrack(descID);
// There is no track
if (!track)
{
track = CTrack::Alloc(base, descID);
if (!track)
{
MessageDialog("Error! SetKey.track");
return FALSE;
}
base->InsertTrackSorted(track);
doc->AddUndo(UNDO_NEW, track);
}
doc->AddUndo(UNDO_CHANGE, track);// *** SEQUENCE ***
// Continually update document's time frame to fit animation
// - This fixes issues with Timeline extending that differs from document min/max
if (doc->GetMinTime() > insert) doc->SetMinTime(insert);
else if (doc->GetMaxTime() < insert) doc->SetMaxTime(insert);
CCurve* seq = track->GetCurve();
// - This should never happen in R10+
if (!seq)
{
MessageDialog("Error! SetKey.seq");
return FALSE;
}// *** KEY ***
// Create and Set keyframes
CKey* key = seq->FindKey(insert);
if (key)
{
// Undo before changing data
doc->AddUndo(UNDO_CHANGE, key);
key->SetValue(seq, value);
// Interpolation was already set (? - see below)
}
// Add Key if none exists on seq for frameTime
else
{
key = CKey::Alloc();
key = seq->AddKey(insert);
if (!key)
{
MessageDialog("Error! SetKey.key");
return FALSE;
}
doc->AddUndo(UNDO_NEW, key);
doc->AddUndo(UNDO_CHANGE, key);
key->SetValue(seq, value);
// Set key interpolation
key->SetInterpolation(seq, CINTER_SPLINE);
key->SetParameter(DescID(ID_CKEY_AUTO), GeData(TRUE), 0L);
}
// Update Editor
track->AnimateTrack(doc, base, insert, ANIMATE_NO_CHILDS, NULL);
return TRUE;
}_The difficult part here is the DescID descID. This is the id that binds the track/key to the parameter.
You'll need to get used to finding things in the Resource/res/description folder. If you look in the Obase.res file, you'll find this line:
LONG ID_BASEOBJECT_VISIBILITY_EDITOR { CYCLE { OBJECT_UNDEF; OBJECT_ON; OBJECT_OFF; } }
This will need to be passed as something like this in the above 'const DescID & descID' argument of the SetKey method:
DescID(DescLevel(ID_BASEOBJECT_VISIBILITY_EDITOR,DTYPE_LONG,0))
And the 'value' argument will be one of the three choices : OBJECT_UNDEF, OBJECT_ON, or OBJECT_OFF.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/10/2007 at 18:22, xxxxxxxx wrote:
thanks. it almost works
> CTrack *track = CTrack::Alloc(op,DescLevel(ID_BASEOBJECT_VISIBILITY_EDITOR));
>
> op->InsertTrackSorted(track);
>
> CCurve *seq = track->GetCurve();
>
> CKey *key = seq->AddKey(BaseTime(1));
>
> key->SetValue(seq,OBJECT_OFF);
>
> key->SetInterpolation(seq, CINTER_LINEAR);
>
> track->AnimateTrack(doc, op, BaseTime(1), ANIMATE_NO_CHILDS, 0);
>
> op->Message(MSG_UPDATE);
The key is there. It's interpolation is correct but it's value is set incorrect and no animation, no green or red dot.
What i get is:
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/10/2007 at 21:05, xxxxxxxx wrote:
Having not tested this particular key type directly, there might need to be some adjustments. First, the most obvious interpolation might be CINTER_STEP since the value can only be one of the three values (integers) even though the key takes Real values.
I'll test it out to see what works and then see if it works in code.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/10/2007 at 21:10, xxxxxxxx wrote:
Okay. two things to consider:
1. You MUST set an initial key (at the minimum frame) or the value is held before the first non-minimum frame key. One key is not enough for animation - you need at least two.
2. The DTYPE_LONG may be required here, that is, the full DescID. Check your Timeline and verify that the track shows as "Visible in Editor" (and not "?" or something).
It appears that linear works just fine as it will only switch values at integral ones.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 16/10/2007 at 01:26, xxxxxxxx wrote:
Here is how to set the visibility tracks/keys. You should use SetGeData() for setting LONG keys.
> _
> CTrack *track = op- >FindCTrack(DescLevel(ID_BASEOBJECT_VISIBILITY_EDITOR,DTYPE_LONG,0));
> if (!track)
> {
> track = CTrack::Alloc(op,DescLevel(ID_BASEOBJECT_VISIBILITY_EDITOR,DTYPE_LONG,0)); if (!track) return FALSE;
> op->InsertTrackSorted(track);
> }
>
> BaseTime time(10,doc->GetFps());
> CCurve *curve = track->GetCurve();
> CKey *key = curve->AddKey(time); if (!key) return FALSE;
> key->SetInterpolation(curve, CINTER_LINEAR);
> GeData d(OBJECT_ON);
> key->SetGeData(curve,d);
>
> op->Message(MSG_UPDATE);
> EventAdd(EVENT_ANIMATE);
> _The value IDs for the visibility are:
OBJECT_UNDEF
OBJECT_ON
OBJECT_OFFYou should use IDs whenever possible to make your plugin future proof.
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 16/10/2007 at 03:46, xxxxxxxx wrote:
YES. it works!!!
Thanks alot -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 16/10/2007 at 09:14, xxxxxxxx wrote:
Aha! Now we both know.