editor fully scaleable

This commit is contained in:
minenice55 2022-06-29 21:58:21 -04:00
parent 77ce9cb06d
commit 27a928712f
13 changed files with 2361 additions and 784 deletions

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,105 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: FOT-Rodin Pro DB Entity
m_Shader: {fileID: 4800000, guid: 68e6db2ebdc24f95958faec2be5558d6, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Cube:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _FaceTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 3307759631967023827, guid: 8597c35f18a008c428fc5870aec75766, type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OutlineTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _Ambient: 1
- _Bevel: 0.5
- _BevelClamp: 0
- _BevelOffset: 0
- _BevelRoundness: 0
- _BevelWidth: 0
- _BumpFace: 0
- _BumpOutline: 0
- _ColorMask: 15
- _CullMode: 0
- _Diffuse: 0.5
- _FaceDilate: 0.4
- _FaceUVSpeedX: 0
- _FaceUVSpeedY: 0
- _GlowInner: 0.659
- _GlowOffset: -1
- _GlowOuter: 1
- _GlowPower: 0.558
- _GradientScale: 10
- _LightAngle: 3.1416
- _MaskSoftnessX: 0
- _MaskSoftnessY: 0
- _OutlineSoftness: 0
- _OutlineUVSpeedX: 0
- _OutlineUVSpeedY: 0
- _OutlineWidth: 0.2
- _PerspectiveFilter: 0.875
- _Reflectivity: 10
- _ScaleRatioA: 0.9
- _ScaleRatioB: 0.37125
- _ScaleRatioC: 0.37125
- _ScaleX: 1
- _ScaleY: 1
- _ShaderFlags: 0
- _Sharpness: 0
- _SpecularPower: 2
- _Stencil: 0
- _StencilComp: 8
- _StencilOp: 0
- _StencilReadMask: 255
- _StencilWriteMask: 255
- _TextureHeight: 1024
- _TextureWidth: 1024
- _UnderlayDilate: 1
- _UnderlayOffsetX: 0
- _UnderlayOffsetY: 0
- _UnderlaySoftness: 0
- _VertexOffsetX: 0
- _VertexOffsetY: 0
- _WeightBold: 0.75
- _WeightNormal: 0
m_Colors:
- _ClipRect: {r: -32767, g: -32767, b: 32767, a: 32767}
- _EnvMatrixRotation: {r: 0, g: 0, b: 0, a: 0}
- _FaceColor: {r: 0, g: 0, b: 0, a: 1}
- _GlowColor: {r: 0, g: 1, b: 0, a: 0.5}
- _MaskCoord: {r: 0, g: 0, b: 32767, a: 32767}
- _OutlineColor: {r: 1, g: 1, b: 1, a: 1}
- _ReflectFaceColor: {r: 0, g: 0, b: 0, a: 1}
- _ReflectOutlineColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecularColor: {r: 1, g: 1, b: 1, a: 1}
- _UnderlayColor: {r: 1, g: 0, b: 0, a: 0.78039217}
m_BuildTextureStacks: []

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 147c28f2f84477044b69d3cbf70ee556
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load diff

View file

@ -52,6 +52,7 @@ namespace HeavenStudio.Editor
[SerializeField] private Button EditorThemeBTN;
[SerializeField] private Button FullScreenBTN;
[SerializeField] private Button TempoFinderBTN;
[SerializeField] private Button SnapDiagBTN;
[Header("Tooltip")]
public TMP_Text tooltipText;
@ -105,6 +106,7 @@ namespace HeavenStudio.Editor
Tooltip.AddTooltip(EditorThemeBTN.gameObject, "Editor Theme");
Tooltip.AddTooltip(FullScreenBTN.gameObject, "Preview <color=#adadad>[Tab]</color>");
Tooltip.AddTooltip(TempoFinderBTN.gameObject, "Tempo Finder");
Tooltip.AddTooltip(SnapDiagBTN.gameObject, "Snap Settings");
UpdateEditorStatus(true);
}

View file

@ -22,7 +22,7 @@ namespace HeavenStudio.Editor
public Beatmap.Entity entity;
private bool active;
public bool active;
private int childCountAtStart;

View file

@ -40,7 +40,7 @@ namespace HeavenStudio.Editor
private void Update()
{
if(!Conductor.instance.NotStopped())
if(!(EventParameterManager.instance.active || Conductor.instance.NotStopped()))
{
if (gameOpen)
{
@ -54,7 +54,7 @@ namespace HeavenStudio.Editor
}
}
if (Input.mouseScrollDelta.y != 0)
if (RectTransformUtility.RectangleContainsScreenPoint(eventsParent, Input.mousePosition, Editor.instance.EditorCamera) && Input.mouseScrollDelta.y != 0)
{
UpdateIndex(currentEventIndex - Mathf.RoundToInt(Input.mouseScrollDelta.y));
}

View file

@ -0,0 +1,28 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace HeavenStudio.Editor
{
public class SnapDialog : MonoBehaviour
{
[SerializeField] private GameObject snapSetter;
private void Awake()
{
}
public void SwitchSnapDialog()
{
if(snapSetter.activeSelf) {
snapSetter.SetActive(false);
} else {
snapSetter.SetActive(true);
}
}
private void Update()
{
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f32d53b1d58c64e41b71bd7520435169
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,27 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using TMPro;
using Starpelly;
namespace HeavenStudio.Editor.Track
{
public class LayerLabel : MonoBehaviour
{
[SerializeField] private RectTransform rect;
// Update is called once per frame
void Update()
{
//convert timeline layer scale to screen space
Camera cam = Editor.instance.EditorCamera;
float layerScaleDist = cam.WorldToScreenPoint(Timeline.instance.LayerCorners[1]).y - Camera.main.WorldToScreenPoint(Timeline.instance.LayerCorners[0]).y;
float modScale = Timeline.GetScaleModifier();
rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, layerScaleDist/4 * (1/modScale));
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b90b6b57a843c2245bfdae87a3e8fb21
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -68,6 +68,7 @@ namespace HeavenStudio.Editor.Track
[SerializeField] private RectTransform TimelineSongPosLineRef;
[SerializeField] private RectTransform TimelineEventObjRef;
[SerializeField] private RectTransform LayersRect;
public TempoTimeline TempoInfo;
public VolumeTimeline VolumeInfo;
private RectTransform TimelineSongPosLine;
@ -83,6 +84,8 @@ namespace HeavenStudio.Editor.Track
public Button MusicVolumeBTN;
public Slider PlaybackSpeed;
public Vector3[] LayerCorners = new Vector3[4];
public static Timeline instance { get; private set; }
public bool userIsEditingInputField
@ -338,6 +341,22 @@ namespace HeavenStudio.Editor.Track
{
timelineState.SetState(false, false, true);
}
LayersRect.GetWorldCorners(LayerCorners);
}
public static float GetScaleModifier()
{
Camera cam = Editor.instance.EditorCamera;
Vector2 scalerReferenceResolution = new Vector2(1280, 720);
return Mathf.Pow(cam.pixelWidth/scalerReferenceResolution.x, 1f)*
Mathf.Pow(cam.pixelHeight/scalerReferenceResolution.y, 0f);
}
public Vector2 LayerCornersToDist()
{
Vector3[] v = LayerCorners;
return new Vector2(Mathf.Abs(v[1].x - v[2].x), Mathf.Abs(v[3].y - v[1].y));
}
private void SliderControl()

View file

@ -26,7 +26,7 @@ namespace HeavenStudio.Editor.Track
[SerializeField] private RectTransform resizeGraphic;
[SerializeField] private RectTransform leftDrag;
[SerializeField] private RectTransform rightDrag;
private GameObject moveTemp;
// private GameObject moveTemp;
[Header("Properties")]
public Beatmap.Entity entity;
@ -61,8 +61,9 @@ namespace HeavenStudio.Editor.Track
lastMovePos = transform.localPosition;
moveTemp = new GameObject();
moveTemp.transform.SetParent(this.transform.parent);
// what the fuck????
// moveTemp = new GameObject();
// moveTemp.transform.SetParent(this.transform.parent);
bool visible = rectTransform.IsVisibleFrom(Editor.instance.EditorCamera);
for (int i = 0; i < this.transform.childCount; i++)
@ -105,7 +106,7 @@ namespace HeavenStudio.Editor.Track
#endregion
SetColor(GetTrack());
SetColor(entity.track);
if (selected)
{
@ -132,6 +133,20 @@ namespace HeavenStudio.Editor.Track
if (Conductor.instance.NotStopped())
{
Cancel();
if (moving)
moving = false;
if (selected)
{
selected = false;
selectedImage.gameObject.SetActive(false);
for (int i = 0; i < outline.childCount; i++)
outline.GetChild(i).GetComponent<Image>().color = new Color32(0, 0, 0, 51);
}
rectTransform.sizeDelta = new Vector2(rectTransform.sizeDelta.x, Timeline.instance.LayerHeight());
this.transform.localPosition = new Vector3(this.transform.localPosition.x, -entity.track * Timeline.instance.LayerHeight());
return;
}
@ -157,14 +172,11 @@ namespace HeavenStudio.Editor.Track
lastPos_ = transform.localPosition;
this.transform.position = new Vector3(mousePos.x - startPosX, mousePos.y - startPosY - 0.40f, 0);
this.transform.localPosition = new Vector3(Mathf.Clamp(Mathp.Round2Nearest(this.transform.localPosition.x, Timeline.SnapInterval()), 0, Mathf.Infinity), Timeline.instance.SnapToLayer(this.transform.localPosition.y));
// moveTemp.transform.position = new Vector3(mousePos.x - startPosX, mousePos.y - startPosY - 0.40f, 0);
// moveTemp.transform.localPosition = new Vector3(Mathf.Clamp(Mathp.Round2Nearest(moveTemp.transform.localPosition.x, 0.25f), 0, Mathf.Infinity), Timeline.instance.SnapToLayer(moveTemp.transform.localPosition.y));
this.transform.localPosition = new Vector3(Mathf.Max(Mathp.Round2Nearest(this.transform.localPosition.x, Timeline.SnapInterval()), 0), Timeline.instance.SnapToLayer(this.transform.localPosition.y));
if (lastPos != transform.localPosition)
{
OnMove();
// this.transform.DOLocalMove(new Vector3(Mathf.Clamp(Mathp.Round2Nearest(moveTemp.transform.localPosition.x, 0.25f), 0, Mathf.Infinity), Timeline.instance.SnapToLayer(moveTemp.transform.localPosition.y)), 0.15f).SetEase(Ease.OutExpo);
}
lastPos = transform.localPosition;
@ -215,6 +227,9 @@ namespace HeavenStudio.Editor.Track
{
Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
}
rectTransform.sizeDelta = new Vector2(rectTransform.sizeDelta.x, Timeline.instance.LayerHeight());
this.transform.localPosition = new Vector3(this.transform.localPosition.x, -entity.track * Timeline.instance.LayerHeight());
}
#region ClickEvents