<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.frictionalgames.com/page?action=history&amp;feed=atom&amp;title=HPL3%2FSOMA%2FModeling%2FImporting_Animations</id>
	<title>HPL3/SOMA/Modeling/Importing Animations - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.frictionalgames.com/page?action=history&amp;feed=atom&amp;title=HPL3%2FSOMA%2FModeling%2FImporting_Animations"/>
	<link rel="alternate" type="text/html" href="https://wiki.frictionalgames.com/page?title=HPL3/SOMA/Modeling/Importing_Animations&amp;action=history"/>
	<updated>2026-10-04T03:47:49Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.2</generator>
	<entry>
		<id>https://wiki.frictionalgames.com/page?title=HPL3/SOMA/Modeling/Importing_Animations&amp;diff=7334&amp;oldid=prev</id>
		<title>TiMan: Add a SOMA-file-verified animation import guide covering entity registration, caches, preview, events, transitions, script testing, and troubleshooting.</title>
		<link rel="alternate" type="text/html" href="https://wiki.frictionalgames.com/page?title=HPL3/SOMA/Modeling/Importing_Animations&amp;diff=7334&amp;oldid=prev"/>
		<updated>2026-10-02T17:16:49Z</updated>

		<summary type="html">&lt;p&gt;Add a SOMA-file-verified animation import guide covering entity registration, caches, preview, events, transitions, script testing, and troubleshooting.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;'''Importing an animation''' registers an exported animation source on a SOMA entity so the clip can be previewed and played by name.&lt;br /&gt;
&lt;br /&gt;
== Before importing ==&lt;br /&gt;
&lt;br /&gt;
Confirm that:&lt;br /&gt;
&lt;br /&gt;
* the entity already loads its intended animated mesh;&lt;br /&gt;
* the exported animation uses the mesh's node or bone names;&lt;br /&gt;
* the animation and mesh were exported with compatible scale and axis settings;&lt;br /&gt;
* the animation file is in a directory included by the mod's &amp;lt;code&amp;gt;resources.cfg&amp;lt;/code&amp;gt;; and&lt;br /&gt;
* the source file has a unique, stable path inside the mod.&lt;br /&gt;
&lt;br /&gt;
SOMA ships entity registrations that reference both &amp;lt;code&amp;gt;.dae_anim&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;.fbx&amp;lt;/code&amp;gt; sources. This establishes support for those installed assets, not compatibility with every exporter version. Verify the chosen exporter with a minimal clip before producing a full animation set.&lt;br /&gt;
&lt;br /&gt;
== Add a clip to an entity ==&lt;br /&gt;
&lt;br /&gt;
# Open the target &amp;lt;code&amp;gt;.ent&amp;lt;/code&amp;gt; file in &amp;lt;code&amp;gt;ModelEditor.exe&amp;lt;/code&amp;gt;.&lt;br /&gt;
# Enable '''Entity Preview''' from the lower toolbar.&lt;br /&gt;
# Open '''Edit Animations''' in the preview window.&lt;br /&gt;
# Choose '''Add new animation'''.&lt;br /&gt;
# Set a unique '''Name''' used by scripts and entity logic.&lt;br /&gt;
# Set '''File''' to the exported &amp;lt;code&amp;gt;.dae_anim&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;.fbx&amp;lt;/code&amp;gt; source.&lt;br /&gt;
# Use &amp;lt;code&amp;gt;Default&amp;lt;/code&amp;gt; for '''Layer''' unless the entity has a known layered setup.&lt;br /&gt;
# Begin with '''Speed''' set to &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;.&lt;br /&gt;
# Save the entity and select the new animation in the preview controls.&lt;br /&gt;
&lt;br /&gt;
The saved entity entry has this basic form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Animations&amp;gt;&lt;br /&gt;
    &amp;lt;Animation&lt;br /&gt;
        Name=&amp;quot;open&amp;quot;&lt;br /&gt;
        File=&amp;quot;entities/urban/toilet/shower_curtain/shower_curtain_open.fbx&amp;quot;&lt;br /&gt;
        Layer=&amp;quot;Default&amp;quot;&lt;br /&gt;
        Speed=&amp;quot;1&amp;quot;&lt;br /&gt;
    /&amp;gt;&lt;br /&gt;
&amp;lt;/Animations&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example is taken from SOMA's shipped &amp;lt;code&amp;gt;shower_curtain.ent&amp;lt;/code&amp;gt;. The animation's registered name is &amp;lt;code&amp;gt;open&amp;lt;/code&amp;gt;; scripts play that name, not the filename.&lt;br /&gt;
&lt;br /&gt;
== Understand source and cache files ==&lt;br /&gt;
&lt;br /&gt;
SOMA stores compiled animation data in &amp;lt;code&amp;gt;.anm&amp;lt;/code&amp;gt; files. After deduplicating the paths referenced by shipped entity animation registrations:&lt;br /&gt;
&lt;br /&gt;
* 939 non-empty source paths are registered;&lt;br /&gt;
* 879 corresponding source files are present in the installation;&lt;br /&gt;
* 866 of those present sources have a same-stem &amp;lt;code&amp;gt;.anm&amp;lt;/code&amp;gt; file;&lt;br /&gt;
* 785 of those pairs use &amp;lt;code&amp;gt;.dae_anim&amp;lt;/code&amp;gt; sources; and&lt;br /&gt;
* 81 use &amp;lt;code&amp;gt;.fbx&amp;lt;/code&amp;gt; sources.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ventilation_cluster_spin.dae_anim&lt;br /&gt;
ventilation_cluster_spin.anm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The source is the file registered on the entity. Treat &amp;lt;code&amp;gt;.anm&amp;lt;/code&amp;gt; as generated engine data. When replacing a source animation, reload the entity and verify that the cache was refreshed rather than editing the cache manually.&lt;br /&gt;
&lt;br /&gt;
== Preview and validate ==&lt;br /&gt;
&lt;br /&gt;
Use Entity Preview to check:&lt;br /&gt;
&lt;br /&gt;
* whether the animation appears in the selector;&lt;br /&gt;
* whether it plays at the expected speed;&lt;br /&gt;
* whether looping behaves correctly;&lt;br /&gt;
* whether the skeleton moves without unexpected scaling or offsets;&lt;br /&gt;
* whether the first and last poses meet correctly for a loop; and&lt;br /&gt;
* whether physical bodies, sockets, and attached effects remain aligned.&lt;br /&gt;
&lt;br /&gt;
The preview window can display the skeleton and physical objects and provides play, loop, step, time, and timeline controls.&lt;br /&gt;
&lt;br /&gt;
SOMA's executable reports useful failures, including missing animation files, skeleton differences between the mesh and saved entity, vertices without a bone, vertices influenced by more than four bones, and missing transition animations.&lt;br /&gt;
&lt;br /&gt;
== Add events ==&lt;br /&gt;
&lt;br /&gt;
Events are added to the registered animation in the Model Editor, not baked into the exported source file. Each shipped event record stores a name, time, type, destination socket, and value.&lt;br /&gt;
&lt;br /&gt;
Available event types declared by SOMA include:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;PlaySound&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;CreateParticle&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;Step&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;Message&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;PlayLoopSound&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;StopLoopSound&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add an event at the intended timeline position, choose its type, and provide the resource or socket required by that type. Test it in preview and in-game. A valid animation can still have a failing event if its sound, particle system, or destination socket is missing.&lt;br /&gt;
&lt;br /&gt;
SOMA's &amp;lt;code&amp;gt;robot_arm_welding.ent&amp;lt;/code&amp;gt; demonstrates timed loop sounds, ordinary sounds, particles attached to sockets, and a stop-loop event on one animation.&lt;br /&gt;
&lt;br /&gt;
== Add transitions ==&lt;br /&gt;
&lt;br /&gt;
A transition registers a separate bridge clip to use when entering the selected animation from a previous animation.&lt;br /&gt;
&lt;br /&gt;
# Register the base, target, and bridge clips as ordinary animations first.&lt;br /&gt;
# Confirm that each clip plays independently.&lt;br /&gt;
# Add a transition to the target animation.&lt;br /&gt;
# Set the previous animation and the bridge-animation name.&lt;br /&gt;
# Adjust the minimum and maximum previous-animation time only when the transition should be limited to a time window.&lt;br /&gt;
# Enable transition preview and test every route that can select the target animation.&lt;br /&gt;
&lt;br /&gt;
SOMA's shipped entities contain 204 transition entries. The engine emits separate errors for a missing previous animation, missing transition animation, and missing transition base animation.&lt;br /&gt;
&lt;br /&gt;
== Test from script ==&lt;br /&gt;
&lt;br /&gt;
After preview succeeds, place the entity in a test map and play the registered name:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
Entity_PlayAnimation(&amp;quot;Machine&amp;quot;, &amp;quot;open&amp;quot;, 0.1f, false, true, &amp;quot;OnAnimationFinished&amp;quot;);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The SOMA API records the completion callback as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void OnAnimationFinished(const tString &amp;amp;in asEntityName,&lt;br /&gt;
                         const tString &amp;amp;in asAnimName)&lt;br /&gt;
{&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use a loop only for a clip intended to repeat. Leave transition playback enabled only when the entity has a matching transition setup.&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
* '''The file does not appear or load:''' verify the mod-relative path, extension, and resource configuration.&lt;br /&gt;
* '''The animation name cannot be played:''' check the entity's registered &amp;lt;code&amp;gt;Name&amp;lt;/code&amp;gt;; it can differ from the source filename.&lt;br /&gt;
* '''The mesh deforms incorrectly:''' compare the mesh and animation hierarchy, node names, unit metadata, and export axes.&lt;br /&gt;
* '''The entity reports a skeleton mismatch:''' reimport the mesh into the entity and confirm that the exported animation targets that same skeleton.&lt;br /&gt;
* '''Events do not fire correctly:''' inspect event time, type, value, and socket separately from animation playback.&lt;br /&gt;
* '''A transition fails:''' verify that the previous, target, and bridge names all match registered entity animations.&lt;br /&gt;
* '''An update still plays old data:''' reload the entity after replacing the source and ensure the generated &amp;lt;code&amp;gt;.anm&amp;lt;/code&amp;gt; cache is refreshed.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[HPL3/SOMA/Animation/Animation Overview|Animation Overview]]&lt;br /&gt;
* [[HPL3/SOMA/Modeling/Exporting Animations|Exporting Animations]]&lt;br /&gt;
* [[HPL3/Entities/Adding Animations to Entities|Animation Editor fields]]&lt;br /&gt;
* [[HPL3/Entities/Model Preview Settings|Entity Preview]]&lt;br /&gt;
&lt;br /&gt;
[[Category:English]]&lt;/div&gt;</summary>
		<author><name>TiMan</name></author>
		
	</entry>
</feed>