Exemplo n.º 1
0
 // Draw rotation handle
 private void RotationHandle(int index, Vector3 position)
 {
     if (Tools.pivotRotation == PivotRotation.Global)
     {
         EditorGUI.BeginChangeCheck();
         handleRotation = Handles.RotationHandle(handleRotation, position);
         if (EditorGUI.EndChangeCheck())
         {
             Undo.RecordObject(component, "Rotate Point");
             EditorUtility.SetDirty(component);
             if (tool == 0)
             {
                 component.SetRotation(activeSpline, index, handleRotation * pointRotation);
             }
             else if (tool == 2)
             {
                 component.RotateConnection(activeSpline, index, handleRotation * pointRotation);
             }
         }
     }
     else
     {
         EditorGUI.BeginChangeCheck();
         Quaternion rotation = component.GetRotation(activeSpline, index);
         rotation = Handles.RotationHandle(rotation, position);
         if (EditorGUI.EndChangeCheck())
         {
             Undo.RecordObject(component, "Rotate Point");
             EditorUtility.SetDirty(component);
             if (tool == 0)
             {
                 component.SetRotation(activeSpline, index, rotation);
             }
             else if (tool == 2)
             {
                 component.RotateConnection(activeSpline, index, rotation);
             }
         }
     }
 }