@@ -49,7 +49,7 @@ public static void OpenPlayer(GameObject scenePrefab)
4949 {
5050 if ( scenePrefab )
5151 {
52- scenePrefab = Util . TryResetScenePrefab ( scenePrefab ) ;
52+ // scenePrefab = Util.TryResetScenePrefab(scenePrefab);
5353 SetCharacter ( scenePrefab ) ;
5454 }
5555
@@ -84,11 +84,11 @@ public static void ClosePlayer()
8484 EditorApplication . update -= UpdateCallback ;
8585 EditorApplication . playModeStateChanged -= PlayStateChangeCallback ;
8686
87- if ( CharacterAnimator )
88- {
89- GameObject scenePrefab = Util . GetScenePrefabInstanceRoot ( CharacterAnimator . gameObject ) ;
90- Util . TryResetScenePrefab ( scenePrefab ) ;
91- }
87+ // if (CharacterAnimator)
88+ /// {
89+ // GameObject scenePrefab = Util.GetScenePrefabInstanceRoot(CharacterAnimator.gameObject);
90+ // Util.TryResetScenePrefab(scenePrefab);
91+ // }
9292
9393#if SCENEVIEW_OVERLAY_COMPATIBLE
9494 //2021.2.0a17+
@@ -121,7 +121,7 @@ public static bool IsPlayerShown()
121121 public static void SetCharacter ( GameObject scenePrefab )
122122 {
123123 if ( scenePrefab )
124- Util . LogInfo ( "scenePrefab.name: " + scenePrefab . name + " " + PrefabUtility . IsPartOfPrefabInstance ( scenePrefab ) ) ;
124+ Util . LogDetail ( "scenePrefab.name: " + scenePrefab . name + " " + PrefabUtility . IsPartOfPrefabInstance ( scenePrefab ) ) ;
125125
126126 if ( ! scenePrefab && WindowManager . IsPreviewScene )
127127 scenePrefab = WindowManager . GetPreviewScene ( ) . GetPreviewCharacter ( ) ;
@@ -246,12 +246,10 @@ enum AnimatorFlags
246246 // GUIStyles
247247 private static Styles guiStyles ;
248248
249- [ SerializeField ]
250- private static List < BoneItem > boneItemList ;
251- [ SerializeField ]
252- public static bool isTracking = false ;
253- [ SerializeField ]
254- private static GameObject lastTracked ;
249+ [ SerializeField ] private static List < BoneItem > boneItemList ;
250+ [ SerializeField ] public static bool isTracking = false ;
251+ [ SerializeField ] public static GameObject lastTracked ;
252+ [ SerializeField ] public static bool trackingPermitted = true ;
255253 private static string boneNotFound = "not found" ;
256254
257255 // ----------------------------------------------------------------------------
@@ -286,7 +284,7 @@ private static AnimatorController CreateAnimatiorController()
286284 {
287285 controllerPath = dirString + controllerName + ".controller" ;
288286
289- Util . LogInfo ( "Creating Temporary file " + controllerPath ) ;
287+ Util . LogDetail ( "Creating Temporary file " + controllerPath ) ;
290288 AnimatorController a = AnimatorController . CreateAnimatorControllerAtPath ( controllerPath ) ;
291289 a . name = controllerName ;
292290 // play mode parameters
@@ -373,7 +371,7 @@ private static void SelectOverrideAnimation(AnimationClip clip, AnimatorOverride
373371
374372 foreach ( var v in overrides )
375373 {
376- Util . LogInfo ( "Overrides: " + " Key: " + v . Key + " Value: " + v . Value ) ;
374+ Util . LogDetail ( "Overrides: " + " Key: " + v . Key + " Value: " + v . Value ) ;
377375 }
378376
379377 overrides [ 0 ] = new KeyValuePair < AnimationClip , AnimationClip > ( overrides [ 0 ] . Key , WorkingClip ) ;
@@ -390,7 +388,7 @@ public static void SelectOverrideAnimationWithoutReset(AnimationClip clip, Anima
390388
391389 foreach ( var v in overrides )
392390 {
393- Util . LogInfo ( "Overrides: " + " Key: " + v . Key + " Value: " + v . Value ) ;
391+ Util . LogDetail ( "Overrides: " + " Key: " + v . Key + " Value: " + v . Value ) ;
394392 }
395393
396394 overrides [ 0 ] = new KeyValuePair < AnimationClip , AnimationClip > ( overrides [ 0 ] . Key , WorkingClip ) ;
@@ -439,7 +437,7 @@ public static void ResetToBaseAnimatorController()
439437
440438 if ( ! characterPrefab ) return ;
441439
442- Util . LogInfo ( ( "Attempting to reset: " + characterPrefab . name ) ) ;
440+ Util . LogDetail ( ( "Attempting to reset: " + characterPrefab . name ) ) ;
443441
444442 GameObject basePrefab = PrefabUtility . GetCorrespondingObjectFromSource ( characterPrefab ) ;
445443
@@ -448,36 +446,36 @@ public static void ResetToBaseAnimatorController()
448446 if ( true ) //(PrefabUtility.IsAnyPrefabInstanceRoot(basePrefab))
449447 {
450448 string prefabPath = AssetDatabase . GetAssetPath ( basePrefab ) ;
451- Util . LogInfo ( ( basePrefab . name + "Prefab instance root found: " + prefabPath ) ) ;
449+ Util . LogDetail ( ( basePrefab . name + "Prefab instance root found: " + prefabPath ) ) ;
452450
453- Util . LogInfo ( "Loaded Prefab: " + basePrefab . name ) ;
451+ Util . LogDetail ( "Loaded Prefab: " + basePrefab . name ) ;
454452 Animator baseAnimator = basePrefab . GetComponent < Animator > ( ) ;
455453 if ( ! baseAnimator ) baseAnimator = basePrefab . GetComponentInChildren < Animator > ( ) ;
456454 if ( baseAnimator != null )
457455 {
458- Util . LogInfo ( "Prefab Animator: " + baseAnimator . name ) ;
456+ Util . LogDetail ( "Prefab Animator: " + baseAnimator . name ) ;
459457 if ( baseAnimator . runtimeAnimatorController )
460458 {
461- Util . LogInfo ( "Prefab Animator Controller: " + baseAnimator . runtimeAnimatorController . name ) ;
459+ Util . LogDetail ( "Prefab Animator Controller: " + baseAnimator . runtimeAnimatorController . name ) ;
462460 string controllerpath = AssetDatabase . GetAssetPath ( baseAnimator . runtimeAnimatorController ) ;
463- Util . LogInfo ( "Prefab Animator Controller Path: " + controllerpath ) ;
461+ Util . LogDetail ( "Prefab Animator Controller Path: " + controllerpath ) ;
464462 AnimatorController baseController = AssetDatabase . LoadAssetAtPath < AnimatorController > ( controllerpath ) ;
465463
466464 if ( CharacterAnimator . runtimeAnimatorController != null )
467465 {
468466 // ensure the created override controller is the one on the animator
469467 // to avoid wiping user generated controller (it will have to be a disk asset - but nevertheless)
470- Util . LogInfo ( "Current controller on character: " + CharacterAnimator . runtimeAnimatorController . name ) ;
468+ Util . LogDetail ( "Current controller on character: " + CharacterAnimator . runtimeAnimatorController . name ) ;
471469 if ( CharacterAnimator . runtimeAnimatorController . GetType ( ) == typeof ( AnimatorOverrideController ) && CharacterAnimator . runtimeAnimatorController . name == overrideName )
472470 {
473- Util . LogInfo ( "Created override controller found: can reset" ) ;
471+ Util . LogDetail ( "Created override controller found: can reset" ) ;
474472 CharacterAnimator . runtimeAnimatorController = baseController ;
475473 }
476474 }
477475 }
478476 else
479477 {
480- Util . LogInfo ( "NO Prefab Animator Controller" ) ;
478+ Util . LogDetail ( "NO Prefab Animator Controller" ) ;
481479 CharacterAnimator . runtimeAnimatorController = null ;
482480 }
483481 }
@@ -495,7 +493,7 @@ private static void DestroyAnimationController()
495493 {
496494 //if (showMessages)
497495
498- Util . LogInfo ( "Override controller: " + controllerPath + " exists -- removing" ) ;
496+ Util . LogDetail ( "Override controller: " + controllerPath + " exists -- removing" ) ;
499497 AssetDatabase . DeleteAsset ( controllerPath ) ;
500498 }
501499 }
@@ -602,6 +600,7 @@ public static void DrawPlayer()
602600 if ( ! CheckTackingStatus ( ) )
603601 CancelBoneTracking ( false ) ; //object focus lost - arrange ui to reflect that, but dont fight with the scene camera
604602
603+ EditorGUI . BeginDisabledGroup ( ! trackingPermitted ) ;
605604 if ( GUILayout . Button ( new GUIContent ( EditorGUIUtility . IconContent ( "Camera Gizmo" ) . image , "Select individual bone to track with the scene camera." ) , guiStyles . settingsButton , GUILayout . Width ( 24f ) , GUILayout . Height ( 24f ) ) )
606605 {
607606 GenerateBoneMenu ( ) ;
@@ -615,6 +614,7 @@ public static void DrawPlayer()
615614 CancelBoneTracking ( true ) ; //tracking deliberately cancelled - leave scene camera in last position with last tracked object still selected
616615 }
617616 EditorGUI . EndDisabledGroup ( ) ;
617+ EditorGUI . EndDisabledGroup ( ) ;
618618 GUILayout . FlexibleSpace ( ) ;
619619
620620 EditorGUI . BeginChangeCheck ( ) ;
@@ -725,7 +725,20 @@ public static void DrawPlayer()
725725 EditorGUI . EndDisabledGroup ( ) ;
726726
727727 GUILayout . Space ( 10f ) ;
728- GUILayout . Label ( new GUIContent ( EditorGUIUtility . IconContent ( "d_UnityEditor.GameView" ) . image , "Controls for 'Play Mode'" ) , guiStyles . playIconStyle , GUILayout . Width ( 24f ) , GUILayout . Height ( 24f ) ) ;
728+ //GUILayout.Label(new GUIContent(EditorGUIUtility.IconContent("d_UnityEditor.GameView").image, "Controls for 'Play Mode'"), guiStyles.playIconStyle, GUILayout.Width(24f), GUILayout.Height(24f));
729+
730+ if ( GUILayout . Button ( new GUIContent ( EditorGUIUtility . IconContent ( "d_ViewToolOrbit On" ) . image , "Select the character root." ) , EditorStyles . toolbarButton ) )
731+ {
732+ if ( ColliderManagerEditor . EditMode )
733+ {
734+ Selection . activeObject = null ;
735+ }
736+ else
737+ {
738+ Selection . activeObject = selectedAnimator . gameObject ;
739+ }
740+
741+ }
729742
730743 Texture bigPlayButton = EditorApplication . isPlaying ? EditorGUIUtility . IconContent ( "preAudioPlayOn" ) . image : EditorGUIUtility . IconContent ( "preAudioPlayOff" ) . image ;
731744 string playToggleTxt = EditorApplication . isPlaying ? "Exit 'Play Mode'." : "Enter 'Play Mode' and focus on the scene view window. This is to be used to evaluate play mode physics whilst allowing visualization of objects such as colliders." ;
@@ -1142,6 +1155,34 @@ private static void TrackBone(BoneItem boneItem)
11421155 scene . Repaint ( ) ;
11431156 }
11441157
1158+ public static void ForbidTracking ( )
1159+ {
1160+ // this is called by the collider manager editor script to use its own tracking while editing colliders
1161+ // this avoids having an objected selected since its control handles will be visible and cause problems
1162+
1163+ if ( isTracking )
1164+ {
1165+ isTracking = false ;
1166+ Selection . activeObject = null ;
1167+ }
1168+
1169+ trackingPermitted = false ;
1170+
1171+ if ( boneItemList != null )
1172+ {
1173+ foreach ( BoneItem boneItem in boneItemList )
1174+ {
1175+ if ( boneItem . selected )
1176+ boneItem . selected = false ;
1177+ }
1178+ }
1179+ }
1180+
1181+ public static void AllowTracking ( )
1182+ {
1183+ trackingPermitted = true ;
1184+ }
1185+
11451186 public static void ReEstablishTracking ( string humanBoneName )
11461187 {
11471188 //if (boneItemList == null)
0 commit comments