mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-09-10 21:09:08 -05:00
GameObjectType
This commit is contained in:
43
Assets/UniGLTF/Editor/MeshUtility/GameObjectType.cs
Normal file
43
Assets/UniGLTF/Editor/MeshUtility/GameObjectType.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UniGLTF.MeshUtility
|
||||
{
|
||||
public enum GameObjectType
|
||||
{
|
||||
Null,
|
||||
SceneInstance,
|
||||
PrefabInstance,
|
||||
AssetPrefab,
|
||||
}
|
||||
|
||||
public static class GameObjectTypeUtility
|
||||
{
|
||||
public static GameObjectType GetGameObjectType(this GameObject go)
|
||||
{
|
||||
if (go == null)
|
||||
{
|
||||
return GameObjectType.Null;
|
||||
}
|
||||
|
||||
if (!go.scene.IsValid())
|
||||
{
|
||||
if (PrefabUtility.IsPartOfAnyPrefab(go))
|
||||
{
|
||||
return GameObjectType.AssetPrefab;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new System.Exception("unknown");
|
||||
}
|
||||
}
|
||||
|
||||
if (PrefabUtility.IsPartOfAnyPrefab(go))
|
||||
{
|
||||
return GameObjectType.PrefabInstance;
|
||||
}
|
||||
|
||||
return GameObjectType.SceneInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/UniGLTF/Editor/MeshUtility/GameObjectType.cs.meta
Normal file
11
Assets/UniGLTF/Editor/MeshUtility/GameObjectType.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 95cda911ba335b449901767f9bee8ca8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -104,6 +104,13 @@ namespace VRM
|
||||
OnValidate();
|
||||
}
|
||||
|
||||
protected override bool DrawWizardGUI()
|
||||
{
|
||||
var t = m_root.GetGameObjectType();
|
||||
EditorGUILayout.HelpBox($"{t}", MessageType.Info);
|
||||
return base.DrawWizardGUI();
|
||||
}
|
||||
|
||||
static object GetPropertyValue(Shader shader, int i, Material m)
|
||||
{
|
||||
var propType = ShaderUtil.GetPropertyType(shader, i);
|
||||
|
||||
Reference in New Issue
Block a user