Hi,
Here is my two cents on a handy usability feature when editing Control Points: Insert After & Insert Before toolbar shortcuts.
Here is what I added to CurvyToolbar.cs to enables this:
Just those few things missing:
Here is my two cents on a handy usability feature when editing Control Points: Insert After & Insert Before toolbar shortcuts.
Here is what I added to CurvyToolbar.cs to enables this:
Code:
[ToolbarItem(107, "Curvy", "Insert After", "Adds a control point after ", "next,24,24")]
public class TBCPAppend : DTToolbarButton
{
public override string StatusBarInfo { get { return "Insert point after the current one"; } }
public TBCPAppend()
{
KeyBindings.Add(new EditorKeyBinding("Insert", "", KeyCode.Insert));
}
public override void OnClick()
{
base.OnClick();
CurvySplineSegment point = DTSelection.GetAs<CurvySplineSegment>(false);
if (point)
{
point = point.Spline.InsertAfter(point);
Selection.activeGameObject = point.gameObject;
}
}
public override void OnSelectionChange()
{
Visible = DTSelection.HasComponent<CurvySplineSegment>();
}
}
[ToolbarItem(107, "Curvy", "Insert Before", "Adds a control point before ", "prev,24,24")]
public class TBCPInsertBefore : DTToolbarButton
{
public override string StatusBarInfo { get { return "Insert point before the selected one"; } }
public TBCPInsertBefore()
{
KeyBindings.Add(new EditorKeyBinding("Insert before", "", KeyCode.Insert, true));
}
public override void OnClick()
{
base.OnClick();
CurvySplineSegment point = DTSelection.GetAs<CurvySplineSegment>(false);
if (point)
{
point = point.Spline.InsertBefore(point);
Selection.activeGameObject = point.gameObject;
}
}
public override void OnSelectionChange()
{
Visible = DTSelection.HasComponent<CurvySplineSegment>();
}
}
Just those few things missing:
- Appropriate icons
- Insert before shortcut does not seem to work...