Editor bug fixes (#261)

* Spaceball cleanup and small bug fix

* Replace old hit sound in spaceball

* Camera filters

* added 9 new filters, including 3 types of sepia

* oops

* remark

* normalization of fade out and fade in on filters are by 100

* GenerateFilterTypeEnum comments

* Pure black and white filter

* Zooming

* Constant playback bar offset

* Prepare box selector rewrite

* Update icons, finalize

* Bug fixes
This commit is contained in:
Braedon Lewis
2023-02-05 14:48:49 -05:00
committed by GitHub
parent 5ce7862369
commit b45c4315b5
13 changed files with 130 additions and 88 deletions

View File

@ -90,14 +90,14 @@ namespace HeavenStudio.Editor.Track
if (count > 0) transform.GetChild(0).gameObject.SetActive(false);
}
if (scrollRect.content.anchoredPosition.x != lastPosX)
if (rectTransform.anchoredPosition.x != lastPosX)
{
UpdateGridNum();
}
lastContentScale = scrollRect.content.localScale.x;
lastTimelineSize = scrollRect.viewport.rect.size.x;
lastPosX = scrollRect.content.anchoredPosition.x;
lastPosX = rectTransform.anchoredPosition.x;
}
private void UpdateGridNum()

View File

@ -524,6 +524,7 @@ namespace HeavenStudio.Editor
GameManager.instance.OverlayCamera.rect = new Rect(0, 0, 1, 1);
EditorCamera.rect = new Rect(0, 0, 1, 1);
}
Timeline.AutoBtnUpdate();
}
private void UpdateEditorStatus(bool updateTime)

View File

@ -26,6 +26,9 @@ namespace HeavenStudio.Editor
for (int i = 0; i < buggedSelections.Count; i++)
Deselect(buggedSelections[i]);
}
if (Input.GetKey(KeyCode.LeftControl))
if (Input.GetKeyDown(KeyCode.A))
SelectAll();
}
public void ClickSelect(TimelineEventObj eventToAdd)
@ -56,6 +59,14 @@ namespace HeavenStudio.Editor
}
}
public void SelectAll()
{
DeselectAll();
var eventObjs = Timeline.instance.eventObjs;
for (int i = 0; i < eventObjs.Count; i++)
eventsSelected.Add(eventObjs[i]);
}
public void DeselectAll()
{
eventsSelected.Clear();

View File

@ -7,6 +7,7 @@ namespace HeavenStudio.Editor.Track
{
public override void OnBeginDrag(PointerEventData eventData)
{
if (Conductor.instance.isPlaying) return;
if (eventData.button != PointerEventData.InputButton.Middle) return;
eventData.button = PointerEventData.InputButton.Left;
base.OnBeginDrag(eventData);
@ -14,6 +15,7 @@ namespace HeavenStudio.Editor.Track
public override void OnEndDrag(PointerEventData eventData)
{
if (Conductor.instance.isPlaying) return;
if (eventData.button != PointerEventData.InputButton.Middle) return;
eventData.button = PointerEventData.InputButton.Left;
base.OnEndDrag(eventData);
@ -21,6 +23,7 @@ namespace HeavenStudio.Editor.Track
public override void OnDrag(PointerEventData eventData)
{
if (Conductor.instance.isPlaying) return;
if (eventData.button != PointerEventData.InputButton.Middle) return;
eventData.button = PointerEventData.InputButton.Left;
base.OnDrag(eventData);

View File

@ -225,5 +225,10 @@ namespace HeavenStudio.Editor.Track
//auto-open the dialog
sectionTimelineObj.OnRightClick();
}
public bool InteractingWithEvents()
{
return specialTimelineObjs.FindAll(c => c.hovering == true).Count > 0 || specialTimelineObjs.FindAll(c => c.moving == true).Count > 0;
}
}
}

View File

@ -15,11 +15,11 @@ namespace HeavenStudio.Editor.Track
[SerializeField] private RectTransform raycastRect;
private float startPosX;
private bool moving = false;
public bool hovering;
private float lastPosX;
public bool moving = false;
public bool hovering;
private void Start()
{
rectTransform = GetComponent<RectTransform>();

View File

@ -259,11 +259,11 @@ namespace HeavenStudio.Editor.Track
ZoomInBTN.onClick.AddListener(delegate
{
zoomComponent.ZoomIn(3, Vector2.zero);
zoomComponent.ZoomIn(1, Vector2.zero);
});
ZoomOutBTN.onClick.AddListener(delegate
{
zoomComponent.ZoomOut(-3, Vector2.zero);
zoomComponent.ZoomOut(-1, Vector2.zero);
});
ZoomResetBTN.onClick.AddListener(delegate
{
@ -440,13 +440,13 @@ namespace HeavenStudio.Editor.Track
}
float moveSpeed = 750;
if (Input.GetKey(KeyCode.LeftShift)) moveSpeed *= 6;
if (Input.GetKey(KeyCode.LeftArrow) || Input.GetKey(KeyCode.A))
if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) moveSpeed *= 6;
if (Input.GetKey(KeyCode.LeftArrow) || (!Input.GetKey(KeyCode.LeftControl) && Input.GetKey(KeyCode.A)))
{
TimelineContent.transform.localPosition += new Vector3(moveSpeed * Time.deltaTime, 0);
}
else if (Input.GetKey(KeyCode.RightArrow) || Input.GetKey(KeyCode.D))
else if (Input.GetKey(KeyCode.RightArrow) || (!Input.GetKey(KeyCode.LeftControl) && Input.GetKey(KeyCode.D)))
{
TimelineContent.transform.localPosition += new Vector3(-moveSpeed * Time.deltaTime, 0);
}

View File

@ -35,11 +35,11 @@ namespace HeavenStudio.Editor.Track
_scaleIncrement = 0.1f * _scale.x;
if (delta > 0 && _scale.x < _maximumScale)
if (delta > 0)
{
ZoomIn(delta, relativeMousePosition);
}
else if (delta < 0 && _scale.x > _minimumScale)
else if (delta < 0)
{
ZoomOut(delta, relativeMousePosition);
}
@ -47,6 +47,9 @@ namespace HeavenStudio.Editor.Track
public void ZoomIn(float delta, Vector2 relativeMousePosition)
{
if (!(_scale.x < _maximumScale)) return;
if (Timeline.instance.InteractingWithEvents() || SpecialTimeline.instance.InteractingWithEvents()) return;
float incre = _scaleIncrement * delta;
var newScale = Mathf.Clamp(_scale.x + incre, _minimumScale, _maximumScale);
@ -58,6 +61,9 @@ namespace HeavenStudio.Editor.Track
public void ZoomOut(float delta, Vector2 relativeMousePosition)
{
if (!(_scale.x > _minimumScale)) return;
if (Timeline.instance.InteractingWithEvents() || SpecialTimeline.instance.InteractingWithEvents()) return;
float incre = _scaleIncrement * -delta;
var newScale = _scale.x - incre;