Skip to content

Commit ca9ea3e

Browse files
committed
update 1.0.6
1 parent cfcfb91 commit ca9ea3e

44 files changed

Lines changed: 1663 additions & 1141 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Binary file not shown.
Binary file not shown.

Assets/CVVTuberExample/CVVTuber/Addons/Live2DCubism3CVVTuber.unitypackage.meta

Lines changed: 0 additions & 8 deletions
This file was deleted.
Binary file not shown.

Assets/CVVTuberExample/CVVTuber/Addons/Live2DCubism2CVVTuber.unitypackage.meta renamed to Assets/CVVTuberExample/CVVTuber/Addons/Live2DCubism4CVVTuber.unitypackage.meta

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.
852 Bytes
Binary file not shown.
Binary file not shown.

Assets/CVVTuberExample/CVVTuber/CVVTuberModel/Models/CVVTuberModel.fbx.meta

Lines changed: 29 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/CVVTuberExample/CVVTuber/Editor/CVVTuberExampleMenuItem.cs

Lines changed: 110 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,143 @@
1-
using System.Collections;
2-
using System.Collections.Generic;
3-
using UnityEngine;
4-
using UnityEditor;
1+
using UnityEditor;
52
using UnityEditor.Animations;
3+
using UnityEngine;
64

75
namespace CVVTuber
86
{
97
public class CVVTuberExampleMenuItem : MonoBehaviour
108
{
11-
[MenuItem ("Tools/CVVTuberExample/Setup CVVTuberExample", false, 1)]
12-
public static void SetCVVTuberSettings ()
9+
[MenuItem("Tools/CVVTuberExample/Setup CVVTuberExample", false, 1)]
10+
public static void SetCVVTuberSettings()
1311
{
14-
GameObject cVVTuberModel = GameObject.Find ("CVVTuberModel");
15-
if (cVVTuberModel != null) {
12+
GameObject cVVTuberModel = GameObject.Find("CVVTuberModel");
13+
if (cVVTuberModel != null)
14+
{
1615
//Undo.RecordObject(cVVTuberModel.transform.localEulerAngles, "Change cVVTuberModel.transform.localEulerAngles");
1716
//cVVTuberModel.transform.localEulerAngles = new Vector3 (0, 180, 0);
1817

19-
Animator animator = cVVTuberModel.GetComponent<Animator> ();
18+
bool allComplete = true;
19+
20+
Animator animator = cVVTuberModel.GetComponent<Animator>();
2021

2122
AnimatorController animCon = animator.runtimeAnimatorController as AnimatorController;
22-
Undo.RecordObject (animCon, "Set true to layer.ikPass");
23-
var layers = animCon.layers;
24-
foreach (var layer in layers) {
25-
if (layer.stateMachine.name == "Base Layer") {
26-
layer.iKPass = true;
23+
if (animCon != null)
24+
{
25+
Undo.RecordObject(animCon, "Set true to layer.ikPass");
26+
var layers = animCon.layers;
27+
bool success = false;
28+
foreach (var layer in layers)
29+
{
30+
if (layer.stateMachine.name == "Base Layer")
31+
{
32+
layer.iKPass = true;
33+
success = true;
34+
}
35+
}
36+
EditorUtility.SetDirty(animCon);
37+
38+
if (success)
39+
{
40+
Debug.Log("Set true to layer.ikPass");
41+
}
42+
else
43+
{
44+
Debug.LogError("success == false");
45+
allComplete = false;
2746
}
2847
}
29-
EditorUtility.SetDirty (animCon);
48+
else
49+
{
50+
Debug.LogError("animCon == null");
51+
allComplete = false;
52+
}
3053

31-
HeadLookAtIKController headLookAtIKController = FindObjectOfType<HeadLookAtIKController> ();
32-
if (headLookAtIKController != null) {
33-
Undo.RecordObject (headLookAtIKController, "Set animator to headLookAtIKController.target");
54+
HeadLookAtIKController headLookAtIKController = FindObjectOfType<HeadLookAtIKController>();
55+
if (headLookAtIKController != null)
56+
{
57+
Undo.RecordObject(headLookAtIKController, "Set animator to headLookAtIKController.target");
3458
headLookAtIKController.target = animator;
3559

36-
var lookAtLoot = GameObject.Find ("LookAtRoot").transform;
37-
if (lookAtLoot != null) {
60+
var lookAtLoot = GameObject.Find("LookAtRoot").transform;
61+
if (lookAtLoot != null)
62+
{
3863
headLookAtIKController.lookAtRoot = lookAtLoot;
39-
var lookAtTarget = lookAtLoot.transform.Find ("LookAtTarget").transform;
40-
if (lookAtTarget != null) {
64+
var lookAtTarget = lookAtLoot.transform.Find("LookAtTarget").transform;
65+
if (lookAtTarget != null)
66+
{
4167
headLookAtIKController.lookAtTarget = lookAtTarget;
4268
}
4369
}
70+
EditorUtility.SetDirty(headLookAtIKController);
4471

45-
EditorUtility.SetDirty (headLookAtIKController);
72+
if (headLookAtIKController.lookAtRoot != null && headLookAtIKController.lookAtTarget != null)
73+
{
74+
Debug.Log("Set animator to headLookAtIKController.target");
75+
}
76+
else
77+
{
78+
Debug.LogError("headLookAtIKController.lookAtRoot == null || headLookAtIKController.lookAtTarget == null");
79+
allComplete = false;
80+
}
81+
}
82+
else
83+
{
84+
Debug.LogError("headLookAtIKController == null");
85+
allComplete = false;
4686
}
4787

48-
HeadRotationController headRotationController = FindObjectOfType<HeadRotationController> ();
49-
Undo.RecordObject (headRotationController, "Set head.transform to headRotationController.target");
50-
if (headRotationController != null) {
51-
headRotationController.target = cVVTuberModel.transform.Find ("Character001/hips/spine/chest/upper_chest/neck/head").transform;
88+
HeadRotationController headRotationController = FindObjectOfType<HeadRotationController>();
89+
Undo.RecordObject(headRotationController, "Set head.transform to headRotationController.target");
90+
if (headRotationController != null)
91+
{
92+
headRotationController.target = cVVTuberModel.transform.Find("Character001/hips/spine/chest/upper_chest/neck/head").transform;
93+
EditorUtility.SetDirty(headRotationController);
5294

53-
EditorUtility.SetDirty (headRotationController);
95+
if (headRotationController.target != null)
96+
{
97+
Debug.Log("Set head.transform to headRotationController.target");
98+
}
99+
else
100+
{
101+
Debug.LogError("headRotationController.target == null");
102+
allComplete = false;
103+
}
104+
}
105+
else
106+
{
107+
Debug.LogError("headRotationController == null");
108+
allComplete = false;
54109
}
55110

56-
FaceBlendShapeController faceBlendShapeController = FindObjectOfType<FaceBlendShapeController> ();
57-
if (faceBlendShapeController != null) {
58-
Undo.RecordObject (faceBlendShapeController, "Set SkinnedMeshRenderer to faceBlendShapeController.FACE_DEF");
59-
faceBlendShapeController.FACE_DEF = cVVTuberModel.transform.Find ("FACE_DEF").GetComponent<SkinnedMeshRenderer> ();
111+
FaceBlendShapeController faceBlendShapeController = FindObjectOfType<FaceBlendShapeController>();
112+
if (faceBlendShapeController != null)
113+
{
114+
Undo.RecordObject(faceBlendShapeController, "Set SkinnedMeshRenderer to faceBlendShapeController.FACE_DEF");
115+
faceBlendShapeController.FACE_DEF = cVVTuberModel.transform.Find("FACE_DEF").GetComponent<SkinnedMeshRenderer>();
116+
EditorUtility.SetDirty(faceBlendShapeController);
60117

61-
EditorUtility.SetDirty (faceBlendShapeController);
118+
if (faceBlendShapeController.FACE_DEF != null)
119+
{
120+
Debug.Log("Set SkinnedMeshRenderer to faceBlendShapeController.FACE_DEF");
121+
}
122+
else
123+
{
124+
Debug.LogError("faceBlendShapeController.FACE_DEF == null");
125+
allComplete = false;
126+
}
127+
}
128+
else
129+
{
130+
Debug.LogError("faceBlendShapeController == null");
131+
allComplete = false;
62132
}
63133

64-
} else {
65-
Debug.LogError ("There is no \"CVVTuberModel\" prefab in the scene. Please add \"CVVTuberModel\" prefab to the scene.");
134+
if (allComplete)
135+
Debug.Log("CVVTuberExample setup is all complete!");
136+
137+
}
138+
else
139+
{
140+
Debug.LogError("There is no \"CVVTuberModel\" prefab in the scene. Please add \"CVVTuberModel\" prefab to the scene.");
66141
}
67142
}
68143
}

0 commit comments

Comments
 (0)