Search Unity

Question Alembic importer question

Discussion in 'Asset Importing & Exporting' started by Ookoohko, Mar 29, 2023.

  1. Ookoohko

    Ookoohko

    Joined:
    Sep 29, 2009
    Posts:
    103
    (Sorry mods, didn't notice this forum before and posted the same stuff under Animation forum, feel free to remove it!)

    ==>

    I'm trying to write an editor extension that samples Alembic animation vertex positions and writes them to a vertex animation texture.

    I've managed to import the alembic plugin & file successfully and I can mess around with the time in Alembic Stream Player manually, but for some reason I can't control the time position with a script.

    AlembicStreamPlayer seems to live under UnityEngine.Formats.Alembic namespace, but for whatever reason when I try to include the namespace ( using UnityEngine.Formats.Alembic.Importer; ) I get an error that says that type or namespace "Formats" does not exist in namespace 'UnityEngine'.

    What I don't understand is how can the plugin itself work, and the stream player also works fine.

    namespace UnityEngine.Formats.Alembic.Importer
    {
    /// <summary>
    /// This component allows data streaming from Alembic files. It updates children nodes (Meshes, Transforms, Cameras, etc.) to reflect the Alembic data at the given time.
    /// </summary>
    [ExecuteInEditMode]
    [DisallowMultipleComponent]
    public class AlembicStreamPlayer : MonoBehaviour, ISerializationCallbackReceiver
    {
    }

    How am I supposed to control this thing with code if I can't access AlembicStreamPlayer object?

    I tried also adding the clip to a timeline and manually moving the timeline by setting PlayableDirector's time and calling Evaluate() , but that does not seem to change the actual vertex data at all.

    br,
    Sami
     
  2. unity_7B7FCC2E6C8E17B17BAF

    unity_7B7FCC2E6C8E17B17BAF

    Unity Technologies

    Joined:
    Jul 6, 2022
    Posts:
    11
    Hello Ookoohko,

    The use of asmdef files can prevent access to a namespace, you would need to reference the appropriate Alembic's asmdef in yours.

    Can this be the issue?
     
  3. Ookoohko

    Ookoohko

    Joined:
    Sep 29, 2009
    Posts:
    103
    Yes, this seemed to be the case indeed - manged to fix this already on my own, but thanks!

    br,
    Sami