using UnityEditor; using UnityEngine; using UnityEditorInternal; using System; using System.Reflection; using System.IO; using System.Collections; using System.Collections.Generic; using ParticlePlayground; using ParticlePlaygroundLanguage; using PlaygroundSplines; [CustomEditor (typeof(PlaygroundParticlesC))] class PlaygroundParticleSystemInspectorC : Editor { ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // PlaygroundParticles variables ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public static PlaygroundParticlesC playgroundParticlesScriptReference; public static SerializedObject playgroundParticles; // PlaygroundParticlesC public static SerializedProperty source; // SOURCEC public static SerializedProperty sorting; // SORTINGC public static SerializedProperty lifetimeSorting; // AnimationCurve public static SerializedProperty activeState; // int public static SerializedProperty particleCount; // int public static SerializedProperty emissionRate; // float public static SerializedProperty updateRate; // int public static SerializedProperty worldObjectUpdateVertices; // bool public static SerializedProperty worldObjectUpdateNormals; // bool public static SerializedProperty emit; // bool public static SerializedProperty loop; // bool public static SerializedProperty disableOnDone; // bool public static SerializedProperty disableOnDoneRoutine; // ONDONE public static SerializedProperty calculate; // bool public static SerializedProperty deltaMovementStrength; // float public static SerializedProperty particleTimescale; // float public static SerializedProperty sizeMin; // float public static SerializedProperty sizeMax; // float public static SerializedProperty lifetime; // float public static SerializedProperty lifetimeSize; // AnimationCurve public static SerializedProperty arraySize; // AnimationCurve public static SerializedProperty onlySourcePositioning; // bool public static SerializedProperty applyLifetimeVelocity; // bool public static SerializedProperty applyInitialVelocity; // bool public static SerializedProperty applyInitialLocalVelocity; // bool public static SerializedProperty applyVelocityBending; // bool public static SerializedProperty velocityBendingType; // VELOCITYBENDINGTYPE public static SerializedProperty lifetimeVelocity; // Vector3AnimationCurveC public static SerializedProperty initialVelocityShape; // Vector3AnimationCurveC public static SerializedProperty overflowOffset; // Vector3 public static SerializedProperty overflowMode; // OVERFLOWMODEC public static SerializedProperty initialVelocityMin; // Vector3 public static SerializedProperty initialVelocityMax; // Vector3 public static SerializedProperty initialLocalVelocityMin; // Vector3 public static SerializedProperty initialLocalVelocityMax; // Vector3 public static SerializedProperty turbulenceLifetimeStrength; // AnimationCurve public static SerializedProperty lifetimeColor; // Gradient public static SerializedProperty lifetimeColors; // List public static SerializedProperty arrayColor; // Gradient public static SerializedProperty colorSource; // COLORSOURCEC public static SerializedProperty collision; // bool public static SerializedProperty affectRigidbodies; // bool public static SerializedProperty mass; // float public static SerializedProperty collisionRadius; // float public static SerializedProperty collisionMask; // LayerMask public static SerializedProperty stickyCollisionMask; // LayerMask public static SerializedProperty collisionType; // COLLISIONTYPE public static SerializedProperty bounciness; // float public static SerializedProperty lifetimeStretching; // AnimationCurve public static UnityEngine.Object particleMaterial; // Material public static SerializedProperty threadMethod; // ThreadMethodLocal public static SerializedProperty states; // List public static SerializedProperty worldObject; // WorldObjectC public static SerializedProperty worldObjectGameObject; // GameObject public static SerializedProperty skinnedWorldObject; // SkinnedWorldObjectC public static SerializedProperty skinnedWorldObjectGameObject; // GameObject public static SerializedProperty forceSkinnedMeshUpdateOnMainThread; // bool public static SerializedProperty sourceTransform; // Transform public static SerializedProperty sourcePaint; // PaintObjectC public static SerializedProperty sourceProjection; // ParticleProjectionC public static SerializedProperty sourceSplines; // List public static SerializedProperty sourceTransforms; // List public static SerializedProperty lifetimePositioning; // Vector3AnimationCurveC public static SerializedProperty lifetimePositioningX; // AnimationCurve public static SerializedProperty lifetimePositioningY; // AnimationCurve public static SerializedProperty lifetimePositioningZ; // AnimationCurve public static SerializedProperty lifetimePositioningTimeScale; // AnimationCurve public static SerializedProperty lifetimePositioningPositionScale; // AnimationCurve public static SerializedProperty lifeTimeVelocityX; // AnimationCurve public static SerializedProperty lifeTimeVelocityY; // AnimationCurve public static SerializedProperty lifeTimeVelocityZ; // AnimationCurve public static SerializedProperty initialVelocityShapeX; // AnimationCurve public static SerializedProperty initialVelocityShapeY; // AnimationCurve public static SerializedProperty initialVelocityShapeZ; // AnimationCurve public static SerializedProperty movementCompensationLifetimeStrength; // AnimationCurve public static SerializedProperty manipulators; // List public static SerializedProperty events; // List public static SerializedProperty snapshots; // List public static ParticleSystemRenderer shurikenRenderer; // ParticleSystemRenderer public static string[] rendererSortingLayers; // string[] public static int selectedSortingLayer = 0; // int ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Playground variables ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public static PlaygroundC playgroundScriptReference; // PlaygroundC public static SerializedObject playground; // PlaygroundC ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // PlaygroundParticleSystemInspector variables ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // States public static int meshOrImage; public static string addStateName = ""; public static UnityEngine.Object addStateMesh; public static UnityEngine.Object addStateTexture; public static UnityEngine.Object addStateTransform; public static UnityEngine.Object addStateDepthmap; public static float addStateDepthmapStrength = 1f; public static float addStateSize = 1f; public static float addStateScale = 1f; public static Vector3 addStateOffset; // Foldout lists (all others are taken care of the Playground Settings) public static List statesListFoldout; public static List eventListFoldout; // Paint variables public static int brushListStyle = 0; public static Color32 paintColor = new Color(1,1,1,1); public static bool useBrushColor = true; public static int selectedPaintMode; public static GUIStyle sceneBrushStyle; public static List brushPrefabs; public static string[] brushNames; public static float[] paintSpacings; public static bool[] exceedMaxStopsPaintList; public static bool inPaintMode = false; public static UnityEngine.Object paintTexture; public static PlaygroundBrushC[] brushPresets; public static int selectedBrushPreset = -1; public static bool brushPresetFoldout = false; public static SerializedProperty paintLayerMask; public static SerializedProperty paintCollisionType; public static UnityEditor.Tool lastActiveTool = UnityEditor.Tool.None; public static float eraserRadius = 1f; private bool showNoAlphaWarning = false; // Projection variables public static SerializedProperty projectionMask; public static SerializedProperty projectionCollisionType; // GUI public static GUIStyle boxStyle; public static PlaygroundSettingsC playgroundSettings; public static PlaygroundLanguageC playgroundLanguage; public static bool currentWireframe; private Keyframe[] prevLifetimeSortingKeys; private SOURCEC previousSource; public static string saveName = "New Snapshot"; public static bool isEditingInHierarchy; public static SerializedObject shuriken; public static SerializedObject shurikenRendererSO; public static SerializedProperty uvModule; public static SerializedProperty uvModule_enabled; // Bool public static SerializedProperty uvModule_frameOverTime_scalar; // Float public static SerializedProperty uvModule_frameOverTime_minCurve; // AnimationCurve public static SerializedProperty uvModule_frameOverTime_maxCurve; // AnimationCurve public static SerializedProperty uvModule_frameOverTime_minMaxState; // Int public static SerializedProperty uvModule_tilesX; // Int public static SerializedProperty uvModule_tilesY; // Int public static SerializedProperty uvModule_animationType; // Int public static SerializedProperty uvModule_rowIndex; // Int public static SerializedProperty uvModule_cycles; // Float public static SerializedProperty uvModule_randomRow; // Bool public AnimationType uv_animationType; public MinMaxState uv_minMaxState; public AnimationCurve prev_uvModule_frameOverTime_minCurve; public AnimationCurve prev_uvModule_frameOverTime_maxCurve; public static SerializedProperty initialModule; public static SerializedProperty initialModule_maxNumParticles; // Int public static SerializedProperty sortingMode; public static SerializedProperty sortingFudge; public SortMode sortMode; void OnEnable () { lastActiveTool = UnityEditor.Tools.current; isEditingInHierarchy = Selection.activeTransform!=null; // Load settings playgroundSettings = PlaygroundSettingsC.GetReference(); // Load language playgroundLanguage = PlaygroundSettingsC.GetLanguage(); // Playground Particles playgroundParticlesScriptReference = target as PlaygroundParticlesC; if (playgroundParticlesScriptReference==null) return; playgroundParticles = new SerializedObject(playgroundParticlesScriptReference); shurikenRenderer = playgroundParticlesScriptReference.particleSystemGameObject.GetComponent().GetComponent() as ParticleSystemRenderer; // Sorting layers Type internalEditorUtilityType = typeof(InternalEditorUtility); PropertyInfo sortingLayersProperty = internalEditorUtilityType.GetProperty("sortingLayerNames", BindingFlags.Static | BindingFlags.NonPublic); rendererSortingLayers = (string[])sortingLayersProperty.GetValue(null, new object[0]); for (int i = 0; i(); playgroundParticlesScriptReference.particleSystemRenderer = playgroundParticlesScriptReference.shurikenParticleSystem.GetComponent(); particleMaterial = playgroundParticlesScriptReference.particleSystemRenderer.sharedMaterial; onlySourcePositioning = playgroundParticles.FindProperty("onlySourcePositioning"); lifetimePositioning = playgroundParticles.FindProperty("lifetimePositioning"); lifetimePositioningX = lifetimePositioning.FindPropertyRelative("x"); lifetimePositioningY = lifetimePositioning.FindPropertyRelative("y"); lifetimePositioningZ = lifetimePositioning.FindPropertyRelative("z"); lifetimePositioningTimeScale = playgroundParticles.FindProperty ("lifetimePositioningTimeScale"); lifetimePositioningPositionScale = playgroundParticles.FindProperty ("lifetimePositioningPositionScale"); applyLifetimeVelocity = playgroundParticles.FindProperty("applyLifetimeVelocity"); lifeTimeVelocityX = lifetimeVelocity.FindPropertyRelative("x"); lifeTimeVelocityY = lifetimeVelocity.FindPropertyRelative("y"); lifeTimeVelocityZ = lifetimeVelocity.FindPropertyRelative("z"); initialVelocityShapeX = initialVelocityShape.FindPropertyRelative("x"); initialVelocityShapeY = initialVelocityShape.FindPropertyRelative("y"); initialVelocityShapeZ = initialVelocityShape.FindPropertyRelative("z"); applyInitialVelocity = playgroundParticles.FindProperty("applyInitialVelocity"); applyInitialLocalVelocity = playgroundParticles.FindProperty("applyInitialLocalVelocity"); applyVelocityBending = playgroundParticles.FindProperty("applyVelocityBending"); velocityBendingType = playgroundParticles.FindProperty("velocityBendingType"); movementCompensationLifetimeStrength = playgroundParticles.FindProperty ("movementCompensationLifetimeStrength"); worldObjectGameObject = worldObject.FindPropertyRelative("gameObject"); skinnedWorldObjectGameObject = skinnedWorldObject.FindPropertyRelative("gameObject"); // Lifetime colors if (playgroundParticlesScriptReference.lifetimeColors==null) playgroundParticlesScriptReference.lifetimeColors = new List(); // Sorting prevLifetimeSortingKeys = playgroundParticlesScriptReference.lifetimeSorting.keys; // Events list eventListFoldout = new List(); eventListFoldout.AddRange(new bool[playgroundParticlesScriptReference.events.Count]); // States foldout statesListFoldout = new List(); statesListFoldout.AddRange(new bool[playgroundParticlesScriptReference.states.Count]); previousSource = playgroundParticlesScriptReference.source; // Playground playgroundScriptReference = FindObjectOfType(); // Create a manager if no existing instance is in the scene if (!playgroundScriptReference && Selection.activeTransform!=null) { PlaygroundC.ResourceInstantiate("Playground Manager"); playgroundScriptReference = FindObjectOfType(); } if (playgroundScriptReference!=null) { PlaygroundC.reference = playgroundScriptReference; // Serialize Playground playground = new SerializedObject(playgroundScriptReference); PlaygroundInspectorC.Initialize(playgroundScriptReference); // Add this PlaygroundParticles if not existing in Playground list if (!playgroundParticlesScriptReference.isSnapshot && !playgroundScriptReference.particleSystems.Contains(playgroundParticlesScriptReference) && Selection.activeTransform!=null) playgroundScriptReference.particleSystems.Add(playgroundParticlesScriptReference); // Cache components playgroundParticlesScriptReference.particleSystemGameObject = playgroundParticlesScriptReference.gameObject; playgroundParticlesScriptReference.particleSystemTransform = playgroundParticlesScriptReference.transform; playgroundParticlesScriptReference.particleSystemRenderer = playgroundParticlesScriptReference.GetComponent(); playgroundParticlesScriptReference.shurikenParticleSystem = playgroundParticlesScriptReference.particleSystemGameObject.GetComponent(); playgroundParticlesScriptReference.particleSystemRenderer2 = playgroundParticlesScriptReference.particleSystemGameObject.GetComponent().GetComponent() as ParticleSystemRenderer; // Set manager as parent //if (PlaygroundC.reference.autoGroup && playgroundParticlesScriptReference.particleSystemTransform!=null && playgroundParticlesScriptReference.particleSystemTransform.parent == null && Selection.activeTransform!=null) // playgroundParticlesScriptReference.particleSystemTransform.parent = PlaygroundC.referenceTransform; // Issue a quick refresh if (!EditorApplication.isPlaying && isEditingInHierarchy) { foreach (PlaygroundParticlesC p in PlaygroundC.reference.particleSystems) { p.Start(); } } } selectedSort = sorting.intValue; // State initial values if (addStateTransform==null) addStateTransform = (Transform)playgroundParticlesScriptReference.particleSystemTransform; // Visiblity of Shuriken component in Inspector if (!playgroundScriptReference || playgroundScriptReference && !playgroundScriptReference.showShuriken) playgroundParticlesScriptReference.shurikenParticleSystem.hideFlags = HideFlags.HideInInspector; else playgroundParticlesScriptReference.shurikenParticleSystem.hideFlags = HideFlags.None; SetWireframeVisibility(); // Set paint init paintLayerMask = sourcePaint.FindPropertyRelative("layerMask"); paintCollisionType = sourcePaint.FindPropertyRelative("collisionType"); // Set projection init projectionMask = sourceProjection.FindPropertyRelative("projectionMask"); projectionCollisionType = sourceProjection.FindPropertyRelative("collisionType"); // Snapshots if (playgroundParticlesScriptReference.snapshots.Count>0) { if (playgroundParticlesScriptReference.snapshots.Count>0) { for (int i = 0; i(); string assetsDataPath = Application.dataPath; string editorBrushPath = assetsDataPath+"/"+playgroundSettings.playgroundPath+playgroundSettings.brushPath; string[] editorBrushPaths = Directory.GetFiles (editorBrushPath); foreach (string thisBrushPath in editorBrushPaths) { string convertedBrushPath = thisBrushPath.Substring(assetsDataPath.Length-6); UnityEngine.Object brushPathObject = (UnityEngine.Object)AssetDatabase.LoadAssetAtPath(convertedBrushPath, typeof(UnityEngine.Object)); if (brushPathObject!=null && (brushPathObject.GetType().Name)=="GameObject") { brushPrefabs.Add (brushPathObject); } } brushNames = new string[brushPrefabs.Count]; paintSpacings = new float[brushPrefabs.Count]; brushPresets = new PlaygroundBrushC[brushPrefabs.Count]; exceedMaxStopsPaintList = new bool[brushPrefabs.Count]; for (int i = 0; i(); brushNames[i] = thisBrushPrefab.presetName; brushPresets[i] = new PlaygroundBrushC(); brushPresets[i].texture = thisBrushPrefab.texture as Texture2D; brushPresets[i].detail = thisBrushPrefab.detail; brushPresets[i].scale = thisBrushPrefab.scale; brushPresets[i].distance = thisBrushPrefab.distance; paintSpacings[i] = thisBrushPrefab.spacing; exceedMaxStopsPaintList[i] = thisBrushPrefab.exceedMaxStopsPaint; DestroyImmediate (thisBrushGO); } if (source.intValue==5 && paintTexture!=null) SetBrush(selectedBrushPreset); if (playgroundParticlesScriptReference.paint!=null && playgroundParticlesScriptReference.paint.brush!=null && playgroundParticlesScriptReference.paint.brush.texture!=null) { paintTexture = playgroundParticlesScriptReference.paint.brush.texture; } } public static void SetBrush (int i) { if (i>=0 && i0) playgroundSettings.particlesFoldout = GUILayout.Toggle(playgroundSettings.particlesFoldout, playgroundLanguage.playgroundParticles+" ("+playgroundLanguage.eventControlled+")", EditorStyles.foldout); else if (playgroundParticlesScriptReference.isSnapshot) playgroundSettings.particlesFoldout = GUILayout.Toggle(playgroundSettings.particlesFoldout, playgroundLanguage.playgroundParticles+" ("+playgroundLanguage.snapshot+")", EditorStyles.foldout); else playgroundSettings.particlesFoldout = GUILayout.Toggle(playgroundSettings.particlesFoldout, playgroundLanguage.playgroundParticles, EditorStyles.foldout); if (playgroundSettings.particlesFoldout) { EditorGUILayout.BeginVertical(boxStyle); // Source Settings if (GUILayout.Button(playgroundLanguage.source+" ("+playgroundParticlesScriptReference.source.ToString()+")", EditorStyles.toolbarDropDown)) playgroundSettings.sourceFoldout=!playgroundSettings.sourceFoldout; if (playgroundSettings.sourceFoldout) { EditorGUILayout.Separator(); if (previousSource!=playgroundParticlesScriptReference.source) { LifetimeSorting(); } EditorGUILayout.PropertyField(source, new GUIContent( playgroundLanguage.source, playgroundLanguage.sourceDescription )); EditorGUILayout.Separator(); // Source is State if (source.intValue == 0) { RenderStateSettings(); // Source is Projection } else if (source.intValue == 6) { RenderProjectionSettings(); // Source is Transforms } else if (source.intValue == 1) { playgroundParticlesScriptReference.treatAsOneTransform = EditorGUILayout.Toggle (playgroundLanguage.treatAsOneTransform, playgroundParticlesScriptReference.treatAsOneTransform); EditorGUILayout.Separator(); EditorGUILayout.BeginVertical(boxStyle); GUILayout.BeginHorizontal(); playgroundSettings.transformListFoldout = GUILayout.Toggle(playgroundSettings.transformListFoldout, playgroundLanguage.transforms, EditorStyles.foldout); GUILayout.Label (playgroundParticlesScriptReference.sourceTransforms.Count.ToString(), EditorStyles.miniLabel, GUILayout.ExpandWidth(false)); GUILayout.EndHorizontal(); if (playgroundSettings.transformListFoldout) { bool hasDisabledTransform = false; if (playgroundParticlesScriptReference.sourceTransforms.Count>0) { for (int i = 0; i1); if(GUILayout.Button(playgroundLanguage.upSymbol, EditorStyles.toolbarButton, new GUILayoutOption[]{GUILayout.Width(18), GUILayout.Height(16)})){ sourceTransforms.MoveArrayElement(i, i==0?playgroundParticlesScriptReference.sourceTransforms.Count-1:i-1); } if(GUILayout.Button(playgroundLanguage.downSymbol, EditorStyles.toolbarButton, new GUILayoutOption[]{GUILayout.Width(18), GUILayout.Height(16)})){ sourceTransforms.MoveArrayElement(i, i0)?playgroundParticlesScriptReference.worldObject.vertexPositions.Length.ToString():playgroundLanguage.noMesh, GUILayout.MaxWidth(80)); EditorGUILayout.Separator(); if(GUILayout.Button(playgroundLanguage.setParticleCount, EditorStyles.toolbarButton, GUILayout.ExpandWidth(false)) && playgroundParticlesScriptReference.worldObject.vertexPositions!=null && isEditingInHierarchy){ playgroundParticlesScriptReference.particleCount = playgroundParticlesScriptReference.worldObject.vertexPositions.Length; } if(GUILayout.Button("++", EditorStyles.toolbarButton, new GUILayoutOption[]{GUILayout.Width(24), GUILayout.Height(16)}) && playgroundParticlesScriptReference.worldObject.vertexPositions!=null) particleCount.intValue = particleCount.intValue+playgroundParticlesScriptReference.worldObject.vertexPositions.Length; GUILayout.EndHorizontal(); GUILayout.BeginVertical(boxStyle); EditorGUILayout.LabelField(playgroundLanguage.proceduralOptions); EditorGUILayout.PropertyField(worldObjectUpdateVertices, new GUIContent( playgroundLanguage.meshVerticesUpdate, playgroundLanguage.meshVerticesUpdateDescription )); EditorGUILayout.PropertyField(worldObjectUpdateNormals, new GUIContent( playgroundLanguage.meshNormalsUpdate, playgroundLanguage.meshNormalsUpdateDescription )); GUILayout.EndVertical(); // Source is Skinned World Object } else if (source.intValue == 3) { playgroundParticlesScriptReference.skinnedWorldObject.gameObject = (GameObject)EditorGUILayout.ObjectField(playgroundLanguage.skinnedWorldObject, playgroundParticlesScriptReference.skinnedWorldObject.gameObject, typeof(GameObject), true); if (playgroundParticlesScriptReference.skinnedWorldObject.gameObject!=null && playgroundParticlesScriptReference.skinnedWorldObject.renderer!=null) { if (playgroundParticlesScriptReference.skinnedWorldObject.renderer.bones.Length==0) EditorGUILayout.HelpBox(playgroundLanguage.skinnedMeshOptimizeGameObjectsMessage, MessageType.Warning); } if (playgroundParticlesScriptReference.skinnedWorldObject.mesh != null) { int prevDownResolutionSkinned = playgroundParticlesScriptReference.skinnedWorldObject.downResolution; playgroundParticlesScriptReference.skinnedWorldObject.downResolution = EditorGUILayout.IntSlider(playgroundLanguage.sourceDownResolution, playgroundParticlesScriptReference.skinnedWorldObject.downResolution, 1, Mathf.RoundToInt (playgroundParticlesScriptReference.skinnedWorldObject.vertexPositions.Length/2)); if (prevDownResolutionSkinned!=playgroundParticlesScriptReference.skinnedWorldObject.downResolution) LifetimeSorting(); } EditorGUILayout.PropertyField(forceSkinnedMeshUpdateOnMainThread, new GUIContent( playgroundLanguage.forceUpdateOnMainThread, playgroundLanguage.forceUpdateOnMainThreadDescription )); GUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel(playgroundLanguage.points+":"); if (playgroundParticlesScriptReference.skinnedWorldObject.vertexPositions!=null && playgroundParticlesScriptReference.skinnedWorldObject.vertexPositions.Length>0) { if (playgroundParticlesScriptReference.skinnedWorldObject.downResolution<=1) EditorGUILayout.SelectableLabel(playgroundParticlesScriptReference.skinnedWorldObject.vertexPositions.Length.ToString(), GUILayout.MaxWidth(80)); else EditorGUILayout.SelectableLabel((playgroundParticlesScriptReference.skinnedWorldObject.vertexPositions.Length/playgroundParticlesScriptReference.skinnedWorldObject.downResolution).ToString()+" ("+playgroundParticlesScriptReference.skinnedWorldObject.vertexPositions.Length.ToString()+")", GUILayout.MaxWidth(160)); } else EditorGUILayout.SelectableLabel(playgroundLanguage.noMesh); EditorGUILayout.Separator(); if(GUILayout.Button(playgroundLanguage.setParticleCount, EditorStyles.toolbarButton, GUILayout.ExpandWidth(false)) && playgroundParticlesScriptReference.skinnedWorldObject.vertexPositions!=null && isEditingInHierarchy){ playgroundParticlesScriptReference.particleCount = playgroundParticlesScriptReference.skinnedWorldObject.downResolution<=1?playgroundParticlesScriptReference.skinnedWorldObject.vertexPositions.Length:playgroundParticlesScriptReference.skinnedWorldObject.vertexPositions.Length/playgroundParticlesScriptReference.skinnedWorldObject.downResolution; } if(GUILayout.Button("++", EditorStyles.toolbarButton, new GUILayoutOption[]{GUILayout.Width(24), GUILayout.Height(16)}) && playgroundParticlesScriptReference.skinnedWorldObject.vertexPositions!=null) particleCount.intValue = particleCount.intValue+(playgroundParticlesScriptReference.skinnedWorldObject.vertexPositions.Length/playgroundParticlesScriptReference.skinnedWorldObject.downResolution); GUILayout.EndHorizontal(); GUILayout.BeginVertical(boxStyle); EditorGUILayout.LabelField(playgroundLanguage.proceduralOptions); EditorGUILayout.PropertyField(worldObjectUpdateVertices, new GUIContent( playgroundLanguage.meshVerticesUpdate, playgroundLanguage.meshVerticesUpdateDescription )); EditorGUILayout.PropertyField(worldObjectUpdateNormals, new GUIContent( playgroundLanguage.meshNormalsUpdate, playgroundLanguage.meshNormalsUpdateDescription )); GUILayout.EndVertical(); // Source is Script } else if (source.intValue == 4) { // Controlled by events if (playgroundParticlesScriptReference.eventControlledBy.Count>0) { GUILayout.BeginVertical (boxStyle); int eventCount = 0; EditorGUILayout.HelpBox(playgroundLanguage.controlledByAnotherEvent, MessageType.Info); for (int i = 0; i0) { EditorGUILayout.LabelField(brushNames[i], EditorStyles.wordWrappedMiniLabel, new GUILayoutOption[]{GUILayout.Width(50), GUILayout.Height(30)}); } EditorGUILayout.EndVertical(); if (i%(Screen.width/80)==0 && i>0) { EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); } } EditorGUILayout.EndHorizontal(); // List } else { for (i = 0; i=PlaygroundC.reference.paintMaxPositions) { EditorGUILayout.HelpBox(playgroundLanguage.exceededMaxPaint, MessageType.Warning); } if (isEditingInHierarchy) { GUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel(playgroundLanguage.paint+":"); ProgressBar((playgroundParticlesScriptReference.paint.positionLength*1f)/PlaygroundC.reference.paintMaxPositions, playgroundParticlesScriptReference.paint.positionLength+"/"+PlaygroundC.reference.paintMaxPositions, Mathf.FloorToInt(Screen.width/2.2f)-65); EditorGUILayout.Separator(); if(GUILayout.Button(playgroundLanguage.setParticleCount, EditorStyles.toolbarButton, GUILayout.ExpandWidth(false)) && isEditingInHierarchy){ playgroundParticlesScriptReference.particleCount = playgroundParticlesScriptReference.paint.positionLength; } if(GUILayout.Button("++", EditorStyles.toolbarButton, new GUILayoutOption[]{GUILayout.Width(24), GUILayout.Height(16)})) particleCount.intValue = particleCount.intValue+playgroundParticlesScriptReference.paint.positionLength; GUILayout.EndHorizontal(); } EditorGUILayout.Separator(); GUILayout.BeginHorizontal(); GUI.enabled = GUI.enabled&&isEditingInHierarchy; if (inPaintMode && GUI.enabled) GUI.backgroundColor = paintActiveColor; if (GUILayout.Button((inPaintMode?playgroundLanguage.stop:playgroundLanguage.start)+" "+playgroundLanguage.paint+" ", EditorStyles.toolbarButton, GUILayout.ExpandWidth(false))){ StartStopPaint(); } GUI.enabled = (playgroundParticlesScriptReference.paint.positionLength>0); if(GUILayout.Button(playgroundLanguage.clear, EditorStyles.toolbarButton, GUILayout.ExpandWidth(false))){ ClearPaint(); } GUI.enabled = true; GUILayout.EndHorizontal(); EditorGUILayout.Separator(); GUI.backgroundColor = whiteColor; if (inPaintMode && selectedPaintMode==1 && paintTexture==null) EditorGUILayout.HelpBox(playgroundLanguage.assignATexture, MessageType.Warning); if (playgroundParticlesScriptReference.paint.positionLength-1>playgroundParticlesScriptReference.particleCount) EditorGUILayout.HelpBox(playgroundLanguage.morePaintThanPositions, MessageType.Warning); if (GUI.changed) { SetBrushStyle(); } // Source is Spline } else if (source.intValue == 7) { playgroundParticlesScriptReference.splineTimeOffset = EditorGUILayout.Slider (playgroundLanguage.timeOffset, playgroundParticlesScriptReference.splineTimeOffset, 0, 1f); GUI.enabled = playgroundParticlesScriptReference.splines.Count>1; playgroundParticlesScriptReference.treatAsOneSpline = EditorGUILayout.Toggle (playgroundLanguage.treatAsOneSpline, playgroundParticlesScriptReference.treatAsOneSpline); GUI.enabled = true; EditorGUILayout.Separator(); EditorGUILayout.BeginVertical(boxStyle); GUILayout.BeginHorizontal(); playgroundSettings.splineListFoldout = GUILayout.Toggle(playgroundSettings.splineListFoldout, playgroundLanguage.splines, EditorStyles.foldout); GUILayout.Label (playgroundParticlesScriptReference.splines.Count.ToString(), EditorStyles.miniLabel, GUILayout.ExpandWidth(false)); GUILayout.EndHorizontal(); if (playgroundSettings.splineListFoldout) { bool hasDisabledSpline = false; if (playgroundParticlesScriptReference.splines.Count>0) { for (int i = 0; i1); if(GUILayout.Button(playgroundLanguage.upSymbol, EditorStyles.toolbarButton, new GUILayoutOption[]{GUILayout.Width(18), GUILayout.Height(16)})){ sourceSplines.MoveArrayElement(i, i==0?playgroundParticlesScriptReference.splines.Count-1:i-1); } if(GUILayout.Button(playgroundLanguage.downSymbol, EditorStyles.toolbarButton, new GUILayoutOption[]{GUILayout.Width(18), GUILayout.Height(16)})){ sourceSplines.MoveArrayElement(i, i0?playgroundParticlesScriptReference.particleCount-1:0); break; case NEARESTNEIGHBORORIGINMETHOD.Vector3: playgroundParticlesScriptReference.nearestNeighborOriginVector3 = EditorGUILayout.Vector3Field (playgroundLanguage.sortOrigin, playgroundParticlesScriptReference.nearestNeighborOriginVector3); break; case NEARESTNEIGHBORORIGINMETHOD.Transform: playgroundParticlesScriptReference.nearestNeighborOriginTransform = (Transform)EditorGUILayout.ObjectField(playgroundLanguage.sortOrigin, playgroundParticlesScriptReference.nearestNeighborOriginTransform, typeof(Transform), true); break; } if (GUILayout.Button(playgroundParticlesScriptReference.nearestNeighborOriginMethod==NEARESTNEIGHBORORIGINMETHOD.SourcePoint?playgroundLanguage.sourcePoint:playgroundParticlesScriptReference.nearestNeighborOriginMethod==NEARESTNEIGHBORORIGINMETHOD.Vector3?playgroundLanguage.vector3:playgroundLanguage.transform, EditorStyles.toolbarButton, GUILayout.ExpandWidth(false))){ if (playgroundParticlesScriptReference.nearestNeighborOriginMethod==NEARESTNEIGHBORORIGINMETHOD.SourcePoint) playgroundParticlesScriptReference.nearestNeighborOriginMethod = NEARESTNEIGHBORORIGINMETHOD.Vector3; else if (playgroundParticlesScriptReference.nearestNeighborOriginMethod==NEARESTNEIGHBORORIGINMETHOD.Vector3) playgroundParticlesScriptReference.nearestNeighborOriginMethod = NEARESTNEIGHBORORIGINMETHOD.Transform; else if (playgroundParticlesScriptReference.nearestNeighborOriginMethod==NEARESTNEIGHBORORIGINMETHOD.Transform) playgroundParticlesScriptReference.nearestNeighborOriginMethod = NEARESTNEIGHBORORIGINMETHOD.SourcePoint; } EditorGUILayout.EndHorizontal(); EditorGUI.indentLevel--; } // Custom lifetime sorting if (sorting.intValue==7) { EditorGUI.indentLevel++; playgroundParticlesScriptReference.lifetimeSorting = EditorGUILayout.CurveField(playgroundLanguage.customSorting, playgroundParticlesScriptReference.lifetimeSorting); EditorGUI.indentLevel--; bool changed = prevLifetimeSortingKeys.Length!=playgroundParticlesScriptReference.lifetimeSorting.keys.Length; if (!changed) for (int k = 0; k0 && playgroundParticlesScriptReference.states[playgroundParticlesScriptReference.activeState].stateTransform==null) { EditorGUILayout.HelpBox(playgroundLanguage.assignTransformDeltaMovement, MessageType.Info); GUI.enabled = false; } else GUI.enabled = (source.intValue!=4 && !onlySourcePositioning.boolValue&&!playgroundParticlesScriptReference.onlyLifetimePositioning); playgroundParticlesScriptReference.calculateDeltaMovement = EditorGUILayout.ToggleLeft(playgroundLanguage.deltaMovement, playgroundParticlesScriptReference.calculateDeltaMovement); GUI.enabled = (GUI.enabled && playgroundParticlesScriptReference.calculateDeltaMovement && !onlySourcePositioning.boolValue); //EditorGUI.indentLevel++; //deltaMovementStrength.floatValue = EditorGUILayout.Slider(playgroundLanguage.deltaMovementStrength, deltaMovementStrength.floatValue, 0, playgroundSettings.maximumAllowedDeltaMovementStrength); EditorGUILayout.BeginHorizontal(); GUILayout.Space (16f); if (playgroundParticlesScriptReference.deltaMovementStrengthValueMethod==VALUEMETHOD.Constant) { deltaMovementStrength.floatValue = EditorGUILayout.Slider(playgroundLanguage.deltaMovementStrength, deltaMovementStrength.floatValue, 0, playgroundSettings.maximumAllowedDeltaMovementStrength); } else { GUILayout.Label(playgroundLanguage.deltaMovementStrength); EditorGUILayout.Separator(); float deltaMin = playgroundParticlesScriptReference.minDeltaMovementStrength; float deltaMax = playgroundParticlesScriptReference.deltaMovementStrength; EditorGUILayout.MinMaxSlider(ref deltaMin, ref deltaMax, 0, playgroundSettings.maximumAllowedDeltaMovementStrength, GUILayout.Width(Mathf.FloorToInt(Screen.width/1.8f)-125)); playgroundParticlesScriptReference.minDeltaMovementStrength = Mathf.Clamp (deltaMin, 0, playgroundSettings.maximumAllowedDeltaMovementStrength); playgroundParticlesScriptReference.deltaMovementStrength = Mathf.Clamp (deltaMax, 0, playgroundSettings.maximumAllowedDeltaMovementStrength); playgroundParticlesScriptReference.minDeltaMovementStrength = EditorGUILayout.FloatField(playgroundParticlesScriptReference.minDeltaMovementStrength, GUILayout.Width(50)); playgroundParticlesScriptReference.deltaMovementStrength = EditorGUILayout.FloatField(playgroundParticlesScriptReference.deltaMovementStrength, GUILayout.Width(50)); } playgroundParticlesScriptReference.deltaMovementStrengthValueMethod = (VALUEMETHOD)EditorGUILayout.EnumPopup(playgroundParticlesScriptReference.deltaMovementStrengthValueMethod, EditorStyles.toolbarDropDown, GUILayout.MaxWidth (12)); EditorGUILayout.EndHorizontal(); //EditorGUI.indentLevel--; GUI.enabled = !onlySourcePositioning.boolValue&&!playgroundParticlesScriptReference.onlyLifetimePositioning; // Initial Velocity EditorGUILayout.Separator(); EditorGUILayout.BeginHorizontal(); applyInitialVelocity.boolValue = EditorGUILayout.ToggleLeft(playgroundLanguage.initialGlobalVelocity, applyInitialVelocity.boolValue); GUI.enabled = (applyInitialVelocity.boolValue&&!onlySourcePositioning.boolValue&&!playgroundParticlesScriptReference.onlyLifetimePositioning); if (GUILayout.Button (playgroundLanguage.reset, EditorStyles.toolbarButton, GUILayout.ExpandWidth(false))) { playgroundParticlesScriptReference.initialVelocityMin = Vector3.zero; playgroundParticlesScriptReference.initialVelocityMax = Vector3.zero; } EditorGUILayout.EndHorizontal(); EditorGUI.indentLevel++; playgroundParticlesScriptReference.initialVelocityMethod = (MINMAXVECTOR3METHOD)EditorGUILayout.EnumPopup (playgroundLanguage.method, playgroundParticlesScriptReference.initialVelocityMethod); EditorGUI.indentLevel--; // X GUILayout.BeginHorizontal(); GUILayout.Space(16); GUILayout.Label(playgroundParticlesScriptReference.initialVelocityMethod==MINMAXVECTOR3METHOD.Rectangular||playgroundParticlesScriptReference.initialVelocityMethod==MINMAXVECTOR3METHOD.RectangularLinear?"X":playgroundLanguage.range, GUILayout.Width(50)); EditorGUILayout.Separator(); float initialVelocityMinX = playgroundParticlesScriptReference.initialVelocityMin.x; float initialVelocityMaxX = playgroundParticlesScriptReference.initialVelocityMax.x; EditorGUILayout.MinMaxSlider(ref initialVelocityMinX, ref initialVelocityMaxX, -playgroundSettings.maximumAllowedInitialVelocity, playgroundSettings.maximumAllowedInitialVelocity, GUILayout.Width(Mathf.CeilToInt(Screen.width/1.805f)-110)); playgroundParticlesScriptReference.initialVelocityMin.x = Mathf.Clamp (initialVelocityMinX, -playgroundSettings.maximumAllowedInitialVelocity, playgroundSettings.maximumAllowedInitialVelocity); playgroundParticlesScriptReference.initialVelocityMax.x = Mathf.Clamp (initialVelocityMaxX, -playgroundSettings.maximumAllowedInitialVelocity, playgroundSettings.maximumAllowedInitialVelocity); playgroundParticlesScriptReference.initialVelocityMin.x = EditorGUILayout.FloatField(playgroundParticlesScriptReference.initialVelocityMin.x, GUILayout.Width(50)); playgroundParticlesScriptReference.initialVelocityMax.x = EditorGUILayout.FloatField(playgroundParticlesScriptReference.initialVelocityMax.x, GUILayout.Width(50)); GUILayout.EndHorizontal(); if (playgroundParticlesScriptReference.initialVelocityMethod==MINMAXVECTOR3METHOD.Rectangular || playgroundParticlesScriptReference.initialVelocityMethod==MINMAXVECTOR3METHOD.RectangularLinear) { // Y GUILayout.BeginHorizontal(); GUILayout.Space(16); GUILayout.Label("Y"); EditorGUILayout.Separator(); float initialVelocityMinY = playgroundParticlesScriptReference.initialVelocityMin.y; float initialVelocityMaxY = playgroundParticlesScriptReference.initialVelocityMax.y; EditorGUILayout.MinMaxSlider(ref initialVelocityMinY, ref initialVelocityMaxY, -playgroundSettings.maximumAllowedInitialVelocity, playgroundSettings.maximumAllowedInitialVelocity, GUILayout.Width(Mathf.CeilToInt(Screen.width/1.805f)-110)); playgroundParticlesScriptReference.initialVelocityMin.y = Mathf.Clamp (initialVelocityMinY, -playgroundSettings.maximumAllowedInitialVelocity, playgroundSettings.maximumAllowedInitialVelocity); playgroundParticlesScriptReference.initialVelocityMax.y = Mathf.Clamp (initialVelocityMaxY, -playgroundSettings.maximumAllowedInitialVelocity, playgroundSettings.maximumAllowedInitialVelocity); playgroundParticlesScriptReference.initialVelocityMin.y = EditorGUILayout.FloatField(playgroundParticlesScriptReference.initialVelocityMin.y, GUILayout.Width(50)); playgroundParticlesScriptReference.initialVelocityMax.y = EditorGUILayout.FloatField(playgroundParticlesScriptReference.initialVelocityMax.y, GUILayout.Width(50)); GUILayout.EndHorizontal(); // Z GUILayout.BeginHorizontal(); GUILayout.Space(16); GUILayout.Label("Z"); EditorGUILayout.Separator(); float initialVelocityMinZ = playgroundParticlesScriptReference.initialVelocityMin.z; float initialVelocityMaxZ = playgroundParticlesScriptReference.initialVelocityMax.z; EditorGUILayout.MinMaxSlider(ref initialVelocityMinZ, ref initialVelocityMaxZ, -playgroundSettings.maximumAllowedInitialVelocity, playgroundSettings.maximumAllowedInitialVelocity, GUILayout.Width(Mathf.CeilToInt(Screen.width/1.805f)-110)); playgroundParticlesScriptReference.initialVelocityMin.z = Mathf.Clamp (initialVelocityMinZ, -playgroundSettings.maximumAllowedInitialVelocity, playgroundSettings.maximumAllowedInitialVelocity); playgroundParticlesScriptReference.initialVelocityMax.z = Mathf.Clamp (initialVelocityMaxZ, -playgroundSettings.maximumAllowedInitialVelocity, playgroundSettings.maximumAllowedInitialVelocity); playgroundParticlesScriptReference.initialVelocityMin.z = EditorGUILayout.FloatField(playgroundParticlesScriptReference.initialVelocityMin.z, GUILayout.Width(50)); playgroundParticlesScriptReference.initialVelocityMax.z = EditorGUILayout.FloatField(playgroundParticlesScriptReference.initialVelocityMax.z, GUILayout.Width(50)); GUILayout.EndHorizontal(); } /* if (playgroundParticlesScriptReference.initialVelocityMethod==MINMAXVECTOR3METHOD.SphericalSector || playgroundParticlesScriptReference.initialVelocityMethod==MINMAXVECTOR3METHOD.SphericalSectorLinear) { EditorGUI.indentLevel++; playgroundParticlesScriptReference.initialVelocityMin.y = EditorGUILayout.Slider(playgroundLanguage.sectorA, playgroundParticlesScriptReference.initialVelocityMin.y, -1f, 1f); playgroundParticlesScriptReference.initialVelocityMax.y = EditorGUILayout.Slider(playgroundLanguage.sectorB, playgroundParticlesScriptReference.initialVelocityMax.y, 0, 1f); EditorGUI.indentLevel--; } */ GUI.enabled = !onlySourcePositioning.boolValue&&!playgroundParticlesScriptReference.onlyLifetimePositioning; // Initial Local Velocity EditorGUILayout.Separator(); GUI.enabled=(source.intValue!=4 && !onlySourcePositioning.boolValue&&!playgroundParticlesScriptReference.onlyLifetimePositioning); if (source.intValue==4) { GUI.enabled = true; EditorGUILayout.HelpBox(playgroundLanguage.initialLocalVelocityControlledByScript, MessageType.Info); GUI.enabled = false; } EditorGUILayout.BeginHorizontal(); applyInitialLocalVelocity.boolValue = EditorGUILayout.ToggleLeft(playgroundLanguage.initialLocalVelocity, applyInitialLocalVelocity.boolValue); if (playgroundParticlesScriptReference.source==SOURCEC.State && playgroundParticlesScriptReference.states!=null && playgroundParticlesScriptReference.states.Count>0 && playgroundParticlesScriptReference.states[playgroundParticlesScriptReference.activeState].stateTransform==null) { EditorGUILayout.HelpBox(playgroundLanguage.assignTransformLocalVelocity, MessageType.Info); GUI.enabled = false; } else GUI.enabled = (applyInitialLocalVelocity.boolValue&&!onlySourcePositioning.boolValue&&source.intValue!=4&&!playgroundParticlesScriptReference.onlyLifetimePositioning); if (GUILayout.Button (playgroundLanguage.reset, EditorStyles.toolbarButton, GUILayout.ExpandWidth(false))) { playgroundParticlesScriptReference.initialLocalVelocityMin = Vector3.zero; playgroundParticlesScriptReference.initialLocalVelocityMax = Vector3.zero; } EditorGUILayout.EndHorizontal(); EditorGUI.indentLevel++; playgroundParticlesScriptReference.initialLocalVelocityMethod = (MINMAXVECTOR3METHOD)EditorGUILayout.EnumPopup (playgroundLanguage.method, playgroundParticlesScriptReference.initialLocalVelocityMethod); EditorGUI.indentLevel--; // X GUILayout.BeginHorizontal(); GUILayout.Space(16); GUILayout.Label(playgroundParticlesScriptReference.initialLocalVelocityMethod==MINMAXVECTOR3METHOD.Rectangular||playgroundParticlesScriptReference.initialLocalVelocityMethod==MINMAXVECTOR3METHOD.RectangularLinear?"X":playgroundLanguage.range, GUILayout.Width(50)); EditorGUILayout.Separator(); float initialLocalVelocityMinX = playgroundParticlesScriptReference.initialLocalVelocityMin.x; float initialLocalVelocityMaxX = playgroundParticlesScriptReference.initialLocalVelocityMax.x; EditorGUILayout.MinMaxSlider(ref initialLocalVelocityMinX, ref initialLocalVelocityMaxX, -playgroundSettings.maximumAllowedInitialVelocity, playgroundSettings.maximumAllowedInitialVelocity, GUILayout.Width(Mathf.CeilToInt(Screen.width/1.805f)-110)); playgroundParticlesScriptReference.initialLocalVelocityMin.x = Mathf.Clamp (initialLocalVelocityMinX, -playgroundSettings.maximumAllowedInitialVelocity, playgroundSettings.maximumAllowedInitialVelocity); playgroundParticlesScriptReference.initialLocalVelocityMax.x = Mathf.Clamp (initialLocalVelocityMaxX, -playgroundSettings.maximumAllowedInitialVelocity, playgroundSettings.maximumAllowedInitialVelocity); playgroundParticlesScriptReference.initialLocalVelocityMin.x = EditorGUILayout.FloatField(playgroundParticlesScriptReference.initialLocalVelocityMin.x, GUILayout.Width(50)); playgroundParticlesScriptReference.initialLocalVelocityMax.x = EditorGUILayout.FloatField(playgroundParticlesScriptReference.initialLocalVelocityMax.x, GUILayout.Width(50)); GUILayout.EndHorizontal(); if (playgroundParticlesScriptReference.initialLocalVelocityMethod==MINMAXVECTOR3METHOD.Rectangular || playgroundParticlesScriptReference.initialLocalVelocityMethod==MINMAXVECTOR3METHOD.RectangularLinear) { // Y GUILayout.BeginHorizontal(); GUILayout.Space(16); GUILayout.Label("Y"); EditorGUILayout.Separator(); float initialLocalVelocityMinY = playgroundParticlesScriptReference.initialLocalVelocityMin.y; float initialLocalVelocityMaxY = playgroundParticlesScriptReference.initialLocalVelocityMax.y; EditorGUILayout.MinMaxSlider(ref initialLocalVelocityMinY, ref initialLocalVelocityMaxY, -playgroundSettings.maximumAllowedInitialVelocity, playgroundSettings.maximumAllowedInitialVelocity, GUILayout.Width(Mathf.CeilToInt(Screen.width/1.805f)-110)); playgroundParticlesScriptReference.initialLocalVelocityMin.y = Mathf.Clamp (initialLocalVelocityMinY, -playgroundSettings.maximumAllowedInitialVelocity, playgroundSettings.maximumAllowedInitialVelocity); playgroundParticlesScriptReference.initialLocalVelocityMax.y = Mathf.Clamp (initialLocalVelocityMaxY, -playgroundSettings.maximumAllowedInitialVelocity, playgroundSettings.maximumAllowedInitialVelocity); playgroundParticlesScriptReference.initialLocalVelocityMin.y = EditorGUILayout.FloatField(playgroundParticlesScriptReference.initialLocalVelocityMin.y, GUILayout.Width(50)); playgroundParticlesScriptReference.initialLocalVelocityMax.y = EditorGUILayout.FloatField(playgroundParticlesScriptReference.initialLocalVelocityMax.y, GUILayout.Width(50)); GUILayout.EndHorizontal(); // Z GUILayout.BeginHorizontal(); GUILayout.Space(16); GUILayout.Label("Z"); EditorGUILayout.Separator(); float initialLocalVelocityMinZ = playgroundParticlesScriptReference.initialLocalVelocityMin.z; float initialLocalVelocityMaxZ = playgroundParticlesScriptReference.initialLocalVelocityMax.z; EditorGUILayout.MinMaxSlider(ref initialLocalVelocityMinZ, ref initialLocalVelocityMaxZ, -playgroundSettings.maximumAllowedInitialVelocity, playgroundSettings.maximumAllowedInitialVelocity, GUILayout.Width(Mathf.CeilToInt(Screen.width/1.805f)-110)); playgroundParticlesScriptReference.initialLocalVelocityMin.z = Mathf.Clamp (initialLocalVelocityMinZ, -playgroundSettings.maximumAllowedInitialVelocity, playgroundSettings.maximumAllowedInitialVelocity); playgroundParticlesScriptReference.initialLocalVelocityMax.z = Mathf.Clamp (initialLocalVelocityMaxZ, -playgroundSettings.maximumAllowedInitialVelocity, playgroundSettings.maximumAllowedInitialVelocity); playgroundParticlesScriptReference.initialLocalVelocityMin.z = EditorGUILayout.FloatField(playgroundParticlesScriptReference.initialLocalVelocityMin.z, GUILayout.Width(50)); playgroundParticlesScriptReference.initialLocalVelocityMax.z = EditorGUILayout.FloatField(playgroundParticlesScriptReference.initialLocalVelocityMax.z, GUILayout.Width(50)); GUILayout.EndHorizontal(); } /* if (playgroundParticlesScriptReference.initialLocalVelocityMethod==MINMAXVECTOR3METHOD.SphericalSector || playgroundParticlesScriptReference.initialLocalVelocityMethod==MINMAXVECTOR3METHOD.SphericalSectorLinear) { EditorGUI.indentLevel++; playgroundParticlesScriptReference.initialLocalVelocityMin.y = EditorGUILayout.Slider(playgroundLanguage.sectorA, playgroundParticlesScriptReference.initialLocalVelocityMin.y, -1f, 1f); playgroundParticlesScriptReference.initialLocalVelocityMax.y = EditorGUILayout.Slider(playgroundLanguage.sectorB, playgroundParticlesScriptReference.initialLocalVelocityMax.y, 0, 1f); EditorGUI.indentLevel--; }*/ EditorGUILayout.Separator(); GUI.enabled = !onlySourcePositioning.boolValue&&!playgroundParticlesScriptReference.onlyLifetimePositioning; // Initial velocity shape EditorGUILayout.BeginHorizontal(); playgroundParticlesScriptReference.applyInitialVelocityShape = EditorGUILayout.ToggleLeft(playgroundLanguage.initialVelocityShape, playgroundParticlesScriptReference.applyInitialVelocityShape); GUI.enabled = (playgroundParticlesScriptReference.applyInitialVelocityShape&&!onlySourcePositioning.boolValue&&!playgroundParticlesScriptReference.onlyLifetimePositioning); if (GUILayout.Button (playgroundLanguage.reset, EditorStyles.toolbarButton, GUILayout.ExpandWidth(false))) playgroundParticlesScriptReference.initialVelocityShape.Reset1(); EditorGUILayout.EndHorizontal(); EditorGUI.indentLevel++; initialVelocityShapeX.animationCurveValue = EditorGUILayout.CurveField("X", initialVelocityShapeX.animationCurveValue); initialVelocityShapeY.animationCurveValue = EditorGUILayout.CurveField("Y", initialVelocityShapeY.animationCurveValue); initialVelocityShapeZ.animationCurveValue = EditorGUILayout.CurveField("Z", initialVelocityShapeZ.animationCurveValue); playgroundParticlesScriptReference.initialVelocityShapeScale = EditorGUILayout.FloatField (playgroundLanguage.scale, playgroundParticlesScriptReference.initialVelocityShapeScale); EditorGUI.indentLevel--; } EditorGUILayout.EndVertical(); GUI.enabled = true; // Lifetime velocity EditorGUILayout.BeginVertical (boxStyle); GUILayout.BeginHorizontal(); playgroundSettings.forceLifetimeVelocityFoldout = GUILayout.Toggle(playgroundSettings.forceLifetimeVelocityFoldout, playgroundLanguage.lifetimeVelocity, EditorStyles.foldout); GUILayout.Label ((applyLifetimeVelocity.boolValue?playgroundLanguage.on:playgroundLanguage.off), EditorStyles.miniLabel, GUILayout.ExpandWidth(false)); GUILayout.EndHorizontal(); if (playgroundSettings.forceLifetimeVelocityFoldout) { EditorGUILayout.BeginHorizontal(); GUI.enabled = !onlySourcePositioning.boolValue&&!playgroundParticlesScriptReference.onlyLifetimePositioning; applyLifetimeVelocity.boolValue = EditorGUILayout.ToggleLeft(playgroundLanguage.lifetimeVelocity, applyLifetimeVelocity.boolValue); GUI.enabled = (applyLifetimeVelocity.boolValue&&!onlySourcePositioning.boolValue&&!playgroundParticlesScriptReference.onlyLifetimePositioning); if (GUILayout.Button (playgroundLanguage.reset, EditorStyles.toolbarButton, GUILayout.ExpandWidth(false))) playgroundParticlesScriptReference.lifetimeVelocity.Reset(); EditorGUILayout.EndHorizontal(); EditorGUI.indentLevel++; lifeTimeVelocityX.animationCurveValue = EditorGUILayout.CurveField("X", lifeTimeVelocityX.animationCurveValue); lifeTimeVelocityY.animationCurveValue = EditorGUILayout.CurveField("Y", lifeTimeVelocityY.animationCurveValue); lifeTimeVelocityZ.animationCurveValue = EditorGUILayout.CurveField("Z", lifeTimeVelocityZ.animationCurveValue); playgroundParticlesScriptReference.lifetimeVelocityScale = EditorGUILayout.FloatField (playgroundLanguage.scale, playgroundParticlesScriptReference.lifetimeVelocityScale); EditorGUI.indentLevel--; } EditorGUILayout.EndVertical(); GUI.enabled = true; // Velocity Bending EditorGUILayout.BeginVertical (boxStyle); GUILayout.BeginHorizontal(); playgroundSettings.forceVelocityBendingFoldout = GUILayout.Toggle(playgroundSettings.forceVelocityBendingFoldout, playgroundLanguage.velocityBending, EditorStyles.foldout); GUILayout.Label ((applyVelocityBending.boolValue?playgroundLanguage.on:playgroundLanguage.off), EditorStyles.miniLabel, GUILayout.ExpandWidth(false)); GUILayout.EndHorizontal(); if (playgroundSettings.forceVelocityBendingFoldout) { GUI.enabled = !onlySourcePositioning.boolValue&&!playgroundParticlesScriptReference.onlyLifetimePositioning; applyVelocityBending.boolValue = EditorGUILayout.ToggleLeft(playgroundLanguage.velocityBending, applyVelocityBending.boolValue); GUI.enabled = (applyVelocityBending.boolValue&&!onlySourcePositioning.boolValue&&!playgroundParticlesScriptReference.onlyLifetimePositioning); EditorGUI.indentLevel++; EditorGUILayout.PropertyField (velocityBendingType, new GUIContent(playgroundLanguage.type)); playgroundParticlesScriptReference.velocityBending = EditorGUILayout.Vector3Field(playgroundLanguage.bending, playgroundParticlesScriptReference.velocityBending); EditorGUI.indentLevel--; EditorGUILayout.Separator(); } EditorGUILayout.EndVertical(); GUI.enabled = true; // Turbulence EditorGUILayout.BeginVertical (boxStyle); GUILayout.BeginHorizontal(); playgroundSettings.forceTurbulenceFoldout = GUILayout.Toggle(playgroundSettings.forceTurbulenceFoldout, playgroundLanguage.turbulence, EditorStyles.foldout); GUILayout.Label ((playgroundParticlesScriptReference.turbulenceType==TURBULENCETYPE.None?playgroundLanguage.off:playgroundLanguage.on), EditorStyles.miniLabel, GUILayout.ExpandWidth(false)); GUILayout.EndHorizontal(); if (playgroundSettings.forceTurbulenceFoldout) { GUI.enabled = !onlySourcePositioning.boolValue&&!playgroundParticlesScriptReference.onlyLifetimePositioning; playgroundParticlesScriptReference.turbulenceType = (TURBULENCETYPE)EditorGUILayout.EnumPopup(playgroundLanguage.turbulence, playgroundParticlesScriptReference.turbulenceType); GUI.enabled = (playgroundParticlesScriptReference.turbulenceType!=TURBULENCETYPE.None && !onlySourcePositioning.boolValue&&!playgroundParticlesScriptReference.onlyLifetimePositioning); EditorGUI.indentLevel++; playgroundParticlesScriptReference.turbulenceStrength = EditorGUILayout.Slider(playgroundLanguage.strength, playgroundParticlesScriptReference.turbulenceStrength, 0f, playgroundSettings.maximumAllowedTurbulenceStrength); playgroundParticlesScriptReference.turbulenceScale = EditorGUILayout.Slider(playgroundLanguage.scale, playgroundParticlesScriptReference.turbulenceScale, 0f, playgroundSettings.maximumAllowedTurbulenceScale); playgroundParticlesScriptReference.turbulenceTimeScale = EditorGUILayout.Slider(playgroundLanguage.timeScale, playgroundParticlesScriptReference.turbulenceTimeScale, 0f, playgroundSettings.maximumAllowedTurbulenceTimeScale); EditorGUILayout.BeginHorizontal(); playgroundParticlesScriptReference.turbulenceApplyLifetimeStrength = EditorGUILayout.ToggleLeft (playgroundLanguage.lifetimeStrength, playgroundParticlesScriptReference.turbulenceApplyLifetimeStrength, GUILayout.MaxWidth(Mathf.CeilToInt(EditorGUIUtility.labelWidth)-28)); GUI.enabled = (playgroundParticlesScriptReference.turbulenceApplyLifetimeStrength && playgroundParticlesScriptReference.turbulenceType!=TURBULENCETYPE.None && !onlySourcePositioning.boolValue&&!playgroundParticlesScriptReference.onlyLifetimePositioning); turbulenceLifetimeStrength.animationCurveValue = EditorGUILayout.CurveField(turbulenceLifetimeStrength.animationCurveValue); EditorGUILayout.EndHorizontal(); EditorGUI.indentLevel--; } EditorGUILayout.EndVertical(); GUI.enabled = true; // Constant Force EditorGUILayout.BeginVertical (boxStyle); GUILayout.BeginHorizontal(); playgroundSettings.forceConstantForceFoldout = GUILayout.Toggle(playgroundSettings.forceConstantForceFoldout, playgroundLanguage.constantForce, EditorStyles.foldout); GUILayout.Label ((playgroundParticlesScriptReference.gravity==Vector3.zero&&playgroundParticlesScriptReference.damping==0?playgroundLanguage.off:playgroundLanguage.on), EditorStyles.miniLabel, GUILayout.ExpandWidth(false)); GUILayout.EndHorizontal(); if (playgroundSettings.forceConstantForceFoldout) { GUI.enabled = !onlySourcePositioning.boolValue&&!playgroundParticlesScriptReference.onlyLifetimePositioning; playgroundParticlesScriptReference.gravity = EditorGUILayout.Vector3Field(playgroundLanguage.gravity, playgroundParticlesScriptReference.gravity); playgroundParticlesScriptReference.damping = EditorGUILayout.Slider(playgroundLanguage.damping, playgroundParticlesScriptReference.damping, 0f, playgroundSettings.maximumAllowedDamping); playgroundParticlesScriptReference.velocityScale = EditorGUILayout.Slider(playgroundLanguage.velocityScale, playgroundParticlesScriptReference.velocityScale, 0f, playgroundSettings.maximumAllowedVelocity); } EditorGUILayout.EndVertical(); GUI.enabled = true; } // Collision Settings if (GUILayout.Button(collision.boolValue?collisionType.intValue==0?playgroundLanguage.collision+" ("+playgroundLanguage.threeDimensional+")":playgroundLanguage.collision+" ("+playgroundLanguage.twoDimensional+")":playgroundLanguage.collision+" ("+playgroundLanguage.off+")", EditorStyles.toolbarDropDown)) playgroundSettings.collisionFoldout=!playgroundSettings.collisionFoldout; if (playgroundSettings.collisionFoldout) { if (playgroundParticlesScriptReference.onlySourcePositioning||playgroundParticlesScriptReference.onlyLifetimePositioning) { EditorGUILayout.HelpBox(playgroundLanguage.collisionDisabledDescription, MessageType.Info); EditorGUILayout.Separator(); } EditorGUILayout.BeginVertical(boxStyle); GUILayout.BeginHorizontal(); playgroundSettings.collisionSettingsFoldout = GUILayout.Toggle(playgroundSettings.collisionSettingsFoldout, playgroundLanguage.collisionSettings, EditorStyles.foldout); GUILayout.Label ((collision.boolValue?playgroundLanguage.on:playgroundLanguage.off), EditorStyles.miniLabel, GUILayout.ExpandWidth(false)); GUILayout.EndHorizontal(); if (playgroundSettings.collisionSettingsFoldout) { GUI.enabled = !playgroundParticlesScriptReference.onlySourcePositioning&&!playgroundParticlesScriptReference.onlyLifetimePositioning; collision.boolValue = EditorGUILayout.ToggleLeft(playgroundLanguage.collision, collision.boolValue); EditorGUI.indentLevel++; GUI.enabled = GUI.enabled&&collision.boolValue; EditorGUILayout.PropertyField(collisionType, new GUIContent(playgroundLanguage.collisionType)); if (collisionType.enumValueIndex==1) { GUILayout.BeginHorizontal(); GUILayout.Space (16); GUILayout.Label(playgroundLanguage.depth); EditorGUILayout.Separator(); float minDepth = playgroundParticlesScriptReference.minCollisionDepth; float maxDepth = playgroundParticlesScriptReference.maxCollisionDepth; EditorGUILayout.MinMaxSlider(ref minDepth, ref maxDepth, -playgroundSettings.maximumAllowedDepth, playgroundSettings.maximumAllowedDepth, GUILayout.Width(Mathf.CeilToInt(Screen.width/1.805f)-110)); playgroundParticlesScriptReference.minCollisionDepth = Mathf.Clamp (minDepth, -playgroundSettings.maximumAllowedDepth, playgroundSettings.maximumAllowedDepth); playgroundParticlesScriptReference.maxCollisionDepth = Mathf.Clamp (maxDepth, -playgroundSettings.maximumAllowedDepth, playgroundSettings.maximumAllowedDepth); playgroundParticlesScriptReference.minCollisionDepth = EditorGUILayout.FloatField(playgroundParticlesScriptReference.minCollisionDepth, GUILayout.Width(50)); playgroundParticlesScriptReference.maxCollisionDepth = EditorGUILayout.FloatField(playgroundParticlesScriptReference.maxCollisionDepth, GUILayout.Width(50)); GUILayout.EndHorizontal(); } EditorGUILayout.PropertyField(collisionMask, new GUIContent(playgroundLanguage.collisionMask)); affectRigidbodies.boolValue = EditorGUILayout.Toggle(playgroundLanguage.collideWithRigidbodies, affectRigidbodies.boolValue); playgroundParticlesScriptReference.inverseRigidbodyCollision = EditorGUILayout.Toggle (playgroundLanguage.inverseRigidbodyCollision, playgroundParticlesScriptReference.inverseRigidbodyCollision); playgroundParticlesScriptReference.maskedParticlesBypassCollision = EditorGUILayout.Toggle (playgroundLanguage.bypassMaskedParticles, playgroundParticlesScriptReference.maskedParticlesBypassCollision); mass.floatValue = EditorGUILayout.Slider(playgroundLanguage.mass, mass.floatValue, 0, playgroundSettings.maximumAllowedMass); collisionRadius.floatValue = EditorGUILayout.Slider(playgroundLanguage.collisionRadius, collisionRadius.floatValue, 0, playgroundSettings.maximumAllowedCollisionRadius); playgroundParticlesScriptReference.lifetimeLoss = EditorGUILayout.Slider(playgroundLanguage.lifetimeLoss, playgroundParticlesScriptReference.lifetimeLoss, 0f, 1f); EditorGUILayout.Separator(); playgroundParticlesScriptReference.stickyCollisions = EditorGUILayout.Toggle (playgroundLanguage.sticky, playgroundParticlesScriptReference.stickyCollisions); if (playgroundParticlesScriptReference.stickyCollisions) { EditorGUI.indentLevel++; playgroundParticlesScriptReference.stickyCollisionsSurfaceOffset = EditorGUILayout.FloatField (playgroundLanguage.surfaceOffset, playgroundParticlesScriptReference.stickyCollisionsSurfaceOffset); EditorGUILayout.PropertyField(stickyCollisionMask, new GUIContent(playgroundLanguage.stickyMask)); EditorGUI.indentLevel--; } GUI.enabled = GUI.enabled&&collision.boolValue; EditorGUILayout.Separator (); bounciness.floatValue = EditorGUILayout.Slider(playgroundLanguage.bounciness, bounciness.floatValue, 0, playgroundSettings.maximumAllowedBounciness); GUI.enabled = collision.boolValue; EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel(playgroundLanguage.randomBounce); EditorGUILayout.Separator (); if (GUILayout.Button (playgroundLanguage.reset, EditorStyles.toolbarButton, GUILayout.ExpandWidth(false))) { playgroundParticlesScriptReference.bounceRandomMin = Vector3.zero; playgroundParticlesScriptReference.bounceRandomMax = Vector3.zero; } EditorGUILayout.EndHorizontal(); // X GUILayout.BeginHorizontal(); GUILayout.Space(32); GUILayout.Label("X", GUILayout.Width(50)); EditorGUILayout.Separator(); float bounceRandomMinX = playgroundParticlesScriptReference.bounceRandomMin.x; float bounceRandomMaxX = playgroundParticlesScriptReference.bounceRandomMax.x; EditorGUILayout.MinMaxSlider(ref bounceRandomMinX, ref bounceRandomMaxX, -1f, 1f, GUILayout.Width(Mathf.CeilToInt(Screen.width/1.805f)-100)); playgroundParticlesScriptReference.bounceRandomMin.x = Mathf.Clamp (bounceRandomMinX, -1f, 1f); playgroundParticlesScriptReference.bounceRandomMax.x = Mathf.Clamp (bounceRandomMaxX, -1f, 1f); playgroundParticlesScriptReference.bounceRandomMin.x = EditorGUILayout.FloatField(playgroundParticlesScriptReference.bounceRandomMin.x, GUILayout.Width(50)); playgroundParticlesScriptReference.bounceRandomMax.x = EditorGUILayout.FloatField(playgroundParticlesScriptReference.bounceRandomMax.x, GUILayout.Width(50)); GUILayout.EndHorizontal(); // Y GUILayout.BeginHorizontal(); GUILayout.Space(32); GUILayout.Label("Y"); EditorGUILayout.Separator(); float bounceRandomMinY = playgroundParticlesScriptReference.bounceRandomMin.y; float bounceRandomMaxY = playgroundParticlesScriptReference.bounceRandomMax.y; EditorGUILayout.MinMaxSlider(ref bounceRandomMinY, ref bounceRandomMaxY, -1f, 1f, GUILayout.Width(Mathf.CeilToInt(Screen.width/1.805f)-100)); playgroundParticlesScriptReference.bounceRandomMin.y = Mathf.Clamp (bounceRandomMinY, -1f, 1f); playgroundParticlesScriptReference.bounceRandomMax.y = Mathf.Clamp (bounceRandomMaxY, -1f, 1f); playgroundParticlesScriptReference.bounceRandomMin.y = EditorGUILayout.FloatField(playgroundParticlesScriptReference.bounceRandomMin.y, GUILayout.Width(50)); playgroundParticlesScriptReference.bounceRandomMax.y = EditorGUILayout.FloatField(playgroundParticlesScriptReference.bounceRandomMax.y, GUILayout.Width(50)); GUILayout.EndHorizontal(); // Z GUILayout.BeginHorizontal(); GUILayout.Space(32); GUILayout.Label("Z"); EditorGUILayout.Separator(); float bounceRandomMinZ = playgroundParticlesScriptReference.bounceRandomMin.z; float bounceRandomMaxZ = playgroundParticlesScriptReference.bounceRandomMax.z; EditorGUILayout.MinMaxSlider(ref bounceRandomMinZ, ref bounceRandomMaxZ, -1f, 1f, GUILayout.Width(Mathf.CeilToInt(Screen.width/1.805f)-100)); playgroundParticlesScriptReference.bounceRandomMin.z = Mathf.Clamp (bounceRandomMinZ, -1f, 1f); playgroundParticlesScriptReference.bounceRandomMax.z = Mathf.Clamp (bounceRandomMaxZ, -1f, 1f); playgroundParticlesScriptReference.bounceRandomMin.z = EditorGUILayout.FloatField(playgroundParticlesScriptReference.bounceRandomMin.z, GUILayout.Width(50)); playgroundParticlesScriptReference.bounceRandomMax.z = EditorGUILayout.FloatField(playgroundParticlesScriptReference.bounceRandomMax.z, GUILayout.Width(50)); GUILayout.EndHorizontal(); EditorGUILayout.Separator(); playgroundParticlesScriptReference.collisionPrecision = EditorGUILayout.Toggle (playgroundLanguage.collisionPrecision, playgroundParticlesScriptReference.collisionPrecision); playgroundParticlesScriptReference.forceCollisionCaching = EditorGUILayout.Toggle (playgroundLanguage.forceCollisionCaching, playgroundParticlesScriptReference.forceCollisionCaching); EditorGUILayout.Separator(); EditorGUI.indentLevel--; } EditorGUILayout.EndVertical(); // Collision planes List GUI.enabled = true; EditorGUILayout.BeginVertical(boxStyle); GUILayout.BeginHorizontal(); playgroundSettings.collisionPlanesFoldout = GUILayout.Toggle(playgroundSettings.collisionPlanesFoldout, playgroundLanguage.collisionPlanes, EditorStyles.foldout); GUILayout.Label (playgroundParticlesScriptReference.colliders.Count.ToString(), EditorStyles.miniLabel, GUILayout.ExpandWidth(false)); GUILayout.EndHorizontal(); if (playgroundSettings.collisionPlanesFoldout) { if (playgroundParticlesScriptReference.colliders.Count>0) { for (int c = 0; c0) { for (int c = 0; c0) { SerializedProperty thisLifetimeColor; for (int c = 0; c0) { if (PlaygroundInspectorC.playgroundSettings==null) PlaygroundInspectorC.playgroundSettings = PlaygroundSettingsC.GetReference(); if (PlaygroundInspectorC.playgroundLanguage==null) PlaygroundInspectorC.playgroundLanguage = PlaygroundSettingsC.GetLanguage(); string mName; for (int i = 0; i24) mName = mName.Substring(0, 24)+"..."; } else { GUI.color = Color.red; mName = "("+playgroundLanguage.missingTransform+")"; } EditorGUILayout.BeginVertical("box"); EditorGUILayout.BeginHorizontal(); GUILayout.Label(i.ToString(), EditorStyles.miniLabel, GUILayout.Width(18)); playgroundParticlesScriptReference.manipulators[i].unfolded = GUILayout.Toggle(playgroundParticlesScriptReference.manipulators[i].unfolded, PlaygroundInspectorC.ManipulatorTypeName(playgroundParticlesScriptReference.manipulators[i].type), EditorStyles.foldout, GUILayout.Width(Screen.width/4)); if (playgroundParticlesScriptReference.manipulators[i].transform.available && playgroundParticlesScriptReference.manipulators[i].transform.transform!=null) { if (GUILayout.Button(" ("+mName+")", EditorStyles.label)) { Selection.activeGameObject = playgroundParticlesScriptReference.manipulators[i].transform.transform.gameObject; } } else { GUILayout.Button(PlaygroundInspectorC.ManipulatorTypeName(playgroundParticlesScriptReference.manipulators[i].type)+" ("+playgroundLanguage.missingTransform+")", EditorStyles.label); } GUI.contentColor = Color.white; EditorGUILayout.Separator(); GUI.enabled = (playgroundParticlesScriptReference.manipulators.Count>1); if(GUILayout.Button(playgroundLanguage.upSymbol, EditorStyles.toolbarButton, new GUILayoutOption[]{GUILayout.Width(18), GUILayout.Height(16)})){ manipulators.MoveArrayElement(i, i==0?playgroundParticlesScriptReference.manipulators.Count-1:i-1); } if(GUILayout.Button(playgroundLanguage.downSymbol, EditorStyles.toolbarButton, new GUILayoutOption[]{GUILayout.Width(18), GUILayout.Height(16)})){ manipulators.MoveArrayElement(i, i0) { Transform mTrans = new GameObject().transform; mTrans.parent = playgroundParticlesScriptReference.particleSystemTransform; mTrans.localPosition = Vector3.up; if (playgroundParticlesScriptReference.manipulators.Count>0) mTrans.name = "Manipulator "+(playgroundParticlesScriptReference.manipulators.Count+1)+" ("+playgroundParticlesScriptReference.name+")"; else mTrans.name = "Manipulator "+"("+playgroundParticlesScriptReference.name+")"; PlaygroundC.ManipulatorObject(mTrans, playgroundParticlesScriptReference); } else { manipulators.InsertArrayElementAtIndex(manipulators.arraySize); } SceneView.RepaintAll(); } EditorGUILayout.Separator(); } // Event Settings if (GUILayout.Button(playgroundLanguage.events+" ("+playgroundParticlesScriptReference.events.Count+")", EditorStyles.toolbarDropDown)) playgroundSettings.eventsFoldout=!playgroundSettings.eventsFoldout; if (playgroundSettings.eventsFoldout) { EditorGUILayout.Separator(); if (playgroundParticlesScriptReference.events.Count>0) { if (playgroundParticlesScriptReference.events.Count!=eventListFoldout.Count) { eventListFoldout = new List(); eventListFoldout.AddRange(new bool[playgroundParticlesScriptReference.events.Count]); } string eName; for (int i = 0; i24) eName = eName.Substring(0, 24)+"..."; } else eName = "("+playgroundLanguage.noTarget+")"; } else eName = "("+playgroundLanguage.eventListener+")"; EditorGUILayout.BeginVertical("box"); EditorGUILayout.BeginHorizontal(); GUILayout.Label(i.ToString(), EditorStyles.miniLabel, GUILayout.Width(18)); eventListFoldout[i] = GUILayout.Toggle(eventListFoldout[i], playgroundParticlesScriptReference.events[i].eventType.ToString(), EditorStyles.foldout, GUILayout.Width(Screen.width/4)); if (playgroundParticlesScriptReference.events[i].target!=null) { if (GUILayout.Button(" ("+eName+")", EditorStyles.label)) { Selection.activeGameObject = playgroundParticlesScriptReference.events[i].target.gameObject; } } else { GUILayout.Button(eName, EditorStyles.label); } EditorGUILayout.Separator(); GUI.enabled = (playgroundParticlesScriptReference.events.Count>1); if(GUILayout.Button(playgroundLanguage.upSymbol, EditorStyles.toolbarButton, new GUILayoutOption[]{GUILayout.Width(18), GUILayout.Height(16)})){ events.MoveArrayElement(i, i==0?playgroundParticlesScriptReference.events.Count-1:i-1); } if(GUILayout.Button(playgroundLanguage.downSymbol, EditorStyles.toolbarButton, new GUILayoutOption[]{GUILayout.Width(18), GUILayout.Height(16)})){ events.MoveArrayElement(i, i0 && isEditingInHierarchy) { GUILayout.BeginHorizontal(); playgroundParticlesScriptReference.loadTransition = EditorGUILayout.ToggleLeft(playgroundLanguage.transitionTime, playgroundParticlesScriptReference.loadTransition, GUILayout.Width (Mathf.CeilToInt((Screen.width-140)/2))); GUI.enabled = playgroundParticlesScriptReference.loadTransition; playgroundParticlesScriptReference.loadTransitionTime = EditorGUILayout.Slider(playgroundParticlesScriptReference.loadTransitionTime, 0, playgroundSettings.maximumAllowedTransitionTime); GUILayout.EndHorizontal(); EditorGUI.indentLevel++; playgroundParticlesScriptReference.loadTransitionType = (TRANSITIONTYPEC)EditorGUILayout.EnumPopup(playgroundLanguage.transitionType, playgroundParticlesScriptReference.loadTransitionType); EditorGUI.indentLevel--; GUI.enabled = true; EditorGUILayout.Separator(); playgroundParticlesScriptReference.loadFromStart = EditorGUILayout.ToggleLeft(playgroundLanguage.loadFromStart, playgroundParticlesScriptReference.loadFromStart); for (int i = 0; i1); if(GUILayout.Button(playgroundLanguage.upSymbol, EditorStyles.toolbarButton, new GUILayoutOption[]{GUILayout.Width(18), GUILayout.Height(16)})){ snapshots.MoveArrayElement(i, i==0?playgroundParticlesScriptReference.snapshots.Count-1:i-1); } if(GUILayout.Button(playgroundLanguage.downSymbol, EditorStyles.toolbarButton, new GUILayoutOption[]{GUILayout.Width(18), GUILayout.Height(16)})){ snapshots.MoveArrayElement(i, i=playgroundParticlesScriptReference.snapshots.Count) playgroundParticlesScriptReference.loadFrom = playgroundParticlesScriptReference.snapshots.Count-1; return; } } GUILayout.EndHorizontal(); if (PlaygroundC.reference.showSnapshotsInHierarchy && playgroundParticlesScriptReference.snapshots[i].unfolded) { EditorGUILayout.Separator(); EditorGUI.indentLevel+=3; PlaygroundParticlesC currentSnapshot = playgroundParticlesScriptReference.snapshots[i].settings; playgroundParticlesScriptReference.snapshots[i].settings = (PlaygroundParticlesC)EditorGUILayout.ObjectField(playgroundLanguage.snapshot, playgroundParticlesScriptReference.snapshots[i].settings, typeof(PlaygroundParticlesC), true); if (playgroundParticlesScriptReference.snapshots[i].settings!=currentSnapshot) { if (!playgroundParticlesScriptReference.snapshots[i].settings.isSnapshot) { EditorUtility.DisplayDialog( playgroundParticlesScriptReference.snapshots[i].settings.name+" "+playgroundLanguage.notSnapshot, playgroundLanguage.notSnapshotText, playgroundLanguage.ok ); playgroundParticlesScriptReference.snapshots[i].settings = currentSnapshot; continue; } } GUI.enabled = playgroundParticlesScriptReference.loadTransition; playgroundParticlesScriptReference.snapshots[i].transitionType = (INDIVIDUALTRANSITIONTYPEC)EditorGUILayout.EnumPopup(playgroundLanguage.transitionType, playgroundParticlesScriptReference.snapshots[i].transitionType); playgroundParticlesScriptReference.snapshots[i].transitionMultiplier = EditorGUILayout.FloatField(playgroundLanguage.transitionTimeMultiplier, playgroundParticlesScriptReference.snapshots[i].transitionMultiplier); playgroundParticlesScriptReference.snapshots[i].setMaterialAfterTransition = EditorGUILayout.Toggle(playgroundLanguage.setMaterialAfterTransition, playgroundParticlesScriptReference.snapshots[i].setMaterialAfterTransition); GUI.enabled = true; EditorGUI.indentLevel-=3; EditorGUILayout.Separator(); } GUILayout.EndVertical (); } EditorGUILayout.Separator(); } else { if (playgroundParticlesScriptReference.snapshots.Count>0) EditorGUILayout.HelpBox(playgroundLanguage.editFromHierarchyOnly, MessageType.Info); else EditorGUILayout.HelpBox(playgroundLanguage.noSnapshots, MessageType.Info); } if (isEditingInHierarchy) { GUILayout.BeginHorizontal(); if(GUILayout.Button(playgroundLanguage.save, EditorStyles.toolbarButton, GUILayout.ExpandWidth(false))){ saveName = playgroundLanguage.newSnapshotName+" "+(playgroundParticlesScriptReference.snapshots.Count+1).ToString(); playgroundParticlesScriptReference.SaveAsynchronous(saveName); if (playgroundParticlesScriptReference.loadFrom>=playgroundParticlesScriptReference.snapshots.Count && playgroundParticlesScriptReference.snapshots.Count>0) playgroundParticlesScriptReference.loadFrom = playgroundParticlesScriptReference.snapshots.Count-1; } GUI.enabled = (playgroundParticlesScriptReference.snapshots.Count>0); if(GUILayout.Button(playgroundLanguage.load, EditorStyles.toolbarButton, GUILayout.ExpandWidth(false))){ playgroundParticlesScriptReference.Load(playgroundParticlesScriptReference.loadFrom); } GUILayout.FlexibleSpace(); if (playgroundScriptReference!=null) { if(GUILayout.Button(playgroundScriptReference.showSnapshotsInHierarchy?playgroundLanguage.simple:playgroundLanguage.advanced, EditorStyles.toolbarButton, GUILayout.ExpandWidth(false))){ playgroundScriptReference.showSnapshotsInHierarchy = !playgroundScriptReference.showSnapshotsInHierarchy; PlaygroundInspectorC.UpdateSnapshots(); } } if(GUILayout.Button(playgroundLanguage.removeAll, EditorStyles.toolbarButton, GUILayout.ExpandWidth(false))){ if (EditorUtility.DisplayDialog( playgroundLanguage.removeAllSnapshots, playgroundLanguage.removeAllSnapshotsText, playgroundLanguage.yes, playgroundLanguage.no)) { for (int s = 0; s().simulationSpace==ParticleSystemSimulationSpace.Local?playgroundLanguage.localSpace:playgroundLanguage.globalSpace; if (GUILayout.Button(playgroundLanguage.advanced+" ("+localSimulationSpaceName+")", EditorStyles.toolbarDropDown)) playgroundSettings.advancedFoldout=!playgroundSettings.advancedFoldout; if (playgroundSettings.advancedFoldout) { // Simulation space GUILayout.BeginVertical(boxStyle); GUILayout.BeginHorizontal(); playgroundSettings.advancedSimulationFoldout = GUILayout.Toggle(playgroundSettings.advancedSimulationFoldout, playgroundLanguage.simulationSpace, EditorStyles.foldout); GUILayout.Label (playgroundParticlesScriptReference.GetComponent().simulationSpace.ToString(), EditorStyles.miniLabel, GUILayout.ExpandWidth(false)); GUILayout.EndHorizontal(); if (playgroundSettings.advancedSimulationFoldout) { GUI.enabled = (playgroundParticlesScriptReference.source!=SOURCEC.Projection); playgroundParticlesScriptReference.GetComponent().simulationSpace = (ParticleSystemSimulationSpace)EditorGUILayout.EnumPopup(playgroundLanguage.simulationSpace, playgroundParticlesScriptReference.GetComponent().simulationSpace); GUI.enabled = true; if (playgroundParticlesScriptReference.GetComponent().simulationSpace==ParticleSystemSimulationSpace.Local && playgroundParticlesScriptReference.source!=SOURCEC.Projection) { playgroundParticlesScriptReference.applyLocalSpaceMovementCompensation = EditorGUILayout.ToggleLeft (playgroundLanguage.movementCompensation, playgroundParticlesScriptReference.applyLocalSpaceMovementCompensation); GUI.enabled = playgroundParticlesScriptReference.applyLocalSpaceMovementCompensation; GUILayout.BeginHorizontal(); EditorGUI.indentLevel++; playgroundParticlesScriptReference.applyMovementCompensationLifetimeStrength = EditorGUILayout.ToggleLeft (playgroundLanguage.movementCompensationLifetimeStrength, playgroundParticlesScriptReference.applyMovementCompensationLifetimeStrength, GUILayout.MaxWidth(Mathf.CeilToInt(EditorGUIUtility.labelWidth)-20)); GUI.enabled = playgroundParticlesScriptReference.applyLocalSpaceMovementCompensation && playgroundParticlesScriptReference.applyMovementCompensationLifetimeStrength; movementCompensationLifetimeStrength.animationCurveValue = EditorGUILayout.CurveField(movementCompensationLifetimeStrength.animationCurveValue); GUILayout.EndHorizontal(); GUI.enabled = true; EditorGUI.indentLevel--; if (playgroundParticlesScriptReference.applyLocalSpaceMovementCompensation && playgroundParticlesScriptReference.source==SOURCEC.Transform && playgroundParticlesScriptReference.sourceTransforms!=null && playgroundParticlesScriptReference.sourceTransforms[0].transform!=null && playgroundParticlesScriptReference.particleSystemTransform==playgroundParticlesScriptReference.sourceTransforms[0].transform) EditorGUILayout.HelpBox(playgroundLanguage.useAnotherSourceTransform, MessageType.Warning); } else if (playgroundParticlesScriptReference.source==SOURCEC.Projection) { EditorGUILayout.HelpBox(playgroundLanguage.projectionOnlyWorldSpace, MessageType.Info); } } GUILayout.EndVertical(); EditorGUILayout.BeginVertical(boxStyle); GUILayout.BeginHorizontal(); playgroundSettings.advancedTimeFoldout = GUILayout.Toggle(playgroundSettings.advancedTimeFoldout, playgroundLanguage.time, EditorStyles.foldout); GUILayout.Label (playgroundParticlesScriptReference.particleTimescale.ToString("F1"), EditorStyles.miniLabel, GUILayout.ExpandWidth(false)); GUILayout.EndHorizontal(); if (playgroundSettings.advancedTimeFoldout) { // Update rate updateRate.intValue = EditorGUILayout.IntSlider(playgroundLanguage.updateRate, updateRate.intValue, playgroundSettings.minimumAllowedUpdateRate, 1); // Time scale playgroundParticlesScriptReference.particleTimescale = EditorGUILayout.Slider (playgroundLanguage.timeScale, playgroundParticlesScriptReference.particleTimescale, 0, playgroundSettings.maximumAllowedTimescale); } EditorGUILayout.EndVertical(); // Rebirth Options GUILayout.BeginVertical(boxStyle); GUILayout.BeginHorizontal(); bool hasRebirthOptions = playgroundParticlesScriptReference.applyRandomLifetimeOnRebirth|| playgroundParticlesScriptReference.applyRandomSizeOnRebirth|| playgroundParticlesScriptReference.applyRandomRotationOnRebirth|| playgroundParticlesScriptReference.applyRandomScatterOnRebirth|| playgroundParticlesScriptReference.applyRandomInitialVelocityOnRebirth|| playgroundParticlesScriptReference.applyInitialColorOnRebirth|| playgroundParticlesScriptReference.applyDeltaOnRebirth|| playgroundParticlesScriptReference.calculateManipulatorOnRebirth; playgroundSettings.advancedRebirthOptionsFoldout = GUILayout.Toggle(playgroundSettings.advancedRebirthOptionsFoldout, playgroundLanguage.rebirthOptions, EditorStyles.foldout); GUILayout.Label (hasRebirthOptions?playgroundLanguage.on:playgroundLanguage.off, EditorStyles.miniLabel, GUILayout.ExpandWidth(false)); GUILayout.EndHorizontal(); if (playgroundSettings.advancedRebirthOptionsFoldout) { playgroundParticlesScriptReference.applyRandomLifetimeOnRebirth = EditorGUILayout.Toggle (playgroundLanguage.randomLifetime, playgroundParticlesScriptReference.applyRandomLifetimeOnRebirth); playgroundParticlesScriptReference.applyRandomSizeOnRebirth = EditorGUILayout.Toggle (playgroundLanguage.randomSize, playgroundParticlesScriptReference.applyRandomSizeOnRebirth); playgroundParticlesScriptReference.applyRandomRotationOnRebirth = EditorGUILayout.Toggle (playgroundLanguage.randomRotation, playgroundParticlesScriptReference.applyRandomRotationOnRebirth); playgroundParticlesScriptReference.applyRandomScatterOnRebirth = EditorGUILayout.Toggle (playgroundLanguage.randomScatter, playgroundParticlesScriptReference.applyRandomScatterOnRebirth); playgroundParticlesScriptReference.applyRandomInitialVelocityOnRebirth = EditorGUILayout.Toggle (playgroundLanguage.randomVelocity, playgroundParticlesScriptReference.applyRandomInitialVelocityOnRebirth); playgroundParticlesScriptReference.applyInitialColorOnRebirth = EditorGUILayout.Toggle (playgroundLanguage.forceInitialColor, playgroundParticlesScriptReference.applyInitialColorOnRebirth); playgroundParticlesScriptReference.applyDeltaOnRebirth = EditorGUILayout.Toggle (playgroundLanguage.deltaPositionAdjustment, playgroundParticlesScriptReference.applyDeltaOnRebirth); playgroundParticlesScriptReference.calculateManipulatorOnRebirth = EditorGUILayout.Toggle (playgroundLanguage.calculateManipulator, playgroundParticlesScriptReference.calculateManipulatorOnRebirth); } GUILayout.EndVertical(); // Locks GUILayout.BeginVertical(boxStyle); GUILayout.BeginHorizontal(); playgroundSettings.advancedLocksFoldout = GUILayout.Toggle(playgroundSettings.advancedLocksFoldout, playgroundLanguage.locks, EditorStyles.foldout); GUILayout.Label ((playgroundParticlesScriptReference.applyLockPosition||playgroundParticlesScriptReference.applyLockRotation||playgroundParticlesScriptReference.applyLockScale?playgroundLanguage.on:playgroundLanguage.off), EditorStyles.miniLabel, GUILayout.ExpandWidth(false)); GUILayout.EndHorizontal(); if (playgroundSettings.advancedLocksFoldout) { playgroundParticlesScriptReference.applyLockPosition = EditorGUILayout.ToggleLeft(playgroundLanguage.lockPosition, playgroundParticlesScriptReference.applyLockPosition); GUI.enabled = playgroundParticlesScriptReference.applyLockPosition; EditorGUI.indentLevel++; playgroundParticlesScriptReference.lockPosition = EditorGUILayout.Vector3Field (playgroundLanguage.position, playgroundParticlesScriptReference.lockPosition); playgroundParticlesScriptReference.lockPositionIsLocal = EditorGUILayout.Toggle(playgroundLanguage.positionIsLocal, playgroundParticlesScriptReference.lockPositionIsLocal); EditorGUI.indentLevel--; GUI.enabled = true; EditorGUILayout.Separator(); playgroundParticlesScriptReference.applyLockRotation = EditorGUILayout.ToggleLeft(playgroundLanguage.lockRotation, playgroundParticlesScriptReference.applyLockRotation); GUI.enabled = playgroundParticlesScriptReference.applyLockRotation; EditorGUI.indentLevel++; playgroundParticlesScriptReference.lockRotation = EditorGUILayout.Vector3Field (playgroundLanguage.rotation, playgroundParticlesScriptReference.lockRotation); playgroundParticlesScriptReference.lockRotationIsLocal = EditorGUILayout.Toggle(playgroundLanguage.rotationIsLocal, playgroundParticlesScriptReference.lockRotationIsLocal); EditorGUI.indentLevel--; GUI.enabled = true; EditorGUILayout.Separator(); playgroundParticlesScriptReference.applyLockScale = EditorGUILayout.ToggleLeft(playgroundLanguage.lockScale, playgroundParticlesScriptReference.applyLockScale); GUI.enabled = playgroundParticlesScriptReference.applyLockScale; EditorGUI.indentLevel++; playgroundParticlesScriptReference.lockScale = EditorGUILayout.Vector3Field (playgroundLanguage.scale, playgroundParticlesScriptReference.lockScale); EditorGUI.indentLevel--; GUI.enabled = true; } GUILayout.EndVertical(); // On Enable (Prewarm) GUILayout.BeginVertical(boxStyle); GUILayout.BeginHorizontal(); playgroundSettings.advancedOnEnableFoldout = GUILayout.Toggle(playgroundSettings.advancedOnEnableFoldout, playgroundLanguage.onEnable, EditorStyles.foldout); GUILayout.Label (playgroundLanguage.prewarm+" "+(playgroundParticlesScriptReference.prewarm?playgroundLanguage.on:playgroundLanguage.off), EditorStyles.miniLabel, GUILayout.ExpandWidth(false)); GUILayout.EndHorizontal(); if (playgroundSettings.advancedOnEnableFoldout) { bool previousPrewarm = playgroundParticlesScriptReference.prewarm; float previousPrewarmTime = playgroundParticlesScriptReference.prewarmTime; int previousPrewarmCycles = playgroundParticlesScriptReference.prewarmCycles; playgroundParticlesScriptReference.prewarm = EditorGUILayout.ToggleLeft (playgroundLanguage.prewarm, playgroundParticlesScriptReference.prewarm); GUI.enabled = playgroundParticlesScriptReference.prewarm; EditorGUI.indentLevel++; playgroundParticlesScriptReference.prewarmTime = EditorGUILayout.Slider (playgroundLanguage.prewarmLifetimeCycles, playgroundParticlesScriptReference.prewarmTime, 0, 2f); playgroundParticlesScriptReference.prewarmCycles = EditorGUILayout.IntField (playgroundLanguage.prewarmCyclesResolution, playgroundParticlesScriptReference.prewarmCycles); playgroundParticlesScriptReference.prewarmCycles = Mathf.Clamp (playgroundParticlesScriptReference.prewarmCycles, 8, playgroundSettings.maximumAllowedPrewarmCycles); EditorGUI.indentLevel--; if (previousPrewarm != playgroundParticlesScriptReference.prewarm || previousPrewarmTime != playgroundParticlesScriptReference.prewarmTime || previousPrewarmCycles != playgroundParticlesScriptReference.prewarmCycles) LifetimeSorting(); GUI.enabled = true; } GUILayout.EndVertical(); // Auto Pause GUILayout.BeginVertical(boxStyle); GUILayout.BeginHorizontal(); playgroundSettings.advancedAutoPauseFoldout = GUILayout.Toggle(playgroundSettings.advancedAutoPauseFoldout, playgroundLanguage.outOfView, EditorStyles.foldout); GUILayout.Label (playgroundLanguage.autoPause+" "+(playgroundParticlesScriptReference.pauseCalculationWhenInvisible?playgroundLanguage.on:playgroundLanguage.off), EditorStyles.miniLabel, GUILayout.ExpandWidth(false)); GUILayout.EndHorizontal(); if (playgroundSettings.advancedAutoPauseFoldout) { playgroundParticlesScriptReference.pauseCalculationWhenInvisible = EditorGUILayout.ToggleLeft (playgroundLanguage.autoPauseCalculation, playgroundParticlesScriptReference.pauseCalculationWhenInvisible); EditorGUI.indentLevel++; GUI.enabled = playgroundParticlesScriptReference.pauseCalculationWhenInvisible; playgroundParticlesScriptReference.calculationTriggerTransform = (Transform)EditorGUILayout.ObjectField(playgroundLanguage.calculationTrigger, playgroundParticlesScriptReference.calculationTriggerTransform, typeof(Transform), true); playgroundParticlesScriptReference.calculationTriggerSize = EditorGUILayout.Vector3Field(playgroundLanguage.calculationTriggerSize, playgroundParticlesScriptReference.calculationTriggerSize); playgroundParticlesScriptReference.calculationTriggerOffset = EditorGUILayout.Vector3Field(playgroundLanguage.calculationTriggerOffset, playgroundParticlesScriptReference.calculationTriggerOffset); playgroundParticlesScriptReference.calculationTriggerSizeGizmo = EditorGUILayout.Toggle(playgroundLanguage.drawGizmo, playgroundParticlesScriptReference.calculationTriggerSizeGizmo); GUI.enabled = true; EditorGUI.indentLevel--; } EditorGUILayout.EndVertical(); // Misc GUILayout.BeginVertical(boxStyle); GUILayout.BeginHorizontal(); playgroundSettings.advancedMiscFoldout = GUILayout.Toggle(playgroundSettings.advancedMiscFoldout, playgroundLanguage.misc, EditorStyles.foldout); GUILayout.Label (playgroundLanguage.sync+" "+(playgroundParticlesScriptReference.syncPositionsOnMainThread?playgroundLanguage.on:playgroundLanguage.off), EditorStyles.miniLabel, GUILayout.ExpandWidth(false)); GUILayout.EndHorizontal(); if (playgroundSettings.advancedMiscFoldout) { playgroundParticlesScriptReference.syncPositionsOnMainThread = EditorGUILayout.Toggle (playgroundLanguage.syncParticlesToMainThread, playgroundParticlesScriptReference.syncPositionsOnMainThread); EditorGUILayout.PropertyField(threadMethod, new GUIContent(playgroundLanguage.particleThreadMethod, playgroundLanguage.threadMethodDescription)); playgroundParticlesScriptReference.multithreadedStartup = EditorGUILayout.Toggle (playgroundLanguage.multithreadedStartup, playgroundParticlesScriptReference.multithreadedStartup); EditorGUILayout.Separator(); GUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel(playgroundLanguage.particlePool); // Clear if(GUILayout.Button(playgroundLanguage.clear, EditorStyles.toolbarButton, GUILayout.ExpandWidth(false)) && isEditingInHierarchy){ PlaygroundParticlesC.Clear(playgroundParticlesScriptReference); } // Rebuild if(GUILayout.Button(playgroundLanguage.rebuild, EditorStyles.toolbarButton, GUILayout.ExpandWidth(false)) && isEditingInHierarchy){ PlaygroundParticlesC.SetParticleCount(playgroundParticlesScriptReference, playgroundParticlesScriptReference.particleCount); playgroundParticlesScriptReference.Start(); } GUILayout.EndHorizontal(); } EditorGUILayout.EndVertical(); } EditorGUILayout.EndVertical(); previousSource = playgroundParticlesScriptReference.source; if (playgroundParticles.ApplyModifiedProperties()) playgroundParticlesScriptReference.IsDoneThread = true; } EditorGUILayout.EndVertical(); // Playground Manager - Particle Systems, Manipulators PlaygroundInspectorC.RenderPlaygroundSettings(); // Wireframes in Scene View if (isEditingInHierarchy) if (currentWireframe!=PlaygroundC.reference.drawWireframe) SetWireframeVisibility(); } public void ProgressBar (float val, string label, float width) { Rect rect = GUILayoutUtility.GetRect (18, 18, "TextField"); rect.width = width; rect.height = 16; if (val<0) val = 0; EditorGUI.ProgressBar (rect, val, label); EditorGUILayout.Space (); } bool triedToAssignSelfTarget = false; bool triedToAssignSnapshot = false; public void RenderEventSettings (PlaygroundEventC thisEvent, SerializedProperty serializedEvent) { thisEvent.enabled = EditorGUILayout.ToggleLeft(playgroundLanguage.enabled, thisEvent.enabled); GUI.enabled = thisEvent.enabled; // Event Broadcast Type EditorGUILayout.PropertyField(serializedEvent.FindPropertyRelative("broadcastType"), new GUIContent(playgroundLanguage.broadcastType, playgroundLanguage.broadcastTypeDescription)); // Target if (thisEvent.broadcastType!=EVENTBROADCASTC.EventListeners) { PlaygroundParticlesC currentTarget = thisEvent.target; thisEvent.target = EditorGUILayout.ObjectField(playgroundLanguage.target, thisEvent.target, typeof(PlaygroundParticlesC), true) as PlaygroundParticlesC; if (currentTarget!=thisEvent.target && thisEvent.target!=null) { // Assign new target if (thisEvent.target == playgroundParticlesScriptReference) { thisEvent.target = null; triedToAssignSelfTarget = true; triedToAssignSnapshot = false; } else if (thisEvent.target.isSnapshot) { thisEvent.target = null; triedToAssignSnapshot = true; triedToAssignSelfTarget = false; } else { triedToAssignSelfTarget = false; triedToAssignSnapshot = false; if (thisEvent.target.source!=SOURCEC.Script && EditorUtility.DisplayDialog(playgroundLanguage.switchToScriptMode, playgroundLanguage.switchToScriptModeText1+thisEvent.target.name+" "+playgroundLanguage.switchToScriptModeText2+" "+thisEvent.target.source.ToString()+" "+playgroundLanguage.switchToScriptModeText3, playgroundLanguage.switchText, playgroundLanguage.cancel)) thisEvent.target.source = SOURCEC.Script; } } if (triedToAssignSelfTarget) EditorGUILayout.HelpBox(playgroundLanguage.particleSystemEventAssignErrorSelf, MessageType.Warning); else if (triedToAssignSnapshot) EditorGUILayout.HelpBox(playgroundLanguage.particleSystemEventAssignErrorSnapshot, MessageType.Warning); } if (thisEvent.broadcastType!=EVENTBROADCASTC.Target) { thisEvent.sendToManager = EditorGUILayout.Toggle(playgroundLanguage.sendToManager, thisEvent.sendToManager); } EditorGUILayout.Separator(); // Type EditorGUILayout.PropertyField(serializedEvent.FindPropertyRelative("eventType"), new GUIContent(playgroundLanguage.type, playgroundLanguage.typeOfEvent)); // Type: Collision if (thisEvent.eventType==EVENTTYPEC.Collision) { if (!playgroundParticlesScriptReference.collision) EditorGUILayout.HelpBox(playgroundLanguage.enableCollisionToSendEvents, MessageType.Info); thisEvent.collisionThreshold = EditorGUILayout.FloatField (playgroundLanguage.collisionThreshold, thisEvent.collisionThreshold); } // Type: Time if (thisEvent.eventType == EVENTTYPEC.Time) thisEvent.eventTime = EditorGUILayout.FloatField (playgroundLanguage.time, thisEvent.eventTime); EditorGUILayout.Separator(); // Settings with inheritance options EditorGUILayout.PropertyField(serializedEvent.FindPropertyRelative("eventInheritancePosition"), new GUIContent(playgroundLanguage.position, playgroundLanguage.inheritancePosition)); if (thisEvent.eventInheritancePosition == EVENTINHERITANCEC.User) { EditorGUI.indentLevel++; thisEvent.eventPosition = EditorGUILayout.Vector3Field (" ", thisEvent.eventPosition); EditorGUI.indentLevel--; } EditorGUILayout.Separator(); EditorGUILayout.PropertyField(serializedEvent.FindPropertyRelative("eventInheritanceVelocity"), new GUIContent(playgroundLanguage.velocity, playgroundLanguage.inheritanceVelocity)); if (thisEvent.eventInheritanceVelocity == EVENTINHERITANCEC.User) thisEvent.eventVelocity = EditorGUILayout.Vector3Field (" ", thisEvent.eventVelocity); thisEvent.velocityMultiplier = EditorGUILayout.FloatField(playgroundLanguage.velocityMultiplier, thisEvent.velocityMultiplier); EditorGUILayout.Separator(); EditorGUILayout.PropertyField(serializedEvent.FindPropertyRelative("eventInheritanceColor"), new GUIContent(playgroundLanguage.color, playgroundLanguage.inheritanceColor)); if (thisEvent.eventInheritanceColor == EVENTINHERITANCEC.User) { EditorGUI.indentLevel++; thisEvent.eventColor = EditorGUILayout.ColorField(" ", thisEvent.eventColor); EditorGUI.indentLevel--; } GUI.enabled = true; } public void RenderStateSettings () { GUI.enabled = (states.arraySize>0); activeState.intValue = EditorGUILayout.IntSlider(playgroundLanguage.activeState, activeState.intValue, 0, states.arraySize-1); GUI.enabled = true; EditorGUILayout.Separator(); EditorGUILayout.BeginVertical(boxStyle); GUILayout.BeginHorizontal(); playgroundSettings.statesFoldout = GUILayout.Toggle(playgroundSettings.statesFoldout, playgroundLanguage.states, EditorStyles.foldout); GUILayout.Label (states.arraySize.ToString(), EditorStyles.miniLabel, GUILayout.ExpandWidth(false)); GUILayout.EndHorizontal(); if (playgroundSettings.statesFoldout) { if (states.arraySize>0) { SerializedProperty thisState; SerializedProperty thisName; SerializedProperty thisPoints; SerializedProperty thisTexture; SerializedProperty thisMesh; SerializedProperty thisDepthmap; SerializedProperty thisDepthmapStrength; SerializedProperty thisTransform; SerializedProperty thisStateScale; SerializedProperty thisStateOffset; SerializedProperty thisStateScaleMethod; for (int i = 0; i1); if (GUILayout.Button(i.ToString(), EditorStyles.toolbarButton, GUILayout.Width(20))) playgroundParticlesScriptReference.activeState=i; GUI.enabled = true; statesListFoldout[i] = GUILayout.Toggle(statesListFoldout[i], playgroundParticlesScriptReference.states[i].stateName, EditorStyles.foldout); EditorGUILayout.Separator(); GUI.enabled = (playgroundParticlesScriptReference.states.Count>1); if(GUILayout.Button(playgroundLanguage.upSymbol, EditorStyles.toolbarButton, new GUILayoutOption[]{GUILayout.Width(18), GUILayout.Height(16)})){ int moveUp = i==0?playgroundParticlesScriptReference.states.Count-1:i-1; if (playgroundParticlesScriptReference.activeState==i) playgroundParticlesScriptReference.activeState = moveUp; playgroundParticlesScriptReference.previousActiveState = playgroundParticlesScriptReference.activeState; states.MoveArrayElement(i, moveUp); playgroundParticles.ApplyModifiedProperties(); playgroundParticlesScriptReference.states[i].Initialize(); playgroundParticlesScriptReference.states[moveUp].Initialize(); } if(GUILayout.Button(playgroundLanguage.downSymbol, EditorStyles.toolbarButton, new GUILayoutOption[]{GUILayout.Width(18), GUILayout.Height(16)})){ int moveDown = i0) { for (int i = 0; i0) { for (int c = 0; c0 && playgroundParticlesScriptReference.particleCount>0) { Vector3 sortOriginPosition = Vector3.zero; bool drawPoint = true; switch (playgroundParticlesScriptReference.nearestNeighborOriginMethod) { case NEARESTNEIGHBORORIGINMETHOD.SourcePoint: sortOriginPosition = playgroundParticlesScriptReference.shurikenParticleSystem.simulationSpace==ParticleSystemSimulationSpace.World? playgroundParticlesScriptReference.playgroundCache.targetPosition[playgroundParticlesScriptReference.nearestNeighborOrigin%playgroundParticlesScriptReference.playgroundCache.targetPosition.Length]: playgroundParticlesScriptReference.particleSystemTransform.TransformPoint(playgroundParticlesScriptReference.playgroundCache.targetPosition[playgroundParticlesScriptReference.nearestNeighborOrigin%playgroundParticlesScriptReference.playgroundCache.targetPosition.Length]); break; case NEARESTNEIGHBORORIGINMETHOD.Vector3: sortOriginPosition = playgroundParticlesScriptReference.shurikenParticleSystem.simulationSpace==ParticleSystemSimulationSpace.World? playgroundParticlesScriptReference.nearestNeighborOriginVector3: playgroundParticlesScriptReference.particleSystemTransform.TransformPoint(playgroundParticlesScriptReference.nearestNeighborOriginVector3); break; case NEARESTNEIGHBORORIGINMETHOD.Transform: if (playgroundParticlesScriptReference.nearestNeighborOriginTransform!=null) { sortOriginPosition = playgroundParticlesScriptReference.nearestNeighborOriginTransform.position; } else drawPoint = false; break; } if (drawPoint) { Handles.color = new Color(1f,1f,.2f,.6f); Handles.CircleCap(0, sortOriginPosition, cameraRotation, HandleUtility.GetHandleSize(sortOriginPosition)*.05f); Handles.color = new Color(1f,.7f,.2f,.2f); Handles.DrawSolidDisc(sortOriginPosition, Camera.current.transform.forward, HandleUtility.GetHandleSize(sortOriginPosition)*.2f); } } // Projection mode if (playgroundParticlesScriptReference.source == SOURCEC.Projection) { // Projector preview if (playgroundScriptReference.drawGizmos && playgroundParticlesScriptReference.projection!=null && playgroundParticlesScriptReference.projection.projectionTexture!=null && playgroundParticlesScriptReference.projection.projectionTransform!=null) { RaycastHit projectorHit; Vector3 p2 = playgroundParticlesScriptReference.projection.projectionTransform.position+(playgroundParticlesScriptReference.projection.projectionTransform.forward*playgroundParticlesScriptReference.projection.projectionDistance); bool projectorHasSurface = false; if (Physics.Raycast(playgroundParticlesScriptReference.projection.projectionTransform.position, playgroundParticlesScriptReference.projection.projectionTransform.forward, out projectorHit, playgroundParticlesScriptReference.projection.projectionDistance, playgroundParticlesScriptReference.projection.projectionMask)) { p2 = projectorHit.point; projectorHasSurface = true; } Handles.color = projectorHasSurface?new Color(1f,1f,.25f,.6f):new Color(1f,1f,.25f,.2f); Handles.DrawLine(playgroundParticlesScriptReference.projection.projectionTransform.position, p2); } } // Paint mode if (playgroundParticlesScriptReference.source == SOURCEC.Paint) { Event e = Event.current; // Paint Toolbox in Scene View Rect toolboxRect = new Rect(10f,Screen.height-(138f+foldoutHeight),300f,103f+foldoutHeight); if (PlaygroundC.reference.paintToolbox) { if (!playgroundSettings.paintToolboxSettingsFoldout) { foldoutHeight = 0; } else { switch (selectedPaintMode) { case 0: foldoutHeight = 54; break; case 1: foldoutHeight = 144; break; case 2: foldoutHeight = 36; break; } } if (!playgroundSettings.toolboxFoldout) foldoutHeight=-69; // Don't deselect upon click if (e.type == EventType.Layout && toolboxRect.Contains (e.mousePosition)) { HandleUtility.AddDefaultControl(0); } Handles.BeginGUI(); GUILayout.BeginArea(toolboxRect); if (boxStyle==null) boxStyle = GUI.skin.FindStyle("box"); if (inPaintMode) GUI.backgroundColor = paintActiveColor; GUILayout.BeginVertical(boxStyle); playgroundSettings.toolboxFoldout = GUILayout.Toggle(playgroundSettings.toolboxFoldout, playgroundLanguage.playgroundPaint, EditorStyles.foldout); if (playgroundSettings.toolboxFoldout) { selectedPaintMode = GUILayout.Toolbar (selectedPaintMode, new string[]{playgroundLanguage.dot,playgroundLanguage.brush,playgroundLanguage.eraser}, EditorStyles.toolbarButton); // Settings GUILayout.BeginVertical(boxStyle); playgroundSettings.paintToolboxSettingsFoldout = GUILayout.Toggle(playgroundSettings.paintToolboxSettingsFoldout, playgroundLanguage.settings, EditorStyles.foldout); if (playgroundSettings.paintToolboxSettingsFoldout) { switch (selectedPaintMode) { case 0: GUI.backgroundColor = whiteColor; paintColor = EditorGUILayout.ColorField(playgroundLanguage.color, paintColor); if (inPaintMode) GUI.backgroundColor = paintActiveColor; playgroundParticlesScriptReference.paint.spacing = EditorGUILayout.Slider(playgroundLanguage.paintSpacing, playgroundParticlesScriptReference.paint.spacing, .0f, playgroundSettings.maximumAllowedPaintSpacing); EditorGUILayout.PropertyField(paintLayerMask, new GUIContent(playgroundLanguage.paintMask)); break; case 1: GUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel(playgroundLanguage.brushShape); GUI.backgroundColor = whiteColor; paintTexture = EditorGUILayout.ObjectField(paintTexture, typeof(Texture2D), false) as Texture2D; if (inPaintMode) GUI.backgroundColor = paintActiveColor; GUILayout.EndHorizontal(); if (paintTexture!=null && paintTexture!=playgroundParticlesScriptReference.paint.brush.texture) { selectedBrushPreset = -1; SetBrush(selectedBrushPreset); } playgroundParticlesScriptReference.paint.brush.detail = (BRUSHDETAILC)EditorGUILayout.EnumPopup(playgroundLanguage.detail, playgroundParticlesScriptReference.paint.brush.detail); playgroundParticlesScriptReference.paint.brush.scale = EditorGUILayout.Slider(playgroundLanguage.scale, playgroundParticlesScriptReference.paint.brush.scale, playgroundSettings.minimumAllowedBrushScale, playgroundSettings.maximumAllowedBrushScale); playgroundParticlesScriptReference.paint.brush.distance = EditorGUILayout.FloatField(playgroundLanguage.distance, playgroundParticlesScriptReference.paint.brush.distance); useBrushColor = EditorGUILayout.Toggle(playgroundLanguage.useBrushColor, useBrushColor); GUI.enabled = !useBrushColor; GUI.backgroundColor = whiteColor; paintColor = EditorGUILayout.ColorField(playgroundLanguage.color, paintColor); if (inPaintMode) GUI.backgroundColor = paintActiveColor; GUI.enabled = true; playgroundParticlesScriptReference.paint.spacing = EditorGUILayout.Slider(playgroundLanguage.paintSpacing, playgroundParticlesScriptReference.paint.spacing, .0f, playgroundSettings.maximumAllowedPaintSpacing); EditorGUILayout.PropertyField(paintLayerMask, new GUIContent(playgroundLanguage.paintMask)); break; case 2: eraserRadius = EditorGUILayout.Slider(playgroundLanguage.radius, eraserRadius, playgroundSettings.minimumEraserRadius, playgroundSettings.maximumEraserRadius); EditorGUILayout.PropertyField(paintLayerMask, new GUIContent(playgroundLanguage.paintMask)); break; } } GUILayout.EndVertical(); GUILayout.BeginHorizontal(); //GUI.enabled = !(selectedPaintMode==1 && paintTexture==null); if(GUILayout.Button((inPaintMode?playgroundLanguage.stop:playgroundLanguage.start)+" "+playgroundLanguage.paint, EditorStyles.toolbarButton)) StartStopPaint(); GUI.enabled = (playgroundParticlesScriptReference.paint.positionLength>0); if(GUILayout.Button(playgroundLanguage.clear, EditorStyles.toolbarButton)) ClearPaint(); GUI.enabled = true; ProgressBar((playgroundParticlesScriptReference.paint.positionLength*1f)/PlaygroundC.reference.paintMaxPositions, playgroundParticlesScriptReference.paint.positionLength+"/"+PlaygroundC.reference.paintMaxPositions, 115f); GUILayout.EndHorizontal(); } GUILayout.EndVertical(); GUILayout.EndArea(); Handles.EndGUI(); } if (inPaintMode) { if (e.type == EventType.Layout) { HandleUtility.AddDefaultControl(0); } Ray mouseRay = HandleUtility.GUIPointToWorldRay(e.mousePosition); // Brush preview if (selectedPaintMode==1 && playgroundParticlesScriptReference.paint.brush.texture!=null && sceneBrushStyle!=null && !toolboxRect.Contains(e.mousePosition)) { Handles.Label(mouseRay.origin, new GUIContent(playgroundParticlesScriptReference.paint.brush.texture as Texture2D), sceneBrushStyle); } // Eraser preview if (selectedPaintMode==2 && !toolboxRect.Contains(e.mousePosition)) { if (playgroundParticlesScriptReference.paint.collisionType==COLLISIONTYPEC.Physics3D) { if (Physics.Raycast(mouseRay, out eraserHit, 10000f, playgroundParticlesScriptReference.paint.layerMask)) { Handles.color = new Color(0f,0f,0f,.4f); Handles.CircleCap(-1, eraserHit.point, Quaternion.LookRotation(mouseRay.direction), eraserRadius); } } else { eraserHit2d = Physics2D.Raycast (mouseRay.origin, mouseRay.direction, 100000f, playgroundParticlesScriptReference.paint.layerMask, playgroundParticlesScriptReference.paint.minDepth, playgroundParticlesScriptReference.paint.maxDepth); if (eraserHit2d.collider!=null) { Handles.color = new Color(0f,0f,0f,.4f); Handles.CircleCap(-1, eraserHit2d.point, Quaternion.LookRotation(mouseRay.direction), eraserRadius); } } } // Spacing preview if (selectedPaintMode!=2) { Handles.color = new Color(.3f,1f,.3f,.3f); Handles.CircleCap(-1, playgroundParticlesScriptReference.paint.lastPaintPosition, Quaternion.LookRotation(Camera.current.transform.forward), playgroundParticlesScriptReference.paint.spacing); } if (e.type == EventType.KeyDown) keyPressed = true; else if (e.type == EventType.KeyUp) keyPressed = false; // Paint from the Brush's texture into the Scene View if (!keyPressed && e.button == 0 && e.isMouse && !e.alt) { if (e.type == EventType.MouseDrag || e.type == EventType.MouseDown) { switch (selectedPaintMode) { // Dot case 0: if (playgroundParticlesScriptReference.paint.exceedMaxStopsPaint && playgroundParticlesScriptReference.paint.positionLength>=PlaygroundC.reference.paintMaxPositions) return; if (playgroundParticlesScriptReference.paint.collisionType==COLLISIONTYPEC.Physics3D) { RaycastHit dotHit; if (Physics.Raycast(mouseRay, out dotHit, 10000f, playgroundParticlesScriptReference.paint.layerMask)) { if (e.type != EventType.MouseDown) if (Vector3.Distance(dotHit.point, playgroundParticlesScriptReference.paint.lastPaintPosition)<=playgroundParticlesScriptReference.paint.spacing) return; PlaygroundC.Paint(playgroundParticlesScriptReference, dotHit.point, dotHit.normal, dotHit.transform, paintColor); playgroundParticlesScriptReference.paint.lastPaintPosition = dotHit.point; playgroundParticlesScriptReference.SetHasActiveParticles(); } } else { RaycastHit2D dotHit2d = Physics2D.Raycast (mouseRay.origin, mouseRay.direction, 10000f, playgroundParticlesScriptReference.paint.layerMask, playgroundParticlesScriptReference.paint.minDepth, playgroundParticlesScriptReference.paint.maxDepth); if (dotHit2d.collider!=null) { if (e.type != EventType.MouseDown) if (Vector3.Distance(dotHit2d.point, playgroundParticlesScriptReference.paint.lastPaintPosition)<=playgroundParticlesScriptReference.paint.spacing) return; PlaygroundC.Paint(playgroundParticlesScriptReference, dotHit2d.point, dotHit2d.normal, dotHit2d.transform, paintColor); playgroundParticlesScriptReference.paint.lastPaintPosition = dotHit2d.point; playgroundParticlesScriptReference.SetHasActiveParticles(); } } break; // Brush case 1: if (playgroundParticlesScriptReference.paint.exceedMaxStopsPaint && playgroundParticlesScriptReference.paint.positionLength>=PlaygroundC.reference.paintMaxPositions || !playgroundParticlesScriptReference.paint.brush.texture || playgroundParticlesScriptReference.paint.brush.colorLength <= 0) return; if (e.type != EventType.MouseDown) { if (playgroundParticlesScriptReference.paint.collisionType==COLLISIONTYPEC.Physics3D) { RaycastHit brushHit; if (Physics.Raycast(mouseRay, out brushHit, 10000f, playgroundParticlesScriptReference.paint.layerMask)) if (Vector3.Distance(brushHit.point, playgroundParticlesScriptReference.paint.lastPaintPosition)<=playgroundParticlesScriptReference.paint.spacing) return; } else { RaycastHit2D brushHit2d = Physics2D.Raycast(mouseRay.origin, mouseRay.direction, 10000f, playgroundParticlesScriptReference.paint.layerMask, playgroundParticlesScriptReference.paint.minDepth, playgroundParticlesScriptReference.paint.maxDepth); if (brushHit2d.collider!=null) if (Vector3.Distance(brushHit2d.point, playgroundParticlesScriptReference.paint.lastPaintPosition)<=playgroundParticlesScriptReference.paint.spacing) return; } } int detail = 0; switch (playgroundParticlesScriptReference.paint.brush.detail) { case BRUSHDETAILC.Perfect: detail=0; break; case BRUSHDETAILC.High: detail=2; break; case BRUSHDETAILC.Medium: detail=4; break; case BRUSHDETAILC.Low: detail=6; break; } Color32 pixelColor; for (int x = 0; x