public AnimSource[] GetSourceToNamespaceToActorArray() { AnimNamespace[] namespaces; AnimSource source; AnimSource[] sources = new AnimSource[this.mSrcFile2Ns2Actor.Count]; int j, i = 0; foreach (KeyValuePair <string, SortedDictionary <string, ActorDefinition> > dict in this.mSrcFile2Ns2Actor) { if (dict.Value == null) { source = new AnimSource(dict.Key, null); } else { j = 0; namespaces = new AnimNamespace[dict.Value.Count]; foreach (KeyValuePair <string, ActorDefinition> pair in dict.Value) { namespaces[j++] = new AnimNamespace(pair.Key, pair.Value); } source = new AnimSource(dict.Key, namespaces); } sources[i++] = source; } return(sources); }
protected override JobHandle OnUpdate(JobHandle inputDependencies) { inputDependencies.Complete(); var animGraphSys = World.GetExistingSystem <AnimationGraphSystem>(); // Initialize Entities .WithStructuralChanges() .WithNone <LOD>() .WithAll <Settings>() .ForEach((Entity entity) => { GameDebug.Log(World, ShowLifetime, "InitSys: Initialize DotsAnimStateCtrl:{0}", entity); // Setup lowest LOD rig var rigDataBuffer = EntityManager.GetBuffer <RigData>(entity); // var lowestLod = rigDataBuffer.Length - 1; // TODO (mogensh) for now we only use Rig LOD for selecting low lod on server var isServer = World.GetExistingSystem <ServerSimulationSystemGroup>() != null;// TODO (mogensh) cant we find better way to test for server? var lod = isServer ? 1 : 0; var rigData = rigDataBuffer[lod]; RigEntityBuilder.SetupRigEntity(entity, EntityManager, rigData.Rig); var animLocalToRigBuffer = EntityManager.AddBuffer <AnimatedLocalToRig>(entity); animLocalToRigBuffer.ResizeUninitialized(rigData.Rig.Value.Skeleton.Ids.Length); // Create root animsource var settings = EntityManager.GetComponentData <Settings>(entity); var rootAnimSourceEntity = PrefabAssetManager.CreateEntity(EntityManager, settings.RootAnimSource); #if UNITY_EDITOR var name = EntityManager.GetName(rootAnimSourceEntity) + " -> Entity " + entity.Index + ".DotsAnimStateController.RootAnimSource"; EntityManager.SetName(rootAnimSourceEntity, name); #endif AnimSource.SetAnimStateEntityOnPrefab(EntityManager, rootAnimSourceEntity, entity); var rootAnimSource = RootAnimSource.Default; rootAnimSource.Value = rootAnimSourceEntity; EntityManager.AddComponentData(entity, rootAnimSource); EntityManager.AddComponentData(entity, new LOD { Value = lod, }); }).Run(); // Deinitialize Entities .WithStructuralChanges() .WithNone <Settings>() .WithAll <LOD>() .ForEach((Entity entity, ref RootAnimSource rootAnimSource, ref OutputNode outputNode, ref GraphOutput graphOutput) => { Deinitialize(EntityManager, entity, animGraphSys); }).Run(); return(default);
public AnimSource[] GetSourceToNamespaceToActorArray() { AnimNamespace[] namespaces; AnimSource source; AnimSource[] sources = new AnimSource[this.mSrcFile2Ns2Actor.Count]; int j, i = 0; foreach (KeyValuePair<string, SortedDictionary<string, ActorDefinition>> dict in this.mSrcFile2Ns2Actor) { if (dict.Value == null) { source = new AnimSource(dict.Key, null); } else { j = 0; namespaces = new AnimNamespace[dict.Value.Count]; foreach (KeyValuePair<string, ActorDefinition> pair in dict.Value) { namespaces[j++] = new AnimNamespace(pair.Key, pair.Value); } source = new AnimSource(dict.Key, namespaces); } sources[i++] = source; } return sources; }