Exemplo n.º 1
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);
                }
            }
        }
Exemplo n.º 2
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);
                }
            }
        }