-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
13077ee
commit a4b6a54
Showing
14 changed files
with
104 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using System.Linq; | ||
using System.Text.RegularExpressions; | ||
|
||
namespace VamTimeline | ||
{ | ||
public class GroupingScreen : ScreenBase | ||
{ | ||
public const string ScreenName = "Grouping"; | ||
|
||
private JSONStorableString _assignGroupJSON; | ||
|
||
public override string screenId => ScreenName; | ||
|
||
public override void Init(IAtomPlugin plugin, object arg) | ||
{ | ||
base.Init(plugin, arg); | ||
|
||
CreateChangeScreenButton("<b><</b> <i>Back</i>", MoreScreen.ScreenName); | ||
|
||
InitAssignToGroupUI(); | ||
|
||
prefabFactory.CreateButton("Assign to selected targets").button.onClick.AddListener(Assign); | ||
|
||
animation.animatables.onTargetsSelectionChanged.AddListener(OnTargetsSelectionChanged); | ||
OnTargetsSelectionChanged(); | ||
} | ||
|
||
private void InitAssignToGroupUI() | ||
{ | ||
_assignGroupJSON = new JSONStorableString("Group name (empty for auto)", ""); | ||
prefabFactory.CreateTextInput(_assignGroupJSON); | ||
} | ||
|
||
private void OnTargetsSelectionChanged() | ||
{ | ||
var groups = animationEditContext.GetSelectedTargets().Select(t => t.group).Distinct().ToList(); | ||
if (groups.Count == 1) _assignGroupJSON.val = groups[0]; | ||
} | ||
|
||
private void Assign() | ||
{ | ||
var group = _assignGroupJSON.val; | ||
if (string.IsNullOrEmpty(group)) group = null; | ||
foreach (var target in animationEditContext.GetSelectedTargets()) | ||
{ | ||
foreach (var c in animationEditContext.currentLayer) | ||
{ | ||
var t = c.GetAllTargets().FirstOrDefault(x => x.TargetsSameAs(target)); | ||
if (t == null) continue; | ||
t.group = group; | ||
} | ||
} | ||
current.onTargetsListChanged.Invoke(); | ||
} | ||
|
||
public override void OnDestroy() | ||
{ | ||
animation.animatables.onTargetsSelectionChanged.RemoveListener(OnTargetsSelectionChanged); | ||
base.OnDestroy(); | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters