static public void Draw(SerializedObject serializedObject, LightingSettings.SortingLayer sortingLayer, string serializationDepth = "") { bool value = GUIFoldout.Draw("Sorting Layer", sortingLayer); if (value == false) { return; } SerializedProperty order = serializedObject.FindProperty(serializationDepth + "sortingLayer.Order"); SerializedProperty name = serializedObject.FindProperty(serializationDepth + "sortingLayer.name"); EditorGUI.indentLevel++; string[] sortingLayerNames = GetSortingLayerNames(); int id = Array.IndexOf(sortingLayerNames, sortingLayer.Name); int newId = EditorGUILayout.Popup("Name", id, sortingLayerNames); if (newId > -1 && newId < sortingLayerNames.Length) { string newName = sortingLayerNames[newId]; if (newName != sortingLayer.Name) { name.stringValue = newName; } } EditorGUILayout.PropertyField(order, new GUIContent("Order")); EditorGUI.indentLevel--; }
static public void DrawDay(DayNormalMapMode bumpMapMode) { bool value = GUIFoldout.Draw("Mask Normal Map", bumpMapMode); if (value == false) { return; } EditorGUI.indentLevel++; bumpMapMode.textureType = (NormalMapTextureType)EditorGUILayout.EnumPopup("Texture Type", bumpMapMode.textureType); switch (bumpMapMode.textureType) { case NormalMapTextureType.Texture: bumpMapMode.texture = (Texture)EditorGUILayout.ObjectField("Texture", bumpMapMode.texture, typeof(Texture), true); break; case NormalMapTextureType.Sprite: bumpMapMode.sprite = (Sprite)EditorGUILayout.ObjectField("Sprite", bumpMapMode.sprite, typeof(Sprite), true); break; } EditorGUI.indentLevel--; }
static public void Draw(LightingSettings.SortingLayer sortingLayer) { bool value = GUIFoldout.Draw("Sorting Layer", sortingLayer); if (value == false) { return; } EditorGUI.indentLevel++; string[] sortingLayerNames = GetSortingLayerNames(); int id = Array.IndexOf(sortingLayerNames, sortingLayer.Name); int newId = EditorGUILayout.Popup("Name", id, sortingLayerNames); if (newId > -1 && newId < sortingLayerNames.Length) { string newName = sortingLayerNames[newId]; if (newName != sortingLayer.Name) { sortingLayer.Name = newName; } } sortingLayer.Order = EditorGUILayout.IntField("Order", sortingLayer.Order); EditorGUI.indentLevel--; }
void DrawSpriteRenderer(LightSprite2D script) { if (script.spriteMode == LightSprite2D.SpriteMode.Custom) { bool foldout0 = GUIFoldout.Draw("Sprite Renderer", script); if (foldout0) { EditorGUI.indentLevel++; sprite.objectReferenceValue = (Sprite)EditorGUILayout.ObjectField("Sprite", sprite.objectReferenceValue, typeof(Sprite), true); DrawColor(); EditorGUILayout.PropertyField(flipX, new GUIContent("Flip X")); EditorGUILayout.PropertyField(flipY, new GUIContent("Flip Y")); EditorGUI.indentLevel--; } } else { DrawColor(); } }
public static void DrawList(LightingSettings.LayersList layerList, string name, string singular) { bool foldout = GUIFoldout.Draw(name, layerList); if (foldout == false) { return; } EditorGUI.indentLevel++; int lightLayerCount = EditorGUILayout.IntSlider("Count", layerList.names.Length, 1, 10); if (lightLayerCount != layerList.names.Length) { int oldCount = layerList.names.Length; System.Array.Resize(ref layerList.names, lightLayerCount); for (int i = oldCount; i < lightLayerCount; i++) { layerList.names[i] = singular + " " + (i); } } for (int i = 0; i < lightLayerCount; i++) { layerList.names[i] = EditorGUILayout.TextField(" ", layerList.names[i]); } EditorGUI.indentLevel--; }
public static void Draw(SerializedObject serializedObject, MeshMode meshMode) { bool value = GUIFoldout.Draw("Mesh Mode", meshMode); if (value == false) { return; } EditorGUI.indentLevel++; SerializedProperty meshModeEnable = serializedObject.FindProperty("meshMode.enable"); SerializedProperty meshModeAlpha = serializedObject.FindProperty("meshMode.alpha"); SerializedProperty meshModeShader = serializedObject.FindProperty("meshMode.shader"); EditorGUILayout.PropertyField(meshModeEnable, new GUIContent("Enable")); meshModeAlpha.floatValue = EditorGUILayout.Slider("Alpha", meshModeAlpha.floatValue, 0, 1); EditorGUILayout.PropertyField(meshModeShader, new GUIContent("Shader")); if (meshModeShader.intValue == (int)MeshModeShader.Custom) { bool value2 = GUIFoldout.Draw("Materials", meshMode.materials); if (value2) { EditorGUI.indentLevel++; int count = meshMode.materials.Length; count = EditorGUILayout.IntSlider("Material Count", count, 0, 10); if (count != meshMode.materials.Length) { System.Array.Resize(ref meshMode.materials, count); } for (int id = 0; id < meshMode.materials.Length; id++) { Material material = meshMode.materials[id]; material = (Material)EditorGUILayout.ObjectField("Material", material, typeof(Material), true); meshMode.materials[id] = material; } EditorGUI.indentLevel--; } } GUISortingLayer.Draw(serializedObject, meshMode.sortingLayer, "meshMode."); EditorGUI.indentLevel--; }
public static void DrawList(PresetLayers bufferLayers, string name, LayersList layerList, bool drawType) { bool foldout = GUIFoldout.Draw(name, bufferLayers); if (foldout == false) { return; } EditorGUI.indentLevel++; LightingLayerSetting[] layerSettings = bufferLayers.Get(); int layerCount = EditorGUILayout.IntSlider("Count", layerSettings.Length, 0, 10); EditorGUILayout.Space(); if (layerCount != layerSettings.Length) { int oldCount = layerSettings.Length; System.Array.Resize(ref layerSettings, layerCount); for (int i = oldCount; i < layerCount; i++) { if (layerSettings[i] == null) { layerSettings[i] = new LightingLayerSetting(); layerSettings[i].layer = i; } } bufferLayers.SetArray(layerSettings); } for (int i = 0; i < layerSettings.Length; i++) { layerSettings[i].layer = EditorGUILayout.Popup("Layer", layerSettings[i].layer, layerList.GetNames()); if (drawType) { layerSettings[i].type = (LayerType)EditorGUILayout.EnumPopup("Type", layerSettings[i].type); } layerSettings[i].sorting = (LayerSorting)EditorGUILayout.EnumPopup("Sorting", layerSettings[i].sorting); EditorGUILayout.Space(); } EditorGUI.indentLevel--; }
public static void Draw(EventPresetList lightPresetList) { bool foldout = GUIFoldoutHeader.Begin("Light Event Presets (" + (lightPresetList.list.Length - 1) + ")", lightPresetList); if (foldout == false) { GUIFoldoutHeader.End(); return; } EditorGUI.indentLevel++; int bufferCount = EditorGUILayout.IntSlider("Count", lightPresetList.list.Length - 1, 1, 4) + 1; if (bufferCount != lightPresetList.list.Length) { int oldCount = lightPresetList.list.Length; System.Array.Resize(ref lightPresetList.list, bufferCount); for (int i = oldCount; i < bufferCount; i++) { lightPresetList.list[i] = new EventPreset(i); } } for (int i = 1; i < lightPresetList.list.Length; i++) { bool fold = GUIFoldout.Draw("Preset " + (i), lightPresetList.list[i]); if (fold == false) { continue; } EditorGUI.indentLevel++; lightPresetList.list[i].name = EditorGUILayout.TextField("Name", lightPresetList.list[i].name); EditorGUILayout.Space(); DrawEventLayers(lightPresetList.list[i].layerSetting); EditorGUI.indentLevel--; } EditorGUI.indentLevel--; GUIFoldoutHeader.End(); }
public static void Draw(LightingSettings.Profile profile) { bool foldout = GUIFoldout.Draw("Normal Map", profile.dayLightingSettings.bumpMap); if (foldout == false) { return; } EditorGUI.indentLevel++; profile.dayLightingSettings.bumpMap.height = EditorGUILayout.Slider("Height", profile.dayLightingSettings.bumpMap.height, 0, 5); profile.dayLightingSettings.bumpMap.strength = EditorGUILayout.Slider("Strength", profile.dayLightingSettings.bumpMap.strength, 0, 5); EditorGUI.indentLevel--; }
GUIFoldout CreateHelpFoldout() { GUIFoldout foldout = new GUIFoldout(Localize.GUI("Help")); GUIHorizontal indentLayout = foldout.Add(new GUIHorizontal()) as GUIHorizontal; indentLayout.Add(new GUISpace()); GUIVertical layout = indentLayout.Add(new GUIVertical()) as GUIVertical; layout.Add(new GUILabel(Localize.GUI("Alt/Alt+Shift: cycle editor modes"))); layout.Add(new GUILabel(Localize.GUI("Camera Mode:\nA/S/W/D to move\nLMB to look"))); layout.Add(new GUILabel(Localize.GUI("Coverage Paint Mode:\nLMB to increase coverage\nLMB+Shift to decrease coverage"))); layout.Add(new GUILabel(Localize.GUI("Cloud Type Paint Mode:\nLMB to increase cloud type\nLMB+Shift to decrease cloud type"))); layout.Add(new GUILabel(Localize.GUI("Brush Properties:\nBrush size, opacity & texture can be altered\nfrom the Brush Properties foldout.\nHolding Control while moving the mouse\nin either paint mode adjusts brush size."))); layout.Add(new GUIButton(Localize.GUI("Display full documentation"))); return(foldout); }
void DrawTransform(LightSprite2D script) { bool foldout = GUIFoldout.Draw("Transform", script.lightSpriteTransform); if (foldout) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(transform_position, new GUIContent("Position")); EditorGUILayout.PropertyField(transform_scale, new GUIContent("Scale")); EditorGUILayout.PropertyField(transform_rotation, new GUIContent("Rotation")); EditorGUILayout.PropertyField(transform_applyRotation, new GUIContent("Apply Rotation")); EditorGUI.indentLevel--; } }
private void UpdateGUI() { RemoveAll(); int count = _materials != null ? _materials.Length : 0; _guiStartLights = new GUIVector3Field[count]; _guiEndLights = new GUIVector3Field[count]; _guiStartPaletteMixs = new GUISlider[count]; _guiEndPaletteMixs = new GUISlider[count]; _guiDithers = new GUISlider[count]; if (count < 1) { return; } Vector4 light; GUIFoldout foldout = Add(new GUIFoldout(new GUIContent("PixelArt Materials"))) as GUIFoldout; for (int i = 0; i < count; i++) { _guiStartLights[i] = new GUIVector3Field(new GUIContent("Start Light Direction"), ChangeHandler) as GUIVector3Field; _guiEndLights[i] = new GUIVector3Field(new GUIContent("End Light Direction"), ChangeHandler) as GUIVector3Field; _guiStartPaletteMixs[i] = new GUISlider(new GUIContent("Start Palette Mix"), 0, 0, 1, ChangeHandler) as GUISlider; _guiEndPaletteMixs[i] = new GUISlider(new GUIContent("End Palette Mix"), 0, 0, 1, ChangeHandler) as GUISlider; _guiDithers[i] = new GUISlider(new GUIContent("Dither Threshold"), 0, 0, 1, ChangeHandler) as GUISlider; light = _materials[i].GetVector("_LightDir"); _guiStartLights[i].vector = _guiEndLights[i].vector = new Vector3(light.x, light.y, light.z); _guiStartPaletteMixs[i].value = _guiEndPaletteMixs[i].value = _materials[i].GetFloat("_PaletteMix"); _guiDithers[i].value = _materials[i].GetFloat("_DitherThreshold"); foldout.Add(_guiStartLights[i]); foldout.Add(_guiEndLights[i]); foldout.Add(_guiStartPaletteMixs[i]); foldout.Add(_guiEndPaletteMixs[i]); foldout.Add(_guiDithers[i]); if (i < count - 1) { foldout.Add(new GUISpace()); } } }
static public void Draw(GlowMode glowMode) { bool value = GUIFoldout.Draw("Glow Mode", glowMode); if (value == false) { return; } EditorGUI.indentLevel++; glowMode.enable = EditorGUILayout.Toggle("Enable", glowMode.enable); glowMode.glowRadius = EditorGUILayout.Slider("Glow Size", glowMode.glowRadius, 0.1f, 10); EditorGUI.indentLevel--; }
public static void Draw(LightingSettings.Profile profile) { bool foldout = GUIFoldout.Draw("Softness", profile.dayLightingSettings.softness); if (foldout == false) { return; } EditorGUI.indentLevel++; profile.dayLightingSettings.softness.enable = EditorGUILayout.Toggle("Enable", profile.dayLightingSettings.softness.enable); profile.dayLightingSettings.softness.intensity = EditorGUILayout.FloatField("Intensity", profile.dayLightingSettings.softness.intensity); if (profile.dayLightingSettings.softness.intensity < 0) { profile.dayLightingSettings.softness.intensity = 0; } EditorGUI.indentLevel--; }
private void UpdateGUI() { RemoveAll(); int count = _animators != null ? _animators.Length : 0; _guiClips = new GUIPopup[count]; if (count < 1) { return; } GUIFoldout foldout = Add(new GUIFoldout(new GUIContent("Animators"))) as GUIFoldout; for (int i = 0; i < count; i++) { GUIContent[] options = GetAnimatorDisplayedOptions(_animators[i]); _guiClips[i] = new GUIPopup(new GUIContent("Animator " + i), options, 1, ChangeHandler); foldout.Add(_guiClips[i]); } }
void OnEnable() { CreateExportFolderIfNeeded(); _lastFrameTime = Time.realtimeSinceStartup; _gui = new GUIHorizontal(); GUIVertical sideContainer = _gui.Add(new GUIVertical(GUILayout.MaxWidth(290.0f))) as GUIVertical; _guiSide = sideContainer.Add(new GUIScrollView()) as GUIScrollView; GUIObjectField <GameObject> guiGameObject = _guiSide.Add(new GUIObjectField <GameObject>(new GUIContent("GameObject", "GameObject to render as sprite sheet"), true, GameObjectChanged)) as GUIObjectField <GameObject>; _guiFrameCount = _guiSide.Add(new GUIIntSlider(new GUIContent("Frame Count", "Number of frames in the sprite sheet"), 12, 1, 64, FrameCountChanged)) as GUIIntSlider; _guiFrameWidth = _guiSide.Add(new GUIIntSlider(new GUIContent("Frame Width", "Width of each frame in the sprite sheet"), 100, 32, 512, ResizeFrame)) as GUIIntSlider; _guiFrameHeight = _guiSide.Add(new GUIIntSlider(new GUIContent("Frame Height", "Height of each frame in the sprite sheet"), 100, 32, 512, ResizeFrame)) as GUIIntSlider; _guiFOV = _guiSide.Add(new GUISlider(new GUIContent("FOV"), 20, 1, 179, OffsetChanged)) as GUISlider; _guiSide.Add(new GUISpace()); _guiCurrentFrame = _guiSide.Add(new GUIIntSlider(new GUIContent("Current Frame"), 0, 0, _guiFrameCount.value - 1, RenderPreviewAction)) as GUIIntSlider; _guiDuration = _guiSide.Add(new GUISlider(new GUIContent("Duration"), 1, 0, 100, RenderPreviewAction)) as GUISlider; _guiPlay = _guiSide.Add(new GUIToggle(new GUIContent("Play"))) as GUIToggle; _guiSide.Add(new GUISpace()); GUIFoldout offsetFoldout = _guiSide.Add(new GUIFoldout(new GUIContent("Position/Scale"))) as GUIFoldout; _guiPositionOffset = offsetFoldout.Add(new GUIVector3Field(new GUIContent("Position Offset"), OffsetChanged)) as GUIVector3Field; _guiScaleOffset = offsetFoldout.Add(new GUISlider(new GUIContent("Scale Offset"), 0.0f, -10.0f, 10.0f, OffsetChanged)) as GUISlider; _guiAnimationClips = _guiSide.Add(new GUISpriteSheetClips(RenderPreviewAction)) as GUISpriteSheetClips; _guiMaterials = _guiSide.Add(new GUISpriteSheetMaterials(RenderPreviewAction)) as GUISpriteSheetMaterials; GUIFoldout rotationFoldout = _guiSide.Add(new GUIFoldout(new GUIContent("Rotation"))) as GUIFoldout; _guiStartRotation = rotationFoldout.Add(new GUIVector3Field(new GUIContent("Start Rotation"), RenderPreviewAction)) as GUIVector3Field; _guiEndRotation = rotationFoldout.Add(new GUIVector3Field(new GUIContent("End Rotation"), RenderPreviewAction)) as GUIVector3Field; GUIFoldout loopFoldout = _guiSide.Add(new GUIFoldout(new GUIContent("Rotation/Material Looping"))) as GUIFoldout; _guiLoopCount = loopFoldout.Add(new GUIIntSlider(new GUIContent("Loop Count"), 1, 1, 10, RenderPreviewAction)) as GUIIntSlider; _guiPingPong = loopFoldout.Add(new GUIToggle(new GUIContent("Pingpong"), RenderPreviewAction)) as GUIToggle; GUIFoldout outlineFoldout = _guiSide.Add(new GUIFoldout(new GUIContent("Outline Effect"))) as GUIFoldout; GUIColorField outlineColor = outlineFoldout.Add(new GUIColorField(new GUIContent("Color"), OutlineColorChanged)) as GUIColorField; GUISlider outlineThreshold = outlineFoldout.Add(new GUISlider(new GUIContent("Threshold"), 0.05f, 0.0f, 0.05f, OutlineThresholdChanged)) as GUISlider; _guiSide.Add(new GUISpace()); _guiSpriteSheetName = _guiSide.Add(new GUITextField(new GUIContent("Sprite Sheet Name"))) as GUITextField; _guiExport = _guiSide.Add(new GUIButton(new GUIContent("Export Sprite Sheet"), ExportSpriteSheet)) as GUIButton; _guiPreview = _gui.Add(new GUIVertical(GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true))) as GUIVertical; _guiPreview.shouldStoreLastRect = true; InitPreviewRenderTexture(); InitPreviewCamera(); InitRootGameObject(); guiGameObject.value = _modelGameObject; GameObjectChanged(guiGameObject); RenderPreview(0); _guiStartRotation.vector = Vector3.zero; _guiEndRotation.vector = Vector3.zero; outlineColor.color = _previewOutline.outlineColor; outlineThreshold.value = _previewOutline.depthThreshold; }
void CreateGUI() { int padding = 4; GUIStyle style = new GUIStyle(); style.padding = new RectOffset(padding, padding, padding, padding); _gui = new GUIVertical(); GUIHorizontal toolLayout = new GUIHorizontal(style); toolLayout.Add(new GUIButton(Localize.GUI(null, "Toggle properties panel", "Assets/kode80/Clouds/Editor/gui/button_properties.png"), TogglePropertiesPanel)); toolLayout.Add(new GUISpace()); toolLayout.Add(new GUIButton(Localize.GUI(null, "Create a new coverage map", "Assets/kode80/Clouds/Editor/gui/button_new.png"), NewCoverageMapAction)); toolLayout.Add(new GUIButton(Localize.GUI(null, "Save the current coverage map", "Assets/kode80/Clouds/Editor/gui/button_save.png"), SaveCoverageMapAction)); toolLayout.Add(new GUIButton(Localize.GUI(null, "Save the current coverage map as a new file", "Assets/kode80/Clouds/Editor/gui/button_saveas.png"), SaveCoverageMapAsAction)); toolLayout.Add(new GUISpace()); toolLayout.Add(new GUIButton(Localize.GUI(null, "Export cubemap from current camera", "Assets/kode80/Clouds/Editor/gui/button_cubemap.png"), ExportCubemapAction)); toolLayout.Add(new GUISpace(true)); GUIContent[] toolbarContent = new GUIContent[] { Localize.GUI(null, null, "Assets/kode80/Clouds/Editor/gui/button_camera.png"), Localize.GUI(null, null, "Assets/kode80/Clouds/Editor/gui/button_coverage.png"), Localize.GUI(null, null, "Assets/kode80/Clouds/Editor/gui/button_type.png") }; _guiToolbar = toolLayout.Add(new GUIToolbar(toolbarContent, ChangeModeAction)) as GUIToolbar; toolLayout.Add(new GUISpace(true)); toolLayout.Add(new GUIButton(Localize.GUI(null, "Clear the current coverage map", "Assets/kode80/Clouds/Editor/gui/button_clearmap.png"), ClearCoverageMapAction)); GUIFoldout helpFoldout = CreateHelpFoldout(); GUIFoldout editorFoldout = new GUIFoldout(Localize.GUI("Editor Properties")); editorFoldout.Add(new GUIToggle(Localize.GUI("Continuous Update", "If disabled, the editor will only render on changes"), ContinuousUpdateToggleAction)); if (_cameraComponents.Length > 0) { _guiCameraFoldout = new GUIFoldout(Localize.GUI("Editor Camera")); foreach (MonoBehaviour component in _cameraComponents) { GUIToggle toggle = new GUIToggle(new GUIContent(component.GetType().Name), CameraComponentToggled); toggle.isToggled = component.enabled; _guiCameraFoldout.Add(toggle); } } GUIFoldout brushFoldout = new GUIFoldout(Localize.GUI("Brush Properties")); _guiBrushBlendValues = brushFoldout.Add(new GUIToggle(Localize.GUI("Blend Values", "Blend values when painting or set to a specific value"), UpdateBrushPropertiesAction)) as GUIToggle; _guiBrushOpacity = brushFoldout.Add(new GUISlider(Localize.GUI("Opacity", "Brush opacity"), 0.2f, 0.0f, 1.0f, UpdateBrushPropertiesAction)) as GUISlider; _guiBrushSize = brushFoldout.Add(new GUIIntSlider(Localize.GUI("Size", "Brush size"), 2, 2, (int)EditorState.MaxCursorRadius, UpdateBrushPropertiesAction)) as GUIIntSlider; _guiBrushTexture = brushFoldout.Add(new GUITextureField(Localize.GUI("Brush", "Brush texture"), UpdateBrushPropertiesAction)) as GUITextureField; GUIFoldout sunFoldout = new GUIFoldout(Localize.GUI("Sun Properties")); _guiSunRotation = sunFoldout.Add(new GUIVector3Field(Localize.GUI("Rotation", "Sun's rotation"), UpdateSunPropertiesAction)) as GUIVector3Field; _guiSunColor = sunFoldout.Add(new GUIColorField(Localize.GUI("Color", "Sun's color"), UpdateSunPropertiesAction)) as GUIColorField; GUIFoldout cloudsFoldout = new GUIFoldout(Localize.GUI("Clouds Properties")); GUIHorizontal subLayout = new GUIHorizontal(); subLayout.Add(new GUISpace()); subLayout.Add(new GUIButton(Localize.GUI("Load Settings", "Load key render settings from asset"), LoadRenderSettingsAction)); subLayout.Add(new GUIButton(Localize.GUI("Save Settings", "Save key render settings to asset"), SaveRenderSettingsAction)); cloudsFoldout.Add(subLayout); cloudsFoldout.Add(new GUISpace()); cloudsFoldout.Add(new GUIDefaultInspector(_clouds)); GUIScrollView scrollView = new GUIScrollView(); scrollView.Add(helpFoldout); scrollView.Add(editorFoldout); if (_cameraComponents.Length > 0) { scrollView.Add(_guiCameraFoldout); } scrollView.Add(brushFoldout); scrollView.Add(sunFoldout); scrollView.Add(cloudsFoldout); _guiPropertiesPanel = new GUIVertical(GUILayout.MaxWidth(320.0f)); _guiPropertiesPanel.Add(scrollView); _guiScenePlaceholder = new GUIVertical(GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); _guiScenePlaceholder.shouldStoreLastRect = true; GUIHorizontal lowerLayout = new GUIHorizontal(); lowerLayout.Add(_guiPropertiesPanel); lowerLayout.Add(_guiScenePlaceholder); _gui.Add(toolLayout); _gui.Add(lowerLayout); // Update properties _guiBrushBlendValues.isToggled = _editorState.cursorBlendValues; _guiBrushOpacity.value = _editorState.cursorOpacity; _guiBrushSize.value = (int)_editorState.cursorRadius * 2; _guiBrushTexture.texture = _editorState.brushTexture; _guiSunColor.color = _clouds.sunLight.color; _guiSunRotation.vector = _clouds.sunLight.transform.eulerAngles; }
static public void Draw(SerializedObject serializedObject, object obj) // Serialized property { bool value = GUIFoldout.Draw("Mask Bump Map", obj); if (value == false) { return; } EditorGUI.indentLevel++; SerializedProperty bumpType = serializedObject.FindProperty("bumpMapMode.type"); SerializedProperty bumpTextureType = serializedObject.FindProperty("bumpMapMode.textureType"); SerializedProperty bumpTexture = serializedObject.FindProperty("bumpMapMode.texture"); SerializedProperty bumpSprite = serializedObject.FindProperty("bumpMapMode.sprite"); SerializedProperty invertX = serializedObject.FindProperty("bumpMapMode.invertX"); SerializedProperty invertY = serializedObject.FindProperty("bumpMapMode.invertY"); SerializedProperty depth = serializedObject.FindProperty("bumpMapMode.depth"); SerializedProperty spriteRenderer = serializedObject.FindProperty("bumpMapMode.spriteRenderer"); SpriteRenderer sr = (SpriteRenderer)spriteRenderer.objectReferenceValue; EditorGUILayout.PropertyField(bumpType, new GUIContent("Type")); EditorGUILayout.PropertyField(bumpTextureType, new GUIContent("Texture Type")); EditorGUILayout.PropertyField(invertX, new GUIContent("Invert X")); EditorGUILayout.PropertyField(invertY, new GUIContent("Invert Y")); EditorGUILayout.PropertyField(depth, new GUIContent("Depth")); switch (bumpTextureType.intValue) { case (int)NormalMapTextureType.Texture: bumpTexture.objectReferenceValue = (Texture)EditorGUILayout.ObjectField("Texture", bumpTexture.objectReferenceValue, typeof(Texture), true); break; case (int)NormalMapTextureType.Sprite: bumpSprite.objectReferenceValue = (Sprite)EditorGUILayout.ObjectField("Sprite", bumpSprite.objectReferenceValue, typeof(Sprite), true); break; case (int)NormalMapTextureType.SecondaryTexture: MaterialPropertyBlock matBlock = new MaterialPropertyBlock(); sr.GetPropertyBlock(matBlock); Texture secondaryTexture = matBlock.GetTexture("_SecondaryTex"); EditorGUI.BeginDisabledGroup(true); EditorGUILayout.ObjectField("Sprite", secondaryTexture, typeof(Sprite), true); EditorGUI.EndDisabledGroup(); break; } EditorGUI.indentLevel--; }
static public void DrawLightLayers(LightPresetLayers presetLayers) { LayerSetting[] layerSetting = presetLayers.Get(); int layerCount = layerSetting.Length; layerCount = EditorGUILayout.IntSlider("Layer Count", layerCount, 1, 4); EditorGUILayout.Space(); if (layerCount != layerSetting.Length) { int oldCount = layerSetting.Length; System.Array.Resize(ref layerSetting, layerCount); for (int i = oldCount; i < layerCount; i++) { if (layerSetting[i] == null) { layerSetting[i] = new LayerSetting(); layerSetting[i].layerID = i; } } presetLayers.SetArray(layerSetting); } for (int i = 0; i < layerSetting.Length; i++) { LayerSetting layer = layerSetting[i]; bool foldout = GUIFoldout.Draw("Layer " + (i + 1), layer); if (foldout) { EditorGUI.indentLevel++; layer.layerID = EditorGUILayout.Popup("Layer (Light)", layer.layerID, Lighting2D.Profile.layers.lightLayers.GetNames()); layer.type = (LightLayerType)EditorGUILayout.EnumPopup("Type", layer.type); bool shadowEnabled = layer.type != LightLayerType.MaskOnly; bool maskEnabled = layer.type != LightLayerType.ShadowOnly; EditorGUILayout.Space(); layer.sorting = (LightLayerSorting)EditorGUILayout.EnumPopup("Sorting", layer.sorting); EditorGUI.BeginDisabledGroup(layer.sorting == LightLayerSorting.None); layer.sortingIgnore = (LightLayerSortingIgnore)EditorGUILayout.EnumPopup("Sorting Ignore", layer.sortingIgnore); EditorGUI.EndDisabledGroup(); EditorGUILayout.Space(); EditorGUI.BeginDisabledGroup(shadowEnabled == false); layer.shadowEffect = (LightLayerShadowEffect)EditorGUILayout.EnumPopup("Shadow Effect", layer.shadowEffect); EditorGUI.EndDisabledGroup(); EditorGUI.BeginDisabledGroup(shadowEnabled == false || layer.shadowEffect != LightLayerShadowEffect.Projected); layer.shadowEffectLayer = EditorGUILayout.Popup("Effect Layer (Light)", layer.shadowEffectLayer, Lighting2D.Profile.layers.lightLayers.GetNames()); EditorGUI.EndDisabledGroup(); EditorGUILayout.Space(); EditorGUI.BeginDisabledGroup(maskEnabled == false); layer.maskEffect = (LightLayerMaskEffect)EditorGUILayout.EnumPopup("Mask Effect", layer.maskEffect); EditorGUI.EndDisabledGroup(); bool maskEffectLit = (layer.maskEffect == LightLayerMaskEffect.AboveLit); EditorGUI.BeginDisabledGroup(maskEnabled == false || maskEffectLit == false); layer.maskEffectDistance = EditorGUILayout.FloatField("Mask Effect Distance", layer.maskEffectDistance); if (layer.maskEffectDistance < 0) { layer.maskEffectDistance = 0; } EditorGUI.EndDisabledGroup(); EditorGUILayout.Space(); EditorGUI.indentLevel--; } EditorGUILayout.Space(); } }
public static void Draw(BufferPresetList bufferList) { bool foldout = GUIFoldoutHeader.Begin("Buffer Presets (" + bufferList.list.Length + ")", bufferList); if (foldout == false) { GUIFoldoutHeader.End(); return; } EditorGUI.indentLevel++; int bufferCount = EditorGUILayout.IntSlider("Count", bufferList.list.Length, 1, 4); if (bufferCount != bufferList.list.Length) { int oldCount = bufferList.list.Length; System.Array.Resize(ref bufferList.list, bufferCount); for (int i = oldCount; i < bufferCount; i++) { bufferList.list[i] = new BufferPreset(i); } } for (int i = 0; i < bufferList.list.Length; i++) { bool fold = GUIFoldout.Draw("Preset " + (i + 1), bufferList.list[i]); if (fold == false) { continue; } EditorGUI.indentLevel++; bufferList.list[i].name = EditorGUILayout.TextField("Name", bufferList.list[i].name); EditorGUILayout.Space(); CommonSettings(bufferList.list[i]); EditorGUILayout.Space(); if (Lighting2D.ProjectSettings.renderingMode == RenderingMode.OnRender) { SortingLayer(bufferList.list[i].sortingLayer); } EditorGUILayout.Space(); LayerSettings.DrawList(bufferList.list[i].dayLayers, "Day Layers (" + bufferList.list[i].dayLayers.list.Length + ")", Lighting2D.Profile.layers.dayLayers, true); EditorGUILayout.Space(); LayerSettings.DrawList(bufferList.list[i].nightLayers, "Night Layers (" + bufferList.list[i].nightLayers.list.Length + ")", Lighting2D.Profile.layers.nightLayers, false); EditorGUILayout.Space(); EditorGUI.indentLevel--; } EditorGUI.indentLevel--; GUIFoldoutHeader.End(); }