Chris Robinson
abc676eedd
Allow specifying which bone groups to play an animation on
2013-05-10 20:05:09 -07:00
Chris Robinson
56eede2610
Search more aggressively for an animation velocity
2013-05-10 19:31:33 -07:00
Chris Robinson
5a9c1e1245
Don't explicitly track the last position
2013-05-10 18:58:14 -07:00
Chris Robinson
7c3b014193
Figure out which animations to play based on priority
...
Bone group will also be taken into account later.
2013-05-10 18:37:44 -07:00
Chris Robinson
921f534980
Parameterize the number of bone groups
2013-05-10 16:35:43 -07:00
Chris Robinson
8a9b0eb5f7
Store the AnimSource in the animation state
2013-05-10 15:27:29 -07:00
Chris Robinson
58efce5008
Rename animation layers to animation states
2013-05-10 04:01:30 -07:00
Chris Robinson
ccff364b52
Use a map of active layers instead of an array
...
A bit of an upheaval. Each animation is now a "layer", instead of each layer
having an animation. Incidentally, this is much closer to how Ogre handles
animation states.
In the future, each layer will have a priority, which will be used to determine
which one affects a given bone group (which we currently only have one of).
2013-05-10 03:08:07 -07:00
Chris Robinson
d5490b0f8f
Fix an outdated comment
2013-05-09 23:07:50 -07:00
Chris Robinson
8e38dc410f
Allow loading multiple animation sources
...
Animation sources are treated differently from base objects. When given
"path\file.nif", base objects will look for "path\xfile.nif" and use that
if it exists (falling back to the original name if not found). Animation
sources will instead use "path\xfile.kf", ignoring it if the file doesn't
exist.
2013-05-07 16:59:32 -07:00
Chris Robinson
e85bc8b2cd
Only load one Nif for Animation objects
...
This breaks quite a bit, but it's needed for the transition to using the
.kf files.
2013-05-06 23:11:26 -07:00
Chris Robinson
6a3ba41170
Don't store camera nodes, we don't need them.
2013-05-06 21:46:11 -07:00
Chris Robinson
4b15da076b
Move getStateInfo into the character controller
2013-04-30 19:26:41 -07:00
gus
766d1efa84
Render weapon and shield. Only shield can be seen right now as weapons need to be drawed out.
2013-04-28 11:41:01 +01:00
Chris Robinson
9a2a32f2a5
Add a method to clear all Animation sources except the first
...
The first needs to remain, since that's where any mSkelBase entity comes from,
and where any retrieved nodes are from.
2013-04-25 05:02:11 -07:00
Chris Robinson
9be20b90f1
Fix potential infinite loop when layer 0 is empty
2013-04-25 03:35:40 -07:00
Chris Robinson
86fda1bff6
Only set mSkelBase from the first objectlist
2013-04-25 00:52:26 -07:00
Chris Robinson
7eac37be23
Make sure the old layer is cleared before starting the next
2013-04-25 00:18:02 -07:00
Chris Robinson
09fc50948b
Add methods to disable and get info for a layer
2013-04-25 00:08:16 -07:00
Chris Robinson
24f1eba902
Keep track of whether an animation supplies movement
...
Also handle it when it doesn't.
2013-04-24 22:45:43 -07:00
Chris Robinson
0817d59f23
Allow specifying where to start in an animation
2013-04-24 19:09:36 -07:00
Chris Robinson
333354fe62
Remove the character controller from the Animation class
2013-04-24 07:10:41 -07:00
Chris Robinson
b80891099e
Don't use the character controller to handle text keys
...
The Animation class has the Ptr and can call to whatever subsystem is needed.
2013-04-24 06:48:34 -07:00
Chris Robinson
e8cabc9434
Pass the loop count from loopgroup to the play method
...
Instead of queueing each iteration separately.
2013-04-24 06:32:11 -07:00
Chris Robinson
c58dfbe921
Specify the loop count to Animation::play
2013-04-24 04:56:39 -07:00
Chris Robinson
7241267d5c
Make an AnimationValue for each animation layer
2013-04-24 04:41:52 -07:00
Chris Robinson
102b3bdef9
Update position by reference
2013-04-24 01:57:51 -07:00
Chris Robinson
9e05ee53da
Avoid looking for the controller if there is no NonAccum node
...
Also, make sure there is a controller before updating the position.
2013-04-24 01:18:08 -07:00
Chris Robinson
544011e096
Fix 'start' text key fallback lookup
2013-04-24 00:40:58 -07:00
Chris Robinson
7e2995bc2f
Fix setting up active controllers
2013-04-23 19:43:26 -07:00
Chris Robinson
8c9e2e0ee9
Improve handling of reaching the stop animation text key
2013-04-23 05:34:08 -07:00
Chris Robinson
c4806f01f8
Use a separate list of controllers to update
...
This should make it easier to figure out what controllers need to be updated
for various animation sources and layers.
2013-04-23 04:08:09 -07:00
Chris Robinson
e4c5aac966
Keep track of the animation layers a given object list is animating on
...
This only tracks layers they explicitly animate on. They may animate on other
layers as well, if nothing else is animating on them.
2013-04-23 02:48:11 -07:00
Chris Robinson
e378176937
Don't update controllers that have already been updated
2013-04-23 00:15:31 -07:00
Chris Robinson
8782ae6976
Separate some Animation fields into a separate AnimLayer class
2013-04-22 23:52:28 -07:00
Chris Robinson
c3ce49798a
Fix animation velocity calculation
2013-04-22 21:34:39 -07:00
Chris Robinson
7279e015e9
Search the textkeys to check if an animation group exists
2013-04-22 20:59:55 -07:00
Chris Robinson
a2fc43c7df
Use reset to check that the animation exists and has the right markers
2013-04-22 20:41:54 -07:00
Chris Robinson
bb64efc18e
Improve looping behavior
2013-04-22 05:08:52 -07:00
Chris Robinson
cc70c6263b
Use the NodeTargetValue for the NonAccum root
2013-04-22 04:10:46 -07:00
Chris Robinson
9485a4aa6d
Look through the whole animation stack to find the "velocity"
2013-04-22 01:40:41 -07:00
Chris Robinson
a7776e124c
Only set mNonAccumRoot from mSkelBase
2013-04-22 00:22:31 -07:00
Chris Robinson
a3511c62cf
Don't store textkeys in user object bindings
...
It's a bit unwieldy to have them stored in the 'skeleton master' instead
of the skeleton instance. And although the text keys are extracted for
each created instance now, this shouldn't be much worse than the
multimap copying going on before.
Plus, proper serialization can help for future optimizations.
2013-04-22 00:01:30 -07:00
Chris Robinson
2345b5e8b3
Avoid storing text keys for each animation
2013-04-21 22:56:40 -07:00
Chris Robinson
7d59340ed6
Don't clip out the group name from the textkeys
2013-04-21 22:13:49 -07:00
Chris Robinson
6c85d6763a
Pass "loop stop" to the character controller
2013-04-21 18:38:25 -07:00
Chris Robinson
d7c9df16f8
Store the current animation group
2013-04-21 18:32:34 -07:00
Chris Robinson
835ff8eb1e
Avoid creating an AnimationValue per ObjectList
2013-04-20 17:13:27 -07:00
Chris Robinson
50bb92beb3
Use a method to set the visibility flags and render queue.
2013-04-19 02:01:50 -07:00
Chris Robinson
4ce98e9bd6
Store iterators for start and stop keys
2013-04-15 20:37:10 -07:00
Chris Robinson
1b1f9f7921
Allow multiple ObjectLists to be created for Animations.
...
addObjectList may not currently be called outside of the related constructor.
2013-04-15 18:55:28 -07:00
Chris Robinson
69084139aa
Use an array of objectlists, instead of one base objectlist and an array of 'animation sources'
2013-04-14 17:58:21 -07:00
Chris Robinson
f9dee25fd1
Store the base skeleton entity in MWRender::Animation
2013-04-14 16:56:35 -07:00
Chris Robinson
a700c50e84
Add a first-person view mode to NpcAnimation
...
And use it instead of showing/hiding the player.
2013-04-09 15:10:14 -07:00
Chris Robinson
08d43fe217
Make the getHeadNode method more general
2013-04-08 05:48:52 -07:00
Chris Robinson
7baca30a1d
Only get the non-accum root's keyframe when updating positions
...
The actual animation pose is now handled by the controllers, based on the
current animation time.
2013-04-07 16:21:45 -07:00
Chris Robinson
261ea1fe5e
Implement a KeyframeController
2013-04-07 14:56:23 -07:00
Chris Robinson
f69a8259e1
Update animation source controller targets
2013-04-07 13:51:04 -07:00
Chris Robinson
2362e920f3
Use an unconnected object list for animation sources
...
We'll want the controllers, as the plan is to use their keyframe controllers
to animate the actual skeleton used for the meshes.
2013-04-07 12:41:27 -07:00
Chris Robinson
80a1abd48a
Clear the old text keys when setting new animation sources
2013-04-07 11:09:55 -07:00
Chris Robinson
be419bc891
Handle NiCamera nodes
2013-04-07 02:28:15 -07:00
Chris Robinson
2db72ae607
Rename EntityList to ObjectList
2013-04-07 01:52:35 -07:00
Chris Robinson
59f1d4b047
Add support for NiUVController on meshes
2013-04-06 09:44:10 -07:00
Chris Robinson
0631b28646
Prepare for supporting controller objects
2013-04-05 10:13:54 -07:00
Chris Robinson
af2a38db38
Fix looping anims that dont have "loop start"
2013-04-05 08:27:26 -07:00
Chris Robinson
77ba0fbe73
Prepare for creating particles
...
This adds a vector of ParticleSystems to the EntityList, and modifies
corresponding code to handle it. It also loads the ParticleFX plugin so
particles can be created (although they aren't yet).
2013-04-04 05:10:52 -07:00
Chris Robinson
bfe80bb8dc
Avoid duplicating skeletons due to casing issues
...
Manually created resource names are apparently always case sensitive, causing
some skeletons to get loaded multiple times.
2013-02-27 12:33:36 -08:00
Chris Robinson
8e59ea4941
Use a separate method to handle animation events
2013-02-23 14:39:01 -08:00
Chris Robinson
d77d035d3a
Handle the "sound" events in runAnimation
2013-02-23 14:15:11 -08:00
Chris Robinson
d208422ca7
Add a method to update an Animation's Ptr object
2013-02-23 10:12:36 -08:00
Chris Robinson
0d0e75fe0b
Don't set animation sources for models that don't have a skeleton
2013-02-23 07:36:11 -08:00
Chris Robinson
e6da9dfae5
Specify the animation key to stop playing at
2013-02-23 05:15:10 -08:00
Chris Robinson
b8f5813609
Set all animation sources at once
2013-02-23 03:34:03 -08:00
Chris Robinson
9dee2a72cd
Use a separate method to calculate animation velocity
2013-02-22 09:22:06 -08:00
Chris Robinson
617158afcd
Ensure updated skeleton bone placement matches in world space
...
Objects attached to actors (shirts, robes, etc) do not require the same node
hierarchy as the character root. So to ensure proper placement, we need to set
the bone target's derived transformation using the source bone's derived
transformation (which in turn means we need to work up from the root, to ensure
the bone's parents are properly placed).
2013-02-20 02:41:46 -08:00
Chris Robinson
8196694c08
Avoid applying the animation when resetting it
2013-02-19 06:04:25 -08:00
Chris Robinson
f8349a04bf
Use the looping portion of the animation to calculate the velocity
2013-02-19 05:26:58 -08:00
Chris Robinson
1399a06c76
Update animation looping when setting the same state
2013-02-19 04:01:33 -08:00
Chris Robinson
ff0099fa6e
Scale the animation speed based on the animation velocity and movement speed
...
This may not be totoally correct since it takes the whole animation into
account, rather than just the looping portion. But it's good enough for now.
2013-02-15 02:15:39 -08:00
Chris Robinson
4ee5857bae
Filter accumulation axis for mLastPosition as needed
2013-02-09 19:09:56 -08:00
Chris Robinson
8d6f017f17
Remove an unneeded Animation field
2013-02-09 13:25:39 -08:00
Chris Robinson
18b7008409
Better fix some scaling issues
2013-02-05 18:25:09 -08:00
Chris Robinson
8b1e7b95ba
Attempt to load the skeleton source if it doesn't yet exist
2013-02-05 17:55:12 -08:00
Chris Robinson
054ef3113a
Check existing skeleton sources if the current one has no animation root
2013-02-05 17:15:40 -08:00
Chris Robinson
16933e3926
Scale the accumulation root translation
2013-02-05 16:59:20 -08:00
Chris Robinson
600fe06f00
Use a vector of skeletons to handle animation sources
2013-02-05 16:29:51 -08:00
Chris Robinson
23acf4b130
Don't break right away when the animation time remaining is 0
2013-02-03 01:38:42 -08:00
Chris Robinson
fc7590694d
Revert "Revert "Use a child scene node for the accumulation root""
...
This reverts commit 376dfed15b
.
I was wrong. It's needed at least for NPCs since they're attaching multiple
animated skeletons to an object, and they all need to be offset correctly.
Would be nice to use a Node, Bone, or TagPoint instead of a hefty SceneNode,
though.
2013-02-02 05:43:37 -08:00
Chris Robinson
376dfed15b
Revert "Use a child scene node for the accumulation root"
...
This reverts commit d6f923f274
.
We don't need it for any of the NIFs we're currently handling. As long as
there's no NIF files that would break it, we should require a stationary root
if an animation wants to accumulate. If we must, a better idea may be to inject
an extra bone into the skeleton instance and make that the accumulation root.
2013-02-01 08:50:32 -08:00
Chris Robinson
d6f923f274
Use a child scene node for the accumulation root
2013-01-30 22:28:18 -08:00
Chris Robinson
b6354c6282
Don't share skeleton instances between bounded parts on an NPC
...
However, a skeleton instance will still be shared between entities in an entity
list.
2013-01-30 09:29:16 -08:00
Chris Robinson
5c3a7f7d52
Avoid handling animation states
...
We don't need them anymore
2013-01-30 07:34:07 -08:00
Chris Robinson
360f7bfac8
Apply animations to bones manually
...
Couple reasons for this:
* This paves the way for allowing animations specified in other skeletons to
be applied to the character (NPCs and certain creatures can have multiple
animation sources, but Ogre is incredibly strict when it comes to sharing
animations between skeletons).
* It will allow for entities to be animated based on the character's skeleton,
without having to duplicate the mesh for each skeleton it can be used on.
This doesn't impact Ogre's ability to efficiently deform skinned meshes, nor
does it get in the way of hardware skinning.
2013-01-30 07:04:18 -08:00
Chris Robinson
99efe4e494
Remove an unnecessary class member
2013-01-29 01:02:55 -08:00
Chris Robinson
879359f39d
Set the animation state loop flag as appropriate
2013-01-29 00:50:52 -08:00
Chris Robinson
92d0c55f32
Add a flag to specify if an animation should be playing
2013-01-29 00:43:42 -08:00
Chris Robinson
7df4d0d19f
Remove an unnecessary cast
2013-01-28 21:41:51 -08:00
Chris Robinson
b1ffdf855f
Reset the initial state of animated nodes on the skeleton instances
...
This is so the animation specifies node keyframe data based on the node's
parent. This will also be necessary for applying animations from different
skeleton sources, as they can have different binding positions (even native
.skeleton resources will need to specify animation data this way).
2013-01-26 04:48:53 -08:00
Chris Robinson
05f8b8c283
Specify the text key to reset animations to
2013-01-22 00:31:45 -08:00
Chris Robinson
37fe1bd3f0
Handle looping in the Animation object
2013-01-21 22:51:13 -08:00
Chris Robinson
536f8104e6
Do not create an 'all' animation.
2013-01-20 17:24:43 -08:00
Chris Robinson
e1e76bde76
Combine a loop into another where it's used
2013-01-20 15:39:43 -08:00
Chris Robinson
85ca1e993f
Properly check if an animation exists before playing it
2013-01-19 21:55:04 -08:00
Chris Robinson
0b68953f0d
Scale animation speed using the direction length
...
The direction length doesn't currently give a good speed, but it's something.
2013-01-18 21:40:47 -08:00
Chris Robinson
1cdd64cd9b
Return the animation movement from the character controller.
...
Consequently, dead actors don't move anymore. The doPhysics call apparently
isn't moving them.
2013-01-18 17:05:58 -08:00
Chris Robinson
9123f4f2af
Return the movement vector from runAnimation
2013-01-18 16:21:29 -08:00
Chris Robinson
c7684cb979
Pass the key time to markerEvent
2013-01-18 14:50:55 -08:00
Chris Robinson
3e9b0a333c
Allow specifying the accumulation for animations
...
Animations that move a character may do so either visually or physically. An
axis' accumuluation value specifies whether the movement is visual (0) or
physical (1). Idle animations, for instance, typically don't physically move a
character, while death animations may physically move them along the X and Y
planes, but not along Z (the vertical movement is purely visual).
2013-01-18 14:25:32 -08:00
Chris Robinson
fef6284f15
Only reset the animation time if a new state was set
2013-01-17 15:47:25 -08:00
Chris Robinson
fc0f9e2159
The animation state tracks the animation time for us
2013-01-17 14:49:42 -08:00
Chris Robinson
7cce44290e
Handle the animation queue in mwmechanics
2013-01-17 13:18:40 -08:00
Chris Robinson
82d549e22f
Don't update the animation if time is the same
2013-01-16 21:39:14 -08:00
Chris Robinson
7ee389f3b2
Handle animation skipping in the character controller
2013-01-16 21:25:50 -08:00
Chris Robinson
852aa214cc
Store the available animation names in the character controller
2013-01-16 21:16:22 -08:00
Chris Robinson
4dd01b81c6
Update mTime when updating or reseting the animation, and refactor the animation loop
2013-01-16 20:14:49 -08:00
Chris Robinson
3c32385e17
Avoid trying to animate things that don't have animations
2013-01-16 15:00:06 -08:00
Chris Robinson
94b93227d3
Treat activators as actors for rendering and mechanics
...
Kinda hacky, but it's the only way to get animated activators (flags, silt
striders, etc) to work properly.
2013-01-16 14:37:32 -08:00
Chris Robinson
d2fc3c7b33
Add a method to tell the character controller of new text keys
2013-01-16 13:09:21 -08:00
Chris Robinson
0a2f92f679
Keep track of the current text key in the animation
2013-01-16 11:57:08 -08:00
Chris Robinson
f46587c383
Store an character controller in the animation
2013-01-16 11:01:08 -08:00
Chris Robinson
c4c8295e0b
Rename NIFLoader to Loader, and update some comments
2013-01-09 09:10:59 -08:00
Chris Robinson
1e38e381a4
Use text keys for each animation
2013-01-09 03:30:55 -08:00
Chris Robinson
bb98542c5a
Build separate animations for each group
2013-01-09 01:40:38 -08:00
Chris Robinson
e44729cd43
Make the text keys lower-case when extracting them
...
I think it's safe to assume all text keys are treated in a case-insensitive
manner. So far the only known NiTextKeyExtraData records are for animation
keys, which effectively are.
2013-01-09 00:17:42 -08:00
Chris Robinson
2a9dc5ad94
Ensure mCurGroup always has valid iterators, and only get the animation state when animation keys exist
2013-01-07 21:00:21 -08:00
Chris Robinson
d8dbd5e206
Store text key iterators for the start and stop times
2013-01-07 05:56:03 -08:00
Chris Robinson
d3e949f5c6
Make the animation text keys lower case to help lookup
2013-01-07 05:23:44 -08:00
Chris Robinson
5f668976a8
Improve resetting the animation position
2013-01-07 04:48:59 -08:00
Chris Robinson
648e3331f5
Don't try to move objects that aren't in a cell
2013-01-06 23:20:20 -08:00
Chris Robinson
5b3a20ef69
Update the object position as the animation moves
2013-01-06 21:18:48 -08:00
Chris Robinson
910619eb21
Store the NonAccum animation root from the skeleton instance
...
Currently this is assumed to be the node with the animation text keys.
2013-01-06 17:31:53 -08:00
Chris Robinson
b96a979719
Store an MWWorld::Ptr with the Animation
2013-01-06 17:05:48 -08:00
Chris Robinson
58d35dbfcf
Have createEntities' caller retrieve the text keys as needed
2013-01-05 04:01:11 -08:00
Chris Robinson
818a24cdd6
Hold on to the AnimationState being used for animating
2013-01-05 00:03:14 -08:00
Chris Robinson
6e84d4bcdd
Add a helper method to load entity objects
2013-01-04 23:19:48 -08:00
greye
50867e8d87
fix gender selection update, main model visibility and couple of crashes
2012-11-10 19:57:50 +04:00
Chris Robinson
41f80908d9
Simplify getting the stop time when playing all animation groups
2012-09-29 01:10:49 -07:00
Chris Robinson
cd8515396a
Use a multimap to store the text keys
2012-09-28 23:20:15 -07:00
scrawl
2793096b50
Merge branch 'externalrendering' of https://github.com/zinnschlag/openmw into characterpreview
...
Conflicts:
apps/openmw/CMakeLists.txt
apps/openmw/mwbase/world.hpp
apps/openmw/mwrender/renderingmanager.cpp
apps/openmw/mwrender/renderingmanager.hpp
apps/openmw/mwworld/worldimp.cpp
apps/openmw/mwworld/worldimp.hpp
2012-09-15 00:57:29 +02:00
Chris Robinson
9f0c1eeb7b
Support playgroup mode 0
2012-07-24 14:54:12 -07:00
Chris Robinson
13ab2baef0
Use a struct to hold the current animation times and remaining loop count
2012-07-24 14:42:01 -07:00
Chris Robinson
fd1e3f6ec5
Add support for playgroup mode 2
2012-07-24 14:14:32 -07:00
Chris Robinson
20121f3b0a
Remove some unused stuff
2012-07-24 13:56:28 -07:00
Chris Robinson
9a7a629d0f
Add support for playing animation groups
2012-07-24 13:51:48 -07:00
Chris Robinson
77446a0d58
Fix skipAnim, only skip one animation update
2012-07-21 17:39:57 -07:00
Chris Robinson
81ce8dbe12
Combine animation handling into the base class
2012-07-21 14:41:26 -07:00
Chris Robinson
2db80a1504
Rename a couple methods to match their scripting counterparts
2012-07-20 00:53:12 -07:00
Chris Robinson
66860825cf
Remove some unused and unneeded bits from the Animation class
2012-07-20 00:36:52 -07:00
Chris Robinson
02d39080c8
Destroy entities when they're done with.
2012-07-18 00:17:39 -07:00
Chris Robinson
0a4a141f2e
Support multiple meshes for creatures
2012-07-17 11:23:34 -07:00