Inheritance: SerializedModule
Ejemplo n.º 1
0
 private static ModuleUI[] CreateUIModules(ParticleSystemUI e, SerializedObject so)
 {
     int num = 0;
     ModuleUI[] euiArray1 = new ModuleUI[0x16];
     euiArray1[0] = new InitialModuleUI(e, so, s_ModuleNames[num++]);
     euiArray1[1] = new EmissionModuleUI(e, so, s_ModuleNames[num++]);
     euiArray1[2] = new ShapeModuleUI(e, so, s_ModuleNames[num++]);
     euiArray1[3] = new VelocityModuleUI(e, so, s_ModuleNames[num++]);
     euiArray1[4] = new ClampVelocityModuleUI(e, so, s_ModuleNames[num++]);
     euiArray1[5] = new InheritVelocityModuleUI(e, so, s_ModuleNames[num++]);
     euiArray1[6] = new ForceModuleUI(e, so, s_ModuleNames[num++]);
     euiArray1[7] = new ColorModuleUI(e, so, s_ModuleNames[num++]);
     euiArray1[8] = new ColorByVelocityModuleUI(e, so, s_ModuleNames[num++]);
     euiArray1[9] = new SizeModuleUI(e, so, s_ModuleNames[num++]);
     euiArray1[10] = new SizeByVelocityModuleUI(e, so, s_ModuleNames[num++]);
     euiArray1[11] = new RotationModuleUI(e, so, s_ModuleNames[num++]);
     euiArray1[12] = new RotationByVelocityModuleUI(e, so, s_ModuleNames[num++]);
     euiArray1[13] = new ExternalForcesModuleUI(e, so, s_ModuleNames[num++]);
     euiArray1[14] = new NoiseModuleUI(e, so, s_ModuleNames[num++]);
     euiArray1[15] = new CollisionModuleUI(e, so, s_ModuleNames[num++]);
     euiArray1[0x10] = new TriggerModuleUI(e, so, s_ModuleNames[num++]);
     euiArray1[0x11] = new SubModuleUI(e, so, s_ModuleNames[num++]);
     euiArray1[0x12] = new UVModuleUI(e, so, s_ModuleNames[num++]);
     euiArray1[0x13] = new LightsModuleUI(e, so, s_ModuleNames[num++]);
     euiArray1[20] = new TrailModuleUI(e, so, s_ModuleNames[num++]);
     return euiArray1;
 }
 protected override void SetVisibilityState(ModuleUI.VisibilityState newState)
 {
   base.SetVisibilityState(newState);
   if (newState != ModuleUI.VisibilityState.VisibleAndFoldedOut)
   {
     Tools.s_Hidden = false;
     CollisionModuleUI.m_SelectedTransform = (Transform) null;
     ParticleEffectUtils.ClearPlanes();
   }
   else
     this.SyncVisualization();
 }
            internal void RenderLightProbeUsage(int selectionCount, Renderer renderer, bool useMiniStyle, bool lightProbeAllowed)
            {
                using (new EditorGUI.DisabledScope(!lightProbeAllowed))
                {
                    if (lightProbeAllowed)
                    {
                        // LightProbeUsage has non-sequential enum values. Extra care is to be taken.
                        if (useMiniStyle)
                        {
                            EditorGUI.BeginChangeCheck();
                            var newValue = ModuleUI.GUIEnumPopup(m_LightProbeUsageStyle, (LightProbeUsage)m_LightProbeUsage.intValue, m_LightProbeUsage);
                            if (EditorGUI.EndChangeCheck())
                            {
                                m_LightProbeUsage.intValue = (int)(LightProbeUsage)newValue;
                            }
                        }
                        else
                        {
                            Rect r = EditorGUILayout.GetControlRect(true, EditorGUI.kSingleLineHeight, EditorStyles.popup);
                            EditorGUI.BeginProperty(r, m_LightProbeUsageStyle, m_LightProbeUsage);
                            EditorGUI.BeginChangeCheck();
                            var newValue = EditorGUI.EnumPopup(r, m_LightProbeUsageStyle, (LightProbeUsage)m_LightProbeUsage.intValue);
                            if (EditorGUI.EndChangeCheck())
                            {
                                m_LightProbeUsage.intValue = (int)(LightProbeUsage)newValue;
                            }
                            EditorGUI.EndProperty();
                        }

                        if (!m_LightProbeUsage.hasMultipleDifferentValues)
                        {
                            if (m_LightProbeUsage.intValue == (int)LightProbeUsage.UseProxyVolume &&
                                SupportedRenderingFeatures.active.lightProbeProxyVolumes)
                            {
                                EditorGUI.indentLevel++;
                                if (useMiniStyle)
                                {
                                    ModuleUI.GUIObject(m_LightProbeVolumeOverrideStyle, m_LightProbeVolumeOverride);
                                }
                                else
                                {
                                    EditorGUILayout.PropertyField(m_LightProbeVolumeOverride, m_LightProbeVolumeOverrideStyle);
                                }
                                EditorGUI.indentLevel--;
                            }
                            else if (m_LightProbeUsage.intValue == (int)LightProbeUsage.CustomProvided)
                            {
                                EditorGUI.indentLevel++;
                                if (!Application.isPlaying)
                                {
                                    EditorGUILayout.HelpBox(m_LightProbeCustomNote.text, MessageType.Info);
                                }
                                else if (!renderer.HasPropertyBlock())
                                {
                                    EditorGUILayout.HelpBox(m_LightProbeCustomNote.text, MessageType.Error);
                                }
                                EditorGUI.indentLevel--;
                            }
                        }
                    }
                    else
                    {
                        if (useMiniStyle)
                        {
                            ModuleUI.GUIEnumPopup(m_LightProbeUsageStyle, LightProbeUsage.Off, m_LightProbeUsage);
                        }
                        else
                        {
                            EditorGUILayout.EnumPopup(m_LightProbeUsageStyle, LightProbeUsage.Off);
                        }
                    }
                }

                Tree tree;

                renderer.TryGetComponent(out tree);
                if ((tree != null) && (m_LightProbeUsage.intValue == (int)LightProbeUsage.UseProxyVolume))
                {
                    EditorGUI.indentLevel++;
                    EditorGUILayout.HelpBox(m_LightProbeVolumeUnsupportedOnTreesNote.text, MessageType.Warning);
                    EditorGUI.indentLevel--;
                }
            }
 public SerializedMinMaxCurve(ModuleUI m, GUIContent displayName)
 {
     this.Init(m, displayName, "curve", false);
 }
Ejemplo n.º 5
0
        public override void OnInspectorGUI(InitialModuleUI initial)
        {
            ModuleUI.GUIFloat(InitialModuleUI.s_Texts.duration, this.m_LengthInSec, "f2", new GUILayoutOption[0]);
            EditorGUI.BeginChangeCheck();
            bool flag = ModuleUI.GUIToggle(InitialModuleUI.s_Texts.looping, this.m_Looping, new GUILayoutOption[0]);

            if (EditorGUI.EndChangeCheck() && flag)
            {
                ParticleSystem[] particleSystems = this.m_ParticleSystemUI.m_ParticleSystems;
                for (int i = 0; i < particleSystems.Length; i++)
                {
                    ParticleSystem particleSystem = particleSystems[i];
                    if (particleSystem.time >= particleSystem.main.duration)
                    {
                        particleSystem.time = 0f;
                    }
                }
            }
            using (new EditorGUI.DisabledScope(!this.m_Looping.boolValue))
            {
                ModuleUI.GUIToggle(InitialModuleUI.s_Texts.prewarm, this.m_Prewarm, new GUILayoutOption[0]);
            }
            using (new EditorGUI.DisabledScope(this.m_Prewarm.boolValue && this.m_Looping.boolValue))
            {
                ModuleUI.GUIMinMaxCurve(InitialModuleUI.s_Texts.startDelay, this.m_StartDelay, new GUILayoutOption[0]);
            }
            ModuleUI.GUIMinMaxCurve(InitialModuleUI.s_Texts.lifetime, this.m_LifeTime, new GUILayoutOption[0]);
            ModuleUI.GUIMinMaxCurve(InitialModuleUI.s_Texts.speed, this.m_Speed, new GUILayoutOption[0]);
            EditorGUI.BeginChangeCheck();
            bool flag2 = ModuleUI.GUIToggle(InitialModuleUI.s_Texts.size3D, this.m_Size3D, new GUILayoutOption[0]);

            if (EditorGUI.EndChangeCheck())
            {
                if (!flag2)
                {
                    this.m_SizeY.RemoveCurveFromEditor();
                    this.m_SizeZ.RemoveCurveFromEditor();
                }
            }
            if (!this.m_SizeX.stateHasMultipleDifferentValues)
            {
                this.m_SizeZ.SetMinMaxState(this.m_SizeX.state, flag2);
                this.m_SizeY.SetMinMaxState(this.m_SizeX.state, flag2);
            }
            if (flag2)
            {
                this.m_SizeX.m_DisplayName = InitialModuleUI.s_Texts.x;
                base.GUITripleMinMaxCurve(GUIContent.none, InitialModuleUI.s_Texts.x, this.m_SizeX, InitialModuleUI.s_Texts.y, this.m_SizeY, InitialModuleUI.s_Texts.z, this.m_SizeZ, null, new GUILayoutOption[0]);
            }
            else
            {
                this.m_SizeX.m_DisplayName = InitialModuleUI.s_Texts.size;
                ModuleUI.GUIMinMaxCurve(InitialModuleUI.s_Texts.size, this.m_SizeX, new GUILayoutOption[0]);
            }
            EditorGUI.BeginChangeCheck();
            bool flag3 = ModuleUI.GUIToggle(InitialModuleUI.s_Texts.rotation3D, this.m_Rotation3D, new GUILayoutOption[0]);

            if (EditorGUI.EndChangeCheck())
            {
                if (!flag3)
                {
                    this.m_RotationX.RemoveCurveFromEditor();
                    this.m_RotationY.RemoveCurveFromEditor();
                }
            }
            if (!this.m_RotationZ.stateHasMultipleDifferentValues)
            {
                this.m_RotationX.SetMinMaxState(this.m_RotationZ.state, flag3);
                this.m_RotationY.SetMinMaxState(this.m_RotationZ.state, flag3);
            }
            if (flag3)
            {
                this.m_RotationZ.m_DisplayName = InitialModuleUI.s_Texts.z;
                base.GUITripleMinMaxCurve(GUIContent.none, InitialModuleUI.s_Texts.x, this.m_RotationX, InitialModuleUI.s_Texts.y, this.m_RotationY, InitialModuleUI.s_Texts.z, this.m_RotationZ, null, new GUILayoutOption[0]);
            }
            else
            {
                this.m_RotationZ.m_DisplayName = InitialModuleUI.s_Texts.rotation;
                ModuleUI.GUIMinMaxCurve(InitialModuleUI.s_Texts.rotation, this.m_RotationZ, new GUILayoutOption[0]);
            }
            ModuleUI.GUIFloat(InitialModuleUI.s_Texts.randomizeRotationDirection, this.m_RandomizeRotationDirection, new GUILayoutOption[0]);
            base.GUIMinMaxGradient(InitialModuleUI.s_Texts.color, this.m_Color, false, new GUILayoutOption[0]);
            ModuleUI.GUIMinMaxCurve(InitialModuleUI.s_Texts.gravity, this.m_GravityModifier, new GUILayoutOption[0]);
            int num = ModuleUI.GUIPopup(InitialModuleUI.s_Texts.simulationSpace, this.m_SimulationSpace, InitialModuleUI.s_Texts.simulationSpaces, new GUILayoutOption[0]);

            if (num == 2 && this.m_CustomSimulationSpace != null)
            {
                ModuleUI.GUIObject(InitialModuleUI.s_Texts.customSimulationSpace, this.m_CustomSimulationSpace, new GUILayoutOption[0]);
            }
            ModuleUI.GUIFloat(InitialModuleUI.s_Texts.simulationSpeed, this.m_SimulationSpeed, new GUILayoutOption[0]);
            ModuleUI.GUIBoolAsPopup(InitialModuleUI.s_Texts.deltaTime, this.m_UseUnscaledTime, new string[]
            {
                "Scaled",
                "Unscaled"
            }, new GUILayoutOption[0]);
            bool flag4 = this.m_ParticleSystemUI.m_ParticleSystems.FirstOrDefault((ParticleSystem o) => !o.shape.enabled || (o.shape.shapeType != ParticleSystemShapeType.SkinnedMeshRenderer && o.shape.shapeType != ParticleSystemShapeType.MeshRenderer)) != null;

            if (flag4)
            {
                ModuleUI.GUIPopup(InitialModuleUI.s_Texts.scalingMode, this.m_ScalingMode, InitialModuleUI.s_Texts.scalingModes, new GUILayoutOption[0]);
            }
            bool boolValue = this.m_PlayOnAwake.boolValue;
            bool flag5     = ModuleUI.GUIToggle(InitialModuleUI.s_Texts.autoplay, this.m_PlayOnAwake, new GUILayoutOption[0]);

            if (boolValue != flag5)
            {
                this.m_ParticleSystemUI.m_ParticleEffectUI.PlayOnAwakeChanged(flag5);
            }
            ModuleUI.GUIBoolAsPopup(InitialModuleUI.s_Texts.emitterVelocity, this.m_EmitterVelocity, new string[]
            {
                "Transform",
                "Rigidbody"
            }, new GUILayoutOption[0]);
            ModuleUI.GUIInt(InitialModuleUI.s_Texts.maxParticles, this.m_MaxNumParticles, new GUILayoutOption[0]);
            if (!ModuleUI.GUIToggle(InitialModuleUI.s_Texts.autoRandomSeed, this.m_AutoRandomSeed, new GUILayoutOption[0]))
            {
                bool flag6 = this.m_ParticleSystemUI.m_ParticleEffectUI.m_Owner is ParticleSystemInspector;
                if (flag6)
                {
                    GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                    ModuleUI.GUIInt(InitialModuleUI.s_Texts.randomSeed, this.m_RandomSeed, new GUILayoutOption[0]);
                    if (!this.m_ParticleSystemUI.multiEdit && GUILayout.Button("Reseed", EditorStyles.miniButton, new GUILayoutOption[]
                    {
                        GUILayout.Width(60f)
                    }))
                    {
                        this.m_RandomSeed.intValue = this.m_ParticleSystemUI.m_ParticleSystems[0].GenerateRandomSeed();
                    }
                    GUILayout.EndHorizontal();
                }
                else
                {
                    ModuleUI.GUIInt(InitialModuleUI.s_Texts.randomSeed, this.m_RandomSeed, new GUILayoutOption[0]);
                    if (!this.m_ParticleSystemUI.multiEdit && GUILayout.Button("Reseed", EditorStyles.miniButton, new GUILayoutOption[0]))
                    {
                        this.m_RandomSeed.intValue = this.m_ParticleSystemUI.m_ParticleSystems[0].GenerateRandomSeed();
                    }
                }
            }
            ModuleUI.GUIPopup(InitialModuleUI.s_Texts.stopAction, this.m_StopAction, InitialModuleUI.s_Texts.stopActions, new GUILayoutOption[0]);
        }
Ejemplo n.º 6
0
 public ModuleUI(ParticleSystemUI owner, SerializedObject o, string name, string displayName, ModuleUI.VisibilityState initialVisibilityState)
   : base(o, name)
 {
   this.Setup(owner, o, name, displayName, initialVisibilityState);
 }
 private void Init(ModuleUI m, GUIContent displayName, string uniqueName, bool signedRange, bool useProp0)
 {
     this.m_Module = m;
     this.m_DisplayName = displayName;
     this.m_Name = uniqueName;
     this.m_SignedRange = signedRange;
     this.m_RemapValue = 1f;
     this.m_DefaultCurveScalar = 1f;
     this.m_AllowConstant = true;
     this.m_AllowRandom = true;
     this.m_AllowCurves = true;
     this.scalar = !useProp0 ? m.GetProperty(this.m_Name, "scalar") : m.GetProperty0(this.m_Name, "scalar");
     this.maxCurve = !useProp0 ? m.GetProperty(this.m_Name, "maxCurve") : m.GetProperty0(this.m_Name, "maxCurve");
     this.maxCurveFirstKeyValue = this.maxCurve.FindPropertyRelative("m_Curve.Array.data[0].value");
     this.minCurve = !useProp0 ? m.GetProperty(this.m_Name, "minCurve") : m.GetProperty0(this.m_Name, "minCurve");
     this.minCurveFirstKeyValue = this.minCurve.FindPropertyRelative("m_Curve.Array.data[0].value");
     this.minMaxState = !useProp0 ? m.GetProperty(this.m_Name, "minMaxState") : m.GetProperty0(this.m_Name, "minMaxState");
     if (((this.state == MinMaxCurveState.k_Curve) || (this.state == MinMaxCurveState.k_TwoCurves)) && this.m_Module.m_ParticleSystemUI.m_ParticleEffectUI.IsParticleSystemUIVisible(this.m_Module.m_ParticleSystemUI))
     {
         m.GetParticleSystemCurveEditor().AddCurveDataIfNeeded(this.GetUniqueCurveName(), this.CreateCurveData(Color.black));
     }
     m.AddToModuleCurves(this.maxCurve);
 }
 public SerializedMinMaxCurve(ModuleUI m, GUIContent displayName, bool signedRange)
 {
     this.Init(m, displayName, "curve", signedRange, false, true);
 }
Ejemplo n.º 9
0
 public static bool GUIToggle(GUIContent guiContent, SerializedProperty boolProp)
 {
     return(ModuleUI.Toggle(ModuleUI.PrefixLabel(ModuleUI.GetControlRect(13), guiContent), boolProp));
 }
Ejemplo n.º 10
0
 public static bool GUIToggle(string label, SerializedProperty boolProp)
 {
     return(ModuleUI.GUIToggle(GUIContent.Temp(label), boolProp));
 }
Ejemplo n.º 11
0
		private static ModuleUI[] CreateUIModules(ParticleSystemUI e, SerializedObject so)
		{
			int num = 0;
			ModuleUI[] expr_09 = new ModuleUI[17];
			expr_09[0] = new InitialModuleUI(e, so, ParticleSystemUI.s_ModuleNames[num++]);
			expr_09[1] = new EmissionModuleUI(e, so, ParticleSystemUI.s_ModuleNames[num++]);
			expr_09[2] = new ShapeModuleUI(e, so, ParticleSystemUI.s_ModuleNames[num++]);
			expr_09[3] = new VelocityModuleUI(e, so, ParticleSystemUI.s_ModuleNames[num++]);
			expr_09[4] = new ClampVelocityModuleUI(e, so, ParticleSystemUI.s_ModuleNames[num++]);
			expr_09[5] = new ForceModuleUI(e, so, ParticleSystemUI.s_ModuleNames[num++]);
			expr_09[6] = new ColorModuleUI(e, so, ParticleSystemUI.s_ModuleNames[num++]);
			expr_09[7] = new ColorByVelocityModuleUI(e, so, ParticleSystemUI.s_ModuleNames[num++]);
			expr_09[8] = new SizeModuleUI(e, so, ParticleSystemUI.s_ModuleNames[num++]);
			expr_09[9] = new SizeByVelocityModuleUI(e, so, ParticleSystemUI.s_ModuleNames[num++]);
			expr_09[10] = new RotationModuleUI(e, so, ParticleSystemUI.s_ModuleNames[num++]);
			expr_09[11] = new RotationByVelocityModuleUI(e, so, ParticleSystemUI.s_ModuleNames[num++]);
			expr_09[12] = new ExternalForcesModuleUI(e, so, ParticleSystemUI.s_ModuleNames[num++]);
			expr_09[13] = new CollisionModuleUI(e, so, ParticleSystemUI.s_ModuleNames[num++]);
			expr_09[14] = new SubModuleUI(e, so, ParticleSystemUI.s_ModuleNames[num++]);
			expr_09[15] = new UVModuleUI(e, so, ParticleSystemUI.s_ModuleNames[num++]);
			return expr_09;
		}
 private static ModuleUI[] CreateUIModules(ParticleSystemUI e, SerializedObject so)
 {
   int num1 = 0;
   ModuleUI[] moduleUiArray = new ModuleUI[18];
   int index1 = 0;
   ParticleSystemUI owner1 = e;
   SerializedObject o1 = so;
   string[] moduleNames1 = ParticleSystemUI.s_ModuleNames;
   int index2 = num1;
   int num2 = 1;
   int num3 = index2 + num2;
   string displayName1 = moduleNames1[index2];
   InitialModuleUI initialModuleUi = new InitialModuleUI(owner1, o1, displayName1);
   moduleUiArray[index1] = (ModuleUI) initialModuleUi;
   int index3 = 1;
   ParticleSystemUI owner2 = e;
   SerializedObject o2 = so;
   string[] moduleNames2 = ParticleSystemUI.s_ModuleNames;
   int index4 = num3;
   int num4 = 1;
   int num5 = index4 + num4;
   string displayName2 = moduleNames2[index4];
   EmissionModuleUI emissionModuleUi = new EmissionModuleUI(owner2, o2, displayName2);
   moduleUiArray[index3] = (ModuleUI) emissionModuleUi;
   int index5 = 2;
   ParticleSystemUI owner3 = e;
   SerializedObject o3 = so;
   string[] moduleNames3 = ParticleSystemUI.s_ModuleNames;
   int index6 = num5;
   int num6 = 1;
   int num7 = index6 + num6;
   string displayName3 = moduleNames3[index6];
   ShapeModuleUI shapeModuleUi = new ShapeModuleUI(owner3, o3, displayName3);
   moduleUiArray[index5] = (ModuleUI) shapeModuleUi;
   int index7 = 3;
   ParticleSystemUI owner4 = e;
   SerializedObject o4 = so;
   string[] moduleNames4 = ParticleSystemUI.s_ModuleNames;
   int index8 = num7;
   int num8 = 1;
   int num9 = index8 + num8;
   string displayName4 = moduleNames4[index8];
   VelocityModuleUI velocityModuleUi1 = new VelocityModuleUI(owner4, o4, displayName4);
   moduleUiArray[index7] = (ModuleUI) velocityModuleUi1;
   int index9 = 4;
   ParticleSystemUI owner5 = e;
   SerializedObject o5 = so;
   string[] moduleNames5 = ParticleSystemUI.s_ModuleNames;
   int index10 = num9;
   int num10 = 1;
   int num11 = index10 + num10;
   string displayName5 = moduleNames5[index10];
   ClampVelocityModuleUI velocityModuleUi2 = new ClampVelocityModuleUI(owner5, o5, displayName5);
   moduleUiArray[index9] = (ModuleUI) velocityModuleUi2;
   int index11 = 5;
   ParticleSystemUI owner6 = e;
   SerializedObject o6 = so;
   string[] moduleNames6 = ParticleSystemUI.s_ModuleNames;
   int index12 = num11;
   int num12 = 1;
   int num13 = index12 + num12;
   string displayName6 = moduleNames6[index12];
   InheritVelocityModuleUI velocityModuleUi3 = new InheritVelocityModuleUI(owner6, o6, displayName6);
   moduleUiArray[index11] = (ModuleUI) velocityModuleUi3;
   int index13 = 6;
   ParticleSystemUI owner7 = e;
   SerializedObject o7 = so;
   string[] moduleNames7 = ParticleSystemUI.s_ModuleNames;
   int index14 = num13;
   int num14 = 1;
   int num15 = index14 + num14;
   string displayName7 = moduleNames7[index14];
   ForceModuleUI forceModuleUi = new ForceModuleUI(owner7, o7, displayName7);
   moduleUiArray[index13] = (ModuleUI) forceModuleUi;
   int index15 = 7;
   ParticleSystemUI owner8 = e;
   SerializedObject o8 = so;
   string[] moduleNames8 = ParticleSystemUI.s_ModuleNames;
   int index16 = num15;
   int num16 = 1;
   int num17 = index16 + num16;
   string displayName8 = moduleNames8[index16];
   ColorModuleUI colorModuleUi = new ColorModuleUI(owner8, o8, displayName8);
   moduleUiArray[index15] = (ModuleUI) colorModuleUi;
   int index17 = 8;
   ParticleSystemUI owner9 = e;
   SerializedObject o9 = so;
   string[] moduleNames9 = ParticleSystemUI.s_ModuleNames;
   int index18 = num17;
   int num18 = 1;
   int num19 = index18 + num18;
   string displayName9 = moduleNames9[index18];
   ColorByVelocityModuleUI velocityModuleUi4 = new ColorByVelocityModuleUI(owner9, o9, displayName9);
   moduleUiArray[index17] = (ModuleUI) velocityModuleUi4;
   int index19 = 9;
   ParticleSystemUI owner10 = e;
   SerializedObject o10 = so;
   string[] moduleNames10 = ParticleSystemUI.s_ModuleNames;
   int index20 = num19;
   int num20 = 1;
   int num21 = index20 + num20;
   string displayName10 = moduleNames10[index20];
   SizeModuleUI sizeModuleUi = new SizeModuleUI(owner10, o10, displayName10);
   moduleUiArray[index19] = (ModuleUI) sizeModuleUi;
   int index21 = 10;
   ParticleSystemUI owner11 = e;
   SerializedObject o11 = so;
   string[] moduleNames11 = ParticleSystemUI.s_ModuleNames;
   int index22 = num21;
   int num22 = 1;
   int num23 = index22 + num22;
   string displayName11 = moduleNames11[index22];
   SizeByVelocityModuleUI velocityModuleUi5 = new SizeByVelocityModuleUI(owner11, o11, displayName11);
   moduleUiArray[index21] = (ModuleUI) velocityModuleUi5;
   int index23 = 11;
   ParticleSystemUI owner12 = e;
   SerializedObject o12 = so;
   string[] moduleNames12 = ParticleSystemUI.s_ModuleNames;
   int index24 = num23;
   int num24 = 1;
   int num25 = index24 + num24;
   string displayName12 = moduleNames12[index24];
   RotationModuleUI rotationModuleUi = new RotationModuleUI(owner12, o12, displayName12);
   moduleUiArray[index23] = (ModuleUI) rotationModuleUi;
   int index25 = 12;
   ParticleSystemUI owner13 = e;
   SerializedObject o13 = so;
   string[] moduleNames13 = ParticleSystemUI.s_ModuleNames;
   int index26 = num25;
   int num26 = 1;
   int num27 = index26 + num26;
   string displayName13 = moduleNames13[index26];
   RotationByVelocityModuleUI velocityModuleUi6 = new RotationByVelocityModuleUI(owner13, o13, displayName13);
   moduleUiArray[index25] = (ModuleUI) velocityModuleUi6;
   int index27 = 13;
   ParticleSystemUI owner14 = e;
   SerializedObject o14 = so;
   string[] moduleNames14 = ParticleSystemUI.s_ModuleNames;
   int index28 = num27;
   int num28 = 1;
   int num29 = index28 + num28;
   string displayName14 = moduleNames14[index28];
   ExternalForcesModuleUI externalForcesModuleUi = new ExternalForcesModuleUI(owner14, o14, displayName14);
   moduleUiArray[index27] = (ModuleUI) externalForcesModuleUi;
   int index29 = 14;
   ParticleSystemUI owner15 = e;
   SerializedObject o15 = so;
   string[] moduleNames15 = ParticleSystemUI.s_ModuleNames;
   int index30 = num29;
   int num30 = 1;
   int num31 = index30 + num30;
   string displayName15 = moduleNames15[index30];
   CollisionModuleUI collisionModuleUi = new CollisionModuleUI(owner15, o15, displayName15);
   moduleUiArray[index29] = (ModuleUI) collisionModuleUi;
   int index31 = 15;
   ParticleSystemUI owner16 = e;
   SerializedObject o16 = so;
   string[] moduleNames16 = ParticleSystemUI.s_ModuleNames;
   int index32 = num31;
   int num32 = 1;
   int num33 = index32 + num32;
   string displayName16 = moduleNames16[index32];
   SubModuleUI subModuleUi = new SubModuleUI(owner16, o16, displayName16);
   moduleUiArray[index31] = (ModuleUI) subModuleUi;
   int index33 = 16;
   ParticleSystemUI owner17 = e;
   SerializedObject o17 = so;
   string[] moduleNames17 = ParticleSystemUI.s_ModuleNames;
   int index34 = num33;
   int num34 = 1;
   int num35 = index34 + num34;
   string displayName17 = moduleNames17[index34];
   UVModuleUI uvModuleUi = new UVModuleUI(owner17, o17, displayName17);
   moduleUiArray[index33] = (ModuleUI) uvModuleUi;
   return moduleUiArray;
 }
Ejemplo n.º 13
0
		private static void GUICurveField(Rect position, SerializedProperty maxCurve, SerializedProperty minCurve, Color color, Rect ranges, ModuleUI.CurveFieldMouseDownCallback mouseDownCallback)
		{
			int controlID = GUIUtility.GetControlID(1321321231, EditorGUIUtility.native, position);
			Event current = Event.current;
			EventType typeForControl = current.GetTypeForControl(controlID);
			if (typeForControl != EventType.MouseDown)
			{
				if (typeForControl == EventType.Repaint)
				{
					Rect position2 = position;
					if (minCurve == null)
					{
						EditorGUIUtility.DrawCurveSwatch(position2, null, maxCurve, color, EditorGUI.kCurveBGColor, ranges);
					}
					else
					{
						EditorGUIUtility.DrawRegionSwatch(position2, maxCurve, minCurve, color, EditorGUI.kCurveBGColor, ranges);
					}
					EditorStyles.colorPickerBox.Draw(position2, GUIContent.none, controlID, false);
				}
			}
			else
			{
				if (position.Contains(current.mousePosition) && mouseDownCallback != null && mouseDownCallback(current.button, position, ranges))
				{
					current.Use();
				}
			}
		}
Ejemplo n.º 14
0
		protected virtual void SetVisibilityState(ModuleUI.VisibilityState newState)
		{
			if (newState != this.m_VisibilityState)
			{
				if (newState == ModuleUI.VisibilityState.VisibleAndFolded)
				{
					ParticleSystemCurveEditor particleSystemCurveEditor = this.m_ParticleSystemUI.m_ParticleEffectUI.GetParticleSystemCurveEditor();
					foreach (SerializedProperty current in this.m_ModuleCurves)
					{
						if (particleSystemCurveEditor.IsAdded(current))
						{
							this.m_CurvesRemovedWhenFolded.Add(current);
							particleSystemCurveEditor.SetVisible(current, false);
						}
					}
					particleSystemCurveEditor.Refresh();
				}
				else
				{
					if (newState == ModuleUI.VisibilityState.VisibleAndFoldedOut)
					{
						ParticleSystemCurveEditor particleSystemCurveEditor2 = this.m_ParticleSystemUI.m_ParticleEffectUI.GetParticleSystemCurveEditor();
						foreach (SerializedProperty current2 in this.m_CurvesRemovedWhenFolded)
						{
							particleSystemCurveEditor2.SetVisible(current2, true);
						}
						this.m_CurvesRemovedWhenFolded.Clear();
						particleSystemCurveEditor2.Refresh();
					}
				}
				this.m_VisibilityState = newState;
				InspectorState.SetInt(base.GetUniqueModuleName(), (int)this.m_VisibilityState);
				if (newState == ModuleUI.VisibilityState.VisibleAndFoldedOut)
				{
					this.Init();
				}
			}
		}
Ejemplo n.º 15
0
		private void Setup(ParticleSystemUI owner, SerializedObject o, string name, string displayName, ModuleUI.VisibilityState defaultVisibilityState)
		{
			this.m_ParticleSystemUI = owner;
			this.m_DisplayName = displayName;
			if (this is RendererModuleUI)
			{
				this.m_Enabled = base.GetProperty0("m_Enabled");
			}
			else
			{
				this.m_Enabled = base.GetProperty("enabled");
			}
			this.m_VisibilityState = (ModuleUI.VisibilityState)InspectorState.GetInt(base.GetUniqueModuleName(), (int)defaultVisibilityState);
			this.CheckVisibilityState();
			if (this.foldout)
			{
				this.Init();
			}
		}
Ejemplo n.º 16
0
        public void OnGUI(float width, bool fixedWidth)
        {
            bool   flag = Event.current.type == EventType.Repaint;
            string text = null;

            if (this.m_ParticleSystems.Length > 1)
            {
                text = "Multiple Particle Systems";
            }
            else if (this.m_ParticleSystems.Length > 0)
            {
                text = this.m_ParticleSystems[0].gameObject.name;
            }
            if (fixedWidth)
            {
                EditorGUIUtility.labelWidth = width * 0.4f;
                EditorGUILayout.BeginVertical(new GUILayoutOption[]
                {
                    GUILayout.Width(width)
                });
            }
            else
            {
                EditorGUIUtility.labelWidth  = 0f;
                EditorGUIUtility.labelWidth -= 4f;
                EditorGUILayout.BeginVertical(new GUILayoutOption[0]);
            }
            InitialModuleUI initial = (InitialModuleUI)this.m_Modules[0];

            for (int i = 0; i < this.m_Modules.Length; i++)
            {
                ModuleUI moduleUI = this.m_Modules[i];
                if (moduleUI != null)
                {
                    bool flag2 = moduleUI == this.m_Modules[0];
                    if (moduleUI.visibleUI || flag2)
                    {
                        GUIContent gUIContent = new GUIContent();
                        Rect       rect;
                        GUIStyle   style;
                        if (flag2)
                        {
                            rect  = GUILayoutUtility.GetRect(width, 25f);
                            style = ParticleSystemStyles.Get().emitterHeaderStyle;
                        }
                        else
                        {
                            rect  = GUILayoutUtility.GetRect(width, 15f);
                            style = ParticleSystemStyles.Get().moduleHeaderStyle;
                        }
                        if (moduleUI.foldout)
                        {
                            using (new EditorGUI.DisabledScope(!moduleUI.enabled))
                            {
                                Rect position = EditorGUILayout.BeginVertical(ParticleSystemStyles.Get().modulePadding, new GUILayoutOption[0]);
                                position.y      -= 4f;
                                position.height += 4f;
                                GUI.Label(position, GUIContent.none, ParticleSystemStyles.Get().moduleBgStyle);
                                moduleUI.OnInspectorGUI(initial);
                                EditorGUILayout.EndVertical();
                            }
                        }
                        if (flag2)
                        {
                            ParticleSystemRenderer component = this.m_ParticleSystems[0].GetComponent <ParticleSystemRenderer>();
                            float num       = 21f;
                            Rect  position2 = new Rect(rect.x + 4f, rect.y + 2f, num, num);
                            if (flag && component != null)
                            {
                                bool flag3 = false;
                                int  num2  = 0;
                                if (!this.multiEdit)
                                {
                                    if (component.renderMode == ParticleSystemRenderMode.Mesh)
                                    {
                                        if (component.mesh != null)
                                        {
                                            num2 = component.mesh.GetInstanceID();
                                        }
                                    }
                                    else if (component.sharedMaterial != null)
                                    {
                                        num2 = component.sharedMaterial.GetInstanceID();
                                    }
                                    if (EditorUtility.IsDirty(num2))
                                    {
                                        AssetPreview.ClearTemporaryAssetPreviews();
                                    }
                                    if (num2 != 0)
                                    {
                                        Texture2D assetPreview = AssetPreview.GetAssetPreview(num2);
                                        if (assetPreview != null)
                                        {
                                            GUI.DrawTexture(position2, assetPreview, ScaleMode.StretchToFill, true);
                                            flag3 = true;
                                        }
                                    }
                                }
                                if (!flag3)
                                {
                                    GUI.Label(position2, GUIContent.none, ParticleSystemStyles.Get().moduleBgStyle);
                                }
                            }
                            if (!this.multiEdit && EditorGUI.DropdownButton(position2, GUIContent.none, FocusType.Passive, GUIStyle.none))
                            {
                                if (EditorGUI.actionKey)
                                {
                                    List <int> list       = new List <int>();
                                    int        instanceID = this.m_ParticleSystems[0].gameObject.GetInstanceID();
                                    list.AddRange(Selection.instanceIDs);
                                    if (!list.Contains(instanceID) || list.Count != 1)
                                    {
                                        if (list.Contains(instanceID))
                                        {
                                            list.Remove(instanceID);
                                        }
                                        else
                                        {
                                            list.Add(instanceID);
                                        }
                                    }
                                    Selection.instanceIDs = list.ToArray();
                                }
                                else
                                {
                                    Selection.instanceIDs      = new int[0];
                                    Selection.activeInstanceID = this.m_ParticleSystems[0].gameObject.GetInstanceID();
                                }
                            }
                        }
                        Rect position3 = new Rect(rect.x + 2f, rect.y + 1f, 13f, 13f);
                        if (!flag2 && GUI.Button(position3, GUIContent.none, GUIStyle.none))
                        {
                            moduleUI.enabled = !moduleUI.enabled;
                        }
                        Rect position4 = new Rect(rect.x + rect.width - 10f, rect.y + rect.height - 10f, 10f, 10f);
                        Rect position5 = new Rect(position4.x - 4f, position4.y - 4f, position4.width + 4f, position4.height + 4f);
                        Rect position6 = new Rect(position4.x - 23f, position4.y - 8f, 20f, 20f);
                        if (flag2 && EditorGUI.DropdownButton(position5, ParticleSystemUI.s_Texts.addModules, FocusType.Passive, GUIStyle.none))
                        {
                            this.ShowAddModuleMenu();
                        }
                        if (!string.IsNullOrEmpty(text))
                        {
                            gUIContent.text = ((!flag2) ? moduleUI.displayName : text);
                        }
                        else
                        {
                            gUIContent.text = moduleUI.displayName;
                        }
                        gUIContent.tooltip = moduleUI.toolTip;
                        bool flag4 = GUI.Toggle(rect, moduleUI.foldout, gUIContent, style);
                        if (flag4 != moduleUI.foldout)
                        {
                            int button = Event.current.button;
                            if (button != 0)
                            {
                                if (button == 1)
                                {
                                    if (flag2)
                                    {
                                        this.ShowEmitterMenu();
                                    }
                                    else
                                    {
                                        this.ShowModuleMenu(i);
                                    }
                                }
                            }
                            else
                            {
                                bool foldout = !moduleUI.foldout;
                                if (Event.current.control)
                                {
                                    ModuleUI[] modules = this.m_Modules;
                                    for (int j = 0; j < modules.Length; j++)
                                    {
                                        ModuleUI moduleUI2 = modules[j];
                                        if (moduleUI2 != null && moduleUI2.visibleUI)
                                        {
                                            moduleUI2.foldout = foldout;
                                        }
                                    }
                                }
                                else
                                {
                                    moduleUI.foldout = foldout;
                                }
                            }
                        }
                        if (!flag2)
                        {
                            EditorGUI.showMixedValue = moduleUI.enabledHasMultipleDifferentValues;
                            GUIStyle style2 = (!EditorGUI.showMixedValue) ? ParticleSystemStyles.Get().checkmark : ParticleSystemStyles.Get().checkmarkMixed;
                            GUI.Toggle(position3, moduleUI.enabled, GUIContent.none, style2);
                            EditorGUI.showMixedValue = false;
                        }
                        if (flag)
                        {
                            if (flag2)
                            {
                                GUI.Label(position4, GUIContent.none, ParticleSystemStyles.Get().plus);
                            }
                        }
                        if (flag2 && !string.IsNullOrEmpty(this.m_SupportsCullingTextLabel))
                        {
                            GUIContent content = new GUIContent("", ParticleSystemStyles.Get().warningIcon, this.m_SupportsCullingTextLabel);
                            GUI.Label(position6, content);
                        }
                        GUILayout.Space(1f);
                    }
                }
            }
            GUILayout.Space(-1f);
            EditorGUILayout.EndVertical();
            this.ApplyProperties();
        }
Ejemplo n.º 17
0
        public override void OnInspectorGUI(InitialModuleUI initial)
        {
            if (RendererModuleUI.s_Texts == null)
            {
                RendererModuleUI.s_Texts = new RendererModuleUI.Texts();
            }
            EditorGUI.BeginChangeCheck();
            RendererModuleUI.RenderMode renderMode = (RendererModuleUI.RenderMode)ModuleUI.GUIPopup(RendererModuleUI.s_Texts.renderMode, this.m_RenderMode, RendererModuleUI.s_Texts.particleTypes, new GUILayoutOption[0]);
            bool flag = EditorGUI.EndChangeCheck();

            if (!this.m_RenderMode.hasMultipleDifferentValues)
            {
                if (renderMode == RendererModuleUI.RenderMode.Mesh)
                {
                    EditorGUI.indentLevel++;
                    this.DoListOfMeshesGUI();
                    EditorGUI.indentLevel--;
                    if (flag && this.m_Meshes[0].objectReferenceInstanceIDValue == 0 && !this.m_Meshes[0].hasMultipleDifferentValues)
                    {
                        this.m_Meshes[0].objectReferenceValue = Resources.GetBuiltinResource(typeof(Mesh), "Cube.fbx");
                    }
                }
                else if (renderMode == RendererModuleUI.RenderMode.Stretch3D)
                {
                    EditorGUI.indentLevel++;
                    ModuleUI.GUIFloat(RendererModuleUI.s_Texts.cameraSpeedScale, this.m_CameraVelocityScale, new GUILayoutOption[0]);
                    ModuleUI.GUIFloat(RendererModuleUI.s_Texts.speedScale, this.m_VelocityScale, new GUILayoutOption[0]);
                    ModuleUI.GUIFloat(RendererModuleUI.s_Texts.lengthScale, this.m_LengthScale, new GUILayoutOption[0]);
                    EditorGUI.indentLevel--;
                }
                if (renderMode != RendererModuleUI.RenderMode.None)
                {
                    if (renderMode != RendererModuleUI.RenderMode.Mesh)
                    {
                        ModuleUI.GUIFloat(RendererModuleUI.s_Texts.normalDirection, this.m_NormalDirection, new GUILayoutOption[0]);
                    }
                    if (this.m_Material != null)
                    {
                        ModuleUI.GUIObject(RendererModuleUI.s_Texts.material, this.m_Material, new GUILayoutOption[0]);
                    }
                }
            }
            if (this.m_TrailMaterial != null)
            {
                ModuleUI.GUIObject(RendererModuleUI.s_Texts.trailMaterial, this.m_TrailMaterial, new GUILayoutOption[0]);
            }
            if (renderMode != RendererModuleUI.RenderMode.None)
            {
                if (!this.m_RenderMode.hasMultipleDifferentValues)
                {
                    ModuleUI.GUIPopup(RendererModuleUI.s_Texts.sortMode, this.m_SortMode, RendererModuleUI.s_Texts.sortTypes, new GUILayoutOption[0]);
                    ModuleUI.GUIFloat(RendererModuleUI.s_Texts.sortingFudge, this.m_SortingFudge, new GUILayoutOption[0]);
                    if (renderMode != RendererModuleUI.RenderMode.Mesh)
                    {
                        ModuleUI.GUIFloat(RendererModuleUI.s_Texts.minParticleSize, this.m_MinParticleSize, new GUILayoutOption[0]);
                        ModuleUI.GUIFloat(RendererModuleUI.s_Texts.maxParticleSize, this.m_MaxParticleSize, new GUILayoutOption[0]);
                    }
                    if (renderMode == RendererModuleUI.RenderMode.Billboard || renderMode == RendererModuleUI.RenderMode.Mesh)
                    {
                        bool flag2 = this.m_ParticleSystemUI.m_ParticleSystems.FirstOrDefault((ParticleSystem o) => o.shape.alignToDirection) != null;
                        if (flag2)
                        {
                            using (new EditorGUI.DisabledScope(true))
                            {
                                ModuleUI.GUIPopup(RendererModuleUI.s_Texts.space, 0, new string[]
                                {
                                    RendererModuleUI.s_Texts.spaces[2]
                                }, new GUILayoutOption[0]);
                            }
                            GUIContent gUIContent = EditorGUIUtility.TextContent("Using Align to Direction in the Shape Module forces the system to be rendered using Local Render Alignment.");
                            EditorGUILayout.HelpBox(gUIContent.text, MessageType.Info, true);
                        }
                        else
                        {
                            ModuleUI.GUIPopup(RendererModuleUI.s_Texts.space, this.m_RenderAlignment, RendererModuleUI.s_Texts.spaces, new GUILayoutOption[0]);
                        }
                    }
                    ModuleUI.GUIVector3Field(RendererModuleUI.s_Texts.pivot, this.m_Pivot, new GUILayoutOption[0]);
                    EditorGUI.BeginChangeCheck();
                    RendererModuleUI.s_VisualizePivot = ModuleUI.GUIToggle(RendererModuleUI.s_Texts.visualizePivot, RendererModuleUI.s_VisualizePivot, new GUILayoutOption[0]);
                    if (EditorGUI.EndChangeCheck())
                    {
                        EditorPrefs.SetBool("VisualizePivot", RendererModuleUI.s_VisualizePivot);
                    }
                }
                ModuleUI.GUIPopup(RendererModuleUI.s_Texts.maskingMode, this.m_MaskInteraction, RendererModuleUI.s_Texts.maskInteraction, new GUILayoutOption[0]);
                if (!this.m_RenderMode.hasMultipleDifferentValues)
                {
                    if (ModuleUI.GUIToggle(RendererModuleUI.s_Texts.useCustomVertexStreams, this.m_UseCustomVertexStreams, new GUILayoutOption[0]))
                    {
                        this.DoVertexStreamsGUI(renderMode);
                    }
                    EditorGUILayout.Space();
                    ModuleUI.GUIPopup(RendererModuleUI.s_Texts.castShadows, this.m_CastShadows, this.m_CastShadows.enumDisplayNames, new GUILayoutOption[0]);
                    using (new EditorGUI.DisabledScope(SceneView.IsUsingDeferredRenderingPath()))
                    {
                        ModuleUI.GUIToggle(RendererModuleUI.s_Texts.receiveShadows, this.m_ReceiveShadows, new GUILayoutOption[0]);
                    }
                    ModuleUI.GUIPopup(RendererModuleUI.s_Texts.motionVectors, this.m_MotionVectors, RendererModuleUI.s_Texts.motionVectorOptions, new GUILayoutOption[0]);
                    EditorGUILayout.SortingLayerField(RendererModuleUI.s_Texts.sortingLayer, this.m_SortingLayerID, ParticleSystemStyles.Get().popup, ParticleSystemStyles.Get().label);
                    ModuleUI.GUIInt(RendererModuleUI.s_Texts.sortingOrder, this.m_SortingOrder, new GUILayoutOption[0]);
                }
            }
            List <ParticleSystemRenderer> list = new List <ParticleSystemRenderer>();

            ParticleSystem[] particleSystems = this.m_ParticleSystemUI.m_ParticleSystems;
            for (int i = 0; i < particleSystems.Length; i++)
            {
                ParticleSystem particleSystem = particleSystems[i];
                list.Add(particleSystem.GetComponent <ParticleSystemRenderer>());
            }
            this.m_Probes.OnGUI(list.ToArray(), list.FirstOrDefault <ParticleSystemRenderer>(), true);
        }
Ejemplo n.º 18
0
 public static void GUILayerMask(GUIContent guiContent, SerializedProperty boolProp)
 {
     EditorGUI.LayerMaskField(ModuleUI.PrefixLabel(ModuleUI.GetControlRect(13), guiContent), boolProp, GUIContent.none, ParticleSystemStyles.Get().popup);
 }
 public SerializedMinMaxCurve(ModuleUI m, GUIContent displayName, string name, bool signedRange, bool useProp0)
 {
   this.Init(m, displayName, name, signedRange, useProp0);
 }
Ejemplo n.º 20
0
 public static bool GUIToggle(GUIContent guiContent, bool boolValue)
 {
     boolValue = EditorGUI.Toggle(ModuleUI.PrefixLabel(ModuleUI.GetControlRect(13), guiContent), boolValue, ParticleSystemStyles.Get().toggle);
     return(boolValue);
 }
 public SerializedMinMaxCurve(ModuleUI m, GUIContent displayName, string name)
 {
     this.m_MaxAllowedScalar = float.PositiveInfinity;
     this.Init(m, displayName, name, false, false);
 }
Ejemplo n.º 22
0
 public static void GUIToggleWithIntField(string name, SerializedProperty boolProp, SerializedProperty floatProp, bool invertToggle)
 {
     ModuleUI.GUIToggleWithIntField(EditorGUIUtility.TempContent(name), boolProp, floatProp, invertToggle);
 }
Ejemplo n.º 23
0
 protected virtual void SetVisibilityState(ModuleUI.VisibilityState newState)
 {
   if (newState == this.m_VisibilityState)
     return;
   if (newState == ModuleUI.VisibilityState.VisibleAndFolded)
   {
     ParticleSystemCurveEditor systemCurveEditor = this.m_ParticleSystemUI.m_ParticleEffectUI.GetParticleSystemCurveEditor();
     using (List<SerializedProperty>.Enumerator enumerator = this.m_ModuleCurves.GetEnumerator())
     {
       while (enumerator.MoveNext())
       {
         SerializedProperty current = enumerator.Current;
         if (systemCurveEditor.IsAdded(current))
         {
           this.m_CurvesRemovedWhenFolded.Add(current);
           systemCurveEditor.SetVisible(current, false);
         }
       }
     }
     systemCurveEditor.Refresh();
   }
   else if (newState == ModuleUI.VisibilityState.VisibleAndFoldedOut)
   {
     ParticleSystemCurveEditor systemCurveEditor = this.m_ParticleSystemUI.m_ParticleEffectUI.GetParticleSystemCurveEditor();
     using (List<SerializedProperty>.Enumerator enumerator = this.m_CurvesRemovedWhenFolded.GetEnumerator())
     {
       while (enumerator.MoveNext())
       {
         SerializedProperty current = enumerator.Current;
         systemCurveEditor.SetVisible(current, true);
       }
     }
     this.m_CurvesRemovedWhenFolded.Clear();
     systemCurveEditor.Refresh();
   }
   this.m_VisibilityState = newState;
   SessionState.SetInt(this.GetUniqueModuleName(), (int) this.m_VisibilityState);
   if (newState != ModuleUI.VisibilityState.VisibleAndFoldedOut)
     return;
   this.Init();
 }
Ejemplo n.º 24
0
 public static void GUIObject(GUIContent label, SerializedProperty objectProp)
 {
     EditorGUI.ObjectField(ModuleUI.PrefixLabel(ModuleUI.GetControlRect(13), label), objectProp, (System.Type)null, GUIContent.none, ParticleSystemStyles.Get().objectField);
 }
Ejemplo n.º 25
0
        private void ShowSubEmitter(int index)
        {
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            SerializedProperty arrayElementAtIndex = this.m_SubEmitters.GetArrayElementAtIndex(index);
            SerializedProperty serializedProperty  = arrayElementAtIndex.FindPropertyRelative("emitter");
            SerializedProperty serializedProperty2 = arrayElementAtIndex.FindPropertyRelative("type");
            SerializedProperty serializedProperty3 = arrayElementAtIndex.FindPropertyRelative("properties");

            ModuleUI.GUIPopup(GUIContent.none, serializedProperty2, SubModuleUI.s_Texts.subEmitterTypeTexts, new GUILayoutOption[]
            {
                GUILayout.MaxWidth(80f)
            });
            GUILayout.Label("", ParticleSystemStyles.Get().label, new GUILayoutOption[]
            {
                GUILayout.Width(4f)
            });
            ModuleUI.GUIObject(GUIContent.none, serializedProperty, new GUILayoutOption[0]);
            if (serializedProperty.objectReferenceValue == null)
            {
                GUILayout.Label("", ParticleSystemStyles.Get().label, new GUILayoutOption[]
                {
                    GUILayout.Width(8f)
                });
                if (GUILayout.Button(GUIContent.none, ParticleSystemStyles.Get().plus, new GUILayoutOption[]
                {
                    GUILayout.Width(16f)
                }))
                {
                    this.CreateSubEmitter(serializedProperty, index, (SubModuleUI.SubEmitterType)serializedProperty2.intValue);
                }
            }
            else
            {
                GUILayout.Label("", ParticleSystemStyles.Get().label, new GUILayoutOption[]
                {
                    GUILayout.Width(24f)
                });
            }
            serializedProperty3.intValue = ModuleUI.GUIMask(GUIContent.none, serializedProperty3.intValue, SubModuleUI.s_Texts.propertyStrings, new GUILayoutOption[]
            {
                GUILayout.Width(100f)
            });
            GUILayout.Label("", ParticleSystemStyles.Get().label, new GUILayoutOption[]
            {
                GUILayout.Width(8f)
            });
            if (index == 0)
            {
                if (GUILayout.Button(GUIContent.none, new GUIStyle("OL Plus"), new GUILayoutOption[]
                {
                    GUILayout.Width(16f)
                }))
                {
                    this.m_SubEmitters.InsertArrayElementAtIndex(this.m_SubEmitters.arraySize);
                    SerializedProperty arrayElementAtIndex2 = this.m_SubEmitters.GetArrayElementAtIndex(this.m_SubEmitters.arraySize - 1);
                    SerializedProperty serializedProperty4  = arrayElementAtIndex2.FindPropertyRelative("emitter");
                    serializedProperty4.objectReferenceValue = null;
                }
            }
            else if (GUILayout.Button(GUIContent.none, new GUIStyle("OL Minus"), new GUILayoutOption[]
            {
                GUILayout.Width(16f)
            }))
            {
                this.m_SubEmitters.DeleteArrayElementAtIndex(index);
            }
            GUILayout.EndHorizontal();
        }
Ejemplo n.º 26
0
 public static int GUIIntDraggable(GUIContent label, SerializedProperty intProp)
 {
     return(ModuleUI.GUIIntDraggable(label, intProp.intValue));
 }
 public SerializedMinMaxCurve(ModuleUI m, GUIContent displayName, string name, bool signedRange)
 {
     this.Init(m, displayName, name, signedRange);
 }
Ejemplo n.º 28
0
 public static int GUIIntDraggable(GUIContent label, int intValue)
 {
     return(ModuleUI.IntDraggable(GUILayoutUtility.GetRect(0.0f, 13f), label, intValue, EditorGUIUtility.labelWidth));
 }
Ejemplo n.º 29
0
        public override void OnInspectorGUI(InitialModuleUI initial)
        {
            EditorGUI.showMixedValue = this.m_Type.hasMultipleDifferentValues;
            int num  = this.m_Type.intValue;
            int num2 = this.m_TypeToGuiTypeIndex[num];

            EditorGUI.BeginChangeCheck();
            int  num3 = ModuleUI.GUIPopup(ShapeModuleUI.s_Texts.shape, num2, ShapeModuleUI.s_Texts.shapeTypes, this.m_Type, new GUILayoutOption[0]);
            bool flag = EditorGUI.EndChangeCheck();

            EditorGUI.showMixedValue = false;
            ParticleSystemShapeType particleSystemShapeType = this.m_GuiTypes[num3];

            if (num3 != num2)
            {
                num = (int)particleSystemShapeType;
            }
            if (!this.m_Type.hasMultipleDifferentValues)
            {
                switch (particleSystemShapeType)
                {
                case ParticleSystemShapeType.Sphere:
                case ParticleSystemShapeType.Hemisphere:
                    ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.radius, this.m_Radius.m_Value, new GUILayoutOption[0]);
                    ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.radiusThickness, this.m_RadiusThickness, new GUILayoutOption[0]);
                    break;

                case ParticleSystemShapeType.Cone:
                {
                    ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.coneAngle, this.m_Angle, new GUILayoutOption[0]);
                    ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.radius, this.m_Radius.m_Value, new GUILayoutOption[0]);
                    ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.radiusThickness, this.m_RadiusThickness, new GUILayoutOption[0]);
                    this.m_Arc.OnInspectorGUI(ShapeModuleUI.s_ArcTexts);
                    bool disabled = num != 8;
                    using (new EditorGUI.DisabledScope(disabled))
                    {
                        ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.coneLength, this.m_Length, new GUILayoutOption[0]);
                    }
                    int num4 = this.ConvertConeTypeToConeEmitFrom((ParticleSystemShapeType)num);
                    num4 = ModuleUI.GUIPopup(ShapeModuleUI.s_Texts.emitFrom, num4, ShapeModuleUI.s_Texts.coneTypes, this.m_Type, new GUILayoutOption[0]);
                    num  = (int)this.ConvertConeEmitFromToConeType(num4);
                    break;
                }

                case ParticleSystemShapeType.Box:
                {
                    int num5 = this.ConvertBoxTypeToBoxEmitFrom((ParticleSystemShapeType)num);
                    num5 = ModuleUI.GUIPopup(ShapeModuleUI.s_Texts.emitFrom, num5, ShapeModuleUI.s_Texts.boxTypes, this.m_Type, new GUILayoutOption[0]);
                    num  = (int)this.ConvertBoxEmitFromToBoxType(num5);
                    if (num == 15 || num == 16)
                    {
                        ModuleUI.GUIVector3Field(ShapeModuleUI.s_Texts.boxThickness, this.m_BoxThickness, new GUILayoutOption[0]);
                    }
                    break;
                }

                case ParticleSystemShapeType.Mesh:
                case ParticleSystemShapeType.MeshRenderer:
                case ParticleSystemShapeType.SkinnedMeshRenderer:
                {
                    ModuleUI.GUIPopup(ShapeModuleUI.s_Texts.meshType, this.m_PlacementMode, ShapeModuleUI.s_Texts.meshTypes, new GUILayoutOption[0]);
                    Material material = null;
                    Mesh     mesh     = null;
                    if (particleSystemShapeType == ParticleSystemShapeType.Mesh)
                    {
                        ModuleUI.GUIObject(ShapeModuleUI.s_Texts.mesh, this.m_Mesh, new GUILayoutOption[0]);
                        mesh = (Mesh)this.m_Mesh.objectReferenceValue;
                    }
                    else if (particleSystemShapeType == ParticleSystemShapeType.MeshRenderer)
                    {
                        ModuleUI.GUIObject(ShapeModuleUI.s_Texts.meshRenderer, this.m_MeshRenderer, new GUILayoutOption[0]);
                        MeshRenderer meshRenderer = (MeshRenderer)this.m_MeshRenderer.objectReferenceValue;
                        if (meshRenderer)
                        {
                            material = meshRenderer.sharedMaterial;
                            if (meshRenderer.GetComponent <MeshFilter>())
                            {
                                mesh = meshRenderer.GetComponent <MeshFilter>().sharedMesh;
                            }
                        }
                    }
                    else
                    {
                        ModuleUI.GUIObject(ShapeModuleUI.s_Texts.skinnedMeshRenderer, this.m_SkinnedMeshRenderer, new GUILayoutOption[0]);
                        SkinnedMeshRenderer skinnedMeshRenderer = (SkinnedMeshRenderer)this.m_SkinnedMeshRenderer.objectReferenceValue;
                        if (skinnedMeshRenderer)
                        {
                            material = skinnedMeshRenderer.sharedMaterial;
                            mesh     = skinnedMeshRenderer.sharedMesh;
                        }
                    }
                    ModuleUI.GUIToggleWithIntField(ShapeModuleUI.s_Texts.meshMaterialIndex, this.m_UseMeshMaterialIndex, this.m_MeshMaterialIndex, false, new GUILayoutOption[0]);
                    bool flag2 = ModuleUI.GUIToggle(ShapeModuleUI.s_Texts.useMeshColors, this.m_UseMeshColors, new GUILayoutOption[0]);
                    if (flag2)
                    {
                        if (material != null && mesh != null)
                        {
                            int name  = Shader.PropertyToID("_Color");
                            int name2 = Shader.PropertyToID("_TintColor");
                            if (!material.HasProperty(name) && !material.HasProperty(name2) && !mesh.HasChannel(Mesh.InternalShaderChannel.Color))
                            {
                                GUIContent gUIContent = EditorGUIUtility.TrTextContent("To use mesh colors, your source mesh must either provide vertex colors, or its shader must contain a color property named \"_Color\" or \"_TintColor\".", null, null);
                                EditorGUILayout.HelpBox(gUIContent.text, MessageType.Warning, true);
                            }
                        }
                    }
                    ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.meshNormalOffset, this.m_MeshNormalOffset, new GUILayoutOption[0]);
                    break;
                }

                case ParticleSystemShapeType.Circle:
                    ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.radius, this.m_Radius.m_Value, new GUILayoutOption[0]);
                    ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.radiusThickness, this.m_RadiusThickness, new GUILayoutOption[0]);
                    this.m_Arc.OnInspectorGUI(ShapeModuleUI.s_ArcTexts);
                    break;

                case ParticleSystemShapeType.SingleSidedEdge:
                    this.m_Radius.OnInspectorGUI(ShapeModuleUI.s_RadiusTexts);
                    break;

                case ParticleSystemShapeType.Donut:
                    ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.radius, this.m_Radius.m_Value, new GUILayoutOption[0]);
                    ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.donutRadius, this.m_DonutRadius, new GUILayoutOption[0]);
                    ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.radiusThickness, this.m_RadiusThickness, new GUILayoutOption[0]);
                    this.m_Arc.OnInspectorGUI(ShapeModuleUI.s_ArcTexts);
                    break;
                }
            }
            if (flag || !this.m_Type.hasMultipleDifferentValues)
            {
                this.m_Type.intValue = num;
            }
            this.OnTextureInspectorGUI();
            this.OnTransformInspectorGUI();
            this.OnMiscInspectorGUI();
        }
Ejemplo n.º 30
0
 public static int IntDraggable(Rect rect, GUIContent label, SerializedProperty intProp, float dragWidth)
 {
     intProp.intValue = ModuleUI.IntDraggable(rect, label, intProp.intValue, dragWidth);
     return(intProp.intValue);
 }
Ejemplo n.º 31
0
        public void OnGUI(float width, bool fixedWidth)
        {
            bool isRepaintEvent = Event.current.type == EventType.Repaint;

            // Name of current emitter
            string selectedEmitterName = null;

            if (m_ParticleSystems.Length > 1)
            {
                selectedEmitterName = "Multiple Particle Systems";
            }
            else if (m_ParticleSystems.Length > 0)
            {
                selectedEmitterName = m_ParticleSystems[0].gameObject.name;
            }

            if (fixedWidth)
            {
                EditorGUIUtility.labelWidth = width * 0.4f;
                EditorGUILayout.BeginVertical(GUILayout.Width(width));
            }
            else
            {
                // First make sure labelWidth is at default width, then subtract
                EditorGUIUtility.labelWidth = 0;
                EditorGUIUtility.labelWidth = EditorGUIUtility.labelWidth - 4;

                EditorGUILayout.BeginVertical();
            }

            {
                InitialModuleUI initial = (InitialModuleUI)m_Modules[0];
                for (int i = 0; i < m_Modules.Length; ++i)
                {
                    ModuleUI module = m_Modules[i];
                    if (module == null)
                    {
                        continue;
                    }

                    bool initialModule = (module == m_Modules[0]);

                    // Skip if not visible (except initial module which should always be visible)
                    if (!module.visibleUI && !initialModule)
                    {
                        continue;
                    }

                    // Module header size
                    GUIContent headerLabel = new GUIContent();
                    Rect       moduleHeaderRect;
                    if (initialModule)
                    {
                        moduleHeaderRect = GUILayoutUtility.GetRect(width, 25);
                    }
                    else
                    {
                        moduleHeaderRect = GUILayoutUtility.GetRect(width, 15);
                    }

                    // Module content here to render it below the the header
                    if (module.foldout)
                    {
                        using (new EditorGUI.DisabledScope(!module.enabled))
                        {
                            Rect moduleSize = EditorGUILayout.BeginVertical(ParticleSystemStyles.Get().modulePadding);
                            {
                                moduleSize.y      -= 4; // pull background 'up' behind title to fill rounded corners.
                                moduleSize.height += 4;
                                GUI.Label(moduleSize, GUIContent.none, ParticleSystemStyles.Get().moduleBgStyle);
                                module.OnInspectorGUI(initial);
                            }
                            EditorGUILayout.EndVertical();
                        }
                    }

                    // TODO: Get Texture instead of static preview. Render Icon (below titlebar due to rounded corners)
                    if (initialModule)
                    {
                        // Get preview of material or mesh
                        ParticleSystemRenderer renderer = m_ParticleSystems[0].GetComponent <ParticleSystemRenderer>();

                        bool isEditable = (m_ParticleSystems[0].gameObject.hideFlags & HideFlags.NotEditable) == 0;

                        float iconSize = 21;
                        Rect  iconRect = new Rect(moduleHeaderRect.x + 4, moduleHeaderRect.y + 2, iconSize, iconSize);
                        if (isRepaintEvent && renderer != null)
                        {
                            bool iconRendered = false;
                            int  instanceID   = 0;

                            if (!multiEdit)
                            {
                                if (renderer.renderMode == ParticleSystemRenderMode.Mesh)
                                {
                                    if (renderer.mesh != null)
                                    {
                                        instanceID = renderer.mesh.GetInstanceID();

                                        // If the asset is dirty we ensure to get a updated one by clearing cache of temporary previews
                                        if (m_CachedMeshInstanceID != instanceID)
                                        {
                                            m_CachedMeshInstanceID = instanceID;
                                            m_CachedMeshDirtyCount = -1;
                                        }
                                        if (EditorUtility.GetDirtyCount(instanceID) != m_CachedMeshDirtyCount)
                                        {
                                            AssetPreview.ClearTemporaryAssetPreviews();
                                            m_CachedMeshDirtyCount = EditorUtility.GetDirtyCount(instanceID);
                                        }
                                    }
                                }
                                else if (renderer.sharedMaterial != null)
                                {
                                    instanceID = renderer.sharedMaterial.GetInstanceID();

                                    // If the asset is dirty we ensure to get a updated one by clearing cache of temporary previews
                                    if (m_CachedMaterialInstanceID != instanceID)
                                    {
                                        m_CachedMaterialInstanceID = instanceID;
                                        m_CachedMaterialDirtyCount = -1;
                                    }
                                    if (EditorUtility.GetDirtyCount(instanceID) != m_CachedMaterialDirtyCount)
                                    {
                                        AssetPreview.ClearTemporaryAssetPreviews();
                                        m_CachedMaterialDirtyCount = EditorUtility.GetDirtyCount(instanceID);
                                    }
                                }
                            }

                            if (multiEdit || !isEditable)
                            {
                                // Presets should use the default material.
                                instanceID = Material.GetDefaultParticleMaterial().GetInstanceID();
                            }

                            if (instanceID != 0)
                            {
                                Texture2D icon = AssetPreview.GetAssetPreview(instanceID);
                                if (icon != null)
                                {
                                    GUI.DrawTexture(iconRect, icon, ScaleMode.StretchToFill, true);
                                    iconRendered = true;
                                }
                            }

                            // Fill so we do not see the background when we have no icon (eg multi-edit)
                            if (!iconRendered)
                            {
                                GUI.Label(iconRect, GUIContent.none, ParticleSystemStyles.Get().moduleBgStyle);
                            }
                        }

                        // Select gameObject when clicking on icon
                        // Don't attempt to select if the system is a preset. It will select the temporary object causing the
                        // preset to deselect and destroy the particle system. (case 1198545)
                        if (!multiEdit && EditorGUI.DropdownButton(iconRect, GUIContent.none, FocusType.Passive, GUIStyle.none) && isEditable)
                        {
                            // Toggle selected particle system from selection
                            if (EditorGUI.actionKey)
                            {
                                List <int> newSelection = new List <int>();
                                int        instanceID   = m_ParticleSystems[0].gameObject.GetInstanceID();
                                newSelection.AddRange(Selection.instanceIDs);
                                if (!newSelection.Contains(instanceID) || newSelection.Count != 1)
                                {
                                    if (newSelection.Contains(instanceID))
                                    {
                                        newSelection.Remove(instanceID);
                                    }
                                    else
                                    {
                                        newSelection.Add(instanceID);
                                    }
                                }

                                Selection.instanceIDs = newSelection.ToArray();
                            }
                            else
                            {
                                Selection.instanceIDs      = new int[0];
                                Selection.activeInstanceID = m_ParticleSystems[0].gameObject.GetInstanceID();
                            }
                        }
                    }

                    // Button logic for enabledness (see below for UI)
                    Rect checkMarkRect = new Rect(moduleHeaderRect.x + 2, moduleHeaderRect.y + 1, 13, 13);
                    if (!initialModule && GUI.Button(checkMarkRect, GUIContent.none, GUIStyle.none))
                    {
                        module.enabled = !module.enabled;
                    }

                    // Button logic for plus/minus (see below for UI)
                    Rect plusRect         = new Rect(moduleHeaderRect.x + moduleHeaderRect.width - 10, moduleHeaderRect.y + moduleHeaderRect.height - 10, 10, 10);
                    Rect plusRectInteract = new Rect(plusRect.x - 4, plusRect.y - 4, plusRect.width + 4, plusRect.height + 4);
                    Rect infoRect         = new Rect(plusRect.x - 23, plusRect.y - 8, 20, 20);

                    if (initialModule && EditorGUI.DropdownButton(plusRectInteract, s_Texts.addModules, FocusType.Passive, GUIStyle.none))
                    {
                        ShowAddModuleMenu();
                    }

                    // Module header (last to become top most renderered)
                    if (!string.IsNullOrEmpty(selectedEmitterName))
                    {
                        headerLabel.text = initialModule ? selectedEmitterName : module.displayName;
                    }
                    else
                    {
                        headerLabel.text = module.displayName;
                    }
                    headerLabel.tooltip = module.toolTip;

                    bool newToggleState = module.DrawHeader(moduleHeaderRect, headerLabel);

                    if (newToggleState != module.foldout)
                    {
                        switch (Event.current.button)
                        {
                        case 0:
                            bool newFoldoutState = !module.foldout;
                            if (Event.current.control)
                            {
                                foreach (var moduleUi in m_Modules)
                                {
                                    if (moduleUi != null && moduleUi.visibleUI)
                                    {
                                        moduleUi.foldout = newFoldoutState;
                                    }
                                }
                            }
                            else
                            {
                                module.foldout = newFoldoutState;
                            }
                            break;

                        case 1:
                            if (initialModule)
                            {
                                ShowEmitterMenu();
                            }
                            else
                            {
                                ShowModuleMenu(i);
                            }
                            break;
                        }
                    }

                    // Render checkmark on top (logic: see above)
                    if (!initialModule)
                    {
                        EditorGUI.showMixedValue = module.enabledHasMultipleDifferentValues;
                        GUIStyle style = EditorGUI.showMixedValue ? ParticleSystemStyles.Get().toggleMixed : ParticleSystemStyles.Get().toggle;
                        GUI.Toggle(checkMarkRect, module.enabled, GUIContent.none, style);
                        EditorGUI.showMixedValue = false;
                    }

                    // Render plus/minus on top
                    if (isRepaintEvent && initialModule)
                    {
                        GUI.Label(plusRect, GUIContent.none, ParticleSystemStyles.Get().plus);
                    }

                    if (initialModule && !string.IsNullOrEmpty(m_SupportsCullingTextLabel))
                    {
                        var supportsCullingText = new GUIContent("", ParticleSystemStyles.Get().warningIcon, m_SupportsCullingTextLabel);
                        GUI.Label(infoRect, supportsCullingText);
                    }

                    GUILayout.Space(1); // dist to next module
                } // foreach module
                GUILayout.Space(-1);
            }
            EditorGUILayout.EndVertical(); // end fixed moduleWidth

            // Apply the property, handle undo
            ApplyProperties();
        }
Ejemplo n.º 32
0
 public static void GUIInt(GUIContent guiContent, SerializedProperty intProp)
 {
     intProp.intValue = ModuleUI.GUIInt(guiContent, intProp.intValue);
 }
Ejemplo n.º 33
0
 public override void OnInspectorGUI(InitialModuleUI initial)
 {
     ModuleUI.GUIMinMaxCurve(EmissionModuleUI.s_Texts.rateOverTime, this.m_Time, new GUILayoutOption[0]);
     ModuleUI.GUIMinMaxCurve(EmissionModuleUI.s_Texts.rateOverDistance, this.m_Distance, new GUILayoutOption[0]);
     this.DoBurstGUI(initial);
 }
Ejemplo n.º 34
0
 public static void GUISlider(SerializedProperty floatProp, float a, float b, float remap)
 {
     ModuleUI.GUISlider(string.Empty, floatProp, a, b, remap);
 }
Ejemplo n.º 35
0
 public SerializedMinMaxCurve(ModuleUI m, GUIContent displayName, string name)
 {
     this.Init(m, displayName, name, false, false, true);
 }
Ejemplo n.º 36
0
 public static int GUIPopup(string name, SerializedProperty intProp, string[] options)
 {
     return(ModuleUI.GUIPopup(GUIContent.Temp(name), intProp, options));
 }
 public SerializedMinMaxCurve(ModuleUI m, GUIContent displayName, bool signedRange)
 {
   this.Init(m, displayName, "curve", signedRange, false);
 }
Ejemplo n.º 38
0
 public static int GUIPopup(GUIContent label, int intValue, string[] options)
 {
     return(EditorGUI.Popup(ModuleUI.PrefixLabel(ModuleUI.GetControlRect(13), label), intValue, options, ParticleSystemStyles.Get().popup));
 }
 public SerializedMinMaxCurve(ModuleUI m, GUIContent displayName, string name)
 {
   this.Init(m, displayName, name, false, false);
 }
Ejemplo n.º 40
0
 public static void GUIMinMaxCurve(string label, SerializedMinMaxCurve mmCurve)
 {
     ModuleUI.GUIMinMaxCurve(GUIContent.Temp(label), mmCurve);
 }
 public SerializedMinMaxCurve(ModuleUI m, GUIContent displayName, bool signedRange)
 {
     this.m_MaxAllowedScalar = float.PositiveInfinity;
     this.Init(m, displayName, "curve", signedRange, false);
 }
Ejemplo n.º 42
0
        public void GUITripleMinMaxCurve(GUIContent label, GUIContent x, SerializedMinMaxCurve xCurve, GUIContent y, SerializedMinMaxCurve yCurve, GUIContent z, SerializedMinMaxCurve zCurve, SerializedProperty randomizePerFrame)
        {
            MinMaxCurveState state = xCurve.state;
            bool             flag  = label != GUIContent.none;
            int num1 = !flag ? 1 : 2;

            if (state == MinMaxCurveState.k_TwoScalars)
            {
                ++num1;
            }
            Rect  controlRect   = ModuleUI.GetControlRect(13 * num1);
            Rect  popupRect     = ModuleUI.GetPopupRect(controlRect);
            Rect  totalPosition = ModuleUI.SubtractPopupWidth(controlRect);
            Rect  rect          = totalPosition;
            float num2          = (float)(((double)totalPosition.width - 8.0) / 3.0);

            if (num1 > 1)
            {
                rect.height = 13f;
            }
            if (flag)
            {
                ModuleUI.PrefixLabel(totalPosition, label);
                rect.y += rect.height;
            }
            rect.width = num2;
            GUIContent[] guiContentArray = new GUIContent[3] {
                x, y, z
            };
            SerializedMinMaxCurve[] minMaxCurves = new SerializedMinMaxCurve[3] {
                xCurve, yCurve, zCurve
            };
            if (state == MinMaxCurveState.k_Scalar)
            {
                for (int index = 0; index < minMaxCurves.Length; ++index)
                {
                    ModuleUI.Label(rect, guiContentArray[index]);
                    float a = ModuleUI.FloatDraggable(rect, minMaxCurves[index].scalar, minMaxCurves[index].m_RemapValue, 10f);
                    if (!minMaxCurves[index].signedRange)
                    {
                        minMaxCurves[index].scalar.floatValue = Mathf.Max(a, 0.0f);
                    }
                    rect.x += num2 + 4f;
                }
            }
            else if (state == MinMaxCurveState.k_TwoScalars)
            {
                for (int index = 0; index < minMaxCurves.Length; ++index)
                {
                    ModuleUI.Label(rect, guiContentArray[index]);
                    float minConstant = minMaxCurves[index].minConstant;
                    float maxConstant = minMaxCurves[index].maxConstant;
                    EditorGUI.BeginChangeCheck();
                    float num3 = ModuleUI.FloatDraggable(rect, maxConstant, minMaxCurves[index].m_RemapValue, 10f, "g5");
                    if (EditorGUI.EndChangeCheck())
                    {
                        minMaxCurves[index].maxConstant = num3;
                    }
                    rect.y += 13f;
                    EditorGUI.BeginChangeCheck();
                    float num4 = ModuleUI.FloatDraggable(rect, minConstant, minMaxCurves[index].m_RemapValue, 10f, "g5");
                    if (EditorGUI.EndChangeCheck())
                    {
                        minMaxCurves[index].minConstant = num4;
                    }
                    rect.x += num2 + 4f;
                    rect.y -= 13f;
                }
            }
            else
            {
                rect.width = num2;
                Rect ranges = !xCurve.signedRange ? ModuleUI.kUnsignedRange : ModuleUI.kSignedRange;
                for (int index = 0; index < minMaxCurves.Length; ++index)
                {
                    ModuleUI.Label(rect, guiContentArray[index]);
                    Rect position = rect;
                    position.xMin += 10f;
                    SerializedProperty minCurve = state != MinMaxCurveState.k_TwoCurves ? (SerializedProperty)null : minMaxCurves[index].minCurve;
                    ModuleUI.GUICurveField(position, minMaxCurves[index].maxCurve, minCurve, ModuleUI.GetColor(minMaxCurves[index]), ranges, new ModuleUI.CurveFieldMouseDownCallback(minMaxCurves[index].OnCurveAreaMouseDown));
                    rect.x += num2 + 4f;
                }
            }
            ModuleUI.GUIMMCurveStateList(popupRect, minMaxCurves);
        }
 public SerializedMinMaxCurve(ModuleUI m, GUIContent displayName, string name, bool signedRange, bool useProp0)
 {
     this.m_MaxAllowedScalar = float.PositiveInfinity;
     this.Init(m, displayName, name, signedRange, useProp0);
 }
		public override void OnInspectorGUI(InitialModuleUI initial)
		{
			base.GUIMinMaxGradient(ColorByVelocityModuleUI.s_Texts.color, this.m_Gradient, false, new GUILayoutOption[0]);
			ModuleUI.GUIMinMaxRange(ColorByVelocityModuleUI.s_Texts.velocityRange, this.m_Range, new GUILayoutOption[0]);
		}
Ejemplo n.º 45
0
 private void Setup(ParticleSystemUI owner, SerializedObject o, string name, string displayName, ModuleUI.VisibilityState defaultVisibilityState)
 {
   this.m_ParticleSystemUI = owner;
   this.m_DisplayName = displayName;
   this.m_Enabled = !(this is RendererModuleUI) ? this.GetProperty("enabled") : this.GetProperty0("m_Enabled");
   this.m_VisibilityState = (ModuleUI.VisibilityState) SessionState.GetInt(this.GetUniqueModuleName(), (int) defaultVisibilityState);
   this.CheckVisibilityState();
   if (!this.foldout)
     return;
   this.Init();
 }
Ejemplo n.º 46
0
 public override void OnInspectorGUI(ParticleSystem s)
 {
     if (RendererModuleUI.s_Texts == null)
     {
         RendererModuleUI.s_Texts = new RendererModuleUI.Texts();
     }
     RendererModuleUI.RenderMode intValue   = (RendererModuleUI.RenderMode) this.m_RenderMode.intValue;
     RendererModuleUI.RenderMode renderMode = (RendererModuleUI.RenderMode)ModuleUI.GUIPopup(RendererModuleUI.s_Texts.renderMode, this.m_RenderMode, RendererModuleUI.s_Texts.particleTypes, new GUILayoutOption[0]);
     if (renderMode == RendererModuleUI.RenderMode.Mesh)
     {
         EditorGUI.indentLevel++;
         this.DoListOfMeshesGUI();
         EditorGUI.indentLevel--;
         if (intValue != RendererModuleUI.RenderMode.Mesh && this.m_Meshes[0].objectReferenceInstanceIDValue == 0)
         {
             this.m_Meshes[0].objectReferenceValue = Resources.GetBuiltinResource(typeof(Mesh), "Cube.fbx");
         }
     }
     else if (renderMode == RendererModuleUI.RenderMode.Stretch3D)
     {
         EditorGUI.indentLevel++;
         ModuleUI.GUIFloat(RendererModuleUI.s_Texts.cameraSpeedScale, this.m_CameraVelocityScale, new GUILayoutOption[0]);
         ModuleUI.GUIFloat(RendererModuleUI.s_Texts.speedScale, this.m_VelocityScale, new GUILayoutOption[0]);
         ModuleUI.GUIFloat(RendererModuleUI.s_Texts.lengthScale, this.m_LengthScale, new GUILayoutOption[0]);
         EditorGUI.indentLevel--;
     }
     if (renderMode != RendererModuleUI.RenderMode.None)
     {
         if (renderMode != RendererModuleUI.RenderMode.Mesh)
         {
             ModuleUI.GUIFloat(RendererModuleUI.s_Texts.normalDirection, this.m_NormalDirection, new GUILayoutOption[0]);
         }
         if (this.m_Material != null)
         {
             ModuleUI.GUIObject(RendererModuleUI.s_Texts.material, this.m_Material, new GUILayoutOption[0]);
         }
     }
     if (this.m_ParticleSystemUI.m_ParticleSystem.trails.enabled && this.m_TrailMaterial != null)
     {
         ModuleUI.GUIObject(RendererModuleUI.s_Texts.trailMaterial, this.m_TrailMaterial, new GUILayoutOption[0]);
     }
     if (renderMode != RendererModuleUI.RenderMode.None)
     {
         ModuleUI.GUIPopup(RendererModuleUI.s_Texts.sortMode, this.m_SortMode, RendererModuleUI.s_Texts.sortTypes, new GUILayoutOption[0]);
         ModuleUI.GUIFloat(RendererModuleUI.s_Texts.sortingFudge, this.m_SortingFudge, new GUILayoutOption[0]);
         if (renderMode != RendererModuleUI.RenderMode.Mesh)
         {
             ModuleUI.GUIFloat(RendererModuleUI.s_Texts.minParticleSize, this.m_MinParticleSize, new GUILayoutOption[0]);
             ModuleUI.GUIFloat(RendererModuleUI.s_Texts.maxParticleSize, this.m_MaxParticleSize, new GUILayoutOption[0]);
         }
         if (renderMode == RendererModuleUI.RenderMode.Billboard)
         {
             if (this.m_ParticleSystemUI.m_ParticleSystem.shape.alignToDirection)
             {
                 using (new EditorGUI.DisabledScope(true))
                 {
                     ModuleUI.GUIPopup(RendererModuleUI.s_Texts.space, 0, new string[]
                     {
                         RendererModuleUI.s_Texts.spaces[2]
                     }, new GUILayoutOption[0]);
                 }
                 GUIContent gUIContent = EditorGUIUtility.TextContent("Using Align to Direction in the Shape Module forces the system to be rendered using Local Billboard Alignment.");
                 EditorGUILayout.HelpBox(gUIContent.text, MessageType.Info, true);
             }
             else
             {
                 ModuleUI.GUIPopup(RendererModuleUI.s_Texts.space, this.m_RenderAlignment, RendererModuleUI.s_Texts.spaces, new GUILayoutOption[0]);
             }
         }
         ModuleUI.GUIVector3Field(RendererModuleUI.s_Texts.pivot, this.m_Pivot, new GUILayoutOption[0]);
         EditorGUI.BeginChangeCheck();
         RendererModuleUI.s_VisualizePivot = ModuleUI.GUIToggle(RendererModuleUI.s_Texts.visualizePivot, RendererModuleUI.s_VisualizePivot, new GUILayoutOption[0]);
         if (EditorGUI.EndChangeCheck())
         {
             EditorPrefs.SetBool("VisualizePivot", RendererModuleUI.s_VisualizePivot);
         }
         if (ModuleUI.GUIToggle(RendererModuleUI.s_Texts.useCustomVertexStreams, this.m_UseCustomVertexStreams, new GUILayoutOption[0]))
         {
             this.DoVertexStreamsGUI(renderMode);
         }
         EditorGUILayout.Space();
         ModuleUI.GUIPopup(RendererModuleUI.s_Texts.castShadows, this.m_CastShadows, this.m_CastShadows.enumDisplayNames, new GUILayoutOption[0]);
         using (new EditorGUI.DisabledScope(SceneView.IsUsingDeferredRenderingPath()))
         {
             ModuleUI.GUIToggle(RendererModuleUI.s_Texts.receiveShadows, this.m_ReceiveShadows, new GUILayoutOption[0]);
         }
         EditorGUILayout.SortingLayerField(RendererModuleUI.s_Texts.sortingLayer, this.m_SortingLayerID, ParticleSystemStyles.Get().popup, ParticleSystemStyles.Get().label);
         ModuleUI.GUIInt(RendererModuleUI.s_Texts.sortingOrder, this.m_SortingOrder, new GUILayoutOption[0]);
     }
     this.m_Probes.OnGUI(null, s.GetComponent <Renderer>(), true);
 }
Ejemplo n.º 47
0
 private static void GUICurveField(Rect position, SerializedProperty maxCurve, SerializedProperty minCurve, Color color, Rect ranges, ModuleUI.CurveFieldMouseDownCallback mouseDownCallback)
 {
   int controlId = GUIUtility.GetControlID(1321321231, EditorGUIUtility.native, position);
   Event current = Event.current;
   switch (current.GetTypeForControl(controlId))
   {
     case EventType.MouseDown:
       if (!position.Contains(current.mousePosition) || mouseDownCallback == null || !mouseDownCallback(current.button, position, ranges))
         break;
       current.Use();
       break;
     case EventType.Repaint:
       Rect position1 = position;
       if (minCurve == null)
         EditorGUIUtility.DrawCurveSwatch(position1, (AnimationCurve) null, maxCurve, color, EditorGUI.kCurveBGColor, ranges);
       else
         EditorGUIUtility.DrawRegionSwatch(position1, maxCurve, minCurve, color, EditorGUI.kCurveBGColor, ranges);
       EditorStyles.colorPickerBox.Draw(position1, GUIContent.none, controlId, false);
       break;
     case EventType.ValidateCommand:
       if (!(current.commandName == "UndoRedoPerformed"))
         break;
       AnimationCurvePreviewCache.ClearCache();
       break;
   }
 }
Ejemplo n.º 48
0
        private void DoVertexStreamsGUI(RendererModuleUI.RenderMode renderMode)
        {
            Rect controlRect = ModuleUI.GetControlRect(13, new GUILayoutOption[0]);

            GUI.Label(controlRect, RendererModuleUI.s_Texts.streams, ParticleSystemStyles.Get().label);
            int num = 0;

            for (int i = 0; i < RendererModuleUI.s_Texts.vertexStreams.Length; i++)
            {
                if ((this.m_VertexStreamMask.intValue & 1 << i) != 0)
                {
                    bool   flag     = this.m_ParticleSystemUI.m_ParticleEffectUI.m_Owner is ParticleSystemInspector;
                    string text     = (!flag) ? "TEX" : "TEXCOORD";
                    Rect   position = new Rect(controlRect.x + EditorGUIUtility.labelWidth, controlRect.y, controlRect.width, controlRect.height);
                    if (RendererModuleUI.s_Texts.vertexStreamIsTexCoord[i])
                    {
                        GUI.Label(position, string.Concat(new object[]
                        {
                            RendererModuleUI.s_Texts.vertexStreams[i],
                            " (",
                            text,
                            num++,
                            ", ",
                            RendererModuleUI.s_Texts.vertexStreamDataTypes[i],
                            ")"
                        }), ParticleSystemStyles.Get().label);
                    }
                    else
                    {
                        GUI.Label(position, RendererModuleUI.s_Texts.vertexStreams[i] + " (" + RendererModuleUI.s_Texts.vertexStreamDataTypes[i] + ")", ParticleSystemStyles.Get().label);
                    }
                    position.x  = controlRect.xMax - 12f;
                    controlRect = ModuleUI.GetControlRect(13, new GUILayoutOption[0]);
                    if (i == 0)
                    {
                        if (this.m_VertexStreamMask.intValue != (1 << RendererModuleUI.s_Texts.vertexStreams.Length) - 1)
                        {
                            position.x -= 2f;
                            position.y -= 2f;
                            if (EditorGUI.ButtonMouseDown(position, GUIContent.none, FocusType.Passive, "OL Plus"))
                            {
                                List <GUIContent> list = new List <GUIContent>();
                                for (int j = 0; j < RendererModuleUI.s_Texts.vertexStreams.Length; j++)
                                {
                                    if ((this.m_VertexStreamMask.intValue & 1 << j) == 0)
                                    {
                                        list.Add(new GUIContent(RendererModuleUI.s_Texts.vertexStreams[j]));
                                    }
                                }
                                GenericMenu genericMenu = new GenericMenu();
                                for (int k = 0; k < list.Count; k++)
                                {
                                    GenericMenu arg_292_0 = genericMenu;
                                    GUIContent  arg_292_1 = list[k];
                                    bool        arg_292_2 = false;
                                    if (RendererModuleUI.< > f__mg$cache0 == null)
                                    {
                                        RendererModuleUI.< > f__mg$cache0 = new GenericMenu.MenuFunction2(RendererModuleUI.SelectVertexStreamCallback);
                                    }
                                    arg_292_0.AddItem(arg_292_1, arg_292_2, RendererModuleUI.< > f__mg$cache0, new RendererModuleUI.StreamCallbackData(this.m_VertexStreamMask, list[k].text));
                                }
                                genericMenu.ShowAsContext();
                                Event.current.Use();
                            }
                        }
                    }
                    else if (ModuleUI.MinusButton(position))
                    {
                        this.m_VertexStreamMask.intValue &= ~(1 << i);
                    }
                }
            }
            string text2 = "";

            if (this.m_Material != null)
            {
                Material material = this.m_Material.objectReferenceValue as Material;
                ParticleSystemVertexStreams particleSystemVertexStreams = this.m_ParticleSystemUI.m_ParticleSystem.CheckVertexStreamsMatchShader((ParticleSystemVertexStreams)this.m_VertexStreamMask.intValue, material);
                if (particleSystemVertexStreams != ParticleSystemVertexStreams.None)
                {
                    text2 += "Vertex streams do not match the shader inputs. Particle systems may not render correctly. Ensure your streams match and are used by the shader.";
                    if ((particleSystemVertexStreams & ParticleSystemVertexStreams.Tangent) != ParticleSystemVertexStreams.None)
                    {
                        text2 += "\n- TANGENT stream does not match.";
                    }
                    if ((particleSystemVertexStreams & ParticleSystemVertexStreams.Color) != ParticleSystemVertexStreams.None)
                    {
                        text2 += "\n- COLOR stream does not match.";
                    }
                    if ((particleSystemVertexStreams & ParticleSystemVertexStreams.UV) != ParticleSystemVertexStreams.None)
                    {
                        text2 += "\n- TEXCOORD streams do not match.";
                    }
                }
            }
            int maxTexCoordStreams = this.m_ParticleSystemUI.m_ParticleSystem.GetMaxTexCoordStreams();

            if (num > maxTexCoordStreams)
            {
                if (text2 != "")
                {
                    text2 += "\n\n";
                }
                string text3 = text2;
                text2 = string.Concat(new object[]
                {
                    text3,
                    "Only ",
                    maxTexCoordStreams,
                    " TEXCOORD streams are supported."
                });
            }
            if (renderMode == RendererModuleUI.RenderMode.Mesh)
            {
                ParticleSystemRenderer component = this.m_ParticleSystemUI.m_ParticleSystem.GetComponent <ParticleSystemRenderer>();
                Mesh[] array  = new Mesh[4];
                int    meshes = component.GetMeshes(array);
                for (int l = 0; l < meshes; l++)
                {
                    if (array[l].HasChannel(Mesh.InternalShaderChannel.TexCoord2))
                    {
                        if (text2 != "")
                        {
                            text2 += "\n\n";
                        }
                        text2 += "Meshes may only use a maximum of 2 input UV streams.";
                    }
                }
            }
            if (text2 != "")
            {
                GUIContent gUIContent = EditorGUIUtility.TextContent(text2);
                EditorGUILayout.HelpBox(gUIContent.text, MessageType.Error, true);
            }
        }