public static void RenderManipulatorProperty(ManipulatorObjectC thisManipulator, ManipulatorPropertyC thisManipulatorProperty, SerializedProperty serializedManipulatorProperty) { if (thisManipulatorProperty == null) thisManipulatorProperty = new ManipulatorPropertyC(); thisManipulatorProperty.type = (MANIPULATORPROPERTYTYPEC)EditorGUILayout.EnumPopup(playgroundLanguage.propertyType, thisManipulatorProperty.type); bool guiEnabled = GUI.enabled; EditorGUILayout.Separator(); // Velocity if (thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.Velocity || thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.AdditiveVelocity) { thisManipulatorProperty.velocity = EditorGUILayout.Vector3Field(playgroundLanguage.particleVelocity, thisManipulatorProperty.velocity); thisManipulatorProperty.strength = EditorGUILayout.FloatField(playgroundLanguage.velocityStrength, thisManipulatorProperty.strength); thisManipulatorProperty.useLocalRotation = EditorGUILayout.Toggle(playgroundLanguage.localRotation, thisManipulatorProperty.useLocalRotation); } else // Color if (thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.Color) { thisManipulatorProperty.color = EditorGUILayout.ColorField(playgroundLanguage.particleColor, thisManipulatorProperty.color); thisManipulatorProperty.strength = EditorGUILayout.FloatField(playgroundLanguage.colorStrength, thisManipulatorProperty.strength); thisManipulatorProperty.onlyColorInRange = EditorGUILayout.Toggle(playgroundLanguage.onlyColorInRange, thisManipulatorProperty.onlyColorInRange); thisManipulatorProperty.keepColorAlphas = EditorGUILayout.Toggle(playgroundLanguage.keepColorAlphas, thisManipulatorProperty.keepColorAlphas); } else // Size if (thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.Size) { thisManipulatorProperty.size = EditorGUILayout.FloatField(playgroundLanguage.particleSize, thisManipulatorProperty.size); thisManipulatorProperty.strength = EditorGUILayout.FloatField(playgroundLanguage.sizeStrength, thisManipulatorProperty.strength); thisManipulatorProperty.onlySizeInRange = EditorGUILayout.Toggle(playgroundLanguage.onlySizeInRange, thisManipulatorProperty.onlySizeInRange); } else // Target if (thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.Target) { // Target List bool hasNull = false; EditorGUILayout.BeginVertical(boxStyle); playgroundSettings.manipulatorTargetsFoldout = GUILayout.Toggle(playgroundSettings.manipulatorTargetsFoldout, playgroundLanguage.targets+" ("+thisManipulatorProperty.targets.Count+")", EditorStyles.foldout); if (playgroundSettings.manipulatorTargetsFoldout) { if (thisManipulatorProperty.targets.Count>0) { for (int t = 0; t<thisManipulatorProperty.targets.Count; t++) { EditorGUILayout.BeginVertical(boxStyle, GUILayout.MinHeight(26)); EditorGUILayout.BeginHorizontal(); GUILayout.Label(t.ToString(), EditorStyles.miniLabel, GUILayout.Width(18)); thisManipulatorProperty.targets[t].transform = EditorGUILayout.ObjectField("", thisManipulatorProperty.targets[t].transform, typeof(Transform), true) as Transform; if (!thisManipulatorProperty.targets[t].available) hasNull = true; EditorGUILayout.Separator(); if(GUILayout.Button("-", EditorStyles.toolbarButton, new GUILayoutOption[]{GUILayout.Width(18), GUILayout.Height(16)})){ thisManipulatorProperty.targets.RemoveAt(t); } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); } } else { EditorGUILayout.HelpBox(playgroundLanguage.noTargets, MessageType.Info); } if (hasNull) EditorGUILayout.HelpBox(playgroundLanguage.allTargets, MessageType.Warning); if(GUILayout.Button(playgroundLanguage.create, EditorStyles.toolbarButton, GUILayout.ExpandWidth(false))){ PlaygroundTransformC newPlaygroundTransform = new PlaygroundTransformC(); newPlaygroundTransform.transform = thisManipulator.transform.transform; newPlaygroundTransform.Update (); thisManipulatorProperty.targets.Add(newPlaygroundTransform); } EditorGUILayout.Separator(); } EditorGUILayout.EndVertical(); thisManipulatorProperty.strength = EditorGUILayout.FloatField(playgroundLanguage.targetStrength, thisManipulatorProperty.strength); thisManipulatorProperty.onlyPositionInRange = EditorGUILayout.Toggle(playgroundLanguage.onlyPositionInRange, thisManipulatorProperty.onlyPositionInRange); thisManipulatorProperty.zeroVelocityStrength = EditorGUILayout.Slider(playgroundLanguage.manipulatorZeroVelocityStrength, thisManipulatorProperty.zeroVelocityStrength, 0, playgroundSettings.maximumAllowedManipulatorZeroVelocity); } else // Death if (thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.Death) { thisManipulatorProperty.strength = EditorGUILayout.FloatField(playgroundLanguage.deathStrength, thisManipulatorProperty.strength); } else // Attractor if (thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.Attractor) { thisManipulatorProperty.strength = EditorGUILayout.FloatField(playgroundLanguage.attractorStrength, thisManipulatorProperty.strength); } else // Gravitational if (thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.Gravitational) { thisManipulatorProperty.strength = EditorGUILayout.FloatField(playgroundLanguage.gravitationalStrength, thisManipulatorProperty.strength); } else // Repellent if (thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.Repellent) { thisManipulatorProperty.strength = EditorGUILayout.FloatField(playgroundLanguage.repellentStrength, thisManipulatorProperty.strength); } else // Vortex if (thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.Vortex) { thisManipulatorProperty.strength = EditorGUILayout.FloatField(playgroundLanguage.vortexStrength, thisManipulatorProperty.strength); } else // Turbulence if (thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.Turbulence) { thisManipulatorProperty.turbulenceType = (TURBULENCETYPE)EditorGUILayout.EnumPopup (playgroundLanguage.turbulenceType, thisManipulatorProperty.turbulenceType); EditorGUI.indentLevel++; thisManipulatorProperty.strength = EditorGUILayout.Slider(playgroundLanguage.strength, thisManipulatorProperty.strength, 0f, playgroundSettings.maximumAllowedTurbulenceStrength); thisManipulatorProperty.turbulenceScale = EditorGUILayout.Slider(playgroundLanguage.scale, thisManipulatorProperty.turbulenceScale, 0f, playgroundSettings.maximumAllowedTurbulenceScale); thisManipulatorProperty.turbulenceTimeScale = EditorGUILayout.Slider(playgroundLanguage.timeScale, thisManipulatorProperty.turbulenceTimeScale, 0f, playgroundSettings.maximumAllowedTurbulenceTimeScale); EditorGUILayout.BeginHorizontal(); thisManipulatorProperty.turbulenceApplyLifetimeStrength = EditorGUILayout.ToggleLeft (playgroundLanguage.lifetimeStrength, thisManipulatorProperty.turbulenceApplyLifetimeStrength, GUILayout.Width (140)); GUILayout.FlexibleSpace(); GUI.enabled = (thisManipulatorProperty.turbulenceApplyLifetimeStrength && thisManipulatorProperty.turbulenceType!=TURBULENCETYPE.None); serializedManipulatorProperty.FindPropertyRelative("turbulenceLifetimeStrength").animationCurveValue = EditorGUILayout.CurveField(serializedManipulatorProperty.FindPropertyRelative("turbulenceLifetimeStrength").animationCurveValue); GUI.enabled = true; EditorGUILayout.EndHorizontal(); EditorGUI.indentLevel--; } else // Lifetime Color if (thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.LifetimeColor) { EditorGUILayout.PropertyField(serializedManipulatorProperty.FindPropertyRelative("lifetimeColor"), new GUIContent(playgroundLanguage.lifetimeColor)); thisManipulatorProperty.strength = EditorGUILayout.FloatField(playgroundLanguage.colorStrength, thisManipulatorProperty.strength); thisManipulatorProperty.onlyColorInRange = EditorGUILayout.Toggle(playgroundLanguage.onlyColorInRange, thisManipulatorProperty.onlyColorInRange); } else // Mesh target if (thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.MeshTarget) { EditorGUILayout.PropertyField(serializedManipulatorProperty.FindPropertyRelative("meshTarget").FindPropertyRelative("gameObject"), new GUIContent(playgroundLanguage.meshTarget)); GUILayout.BeginVertical(boxStyle); EditorGUILayout.LabelField(playgroundLanguage.proceduralOptions); EditorGUILayout.PropertyField(serializedManipulatorProperty.FindPropertyRelative("meshTargetIsProcedural"), new GUIContent( playgroundLanguage.meshVerticesUpdate, playgroundLanguage.meshVerticesUpdateDescription )); GUI.enabled = guiEnabled&&serializedManipulatorProperty.FindPropertyRelative("meshTargetIsProcedural").boolValue; EditorGUILayout.PropertyField(serializedManipulatorProperty.FindPropertyRelative("meshTarget").FindPropertyRelative("updateNormals"), new GUIContent( playgroundLanguage.meshNormalsUpdate, playgroundLanguage.meshNormalsUpdateDescription )); GUI.enabled = guiEnabled; GUILayout.EndVertical(); EditorGUILayout.PropertyField(serializedManipulatorProperty.FindPropertyRelative("targetSorting"), new GUIContent(playgroundLanguage.targetSorting)); thisManipulatorProperty.strength = EditorGUILayout.FloatField(playgroundLanguage.targetStrength, thisManipulatorProperty.strength); thisManipulatorProperty.onlyPositionInRange = EditorGUILayout.Toggle(playgroundLanguage.onlyPositionInRange, thisManipulatorProperty.onlyPositionInRange); thisManipulatorProperty.zeroVelocityStrength = EditorGUILayout.Slider(playgroundLanguage.manipulatorZeroVelocityStrength, thisManipulatorProperty.zeroVelocityStrength, 0, playgroundSettings.maximumAllowedManipulatorZeroVelocity); } else // Skinned mesh target if (thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.SkinnedMeshTarget) { EditorGUILayout.PropertyField(serializedManipulatorProperty.FindPropertyRelative("skinnedMeshTarget").FindPropertyRelative("gameObject"), new GUIContent(playgroundLanguage.skinnedMeshTarget)); GUILayout.BeginVertical(boxStyle); EditorGUILayout.LabelField(playgroundLanguage.proceduralOptions); EditorGUILayout.PropertyField(serializedManipulatorProperty.FindPropertyRelative("meshTargetIsProcedural"), new GUIContent( playgroundLanguage.meshVerticesUpdate, playgroundLanguage.meshVerticesUpdateDescription )); GUI.enabled = guiEnabled&&serializedManipulatorProperty.FindPropertyRelative("meshTargetIsProcedural").boolValue; EditorGUILayout.PropertyField(serializedManipulatorProperty.FindPropertyRelative("skinnedMeshTarget").FindPropertyRelative("updateNormals"), new GUIContent( playgroundLanguage.meshNormalsUpdate, playgroundLanguage.meshNormalsUpdateDescription )); GUI.enabled = guiEnabled; GUILayout.EndVertical(); EditorGUILayout.PropertyField(serializedManipulatorProperty.FindPropertyRelative("targetSorting"), new GUIContent(playgroundLanguage.targetSorting)); thisManipulatorProperty.strength = EditorGUILayout.FloatField(playgroundLanguage.targetStrength, thisManipulatorProperty.strength); thisManipulatorProperty.onlyPositionInRange = EditorGUILayout.Toggle(playgroundLanguage.onlyPositionInRange, thisManipulatorProperty.onlyPositionInRange); thisManipulatorProperty.zeroVelocityStrength = EditorGUILayout.Slider(playgroundLanguage.manipulatorZeroVelocityStrength, thisManipulatorProperty.zeroVelocityStrength, 0, playgroundSettings.maximumAllowedManipulatorZeroVelocity); } EditorGUILayout.Separator(); if (thisManipulatorProperty.type!=MANIPULATORPROPERTYTYPEC.None && thisManipulatorProperty.type!=MANIPULATORPROPERTYTYPEC.Attractor && thisManipulatorProperty.type!=MANIPULATORPROPERTYTYPEC.Gravitational && thisManipulatorProperty.type!=MANIPULATORPROPERTYTYPEC.Repellent && thisManipulatorProperty.type!=MANIPULATORPROPERTYTYPEC.Vortex && thisManipulatorProperty.type!=MANIPULATORPROPERTYTYPEC.Turbulence ) thisManipulatorProperty.transition = (MANIPULATORPROPERTYTRANSITIONC)EditorGUILayout.EnumPopup(playgroundLanguage.transition, thisManipulatorProperty.transition); }
public static void RenderManipulatorProperty (ManipulatorObjectC thisManipulator, ManipulatorPropertyC thisManipulatorProperty, SerializedProperty serializedManipulatorProperty) { if (thisManipulatorProperty == null) thisManipulatorProperty = new ManipulatorPropertyC(); thisManipulatorProperty.type = (MANIPULATORPROPERTYTYPEC)EditorGUILayout.EnumPopup(playgroundLanguage.propertyType, thisManipulatorProperty.type); bool guiEnabled = GUI.enabled; EditorGUILayout.Separator(); // Velocity if (thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.Velocity || thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.AdditiveVelocity) { thisManipulatorProperty.velocity = EditorGUILayout.Vector3Field(playgroundLanguage.particleVelocity, thisManipulatorProperty.velocity); thisManipulatorProperty.strength = EditorGUILayout.FloatField(playgroundLanguage.velocityStrength, thisManipulatorProperty.strength); thisManipulatorProperty.useLocalRotation = EditorGUILayout.Toggle(playgroundLanguage.localRotation, thisManipulatorProperty.useLocalRotation); } else // Color if (thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.Color) { thisManipulatorProperty.color = EditorGUILayout.ColorField(playgroundLanguage.particleColor, thisManipulatorProperty.color); thisManipulatorProperty.strength = EditorGUILayout.FloatField(playgroundLanguage.colorStrength, thisManipulatorProperty.strength); thisManipulatorProperty.onlyColorInRange = EditorGUILayout.Toggle(playgroundLanguage.onlyColorInRange, thisManipulatorProperty.onlyColorInRange); thisManipulatorProperty.keepColorAlphas = EditorGUILayout.Toggle(playgroundLanguage.keepColorAlphas, thisManipulatorProperty.keepColorAlphas); } else // Size if (thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.Size) { thisManipulatorProperty.size = EditorGUILayout.FloatField(playgroundLanguage.particleSize, thisManipulatorProperty.size); thisManipulatorProperty.strength = EditorGUILayout.FloatField(playgroundLanguage.sizeStrength, thisManipulatorProperty.strength); thisManipulatorProperty.onlySizeInRange = EditorGUILayout.Toggle(playgroundLanguage.onlySizeInRange, thisManipulatorProperty.onlySizeInRange); } else // Target if (thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.Target) { // Target List bool hasNull = false; EditorGUILayout.BeginVertical(boxStyle); playgroundSettings.manipulatorTargetsFoldout = GUILayout.Toggle(playgroundSettings.manipulatorTargetsFoldout, playgroundLanguage.targets+" ("+thisManipulatorProperty.targets.Count+")", EditorStyles.foldout); if (playgroundSettings.manipulatorTargetsFoldout) { if (thisManipulatorProperty.targets.Count>0) { for (int t = 0; t<thisManipulatorProperty.targets.Count; t++) { EditorGUILayout.BeginVertical(boxStyle, GUILayout.MinHeight(26)); EditorGUILayout.BeginHorizontal(); GUILayout.Label(t.ToString(), EditorStyles.miniLabel, GUILayout.Width(18)); thisManipulatorProperty.targets[t].transform = EditorGUILayout.ObjectField("", thisManipulatorProperty.targets[t].transform, typeof(Transform), true) as Transform; if (!thisManipulatorProperty.targets[t].available) hasNull = true; EditorGUILayout.Separator(); if(GUILayout.Button("-", EditorStyles.toolbarButton, new GUILayoutOption[]{GUILayout.Width(18), GUILayout.Height(16)})){ thisManipulatorProperty.targets.RemoveAt(t); } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); } } else { EditorGUILayout.HelpBox(playgroundLanguage.noTargets, MessageType.Info); } if (hasNull) EditorGUILayout.HelpBox(playgroundLanguage.allTargets, MessageType.Warning); if(GUILayout.Button(playgroundLanguage.create, EditorStyles.toolbarButton, GUILayout.ExpandWidth(false))){ PlaygroundTransformC newPlaygroundTransform = new PlaygroundTransformC(); newPlaygroundTransform.transform = thisManipulator.transform.transform; newPlaygroundTransform.Update (); thisManipulatorProperty.targets.Add(newPlaygroundTransform); } EditorGUILayout.Separator(); } EditorGUILayout.EndVertical(); thisManipulatorProperty.strength = EditorGUILayout.FloatField(playgroundLanguage.targetStrength, thisManipulatorProperty.strength); thisManipulatorProperty.onlyPositionInRange = EditorGUILayout.Toggle(playgroundLanguage.onlyPositionInRange, thisManipulatorProperty.onlyPositionInRange); thisManipulatorProperty.zeroVelocityStrength = EditorGUILayout.Slider(playgroundLanguage.manipulatorZeroVelocityStrength, thisManipulatorProperty.zeroVelocityStrength, 0, playgroundSettings.maximumAllowedManipulatorZeroVelocity); } else // Death if (thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.Death) { thisManipulatorProperty.strength = EditorGUILayout.FloatField(playgroundLanguage.deathStrength, thisManipulatorProperty.strength); } else // Attractor if (thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.Attractor) { thisManipulatorProperty.strength = EditorGUILayout.FloatField(playgroundLanguage.attractorStrength, thisManipulatorProperty.strength); } else // Gravitational if (thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.Gravitational) { thisManipulatorProperty.strength = EditorGUILayout.FloatField(playgroundLanguage.gravitationalStrength, thisManipulatorProperty.strength); } else // Repellent if (thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.Repellent) { thisManipulatorProperty.strength = EditorGUILayout.FloatField(playgroundLanguage.repellentStrength, thisManipulatorProperty.strength); } else // Vortex if (thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.Vortex) { thisManipulatorProperty.strength = EditorGUILayout.FloatField(playgroundLanguage.vortexStrength, thisManipulatorProperty.strength); } else // Turbulence if (thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.Turbulence) { thisManipulatorProperty.turbulenceType = (TURBULENCETYPE)EditorGUILayout.EnumPopup (playgroundLanguage.turbulenceType, thisManipulatorProperty.turbulenceType); EditorGUI.indentLevel++; thisManipulatorProperty.strength = EditorGUILayout.Slider(playgroundLanguage.strength, thisManipulatorProperty.strength, 0f, playgroundSettings.maximumAllowedTurbulenceStrength); thisManipulatorProperty.turbulenceScale = EditorGUILayout.Slider(playgroundLanguage.scale, thisManipulatorProperty.turbulenceScale, 0f, playgroundSettings.maximumAllowedTurbulenceScale); thisManipulatorProperty.turbulenceTimeScale = EditorGUILayout.Slider(playgroundLanguage.timeScale, thisManipulatorProperty.turbulenceTimeScale, 0f, playgroundSettings.maximumAllowedTurbulenceTimeScale); EditorGUILayout.BeginHorizontal(); thisManipulatorProperty.turbulenceApplyLifetimeStrength = EditorGUILayout.ToggleLeft (playgroundLanguage.lifetimeStrength, thisManipulatorProperty.turbulenceApplyLifetimeStrength, GUILayout.Width (140)); GUILayout.FlexibleSpace(); GUI.enabled = (thisManipulatorProperty.turbulenceApplyLifetimeStrength && thisManipulatorProperty.turbulenceType!=TURBULENCETYPE.None); serializedManipulatorProperty.FindPropertyRelative("turbulenceLifetimeStrength").animationCurveValue = EditorGUILayout.CurveField(serializedManipulatorProperty.FindPropertyRelative("turbulenceLifetimeStrength").animationCurveValue); GUI.enabled = true; EditorGUILayout.EndHorizontal(); EditorGUI.indentLevel--; } else // Lifetime Color if (thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.LifetimeColor) { EditorGUILayout.PropertyField(serializedManipulatorProperty.FindPropertyRelative("lifetimeColor"), new GUIContent(playgroundLanguage.lifetimeColor)); thisManipulatorProperty.strength = EditorGUILayout.FloatField(playgroundLanguage.colorStrength, thisManipulatorProperty.strength); thisManipulatorProperty.onlyColorInRange = EditorGUILayout.Toggle(playgroundLanguage.onlyColorInRange, thisManipulatorProperty.onlyColorInRange); } else // Mesh target if (thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.MeshTarget) { EditorGUILayout.PropertyField(serializedManipulatorProperty.FindPropertyRelative("meshTarget").FindPropertyRelative("gameObject"), new GUIContent(playgroundLanguage.meshTarget)); GUILayout.BeginVertical(boxStyle); EditorGUILayout.LabelField(playgroundLanguage.proceduralOptions); EditorGUILayout.PropertyField(serializedManipulatorProperty.FindPropertyRelative("meshTargetIsProcedural"), new GUIContent( playgroundLanguage.meshVerticesUpdate, playgroundLanguage.meshVerticesUpdateDescription )); GUI.enabled = guiEnabled&&serializedManipulatorProperty.FindPropertyRelative("meshTargetIsProcedural").boolValue; EditorGUILayout.PropertyField(serializedManipulatorProperty.FindPropertyRelative("meshTarget").FindPropertyRelative("updateNormals"), new GUIContent( playgroundLanguage.meshNormalsUpdate, playgroundLanguage.meshNormalsUpdateDescription )); GUI.enabled = guiEnabled; GUILayout.EndVertical(); EditorGUILayout.PropertyField(serializedManipulatorProperty.FindPropertyRelative("targetSorting"), new GUIContent(playgroundLanguage.targetSorting)); thisManipulatorProperty.strength = EditorGUILayout.FloatField(playgroundLanguage.targetStrength, thisManipulatorProperty.strength); thisManipulatorProperty.onlyPositionInRange = EditorGUILayout.Toggle(playgroundLanguage.onlyPositionInRange, thisManipulatorProperty.onlyPositionInRange); thisManipulatorProperty.zeroVelocityStrength = EditorGUILayout.Slider(playgroundLanguage.manipulatorZeroVelocityStrength, thisManipulatorProperty.zeroVelocityStrength, 0, playgroundSettings.maximumAllowedManipulatorZeroVelocity); } else // Skinned mesh target if (thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.SkinnedMeshTarget) { EditorGUILayout.PropertyField(serializedManipulatorProperty.FindPropertyRelative("skinnedMeshTarget").FindPropertyRelative("gameObject"), new GUIContent(playgroundLanguage.skinnedMeshTarget)); GUILayout.BeginVertical(boxStyle); EditorGUILayout.LabelField(playgroundLanguage.proceduralOptions); EditorGUILayout.PropertyField(serializedManipulatorProperty.FindPropertyRelative("meshTargetIsProcedural"), new GUIContent( playgroundLanguage.meshVerticesUpdate, playgroundLanguage.meshVerticesUpdateDescription )); GUI.enabled = guiEnabled&&serializedManipulatorProperty.FindPropertyRelative("meshTargetIsProcedural").boolValue; EditorGUILayout.PropertyField(serializedManipulatorProperty.FindPropertyRelative("skinnedMeshTarget").FindPropertyRelative("updateNormals"), new GUIContent( playgroundLanguage.meshNormalsUpdate, playgroundLanguage.meshNormalsUpdateDescription )); GUI.enabled = guiEnabled; GUILayout.EndVertical(); EditorGUILayout.PropertyField(serializedManipulatorProperty.FindPropertyRelative("targetSorting"), new GUIContent(playgroundLanguage.targetSorting)); thisManipulatorProperty.strength = EditorGUILayout.FloatField(playgroundLanguage.targetStrength, thisManipulatorProperty.strength); thisManipulatorProperty.onlyPositionInRange = EditorGUILayout.Toggle(playgroundLanguage.onlyPositionInRange, thisManipulatorProperty.onlyPositionInRange); thisManipulatorProperty.zeroVelocityStrength = EditorGUILayout.Slider(playgroundLanguage.manipulatorZeroVelocityStrength, thisManipulatorProperty.zeroVelocityStrength, 0, playgroundSettings.maximumAllowedManipulatorZeroVelocity); } else // State target if (thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.StateTarget) { if (thisManipulatorProperty.stateTarget.stateTransform==null) thisManipulatorProperty.stateTarget.stateTransform = thisManipulator.transform.transform; GUILayout.BeginVertical(boxStyle); Texture2D currentStateTexture = thisManipulatorProperty.stateTarget.stateTexture; Mesh currentStateMesh = thisManipulatorProperty.stateTarget.stateMesh; EditorGUILayout.PropertyField(serializedManipulatorProperty.FindPropertyRelative("stateTarget").FindPropertyRelative("stateTransform"), new GUIContent(playgroundLanguage.transform)); EditorGUILayout.PropertyField(serializedManipulatorProperty.FindPropertyRelative("stateTarget").FindPropertyRelative("stateMesh"), new GUIContent(playgroundLanguage.mesh)); EditorGUILayout.PropertyField(serializedManipulatorProperty.FindPropertyRelative("stateTarget").FindPropertyRelative("stateTexture"), new GUIContent(playgroundLanguage.texture)); if (currentStateTexture!=thisManipulatorProperty.stateTarget.stateTexture || currentStateMesh!=thisManipulatorProperty.stateTarget.stateMesh) thisManipulatorProperty.stateTarget.Initialize(); if (thisManipulatorProperty.stateTarget.stateTexture!=null) EditorGUILayout.PropertyField(serializedManipulatorProperty.FindPropertyRelative("stateTarget").FindPropertyRelative("stateDepthmap"), new GUIContent(playgroundLanguage.depthmap)); EditorGUILayout.PropertyField(serializedManipulatorProperty.FindPropertyRelative("stateTarget").FindPropertyRelative("stateScale"), new GUIContent(playgroundLanguage.scale, playgroundLanguage.stateScaleDescription)); EditorGUILayout.PropertyField(serializedManipulatorProperty.FindPropertyRelative("stateTarget").FindPropertyRelative("stateOffset"), new GUIContent(playgroundLanguage.offset, playgroundLanguage.stateOffsetDescription)); if (thisManipulatorProperty.stateTarget.stateMesh==null) { GUILayout.BeginHorizontal(); bool currentApplyChromaKey = thisManipulatorProperty.stateTarget.applyChromaKey; thisManipulatorProperty.stateTarget.applyChromaKey = EditorGUILayout.Toggle (playgroundLanguage.chromaKey, thisManipulatorProperty.stateTarget.applyChromaKey); GUI.enabled = guiEnabled&&thisManipulatorProperty.stateTarget.applyChromaKey; EditorGUIUtility.labelWidth = 1f; Color currentChroma = new Color(thisManipulatorProperty.stateTarget.chromaKey.r,thisManipulatorProperty.stateTarget.chromaKey.g, thisManipulatorProperty.stateTarget.chromaKey.b); thisManipulatorProperty.stateTarget.chromaKey = (Color32)EditorGUILayout.ColorField((Color)thisManipulatorProperty.stateTarget.chromaKey); EditorGUIUtility.labelWidth = 50f; float currentSpread = thisManipulatorProperty.stateTarget.chromaKeySpread; thisManipulatorProperty.stateTarget.chromaKeySpread = EditorGUILayout.Slider(playgroundLanguage.spread, thisManipulatorProperty.stateTarget.chromaKeySpread, 0, 1f); if (currentChroma!=new Color(thisManipulatorProperty.stateTarget.chromaKey.r,thisManipulatorProperty.stateTarget.chromaKey.g, thisManipulatorProperty.stateTarget.chromaKey.b) || currentSpread!=thisManipulatorProperty.stateTarget.chromaKeySpread || currentApplyChromaKey!=thisManipulatorProperty.stateTarget.applyChromaKey) thisManipulatorProperty.stateTarget.Initialize(); GUI.enabled = guiEnabled; EditorGUIUtility.labelWidth = 0; GUILayout.EndHorizontal(); } GUILayout.BeginHorizontal(); if(GUILayout.Button(playgroundLanguage.refresh, EditorStyles.toolbarButton, GUILayout.ExpandWidth(false))){ thisManipulatorProperty.stateTarget.Initialize(); } EditorGUILayout.Separator(); EditorGUIUtility.labelWidth = 40f; EditorGUILayout.PrefixLabel(playgroundLanguage.points+":"); EditorGUIUtility.labelWidth = 0; EditorGUILayout.SelectableLabel(thisManipulatorProperty.stateTarget.positionLength.ToString(), GUILayout.MaxWidth(80)); GUILayout.EndHorizontal(); GUILayout.EndVertical(); EditorGUILayout.PropertyField(serializedManipulatorProperty.FindPropertyRelative("targetSorting"), new GUIContent(playgroundLanguage.targetSorting)); thisManipulatorProperty.strength = EditorGUILayout.FloatField(playgroundLanguage.targetStrength, thisManipulatorProperty.strength); thisManipulatorProperty.onlyPositionInRange = EditorGUILayout.Toggle(playgroundLanguage.onlyPositionInRange, thisManipulatorProperty.onlyPositionInRange); thisManipulatorProperty.zeroVelocityStrength = EditorGUILayout.Slider(playgroundLanguage.manipulatorZeroVelocityStrength, thisManipulatorProperty.zeroVelocityStrength, 0, playgroundSettings.maximumAllowedManipulatorZeroVelocity); } else // Spline target if (thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.SplineTarget) { EditorGUILayout.BeginVertical(boxStyle); thisManipulatorProperty.splineTarget = (PlaygroundSpline)EditorGUILayout.ObjectField(playgroundLanguage.spline, thisManipulatorProperty.splineTarget, typeof(PlaygroundSpline), true); if (thisManipulatorProperty.splineTarget==null) EditorGUILayout.HelpBox(playgroundLanguage.newSplineMessage, MessageType.Info); else thisManipulatorProperty.splineTimeOffset = EditorGUILayout.Slider (playgroundLanguage.timeOffset, thisManipulatorProperty.splineTimeOffset, 0, 1f); EditorGUILayout.Separator(); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button (playgroundLanguage.create, EditorStyles.toolbarButton, GUILayout.ExpandWidth(false))) { PlaygroundSpline spline = PlaygroundC.CreateSpline(thisManipulatorProperty); spline.transform.parent = Selection.activeTransform; Selection.activeGameObject = thisManipulatorProperty.splineTarget.gameObject; } GUI.enabled = thisManipulatorProperty.splineTarget!=null; if (GUILayout.Button (playgroundLanguage.edit, EditorStyles.toolbarButton, GUILayout.ExpandWidth(false))) Selection.activeGameObject = thisManipulatorProperty.splineTarget.gameObject; GUI.enabled = true; EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); EditorGUILayout.Separator(); thisManipulatorProperty.splineTargetMethod = (SPLINETARGETMETHOD)EditorGUILayout.EnumPopup(playgroundLanguage.targetMethod, thisManipulatorProperty.splineTargetMethod); thisManipulatorProperty.strength = EditorGUILayout.FloatField(playgroundLanguage.targetStrength, thisManipulatorProperty.strength); thisManipulatorProperty.onlyPositionInRange = EditorGUILayout.Toggle(playgroundLanguage.onlyPositionInRange, thisManipulatorProperty.onlyPositionInRange); thisManipulatorProperty.zeroVelocityStrength = EditorGUILayout.Slider(playgroundLanguage.manipulatorZeroVelocityStrength, thisManipulatorProperty.zeroVelocityStrength, 0, playgroundSettings.maximumAllowedManipulatorZeroVelocity); } else if (thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.Math) { thisManipulatorProperty.mathProperty.property = (MATHMANIPULATORPROPERTY)EditorGUILayout.EnumPopup(playgroundLanguage.particleProperty, thisManipulatorProperty.mathProperty.property); thisManipulatorProperty.mathProperty.type = (MATHMANIPULATORTYPE)EditorGUILayout.EnumPopup(playgroundLanguage.type, thisManipulatorProperty.mathProperty.type); thisManipulatorProperty.mathProperty.clamp = (MATHMANIPULATORCLAMP)EditorGUILayout.EnumPopup(playgroundLanguage.clamp, thisManipulatorProperty.mathProperty.clamp); if (thisManipulatorProperty.mathProperty.clamp!=MATHMANIPULATORCLAMP.None) { EditorGUI.indentLevel++; thisManipulatorProperty.mathProperty.clampFloor = EditorGUILayout.FloatField(playgroundLanguage.floor, thisManipulatorProperty.mathProperty.clampFloor); thisManipulatorProperty.mathProperty.clampCeil = EditorGUILayout.FloatField(playgroundLanguage.ceil, thisManipulatorProperty.mathProperty.clampCeil); EditorGUI.indentLevel--; } if (thisManipulatorProperty.mathProperty.property == MATHMANIPULATORPROPERTY.Rotation || thisManipulatorProperty.mathProperty.property == MATHMANIPULATORPROPERTY.Size) { thisManipulatorProperty.mathProperty.value = EditorGUILayout.FloatField(playgroundLanguage.value, thisManipulatorProperty.mathProperty.value); thisManipulatorProperty.mathProperty.rate = EditorGUILayout.FloatField(playgroundLanguage.rate, thisManipulatorProperty.mathProperty.rate); } else { thisManipulatorProperty.mathProperty.value3 = EditorGUILayout.Vector3Field(playgroundLanguage.value, thisManipulatorProperty.mathProperty.value3); thisManipulatorProperty.mathProperty.rate3 = EditorGUILayout.Vector3Field(playgroundLanguage.rate, thisManipulatorProperty.mathProperty.rate3); } } EditorGUILayout.Separator(); if (thisManipulatorProperty.type!=MANIPULATORPROPERTYTYPEC.None && thisManipulatorProperty.type!=MANIPULATORPROPERTYTYPEC.Attractor && thisManipulatorProperty.type!=MANIPULATORPROPERTYTYPEC.Gravitational && thisManipulatorProperty.type!=MANIPULATORPROPERTYTYPEC.Repellent && thisManipulatorProperty.type!=MANIPULATORPROPERTYTYPEC.Vortex && thisManipulatorProperty.type!=MANIPULATORPROPERTYTYPEC.Turbulence && thisManipulatorProperty.type!=MANIPULATORPROPERTYTYPEC.Math ) { GUI.enabled = guiEnabled&&thisManipulatorProperty.type!=MANIPULATORPROPERTYTYPEC.AdditiveVelocity; thisManipulatorProperty.transition = (MANIPULATORPROPERTYTRANSITIONC)EditorGUILayout.EnumPopup(playgroundLanguage.transition, thisManipulatorProperty.transition); GUI.enabled = guiEnabled; } }
public static void RenderManipulatorProperty (ManipulatorObjectC thisManipulator, ManipulatorPropertyC thisManipulatorProperty, SerializedProperty serializedManipulatorProperty) { if (thisManipulatorProperty == null) thisManipulatorProperty = new ManipulatorPropertyC(); thisManipulatorProperty.type = (MANIPULATORPROPERTYTYPEC)EditorGUILayout.EnumPopup("Property Type", thisManipulatorProperty.type); EditorGUILayout.Separator(); // Velocity if (thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.Velocity || thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.AdditiveVelocity) { thisManipulatorProperty.velocity = EditorGUILayout.Vector3Field("Particle Velocity", thisManipulatorProperty.velocity); thisManipulatorProperty.strength = EditorGUILayout.FloatField("Velocity Strength", thisManipulatorProperty.strength); thisManipulatorProperty.useLocalRotation = EditorGUILayout.Toggle("Local Rotation", thisManipulatorProperty.useLocalRotation); } else // Color if (thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.Color) { thisManipulatorProperty.color = EditorGUILayout.ColorField("Particle Color", thisManipulatorProperty.color); thisManipulatorProperty.strength = EditorGUILayout.FloatField("Color Strength", thisManipulatorProperty.strength); thisManipulatorProperty.onlyColorInRange = EditorGUILayout.Toggle("Only Color In Range", thisManipulatorProperty.onlyColorInRange); thisManipulatorProperty.keepColorAlphas = EditorGUILayout.Toggle("Keep Color Alphas", thisManipulatorProperty.keepColorAlphas); } else // Size if (thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.Size) { thisManipulatorProperty.size = EditorGUILayout.FloatField("Particle Size", thisManipulatorProperty.size); thisManipulatorProperty.strength = EditorGUILayout.FloatField("Size Strength", thisManipulatorProperty.strength); } else // Target if (thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.Target) { // Target List bool hasNull = false; EditorGUILayout.BeginVertical(boxStyle); targetsFoldout = GUILayout.Toggle(targetsFoldout, "Targets ("+thisManipulatorProperty.targets.Count+")", EditorStyles.foldout); if (targetsFoldout) { if (thisManipulatorProperty.targets.Count>0) { for (int t = 0; t<thisManipulatorProperty.targets.Count; t++) { EditorGUILayout.BeginVertical(boxStyle, GUILayout.MinHeight(26)); EditorGUILayout.BeginHorizontal(); GUILayout.Label(t.ToString(), EditorStyles.miniLabel, GUILayout.Width(18)); thisManipulatorProperty.targets[t].transform = EditorGUILayout.ObjectField("", thisManipulatorProperty.targets[t].transform, typeof(Transform), true) as Transform; if (!thisManipulatorProperty.targets[t].available) hasNull = true; EditorGUILayout.Separator(); if(GUILayout.Button("-", EditorStyles.toolbarButton, new GUILayoutOption[]{GUILayout.Width(18), GUILayout.Height(16)})){ thisManipulatorProperty.targets.RemoveAt(t); } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); } } else { EditorGUILayout.HelpBox("No targets created.", MessageType.Info); } if (hasNull) EditorGUILayout.HelpBox("All targets must be assigned.", MessageType.Warning); if(GUILayout.Button("Create", EditorStyles.toolbarButton, GUILayout.Width(50))){ PlaygroundTransformC newPlaygroundTransform = new PlaygroundTransformC(); newPlaygroundTransform.transform = thisManipulator.transform.transform; newPlaygroundTransform.Update (); thisManipulatorProperty.targets.Add(newPlaygroundTransform); } EditorGUILayout.Separator(); } EditorGUILayout.EndVertical(); thisManipulatorProperty.strength = EditorGUILayout.FloatField("Target Strength", thisManipulatorProperty.strength); thisManipulatorProperty.onlyPositionInRange = EditorGUILayout.Toggle("Only Position In Range", thisManipulatorProperty.onlyPositionInRange); thisManipulatorProperty.zeroVelocityStrength = EditorGUILayout.Slider("Zero Velocity Strength", thisManipulatorProperty.zeroVelocityStrength, 0, playgroundScriptReference.maximumAllowedManipulatorZeroVelocity); } else // Death if (thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.Death) { thisManipulatorProperty.strength = EditorGUILayout.FloatField("Death Strength", thisManipulatorProperty.strength); } else // Attractor if (thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.Attractor) { thisManipulatorProperty.strength = EditorGUILayout.FloatField("Attractor Strength", thisManipulatorProperty.strength); } else // Gravitational if (thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.Gravitational) { thisManipulatorProperty.strength = EditorGUILayout.FloatField("Gravitational Strength", thisManipulatorProperty.strength); } else // Repellent if (thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.Repellent) { thisManipulatorProperty.strength = EditorGUILayout.FloatField("Repellent Strength", thisManipulatorProperty.strength); } else // Vortex if (thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.Vortex) { thisManipulatorProperty.strength = EditorGUILayout.FloatField("Vortex Strength", thisManipulatorProperty.strength); } else // Lifetime Color if (thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.LifetimeColor) { EditorGUILayout.PropertyField(serializedManipulatorProperty.FindPropertyRelative("lifetimeColor"), new GUIContent("Lifetime Color")); thisManipulatorProperty.strength = EditorGUILayout.FloatField("Color Strength", thisManipulatorProperty.strength); thisManipulatorProperty.onlyColorInRange = EditorGUILayout.Toggle("Only Color In Range", thisManipulatorProperty.onlyColorInRange); } else // Mesh target if (thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.MeshTarget) { EditorGUILayout.PropertyField(serializedManipulatorProperty.FindPropertyRelative("meshTarget").FindPropertyRelative("gameObject"), new GUIContent("Mesh Target")); EditorGUILayout.PropertyField(serializedManipulatorProperty.FindPropertyRelative("targetSorting"), new GUIContent("Target Sorting")); thisManipulatorProperty.strength = EditorGUILayout.FloatField("Target Strength", thisManipulatorProperty.strength); thisManipulatorProperty.onlyPositionInRange = EditorGUILayout.Toggle("Only Position In Range", thisManipulatorProperty.onlyPositionInRange); thisManipulatorProperty.zeroVelocityStrength = EditorGUILayout.Slider("Zero Velocity Strength", thisManipulatorProperty.zeroVelocityStrength, 0, playgroundScriptReference.maximumAllowedManipulatorZeroVelocity); } else // Skinned mesh target if (thisManipulatorProperty.type==MANIPULATORPROPERTYTYPEC.SkinnedMeshTarget) { //bool isInitialized = thisManipulatorProperty.skinnedMeshTarget.initialized; EditorGUILayout.PropertyField(serializedManipulatorProperty.FindPropertyRelative("skinnedMeshTarget").FindPropertyRelative("gameObject"), new GUIContent("Skinned Mesh Target")); EditorGUILayout.PropertyField(serializedManipulatorProperty.FindPropertyRelative("targetSorting"), new GUIContent("Target Sorting")); thisManipulatorProperty.strength = EditorGUILayout.FloatField("Target Strength", thisManipulatorProperty.strength); thisManipulatorProperty.onlyPositionInRange = EditorGUILayout.Toggle("Only Position In Range", thisManipulatorProperty.onlyPositionInRange); thisManipulatorProperty.zeroVelocityStrength = EditorGUILayout.Slider("Zero Velocity Strength", thisManipulatorProperty.zeroVelocityStrength, 0, playgroundScriptReference.maximumAllowedManipulatorZeroVelocity); //if (isInitialized != thisManipulatorProperty.skinnedMeshTarget.initialized) // foreach (PlaygroundParticlesC pSystem in PlaygroundC.reference.particleSystems) // pSystem.Start(); } EditorGUILayout.Separator(); if (thisManipulatorProperty.type!=MANIPULATORPROPERTYTYPEC.None && thisManipulatorProperty.type!=MANIPULATORPROPERTYTYPEC.Attractor && thisManipulatorProperty.type!=MANIPULATORPROPERTYTYPEC.Gravitational && thisManipulatorProperty.type!=MANIPULATORPROPERTYTYPEC.Repellent && thisManipulatorProperty.type!=MANIPULATORPROPERTYTYPEC.Vortex ) thisManipulatorProperty.transition = (MANIPULATORPROPERTYTRANSITIONC)EditorGUILayout.EnumPopup("Transition", thisManipulatorProperty.transition); }