copy entities, prep settings menu

This commit is contained in:
minenice55
2022-07-04 12:57:19 -04:00
parent 21c175d025
commit fb39a7c5fe
7 changed files with 115 additions and 13 deletions

View File

@ -611,6 +611,14 @@ namespace HeavenStudio.Editor.Track
return eventObj;
}
public TimelineEventObj CopyEventObject(Beatmap.Entity e)
{
Beatmap.Entity clone = (Beatmap.Entity) e.Clone();
TimelineEventObj dup = AddEventObject(clone.datamodel, false, new Vector3(clone.beat, -clone.track * Timeline.instance.LayerHeight()), clone, true, RandomID());
return dup;
}
public void DestroyEventObject(Beatmap.Entity entity)
{
if (EventParameterManager.instance.entity == entity)

View File

@ -41,6 +41,7 @@ namespace HeavenStudio.Editor.Track
private bool resizingLeft;
private bool resizingRight;
private bool inResizeRegion;
private bool wasDuplicated;
public Vector2 lastMovePos;
public bool isCreating;
public string eventObjID;
@ -167,6 +168,13 @@ namespace HeavenStudio.Editor.Track
if (Timeline.instance.eventObjs.FindAll(c => c.moving).Count > 0 && selected)
{
//duplicate the entity if holding alt or r-click
if ((!wasDuplicated) && (Input.GetKey(KeyCode.LeftAlt) || Input.GetMouseButton(1)))
{
wasDuplicated = true;
var te = Timeline.instance.CopyEventObject(entity);
}
Vector3 mousePos = Editor.instance.EditorCamera.ScreenToWorldPoint(Input.mousePosition);
lastPos_ = transform.localPosition;
@ -291,6 +299,7 @@ namespace HeavenStudio.Editor.Track
}
moving = false;
wasDuplicated = false;
Cancel();
if (isCreating == true)