Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.0] rename_VRM10Controller_to_Vrm10Instance #1251

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ namespace UniVRM10
//
// Runtime に Expression 操作用の Slider を表示する
//
class VRM10ControllerEditorExpression
class Vrm10InstanceEditorExpression
{
VRM10Controller m_target;
Vrm10Instance m_target;
Dictionary<ExpressionKey, float> m_expressionKeyWeights = new Dictionary<ExpressionKey, float>();
List<ExpressionSlider> m_sliders;

public VRM10ControllerEditorExpression(VRM10Controller target)
public Vrm10InstanceEditorExpression(Vrm10Instance target)
{
m_target = target;

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Assets/VRM10/Editor/Components/SpringBone/SelectedGUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ class SelectedSpringGUI : SelectedGUIBase
ReorderableList _springColliderGroupList;
ReorderableList _springJointList;

public SelectedSpringGUI(VRM10Controller target, SerializedObject so, int i) : base(so, i)
public SelectedSpringGUI(Vrm10Instance target, SerializedObject so, int i) : base(so, i)
{
Property = so.FindProperty($"SpringBone.Springs.Array.data[{i}]");

Expand Down
6 changes: 3 additions & 3 deletions Assets/VRM10/Editor/Components/SpringBone/SpringBoneEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace UniVRM10
public static class SpringBoneEditor
{
static SpringBoneTreeView s_treeView;
static SpringBoneTreeView GetTree(VRM10Controller target, SerializedObject so)
static SpringBoneTreeView GetTree(Vrm10Instance target, SerializedObject so)
{
if (s_treeView == null || s_treeView.Target != target)
{
Expand All @@ -30,7 +30,7 @@ public static void Disable()
/// <summary>
/// 2D の GUI 描画
/// </summary>
public static void Draw2D(VRM10Controller target, SerializedObject so)
public static void Draw2D(Vrm10Instance target, SerializedObject so)
{
var tree = GetTree(target, so);
if (GUILayout.Button("Reload"))
Expand All @@ -45,7 +45,7 @@ public static void Draw2D(VRM10Controller target, SerializedObject so)
/// <summary>
/// 3D の Handle 描画
/// </summary>
public static void Draw3D(VRM10Controller target, SerializedObject so)
public static void Draw3D(Vrm10Instance target, SerializedObject so)
{
var tree = GetTree(target, so);
tree.Draw3D();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace UniVRM10
{
public class SpringBoneTreeView : TreeView
{
public VRM10Controller Target { get; private set; }
public Vrm10Instance Target { get; private set; }
SerializedObject _so;

TreeViewItem _root;
Expand All @@ -20,7 +20,7 @@ public class SpringBoneTreeView : TreeView

Dictionary<int, object> _map = new Dictionary<int, object>();

public SpringBoneTreeView(TreeViewState state, VRM10Controller target, SerializedObject so) : base(state)
public SpringBoneTreeView(TreeViewState state, Vrm10Instance target, SerializedObject so) : base(state)
{
Target = target;
_so = so;
Expand Down Expand Up @@ -75,7 +75,7 @@ protected override void SelectionChanged(IList<int> selectedIds)
var i = Target.SpringBone.ColliderGroups.IndexOf(colliderGroup);
_selected = new SelectedColliderGroupGUI(_so, i);
}
else if (value is VRM10ControllerSpringBone.Spring spring)
else if (value is Vrm10InstanceSpringBone.Spring spring)
{
var i = Target.SpringBone.Springs.IndexOf(spring);
_selected = new SelectedSpringGUI(Target, _so, i);
Expand Down
10 changes: 5 additions & 5 deletions Assets/VRM10/Editor/Components/VRM10Window.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ private static void ExportFromMenu()
var window = (VRM10Window)GetWindow(typeof(VRM10Window));
window.titleContent = new GUIContent(WINDOW_TITLE);
window.Show();
window.Root = UnityEditor.Selection.activeTransform?.GetComponent<VRM10Controller>();
window.Root = UnityEditor.Selection.activeTransform?.GetComponent<Vrm10Instance>();
}

void OnEnable()
Expand All @@ -45,9 +45,9 @@ void OnDisable()

SerializedObject m_so;
int? m_root;
VRM10Controller Root
Vrm10Instance Root
{
get => m_root.HasValue ? (EditorUtility.InstanceIDToObject(m_root.Value) as VRM10Controller) : null;
get => m_root.HasValue ? (EditorUtility.InstanceIDToObject(m_root.Value) as Vrm10Instance) : null;
set
{
int? id = value != null ? value.GetInstanceID() : default;
Expand Down Expand Up @@ -126,15 +126,15 @@ private void OnGUI()
{
if (UnityEditor.Selection.activeTransform != null)
{
var root = UnityEditor.Selection.activeTransform.Ancestors().Select(x => x.GetComponent<VRM10Controller>()).FirstOrDefault(x => x != null);
var root = UnityEditor.Selection.activeTransform.Ancestors().Select(x => x.GetComponent<Vrm10Instance>()).FirstOrDefault(x => x != null);
if (root != null)
{
Root = root;
}
}
}

Root = (VRM10Controller)EditorGUILayout.ObjectField("vrm1", Root, typeof(VRM10Controller), true);
Root = (Vrm10Instance)EditorGUILayout.ObjectField("vrm1", Root, typeof(Vrm10Instance), true);
if (Root == null)
{
return;
Expand Down
4 changes: 2 additions & 2 deletions Assets/VRM10/Editor/EditorTool/VRM10BoneSelectorEditorTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace UniVRM10
/// <summary>
/// Bone Selector
/// </summary>
[EditorTool("vrm-1.0/Humanoid", typeof(UniVRM10.VRM10Controller))]
[EditorTool("vrm-1.0/Humanoid", typeof(UniVRM10.Vrm10Instance))]
public class VRM10BoneSelectorEditorTool : EditorTool
{
static GUIContent s_cachedIcon;
Expand Down Expand Up @@ -65,7 +65,7 @@ public override void OnToolGUI(EditorWindow window)
_impl = new BoneSelector(SceneView.lastActiveSceneView.camera);
}

var root = Selection.activeGameObject?.GetComponent<VRM10Controller>();
var root = Selection.activeGameObject?.GetComponent<Vrm10Instance>();
if (root == null)
{
return;
Expand Down
4 changes: 2 additions & 2 deletions Assets/VRM10/Editor/EditorTool/VRM10ExpressionEditorTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace UniVRM10
{
[EditorTool("vrm-1.0/Expression", typeof(UniVRM10.VRM10Controller))]
[EditorTool("vrm-1.0/Expression", typeof(UniVRM10.Vrm10Instance))]
class VRM10ExpressionEditorTool : EditorTool
{
static GUIContent s_cachedIcon;
Expand Down Expand Up @@ -42,7 +42,7 @@ void ActiveToolDidChange()

public override void OnToolGUI(EditorWindow window)
{
var root = Selection.activeTransform.GetComponent<VRM10Controller>();
var root = Selection.activeTransform.GetComponent<Vrm10Instance>();
if (root == null)
{
return;
Expand Down
4 changes: 2 additions & 2 deletions Assets/VRM10/Editor/EditorTool/VRM10LookAtEditorTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace UniVRM10
{
[EditorTool("vrm-1.0/LookAt", typeof(UniVRM10.VRM10Controller))]
[EditorTool("vrm-1.0/LookAt", typeof(UniVRM10.Vrm10Instance))]
class VRM10LookAtEditorTool : EditorTool
{
static GUIContent s_cachedIcon;
Expand Down Expand Up @@ -41,7 +41,7 @@ void ActiveToolDidChange()

public override void OnToolGUI(EditorWindow window)
{
var root = Selection.activeTransform.GetComponent<VRM10Controller>();
var root = Selection.activeTransform.GetComponent<Vrm10Instance>();
if (root == null)
{
return;
Expand Down
2 changes: 1 addition & 1 deletion Assets/VRM10/Editor/Vrm10ExportDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ protected override void Initialize()
}
else
{
var controller = root.GetComponent<VRM10Controller>();
var controller = root.GetComponent<Vrm10Instance>();
if (controller != null)
{
Vrm = controller.Vrm;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ protected virtual void Reset()
// root
break;
}
if (current.GetComponent<VRM10Controller>() != null)
if (current.GetComponent<Vrm10Instance>() != null)
{
// model root
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ public void RemoveNullClip()

int m_debugCount;

internal void Setup(VRM10Controller target, ILookAtEyeDirectionProvider eyeDirectionProvider, ILookAtEyeDirectionApplicable eyeDirectionApplicable)
internal void Setup(Vrm10Instance target, ILookAtEyeDirectionProvider eyeDirectionProvider, ILookAtEyeDirectionApplicable eyeDirectionApplicable)
{
Restore();

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ namespace UniVRM10
[AddComponentMenu("VRM10/VRMController")]
[DisallowMultipleComponent]
[DefaultExecutionOrder(11000)]
public class VRM10Controller : MonoBehaviour
public class Vrm10Instance : MonoBehaviour
{
[SerializeField, Header("VRM1")]
public VRM10Object Vrm;

[SerializeField]
public VRM10ControllerSpringBone SpringBone = new VRM10ControllerSpringBone();
public Vrm10InstanceSpringBone SpringBone = new Vrm10InstanceSpringBone();

public enum UpdateTypes
{
Expand All @@ -55,17 +55,17 @@ public enum UpdateTypes
[SerializeField]
public VRM10ObjectLookAt.LookAtTargetTypes LookAtTargetType;

VRM10ControllerRuntime m_runtime;
Vrm10InstanceRuntime m_runtime;

/// <summary>
/// delay new VRM10ControllerRuntime
/// delay new Vrm10InstanceRuntime
/// </summary>
/// <returns></returns>
VRM10ControllerRuntime GetOrCreate()
Vrm10InstanceRuntime GetOrCreate()
{
if (m_runtime == null)
{
m_runtime = new VRM10ControllerRuntime(this);
m_runtime = new Vrm10InstanceRuntime(this);
}
return m_runtime;
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ namespace UniVRM10
/// <summary>
/// Play時 と Editorからの参照情報置き場
/// </summary>
public class VRM10ControllerRuntime
public class Vrm10InstanceRuntime
{
VRM10Controller m_target;
Vrm10Instance m_target;
VRM10Constraint[] m_constraints;
Transform m_head;

public VRM10ControllerRuntime(VRM10Controller target)
public Vrm10InstanceRuntime(Vrm10Instance target)
{
m_target = target;
var animator = target.GetComponent<Animator>();
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace UniVRM10
///
/// </summary>
[Serializable]
public sealed class VRM10ControllerSpringBone
public sealed class Vrm10InstanceSpringBone
{
[SerializeField]
public List<VRM10SpringBoneColliderGroup> ColliderGroups = new List<VRM10SpringBoneColliderGroup>();
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions Assets/VRM10/Runtime/IO/Vrm10Exporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public void Export(GameObject root, Model model, ModelExporter converter, Export
UniGLTF.Extensions.VRMC_springBone.VRMC_springBone springBone,
int? thumbnailIndex) ExportVrm(GameObject root, Model model, ModelExporter converter, VRM10ObjectMeta vrmMeta)
{
var vrmController = root?.GetComponent<VRM10Controller>();
var vrmController = root?.GetComponent<Vrm10Instance>();

if (vrmMeta == null)
{
Expand Down Expand Up @@ -321,7 +321,7 @@ UniGLTF.Extensions.VRMC_springBone.SpringBoneJoint ExportJoint(VRM10SpringBoneJo
return joint;
}

UniGLTF.Extensions.VRMC_springBone.VRMC_springBone ExportSpringBone(VRM10Controller controller, Model model, ModelExporter converter)
UniGLTF.Extensions.VRMC_springBone.VRMC_springBone ExportSpringBone(Vrm10Instance controller, Model model, ModelExporter converter)
{
var springBone = new UniGLTF.Extensions.VRMC_springBone.VRMC_springBone
{
Expand Down Expand Up @@ -371,7 +371,7 @@ UniGLTF.Extensions.VRMC_springBone.VRMC_springBone ExportSpringBone(VRM10Control
return springBone;
}

void ExportConstraints(VRM10Controller vrmController, Model model, ModelExporter converter)
void ExportConstraints(Vrm10Instance vrmController, Model model, ModelExporter converter)
{
var constraints = vrmController.GetComponentsInChildren<VRM10Constraint>();
foreach (var constraint in constraints)
Expand Down Expand Up @@ -475,7 +475,7 @@ static UniGLTF.Extensions.VRMC_vrm.MeshAnnotation ExportMeshAnnotation(RendererF
};
}

void ExportFirstPerson(UniGLTF.Extensions.VRMC_vrm.VRMC_vrm vrm, VRM10Controller vrmController, Model model, ModelExporter converter)
void ExportFirstPerson(UniGLTF.Extensions.VRMC_vrm.VRMC_vrm vrm, Vrm10Instance vrmController, Model model, ModelExporter converter)
{
if (!(vrmController?.Vrm?.FirstPerson is VRM10ObjectFirstPerson firstPerson))
{
Expand Down Expand Up @@ -506,7 +506,7 @@ UniGLTF.Extensions.VRMC_vrm.LookAtRangeMap ExportLookAtRangeMap(CurveMapper mapp
};
}

void ExportLookAt(UniGLTF.Extensions.VRMC_vrm.VRMC_vrm vrm, VRM10Controller vrmController)
void ExportLookAt(UniGLTF.Extensions.VRMC_vrm.VRMC_vrm vrm, Vrm10Instance vrmController)
{
if (!(vrmController?.Vrm?.LookAt is VRM10ObjectLookAt lookAt))
{
Expand Down Expand Up @@ -559,7 +559,7 @@ UniGLTF.Extensions.VRMC_vrm.TextureTransformBind ExportTextureTransformBinding(M
};
}

UniGLTF.Extensions.VRMC_vrm.Expression ExportExpression(VRM10Expression e, VRM10Controller vrmController, Model model, ModelExporter converter)
UniGLTF.Extensions.VRMC_vrm.Expression ExportExpression(VRM10Expression e, Vrm10Instance vrmController, Model model, ModelExporter converter)
{
if (e == null)
{
Expand Down Expand Up @@ -634,7 +634,7 @@ UniGLTF.Extensions.VRMC_vrm.Expression ExportExpression(VRM10Expression e, VRM10
return vrmExpression;
}

void ExportExpression(UniGLTF.Extensions.VRMC_vrm.VRMC_vrm vrm, VRM10Controller vrmController, Model model, ModelExporter converter)
void ExportExpression(UniGLTF.Extensions.VRMC_vrm.VRMC_vrm vrm, Vrm10Instance vrmController, Model model, ModelExporter converter)
{
if (vrmController?.Vrm?.Expression?.Clips == null)
{
Expand Down
8 changes: 4 additions & 4 deletions Assets/VRM10/Runtime/IO/Vrm10Importer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ protected override async Task OnLoadHierarchy(IAwaitCaller awaitCaller, Func<str
animator.avatar = m_humanoid;

// VrmController
var controller = Root.AddComponent<VRM10Controller>();
var controller = Root.AddComponent<Vrm10Instance>();

// vrm
controller.Vrm = await LoadVrmAsync(awaitCaller, m_vrm.VrmExtension);
Expand Down Expand Up @@ -452,7 +452,7 @@ async Task<VRM10Object> LoadVrmAsync(IAwaitCaller awaitCaller, UniGLTF.Extension
return vrm;
}

async Task LoadSpringBoneAsync(IAwaitCaller awaitCaller, VRM10Controller controller, UniGLTF.Extensions.VRMC_springBone.VRMC_springBone gltfVrmSpringBone)
async Task LoadSpringBoneAsync(IAwaitCaller awaitCaller, Vrm10Instance controller, UniGLTF.Extensions.VRMC_springBone.VRMC_springBone gltfVrmSpringBone)
{
await awaitCaller.NextFrame();

Expand Down Expand Up @@ -517,7 +517,7 @@ async Task LoadSpringBoneAsync(IAwaitCaller awaitCaller, VRM10Controller control
{
continue;
}
var spring = new VRM10ControllerSpringBone.Spring(gltfSpring.Name);
var spring = new Vrm10InstanceSpringBone.Spring(gltfSpring.Name);
controller.SpringBone.Springs.Add(spring);

if (gltfSpring.ColliderGroups != null)
Expand Down Expand Up @@ -572,7 +572,7 @@ static Vector3 Vector3InvertX(float[] f)
return v;
}

async Task LoadConstraintAsync(IAwaitCaller awaitCaller, VRM10Controller controller)
async Task LoadConstraintAsync(IAwaitCaller awaitCaller, Vrm10Instance controller)
{
for (int i = 0; i < Data.GLTF.nodes.Count; ++i)
{
Expand Down
Loading