Crystal Space
Welcome, Guest. Please login or register.
October 23, 2014, 05:11:03 am

Login with username, password and session length
Search:     Advanced search
9010 Posts in 2044 Topics by 8797 Members
Latest Member: Pamelaboone
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Project Development
| |-+  Feature Requests
| | |-+  SprCal3d plugin animation handling
« previous next »
Pages: [1] Print
Author Topic: SprCal3d plugin animation handling  (Read 4783 times)
narron
Newbie
*
Posts: 4


View Profile
« on: October 05, 2005, 11:57:20 am »

Granted, I'm not sure where this is better situated. It is more a feature request for an existing plugin.

Enough forewords, here it comes:

Playing around with SprCal3D I found it quite suitable for my character animation needs, but there is just one thing that is present in the Cal3D library which is passed on quite inadequately in the CrystalSpace SprCal3D plugin.

When using cal3dstate->SetAnimAction(action_name,blend_in,blend_out); where anim_name describes an animation with the "lock" state set (meaning the animation gets stopped at the last frame and won't be faded out) you can't get rid of the animation with any other means than calling sprcal3d->ClearAllAnims(); .

As a quick patch I did what is described in the following diff:
Code:
--- sprcal3d.cpp.orig   2005-10-05 12:14:32.000000000 +0200
+++ sprcal3d.cpp        2005-10-05 12:15:49.000000000 +0200
@@ -1756,6 +1756,14 @@
 bool csSpriteCal3DMeshObject::SetAnimAction(int idx, float delayIn,
                                                float delayOut)
 {
+  if (idx == -1 && last_locked_anim != -1)
+  {
+     calModel.getMixer()->removeAction(last_locked_anim);
+     last_locked_anim = -1;
+     is_idling = false;
+     return true;
+  }
+
   if (idx < 0 || (size_t)idx >=factory->anims.Length() )
     return false;


To be short, it adds the option to do a cal3dsprite->SetAnimAction(-1,0.0,0.0); to remove the previosly set "locked" anim, though it is lacking any handling when there is more than one locked animation active (as it is with ClearAllAnims() as well).

Hope it helps.
Logged
sunshine
Administrator
Sr. Member
*****
Posts: 294


View Profile
« Reply #1 on: October 06, 2005, 11:44:42 am »

I asked the author of sprcal3d about this, and he admitted that this feature of sprcal3d could stand improvement. He was curious, though, about a real-world game scenarios in which you would multiple locked animations being blended with non-locked animations.

I myself am not especially familiar with sprcal3d usage, but wouldn't it make more sense to introduce specific API into iSpriteCal3DState than to overload the meaning of SetAnimAction() in this fashion? Adding the ability to send -1 to SetAnimAction() seems unintuitive. A more explicit API might be better.
Logged
narron
Newbie
*
Posts: 4


View Profile
« Reply #2 on: October 06, 2005, 06:58:07 pm »

Of course, of course, that was more or less a hack to see if it would set things right... Some function like "StopAnimAction(cost char *name)" to (prematurely) stop the action animation being played.

One scenario for multiple locked animations would be to mix an animation of "sitting down" together with "reading something". Sitting just affects everything from the waitline down (pelvis and legs), reading manages the positioning of the arms. Combining both would result in a figure sitting somewhere at a table and reading.

Another tack is to reduce the idle animation simply to breathing or suchlike - and let the handling of certain "waiting" animations (like shuffling the feet or scratching oneself) being done by the surrounding game engine - in most cases it has its own ideas of how the creatures pass their time. Then, state animations may be done like "sitting_down" (letting the creature sit down and leave it at that, with locked=1) and "stop_sitting_down" (for gracefully standing up) or suchlike.

Next, one may blend a locked action animation into the figure to have it look a certain direction - have two animations like "head_turn_left" and "head_turn_right" where the head is turned 90 degrees to the left or right, respectively - and use the weight to adjust the actual angle. Using the delay values one can leave it to the animation subsystem to have the head turned in a graceful manner.

Hmmmnnn.... That warrants for another class of animations, let's call them "state animations", which may consist of a pair of one locked animation (transition from default to changed state) and one non-locked animation (transition back to default) with some function like "SetAnimState(char *state, bool ison, float delay)" to transform the figure into a given state (like sitting down, lying on a floor or such) and back to normal. Perhaps together with a blend weight...

Definitely need to think about that further.
« Last Edit: October 06, 2005, 07:32:44 pm by narron » Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 6.151 seconds with 17 queries.