Skip to content

Commit 67373c4

Browse files
authored
Merge pull request #91 from soupday/dev
Dev
2 parents a6f68c0 + 76971aa commit 67373c4

34 files changed

+4227
-998
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
Changelog
22
=========
33

4+
### 1.6.0
5+
- Fixes to root bones and physics components in LOD combiner.
6+
- Support for Magica Cloth 2 Physics (if present) - Cloth simulation and spring bones.
7+
- Collider Manager rebuild to support magica cloth
8+
- Collider editor now uses direct on screen manipulation of colliders.
9+
- Support for Json Schema 1.2
10+
- A bug in CC4 can cause the character to export with this schema.
11+
- Run time wrinkle material fix.
12+
413
### 1.5.2
514
- Animation Retargeter fixes.
615
- AnimationMode removed.

Editor/AnimPlayerGUI.cs

Lines changed: 68 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -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)

Editor/AnimPlayerWindow.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public static void DoWindow(int id)
9595

9696
public static void Empty(int id)
9797
{
98-
Util.LogInfo("Showing " + id);
98+
Util.LogDetail("Showing " + id);
9999
}
100100
}
101101
}

Editor/AnimRetargetGUI.cs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -470,14 +470,11 @@ public static bool CanClipLoop(AnimationClip clip)
470470
foreach (EditorCurveBinding binding in curveBindings)
471471
{
472472
Keyframe[] testKeys = AnimationUtility.GetEditorCurve(clip, binding).keys;
473-
//Debug.Log(Math.Round(testKeys[0].value, 3) + " -- " + Math.Round(testKeys[testKeys.Length - 1].value, 3) + " --- " + (Math.Round(testKeys[0].value, 3) != Math.Round(testKeys[testKeys.Length - 1].value, 3)));
474473
if (Math.Round(testKeys[0].value, 2) != Math.Round(testKeys[testKeys.Length - 1].value, 2))
475474
{
476475
canLoop = false;
477-
//Debug.Log(binding.propertyName + " 0: " + testKeys[0].value + " last: " + testKeys[testKeys.Length - 1].value);
478476
}
479477
}
480-
//Debug.Log("Animation Clip " + clip.name + (canLoop ? " can loop" : " can NOT loop"));
481478
return canLoop;
482479
}
483480

@@ -529,7 +526,6 @@ static void CloseMouthToggle(bool close)
529526
AnimPlayerGUI.UpdateAnimator();
530527
}
531528

532-
533529
static void ApplyPose(int mode)
534530
{
535531
if (!(OriginalClip && WorkingClip)) return;
@@ -1325,14 +1321,11 @@ static string GenerateClipAssetPath(AnimationClip originalClip, string character
13251321
return assetPath;
13261322
}
13271323

1328-
1329-
1330-
13311324
static AnimationClip WriteAnimationToAssetDatabase(AnimationClip workingClip, string assetPath, bool originalSettings = false)
13321325
{
13331326
if (string.IsNullOrEmpty(assetPath)) return null;
13341327

1335-
Util.LogInfo("Writing Asset: " + assetPath);
1328+
Util.LogDetail("Writing Asset: " + assetPath);
13361329

13371330
var output = Object.Instantiate(workingClip); // clone so that workingClip isn't locked to an on-disk asset
13381331
AnimationClip outputClip = output as AnimationClip;
@@ -1367,12 +1360,12 @@ static AnimationClip WriteAnimationToAssetDatabase(AnimationClip workingClip, st
13671360
if (asset == null)
13681361
{
13691362
// New
1370-
Util.LogInfo("Writing New Asset: " + assetPath);
1363+
Util.LogDetail("Writing New Asset: " + assetPath);
13711364
AssetDatabase.CreateAsset(outputClip, assetPath);
13721365
}
13731366
else
13741367
{
1375-
Util.LogInfo("Updating Existing Asset: " + assetPath);
1368+
Util.LogDetail("Updating Existing Asset: " + assetPath);
13761369
outputClip.name = asset.name;
13771370
EditorUtility.CopySerialized(outputClip, asset);
13781371
AssetDatabase.SaveAssets();

0 commit comments

Comments
 (0)