コード例 #1
0
ファイル: Claymation.cs プロジェクト: RishitVaidya/HiveDemo
        void reset()
        {
            this.initialized = false;

            if (this.pointCloudDataBuffer != null)
            {
                this.pointCloudDataBuffer.Release();
            }

            if (this.pointToChunkIdBuffer != null)
            {
                this.pointToChunkIdBuffer.Release();
            }

            if (this.chunksCenterBuffer != null)
            {
                this.chunksCenterBuffer.Release();
            }

            this.pointCloudDataBuffer = null;
            this.pointToChunkIdBuffer = null;
            this.chunksCenterBuffer   = null;

            this.numChunks = 0;
            this.loaded    = false;
            this._instance = null;
        }
コード例 #2
0
        public override void OnInspectorGUI()
        {
            Claymation claymation = (Claymation)this.target;

            Claymation instance = (Claymation)EditorGUILayout.ObjectField(new GUIContent("instance", "Set this to point at another Claymation in scene to make this into an instance and avoid duplicating memory."), claymation.instanceOf, typeof(Claymation), true);

            if (instance != claymation.instanceOf && instance != claymation)
            {
                claymation.instanceOf = instance;
            }

            if (claymation.instanceOf != null)
            {
                return;
            }

            EditorGUI.BeginChangeCheck();

            TextAsset claymationFile = (TextAsset)EditorGUILayout.ObjectField(new GUIContent("claymation asset", ""), claymation.claymationFile, typeof(TextAsset), true);

            if (EditorGUI.EndChangeCheck())
            {
                if (claymation.claymationFile != claymationFile)
                {
                    claymation.claymationFile = claymationFile;
                    claymation.init();
                }
            }

            if (GUILayout.Button(new GUIContent("reload file", "click this when your claymation file changes and you need to refresh this player")))
            {
                claymation.init();
            }

            Material material = (Material)EditorGUILayout.ObjectField(new GUIContent("material", "Use the same materials you use on the clayContainers"), claymation.material, typeof(Material), true);

            claymation.material = material;

            if (claymation.getNumFrames() > 1)
            {
                int frameRate = EditorGUILayout.IntField(new GUIContent("frame rate", "how fast will this claymation play"), claymation.frameRate);

                claymation.frameRate = frameRate;

                claymation.playAnim = EditorGUILayout.Toggle(new GUIContent("play anim", "Always play the anim in loop"), claymation.playAnim);

                int currentFrame = EditorGUILayout.IntField(new GUIContent("frame", ""), claymation.getFrame());
                if (currentFrame != claymation.getFrame())
                {
                    claymation.loadFrame(currentFrame);
                }
            }
        }
コード例 #3
0
ファイル: Claymation.cs プロジェクト: RishitVaidya/HiveDemo
        public void init()
        {
                #if UNITY_EDITOR
            if (!Application.isPlaying && !Claymation.globalInit)
            {
                Claymation.globalInit = true;
                this.reinstallEditorEvents();
            }
                        #endif

            this.reset();

            this.initialized = true;

            if (this.instanceOf != null)
            {
                this._instance = instanceOf;
                return;
            }

            if (this.claymationFile == null)
            {
                return;
            }

            this._instance = this;

            this._instance.materialProperties = new MaterialPropertyBlock();

            string renderPipeAsset = "";
            if (GraphicsSettings.renderPipelineAsset != null)
            {
                renderPipeAsset = GraphicsSettings.renderPipelineAsset.GetType().Name;
            }

            if (renderPipeAsset == "HDRenderPipelineAsset")
            {
                this.renderPipe = "hdrp";
            }
            else if (renderPipeAsset == "UniversalRenderPipelineAsset")
            {
                this.renderPipe = "urp";
            }
            else
            {
                this.renderPipe = "builtin";
            }

            this.loadClaymationFile();
        }
コード例 #4
0
ファイル: Claymation.cs プロジェクト: alphabravoab/boost
        void reset()
        {
            for (int chunkIt = 0; chunkIt < this.chunksBuffer.Count; ++chunkIt)
            {
                ComputeBuffer chunkBuffer = this.chunksBuffer[chunkIt];
                if (chunkBuffer != null)
                {
                    chunkBuffer.Release();
                }
            }

            this.chunksBuffer.Clear();
            this.numChunks = 0;
            this.loaded    = false;
            this._instance = null;
        }
コード例 #5
0
ファイル: Claymation.cs プロジェクト: alphabravoab/boost
        public void init()
        {
                #if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                this.reinstallEditorEvents();
            }
                        #endif

            this.reset();

            if (this.instanceOf != null)
            {
                this._instance = instanceOf;
                return;
            }

            if (this.claymationFile == null)
            {
                return;
            }

            this._instance = this;

            string renderPipeAsset = "";
            if (GraphicsSettings.renderPipelineAsset != null)
            {
                renderPipeAsset = GraphicsSettings.renderPipelineAsset.GetType().Name;
            }

            if (renderPipeAsset == "HDRenderPipelineAsset")
            {
                this.renderPipe = "hdrp";
            }
            else if (renderPipeAsset == "UniversalRenderPipelineAsset")
            {
                this.renderPipe = "urp";
            }
            else
            {
                this.renderPipe = "builtin";
            }

            this.loadClaymationFile();
        }
コード例 #6
0
        public override void OnInspectorGUI()
        {
            Claymation claymation = (Claymation)this.target;

            EditorGUI.BeginChangeCheck();

            TextAsset claymationFile = (TextAsset)EditorGUILayout.ObjectField(new GUIContent("claymation asset", ""), claymation.claymationFile, typeof(TextAsset), true);

            if (EditorGUI.EndChangeCheck())
            {
                if (claymation.claymationFile != claymationFile)
                {
                    claymation.claymationFile = claymationFile;
                    claymation.loadClaymationFile();
                }
            }

            if (GUILayout.Button(new GUIContent("reload file", "click this when your claymation file changes and you need to refresh this player")))
            {
                claymation.loadClaymationFile();
            }

            Material material = (Material)EditorGUILayout.ObjectField(new GUIContent("material", "Use the same materials you use on the clayContainers"), claymation.material, typeof(Material), true);

            claymation.material = material;

            if (claymation.getNumFrames() > 1)
            {
                int frameRate = EditorGUILayout.IntField(new GUIContent("frame rate", "how fast will this claymation play"), claymation.frameRate);

                claymation.frameRate = frameRate;

                claymation.playAnim = EditorGUILayout.Toggle(new GUIContent("play anim", "Always play the anim in loop"), claymation.playAnim);

                int currentFrame = EditorGUILayout.IntField(new GUIContent("frame", ""), claymation.getFrame());
                if (currentFrame != claymation.getFrame())
                {
                    claymation.loadFrame(currentFrame);
                }
            }
        }