Ejemplo n.º 1
0
 void OnEnable()
 {
     window          = this;
     this.title      = "Code View";
     this.minSize    = new Vector2(/*380f*/ width_code_min + width_inspector_open_min, 102f);
     this.scrollView = new Vector2(0f, 0f);
     oData           = AMOptionsFile.loadFile();
     loadAnimatorData();
     refreshCode();
 }
Ejemplo n.º 2
0
    void OnEnable()
    {
        window = this;

        texRightArrow = (Texture)Resources.Load("am_nav_right"); // inspector right arrow
        texLeftArrow  = (Texture)Resources.Load("am_nav_left");  // inspector left arrow

        this.titleContent = new GUIContent("Code View");
        this.minSize      = new Vector2(/*380f*/ width_code_min + width_inspector_open_min, 102f);
        this.scrollView   = new Vector2(0f, 0f);
        oData             = AMOptionsFile.loadFile();
        loadAnimatorData();
        refreshCode();
    }
Ejemplo n.º 3
0
    void processSelectProperty(Component propertyComponent, FieldInfo fieldInfo, PropertyInfo propertyInfo, MethodInfo methodMegaMorphSetPercent = null)
    {
        if (!aData || !track)
        {
            this.Close();
        }

        bool changePropertyValue = true;

        if ((track.keys.Count > 0) && (!EditorUtility.DisplayDialog("Data Will Be Lost", "You will lose all of the keyframes on track '" + track.name + "' if you continue.", "Continue Anway", "Cancel")))
        {
            changePropertyValue = false;
        }
        if (changePropertyValue)
        {
            //AMTimeline.registerUndo("Set Property");
            AMUtil.recordObject(this, "set property");

            // delete keys
            if (track.keys.Count > 0)
            {
                track.deleteAllKeys();
                AMCodeView.refresh();
            }
            // set fieldinfo or propertyinfo
            if (fieldInfo != null)
            {
                track.setFieldInfo(fieldInfo);
            }
            else if (propertyInfo != null)
            {
                track.setPropertyInfo(propertyInfo);
            }
            // MegaMorph
            else if (methodMegaMorphSetPercent != null)
            {
                track.setMethodInfo(methodMegaMorphSetPercent, new string[] { "System.Int32", "System.Single" }, AMPropertyTrack.ValueType.MorphChannels);
            }
            // set component
            track.setComponent(propertyComponent);
            track.updateCache();
        }
        this.Close();
    }
Ejemplo n.º 4
0
 void OnDisable()
 {
     window = null;
 }
Ejemplo n.º 5
0
    void OnGUI()
    {
        this.title = "Ease: " + (oData.time_numbering ? AMTimeline.frameToTime(key.frame, (float)aData.getCurrentTake().frameRate) + " s" : key.frame.ToString());
        AMTimeline.loadSkin(oData, ref skin, ref cachedSkinName, position);
        bool updateEasingCurve = false;

        GUIStyle styleBox = new GUIStyle(GUI.skin.button);

        styleBox.normal = GUI.skin.button.active;
        styleBox.hover  = styleBox.normal;
        styleBox.border = GUI.skin.button.border;
        GUILayout.BeginArea(new Rect(5f, 5f, position.width - 10f, position.height - 10f));
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("", styleBox, GUILayout.Width(500f), GUILayout.Height(100f)))
        {
            selectedSpeedIndex = (selectedSpeedIndex + 1) % speedValues.Length;
            percent            = waitPercent * -1f;
        }

        GUILayout.EndHorizontal();

        GUILayout.Space(5f);
        GUILayout.BeginHorizontal();
        int  prevCategory         = category;
        bool updatedSelectedIndex = false;

        if (setCategory(GUILayout.SelectionGrid(category, categories, (position.width >= 715f ? 12 : 6), GUILayout.Width(position.width - 16f))))
        {
            selectedIndex = getSelectedEaseIndex(prevCategory, selectedIndex);
            selectedIndex = getCategoryIndexForEase(selectedIndex);
            if (selectedIndex < 0)
            {
                selectedIndex        = 0;
                percent              = waitPercent * -1f;
                updatedSelectedIndex = true;
            }
        }
        GUILayout.EndHorizontal();
        GUILayout.Space(5f);

        GUILayout.BeginVertical(GUILayout.Height(233f));
        if (updatedSelectedIndex || setSelectedIndex(GUILayout.SelectionGrid(selectedIndex, easeTypesFiltered[category].ToArray(), 3)))
        {
            percent           = waitPercent * -1f;
            updateEasingCurve = true;
            if (getSelectedEaseName(category, selectedIndex) == "Custom")
            {
                isCustomEase = true;
                if (key.customEase.Count > 0)
                {
                    curve = key.getCustomEaseCurve();
                }
                else
                {
                    setEasingCurve();
                }
            }
            else
            {
                isCustomEase = false;
            }
        }
        GUILayout.EndVertical();
        GUILayout.Space(5f);
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("Apply"))
        {
            bool shouldUpdateCache = false;
            if (isCustomEase)
            {
                key.setCustomEase(curve);
                shouldUpdateCache = true;
            }
            if (key.setEaseType(getSelectedEaseIndex(category, selectedIndex)))
            {
                shouldUpdateCache = true;
            }
            if (shouldUpdateCache)
            {
                // update cache when modifying varaibles
                track.updateCache();
                AMCodeView.refresh();
                // preview new position
                aData.getCurrentTake().previewFrame(aData.getCurrentTake().selectedFrame);
                // save data
                EditorUtility.SetDirty(aData);
            }
            this.Close();
        }
        if (GUILayout.Button("Cancel"))
        {
            this.Close();
        }
        GUILayout.EndHorizontal();
        GUILayout.EndArea();

        // orb texture
        GUI.DrawTexture(new Rect(x_pos, 15f, 80f, 80f), tex_orb);
        // speed label
        GUIStyle styleLabelRight = new GUIStyle(GUI.skin.label);

        styleLabelRight.alignment        = TextAnchor.MiddleRight;
        styleLabelRight.normal.textColor = Color.white;
        EditorGUI.DropShadowLabel(new Rect(475f, 5f, 25f, 25f), speedNames[selectedSpeedIndex], styleLabelRight);
        // draw border
        GUI.color = GUI.skin.window.normal.textColor;
        GUI.DrawTexture(new Rect(0f, 0f, 7f, 110f), EditorGUIUtility.whiteTexture);
        GUI.DrawTexture(new Rect(position.width - 209f, 0f, 208f, 110f), EditorGUIUtility.whiteTexture);
        GUI.color = Color.white;

        // curve field
        if (updateEasingCurve)
        {
            setEasingCurve();
        }
        else if (!isCustomEase && didChangeCurve())
        {
            isCustomEase  = true;
            selectedIndex = getCategoryIndexForEaseName("Custom");
            if (selectedIndex < 0)
            {
                category      = 0;
                selectedIndex = getCategoryIndexForEaseName("Custom");
            }
        }
        curve = EditorGUI.CurveField(new Rect(500f, 5f, 208f, 100f), curve, Color.blue, new Rect(0f, -0.5f, 1f, 2.0f));
    }
Ejemplo n.º 6
0
 void OnEnable()
 {
     window = this;
     this.title = "Code View";
     this.minSize = new Vector2(/*380f*/width_code_min+width_inspector_open_min,102f);
     this.scrollView = new Vector2(0f,0f);
     oData = AMOptionsFile.loadFile();
     loadAnimatorData();
     refreshCode();
 }
Ejemplo n.º 7
0
 void OnDisable()
 {
     window = null;
 }
Ejemplo n.º 8
0
    void OnEnable()
    {
        texRightArrow = AMEditorResource.LoadEditorTexture("am_nav_right");// inspector right arrow
        texLeftArrow = AMEditorResource.LoadEditorTexture("am_nav_left");	// inspector left arrow

        window = this;
        this.title = "Code View";
        this.minSize = new Vector2(/*380f*/width_code_min + width_inspector_open_min, 102f);
        this.scrollView = new Vector2(0f, 0f);
        oData = AMOptionsFile.loadFile();
        loadAnimatorData();
        refreshCode();
    }