Skip to content

Conversation

@stormsson
Copy link

@stormsson stormsson commented Dec 14, 2020

SplineNode

  • added tangentType enum to define how the direction behaves

    • allowed values are:
      • Mirrored (default, for backward compatibility)
      • Free
  • added two new fields directionIn, directionOut. (should be tangentIn / tangentOut, but kept old naming convention to avoid confusion)

    • direction has been altered to be a proxy for directionOut
    • when getting directionIn/Out added a check to see if old direction field has a value , but direction not; if this is the scenario, directionIn/Out are compiled. This is to allow saved projects to not have issues
    • when editing directionOut, if tangentType is set to Mirrored, directionIn will be updated accordingly. Update does not occur if directionOut property is directly accessed.
    • when editing directionIn, if tangentType is set to Mirrored, directionOut will be updated accordingly. Update does not occur if directionOut property is directly accessed.

CubicBezierCurve

  • modified GetLocation and GetTangent to consider directionIn / directionOut values

Spline

  • added SplitAtTime method
    • creates a new node at time position on the curve
    • previous and next nodes tangent type are altered to free mode to avoid shape changing of the curve

SplineEditor

  • hidden direction fields in inspector
  • added directionIn/directionOut fields in inspector
  • altered logic of the bezier curve gizmo drawing to take into account directionIn/Out

Comment on lines 280 to 292

SplineNode newNode = new SplineNode(selection.Direction, selection.Direction + selection.Direction - selection.Position);
var index = spline.nodes.IndexOf(selection);
if (index == spline.nodes.Count - 1)
{
spline.AddNode(newNode);
}
else
{
spline.InsertNode(index + 1, newNode);
}
selection = newNode;
serializedObject.Update();
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the original code It was commented by mistake when testing the new method.

this commit restores it

Comment on lines 280 to 293
spline.SplitAtTime(5.25f);

//SplineNode newNode = new SplineNode(selection.Direction, selection.Direction + selection.Direction - selection.Position);
//var index = spline.nodes.IndexOf(selection);
//if (index == spline.nodes.Count - 1)
//{
// spline.AddNode(newNode);
//}
//else
//{
// spline.InsertNode(index + 1, newNode);
//}
//selection = newNode;
//serializedObject.Update();
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was a wrong commit, the code is restored in 4f6b3b1

@MervinRoy4
Copy link

When will this be added to the asset?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants