Esempio n. 1
0
    void OnEnable()
    {
        DeformedMesh = target as DeformedMesh;

        if (Delete == null)
        {
            Delete = new GUIContent((Texture2D)EditorGUIUtility.Load("Assets/ElseForty/Media/Delete.png"));
        }
        if (Visible == null)
        {
            Visible = new GUIContent((Texture2D)EditorGUIUtility.Load("Assets/ElseForty/Media/Visible.png"));
        }
        if (Unvisible == null)
        {
            Unvisible = new GUIContent((Texture2D)EditorGUIUtility.Load("Assets/ElseForty/Media/Unvisible.png"));
        }
        if (SelectionFrame == null)
        {
            SelectionFrame = new GUIContent((Texture2D)EditorGUIUtility.Load("Assets/ElseForty/Media/SelectionFrame.png"));
        }
        if (MeshDeformBanner == null)
        {
            MeshDeformBanner = new GUIContent((Texture2D)EditorGUIUtility.Load("Assets/ElseForty/Media/MeshDeformBanner.png"));
        }
        if (Link == null)
        {
            Link = new GUIContent((Texture2D)EditorGUIUtility.Load("Assets/ElseForty/Media/Link.png"));
        }
        if (Unlink == null)
        {
            Unlink = new GUIContent((Texture2D)EditorGUIUtility.Load("Assets/ElseForty/Media/Unlink.png"));
        }

        EditorApplication.update += Update;
        SceneViewUI.PivotEditDel += PivotEdit;
        SplineEditing.BranchSelectionChangedDel += BranchSelectionChanged;

        DeformedMesh.IsUpdateBase = true;
        DeformedMesh.DrawMeshOnEachBranch();
    }
Esempio n. 2
0
    void Update()
    {
        if (MeshAdded)
        {
            MeshAdded = false;

            var prefabMeshes = DeformedMesh.DMBranches[DeformedMesh.SplinePlus.SPData.Selections._BranchKey].PrefabMeshes;
            var prefabMesh   = new PrefabMesh();
            prefabMesh.Prefab    = NewMeshAdded;
            prefabMesh.LayerName = NewMeshAdded.name;
            var importedMat = prefabMesh.Prefab.GetComponent <MeshRenderer>().sharedMaterial;
            if (importedMat != null)
            {
                prefabMesh.Material = importedMat;
            }
            else
            {
                prefabMesh.Material = (Material)EditorGUIUtility.Load("Assets/ElseForty/Assets/Materials/Base.mat");
            }
            prefabMeshes.Add(prefabMesh);
            DeformedMesh._Layer = prefabMeshes.Count - 1;

            UpdateMaterials();
            DeformedMesh.IsUpdateBase = true;
            DeformedMesh.DrawMeshOnEachBranch();
        }
    }