File tree Expand file tree Collapse file tree 3 files changed +21
-12
lines changed
Expand file tree Collapse file tree 3 files changed +21
-12
lines changed Original file line number Diff line number Diff line change 55
66public class CoordinateSpaceManager : MonoBehaviour
77{
8+ /// <summary>
9+ /// Stores the original transform, when the active transform is a custom transform
10+ /// </summary>
11+ public static CoordinateTransform OriginalTransform ;
12+
813 public static CoordinateSpace ActiveCoordinateSpace ;
914 public static CoordinateTransform ActiveCoordinateTransform ;
1015 public static CoordinateSpaceManager Instance ;
Original file line number Diff line number Diff line change @@ -932,7 +932,11 @@ public static ProbeData ProbeManager2ProbeData(ProbeManager probeManager)
932932 data . Angles = probeManager . ProbeController . Insertion . angles ;
933933
934934 data . CoordSpaceName = probeManager . ProbeController . Insertion . CoordinateSpace . Name ;
935- data . CoordTransformName = probeManager . ProbeController . Insertion . CoordinateTransform . Name ;
935+
936+ if ( probeManager . ProbeController . Insertion . CoordinateTransform . Name . Equals ( "Custom" ) )
937+ data . CoordTransformName = CoordinateSpaceManager . OriginalTransform . Name ;
938+ else
939+ data . CoordTransformName = probeManager . ProbeController . Insertion . CoordinateTransform . Name ;
936940
937941 data . SelectionLayerName = probeManager . SelectionLayerName ;
938942
Original file line number Diff line number Diff line change @@ -914,19 +914,19 @@ private void LoadSavedProbesFromStringArray(string[] savedProbes)
914914 CoordinateTransform probeOrigTransform = coordinateTransformOpts [ probeData . CoordTransformName ] ;
915915
916916 ProbeInsertion probeInsertion ;
917- // if (probeOrigTransform.Name != CoordinateSpaceManager.ActiveCoordinateTransform.Name)
918- // {
919- // Debug.LogError($"[TODO] Need to warn user when transforming a probe into the active coordinate space!!");
920- // Vector3 newAPMLDV = CoordinateSpaceManager.ActiveCoordinateTransform.Space2Transform(probeOrigTransform.Transform2Space(probeData.APMLDV));
921-
922- // probeInsertion = new ProbeInsertion(newAPMLDV, probeData.Angles,
923- // CoordinateSpaceManager.ActiveCoordinateSpace, CoordinateSpaceManager.ActiveCoordinateTransform);
924- // }
925- // else
926- // {
917+ if ( probeOrigTransform . Name != CoordinateSpaceManager . ActiveCoordinateTransform . Name )
918+ {
919+ Debug . LogError ( $ "[TODO] Need to warn user when transforming a probe into the active coordinate space!!") ;
920+ Vector3 newAPMLDV = CoordinateSpaceManager . ActiveCoordinateTransform . Space2Transform ( probeOrigTransform . Transform2Space ( probeData . APMLDV ) ) ;
921+
922+ probeInsertion = new ProbeInsertion ( newAPMLDV , probeData . Angles ,
923+ CoordinateSpaceManager . ActiveCoordinateSpace , CoordinateSpaceManager . ActiveCoordinateTransform ) ;
924+ }
925+ else
926+ {
927927 probeInsertion = new ProbeInsertion ( probeData . APMLDV , probeData . Angles ,
928928 CoordinateSpaceManager . ActiveCoordinateSpace , CoordinateSpaceManager . ActiveCoordinateTransform ) ;
929- // }
929+ }
930930
931931
932932 ProbeManager newProbeManager = AddNewProbe ( ( ProbeProperties . ProbeType ) probeData . Type , probeInsertion ,
You can’t perform that action at this time.
0 commit comments