Ejemplo n.º 1
0
        virtual public void ResetResource(NResourceLoc loc)
        {
            if (TargetActor != null && animMesh == null)
            {
                NActorComponent comp = TargetActor.CreateComponent(animMeshNameGenerator.GetNextUniqueName(), "nanim_mesh_component");
                animMesh = comp as NAnimMeshComponent;
            }

            animMesh.ResetResource(loc);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 重置Avatar资源
        /// </summary>
        public void ResetAvatarResource(NActor ownerActor)
        {
            targetActorRef = new WeakReference(ownerActor);

            NAnimMeshComponent animMesh = (NAnimMeshComponent)ownerActor.CreateComponent("LPC_Anim_Mesh", "nanim_mesh_component");

            animMeshComponentRef = new WeakReference(animMesh);

            try
            {
                // 初始化资源
                //animMesh.ResetResource(new NResourceLoc("content", @"/NPC/NPC_bandit_001/NPC_bandit_001.nam"));
                animMesh.ResetResource(new NResourceLoc("content", @"/NPC/NPC_grpmon_002/atck.nam"));
            }
            catch (System.Exception)
            {
                //Logger.Instance.LogEvent("Load anim mesh faild!" + e.ToString());
            }
        }
Ejemplo n.º 3
0
        static private void CreateActorComponent(NActor newActor, NResourceLoc res)
        {
            try
            {
                switch (res.FileExtension)
                {
                case "nmdl":
                {
                    NActorComponent comp = newActor.CreateComponent(
                        MakeComponentName("StaticMesh_", res),
                        "nstatic_mesh_component");
                    NStaticMeshComponent meshComp = comp as NStaticMeshComponent;
                    meshComp.ResetResource(res);
                }
                break;

                case "spt":
                {
                    NActorComponent comp = newActor.CreateComponent(
                        MakeComponentName("SPTComp_", res),
                        "nspeed_tree_component");
                    NSpeedTreeComponent sptComp = comp as NSpeedTreeComponent;
                    sptComp.Create(res);
                }
                break;

                case "nam":
                {
                    NActorComponent comp = newActor.CreateComponent(
                        MakeComponentName("AnimMeshComp_", res),
                        "nanim_mesh_component");
                    NAnimMeshComponent meshComp = comp as NAnimMeshComponent;
                    meshComp.ResetResource(res);
                }
                break;
                }// end of switch
            }
            catch (System.Exception e)
            {
                NexusEditor.Program.ShowException(e, "Create Resource Actor Component FAILED!");
            }
        }
        internal void ResetAnimMeshResource(NResourceAnimMesh mesh)
        {
            // 重新创建可预览Actor
            CreateAnimMeshPreview();

            NAnimMeshComponent previewMC = AnimMeshPreviewComponent;

            if (previewMC == null)
            {
                NLogger.Instance.WriteString(LogType.Debug, "没有创建可预览对象...");
                return;
            }

            try
            {
                previewMC.ResetResource(mesh);
                m_actorBox = previewMC.GetBoundingBox();
            }
            catch (System.Exception e)
            {
                NexusEditor.Program.ShowException(e, "Anim Mesh Preview Open FAILED!");
            }
        }