My situation is this: i want to move object certain amount of distance and remove it from the world. Natural fit seems attribute animations. This is what i got:
<?xml version="1.0"?>
<objectanimation>
<attributeanimation name="Position" interpolationmethod="Linear" wrapmode="Once" speed="1">
<keyframe time="0" type="Vector3" value="0 0 0" />
<keyframe time="1" type="Vector3" value="0 15 0" />
<eventframe time="1" eventtype="1" />
</attributeanimation>
</objectanimation>
To see if animation is finished i decided to use “eventframe” (undocumented feature it seems).
Q1: Why eventtype is uint? ( github.com/urho3d/Urho3D/blob/m … n.cpp#L123 ). It ends up converted to StringHash. Would it not be better to allow string types so they have more meaningful names? I could make PR changing it to string, but it is not backwards-compatible so need developer blessing on this one. Ofc it can be made backwards-compatible with ugly hack of converting numeric strings to integers before generating StringHash but its ugly.
Q2: Can we modify scene graph from “eventframe” event? I want to remove node from scene graph when animation is done.
animation->SubscribeToEvent(StringHash(1), URHO3D_HANDLER(MyObj, OnPickupAnimationEnd));
...
void MyObj::OnPickupAnimationEnd(StringHash eventType, VariantMap& eventData)
{
node_->Remove();
}
Thing is it causes crash somewhere within attribute animation code at a later time so i guess modifying scene graph is not permitted at that time. Still need clarification.
Q3: Is there a way to “queue” some events to certain step? So we can send events at any time and be sure they are executed during E_SCENEUPDATE step for example. I have not seen such functionality while checking out source code. Maybe this is worthy feature request? Or maybe there is another solution to this problem?