mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2024-12-29 18:55:06 +08:00
fix: support renderers other than SMR (#1042)
This commit is contained in:
parent
b2ada9fe05
commit
f96b2627aa
@ -468,10 +468,10 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
path = RuntimeUtil.RelativePath(context.AvatarRootObject, go);
|
path = RuntimeUtil.RelativePath(context.AvatarRootObject, go);
|
||||||
componentType = typeof(GameObject);
|
componentType = typeof(GameObject);
|
||||||
}
|
}
|
||||||
else if (key.TargetObject is SkinnedMeshRenderer smr)
|
else if (key.TargetObject is Renderer r)
|
||||||
{
|
{
|
||||||
path = RuntimeUtil.RelativePath(context.AvatarRootObject, smr.gameObject);
|
path = RuntimeUtil.RelativePath(context.AvatarRootObject, r.gameObject);
|
||||||
componentType = typeof(SkinnedMeshRenderer);
|
componentType = r.GetType();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -49,6 +49,7 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
{
|
{
|
||||||
var renderer = context.GetComponent<Renderer>(target);
|
var renderer = context.GetComponent<Renderer>(target);
|
||||||
if (renderer == null) continue;
|
if (renderer == null) continue;
|
||||||
|
if (renderer is not MeshRenderer and not SkinnedMeshRenderer) continue;
|
||||||
|
|
||||||
var matCount = context.Observe(renderer, r => r.sharedMaterials.Length);
|
var matCount = context.Observe(renderer, r => r.sharedMaterials.Length);
|
||||||
|
|
||||||
@ -94,6 +95,7 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
var (original, proxy) = proxyPairs.First();
|
var (original, proxy) = proxyPairs.First();
|
||||||
|
|
||||||
if (original == null || proxy == null) return null;
|
if (original == null || proxy == null) return null;
|
||||||
|
if (original is not MeshRenderer and not SkinnedMeshRenderer || proxy is not MeshRenderer and not SkinnedMeshRenderer) return null;
|
||||||
|
|
||||||
var mats = new Material[proxy.sharedMaterials.Length];
|
var mats = new Material[proxy.sharedMaterials.Length];
|
||||||
|
|
||||||
@ -131,6 +133,7 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
public void OnFrame(Renderer original, Renderer proxy)
|
public void OnFrame(Renderer original, Renderer proxy)
|
||||||
{
|
{
|
||||||
if (original == null || proxy == null) return;
|
if (original == null || proxy == null) return;
|
||||||
|
if (original is not MeshRenderer and not SkinnedMeshRenderer || proxy is not MeshRenderer and not SkinnedMeshRenderer) return;
|
||||||
|
|
||||||
var mats = proxy.sharedMaterials;
|
var mats = proxy.sharedMaterials;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user