/// <summary> /// Do the script setup /// </summary> void Setup() { ///Get the DistortVertices of this gameobject distort = GetComponent <Distort>(); ///Make the mesh dynamic, since we will be updating the vertices every frame distort.MakeDynamic(); }
public void OnUndo() { myTarget = (target as Distort); if (myTarget.updateIntEditor) { myTarget.UpdateDistort(); } }
public void OnEnable() { myTarget = (target as Distort); previewRenderUtility = new PreviewRenderUtility(false); previewRenderUtility.cameraFieldOfView = 30f; previewRenderUtility.camera.farClipPlane = 1000; previewRenderUtility.camera.nearClipPlane = 0.3f; //Set the camera to be a little far away from the model. previewRenderUtility.camera.transform.position = Vector3.back * (myTarget.combinedBounds.size.magnitude * 2); reList = new ReorderableList(myTarget.distort, typeof(DistortData), true, false, false, false); reList.drawHeaderCallback = (Rect rect) => { EditorGUI.LabelField(rect, "Effects order:"); }; reList.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => { //var element = reList.serializedProperty.GetArrayElementAtIndex(index); rect.y += 2; myTarget.distort[index].name = EditorGUI.TextField( new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight), myTarget.distort[index].name); /* * EditorGUI.PropertyField( * new Rect(rect.x + 60, rect.y, rect.width - 60 - 30, EditorGUIUtility.singleLineHeight), * element.FindPropertyRelative("Prefab"), GUIContent.none); * EditorGUI.PropertyField( * new Rect(rect.x + rect.width - 30, rect.y, 30, EditorGUIUtility.singleLineHeight), * element.FindPropertyRelative("Count"), GUIContent.none); */ }; }