Пример #1
0
        void OnEnable()
        {
            mTexSelect = CurvyResource.Load("selectsmall,12,12");

            EditorApplication.hierarchyWindowItemOnGUI += OnHierarchyWindowItemOnGUI;

            tInterpolation          = serializedObject.FindProperty("Interpolation");
            tClosed                 = serializedObject.FindProperty("Closed");
            tAutoEndTangents        = serializedObject.FindProperty("AutoEndTangents");
            tInitialUp              = serializedObject.FindProperty("InitialUpVector");
            tOrientation            = serializedObject.FindProperty("Orientation");
            tSetCPRotation          = serializedObject.FindProperty("SetControlPointRotation");
            tSwirl                  = serializedObject.FindProperty("Swirl");
            tSwirlTurns             = serializedObject.FindProperty("SwirlTurns");
            tGranularity            = serializedObject.FindProperty("Granularity");
            tAutoRefresh            = serializedObject.FindProperty("AutoRefresh");
            tAutoRefreshLength      = serializedObject.FindProperty("AutoRefreshLength");
            tAutoRefreshOrientation = serializedObject.FindProperty("AutoRefreshOrientation");
            tT = serializedObject.FindProperty("Tension");
            tC = serializedObject.FindProperty("Continuity");
            tB = serializedObject.FindProperty("Bias");

            Target.Refresh(true, true, false);
            SceneView.RepaintAll();
#if !OLD_UNDO
            Undo.undoRedoPerformed -= CurvyEditorUtility.OnUndoRedoPerformed;
            Undo.undoRedoPerformed += CurvyEditorUtility.OnUndoRedoPerformed;
#endif
        }
        void OnEnable()
        {
            tResolution          = serializedObject.FindProperty("Resolution");
            tRadiusBase          = serializedObject.FindProperty("Radius");
            tRadiusModifier      = serializedObject.FindProperty("RadiusModifier");
            tRadiusModifierCurve = serializedObject.FindProperty("RadiusModifierCurve");

            tZ                = serializedObject.FindProperty("Z");
            tZModifier        = serializedObject.FindProperty("ZModifier");
            tZModifierCurve   = serializedObject.FindProperty("ZModifierCurve");
            tRange            = serializedObject.FindProperty("Range");
            tWeld             = serializedObject.FindProperty("WeldThreshold");
            tName             = serializedObject.FindProperty("Name");
            tm                = serializedObject.FindProperty("m");
            tn1               = serializedObject.FindProperty("n1");
            tn2               = serializedObject.FindProperty("n2");
            tn3               = serializedObject.FindProperty("n3");
            ta                = serializedObject.FindProperty("a");
            tb                = serializedObject.FindProperty("b");
            tAutoRefresh      = serializedObject.FindProperty("AutoRefresh");
            tAutoRefreshSpeed = serializedObject.FindProperty("AutoRefreshSpeed");

            mTexHelp    = CurvyResource.Load("help,24,24");
            mTexRefresh = CurvyResource.Load("refresh,24,24");
            mTexSave    = CurvyResource.Load("save,24,24");
        }
Пример #3
0
        void OnEnable()
        {
            EditorApplication.hierarchyWindowItemOnGUI += OnHierarchyWindowItemOnGUI;
            tSmoothTangent = serializedObject.FindProperty("SmoothEdgeTangent");
            tSyncStartEnd  = serializedObject.FindProperty("SynchronizeTCB");
            tT0            = serializedObject.FindProperty("StartTension");
            tC0            = serializedObject.FindProperty("StartContinuity");
            tB0            = serializedObject.FindProperty("StartBias");
            tT1            = serializedObject.FindProperty("EndTension");
            tC1            = serializedObject.FindProperty("EndContinuity");
            tB1            = serializedObject.FindProperty("EndBias");
            tOT            = serializedObject.FindProperty("OverrideGlobalTension");
            tOC            = serializedObject.FindProperty("OverrideGlobalContinuity");
            tOB            = serializedObject.FindProperty("OverrideGlobalBias");
            tHandleIn      = serializedObject.FindProperty("HandleIn");
            tHandleOut     = serializedObject.FindProperty("HandleOut");
            tFreeHandles   = serializedObject.FindProperty("FreeHandles");
            tHandleScale   = serializedObject.FindProperty("HandleScale");

            mTexDelete         = CurvyResource.Load("deletesmall,12,12");
            mTexSelect         = CurvyResource.Load("selectsmall,12,12");
            mTexAddUserData    = CurvyResource.Load("addsmall,16,16");
            mTexRemoveUserData = CurvyResource.Load("removesmall,16,16");
#if !OLD_UNDO
            Undo.undoRedoPerformed -= CurvyEditorUtility.OnUndoRedoPerformed;
            Undo.undoRedoPerformed += CurvyEditorUtility.OnUndoRedoPerformed;
#endif
        }
Пример #4
0
 void OnEnable()
 {
     GizmoState         = CurvySpline.Gizmos;
     CurvySpline.Gizmos = CurvySplineGizmos.Curve;
     mTexDelete         = CurvyResource.Load("deletesmall,12,12");
     mTexSave           = CurvyResource.Load("save,24,24");
     mTexGO             = CurvyResource.Load("gameobject,24,24");
     mDefaultMatTexture = new Texture2D(32, 32);
     for (int y = 0; y < 16; y++)
     {
         for (int x = 0; x < 16; x++)
         {
             mDefaultMatTexture.SetPixel(x, y, Color.white);
             mDefaultMatTexture.SetPixel(x + 16, y, Color.black);
             mDefaultMatTexture.SetPixel(x, y + 16, Color.black);
             mDefaultMatTexture.SetPixel(x + 16, y + 16, Color.white);
         }
     }
     mDefaultMatTexture.Apply();
     if (!previewGO)
     {
         previewGO           = new GameObject("ExportPreview");
         previewGO.hideFlags = HideFlags.HideAndDontSave;
         previewMeshRenderer = previewGO.AddComponent <MeshRenderer>();
         previewMeshFilter   = previewGO.AddComponent <MeshFilter>();
         if (!Mat)
         {
             Mat             = new Material(Shader.Find("Diffuse"));
             Mat.name        = "Preview";
             Mat.mainTexture = mDefaultMatTexture;
         }
         previewMeshRenderer.material = Mat;
     }
 }
Пример #5
0
        static void addItem(System.Type type, ToolbarItemInfo properties)
        {
            ToolbarItem handler = (ToolbarItem)System.Activator.CreateInstance(type);

            if (handler != null)
            {
                handler.Properties = properties;
                handler.Image      = CurvyResource.Load(handler.Properties.Image);
                _items.Add(handler);
                // Get max. Content size or proper toolbar rendering
                Vector2 size;
                handler.GetContent(out size);
                ItemsMaxDimensions = Vector2.Max(ItemsMaxDimensions, size);
            }
        }
Пример #6
0
 /// <summary>
 /// Load an image defined by a packed string either from the Resource DLL or the Editor/Resources folder
 /// </summary>
 /// <param name="packedstring">string formed name,width,height. E.g. "myIcon,16,16"</param>
 /// <returns>a Texture</returns>
 public static Texture2D Load(string packedstring)
 {
     if (!string.IsNullOrEmpty(packedstring))
     {
         string[] s = packedstring.Split(',');
         if (s.Length == 3)
         {
             try {
                 int w = int.Parse(s[1]);
                 int h = int.Parse(s[2]);
                 return(CurvyResource.Load(s[0], w, h));
             }
             catch {}
         }
     }
     return(null);
 }
Пример #7
0
 protected virtual void OnEnable()
 {
     mTexPlay = CurvyResource.Load("play,24,24");
     mTexStop = CurvyResource.Load("stop,24,24");
 }