private void DoChangeSMR(ref SkinnedMeshRenderer dst_smr, ref SkinnedMeshRenderer src_smr) { dst_smr.set_sharedMesh(src_smr.get_sharedMesh()); List <Transform> list = new List <Transform>(); for (int i = 0; i < src_smr.get_bones().Length; i++) { Transform transform = XUtility.RecursiveFindTransform(base.get_transform(), src_smr.get_bones()[i].get_name()); list.Add(transform); } dst_smr.set_bones(list.ToArray()); dst_smr.set_shadowCastingMode(0); dst_smr.set_receiveShadows(false); dst_smr.set_useLightProbes(false); }
private void AssignedWeightsAndSetBoundsLoop(Transform t, Bounds bounds, Transform rootBone = null) { SkinnedMeshRenderer component1 = (SkinnedMeshRenderer)((Component)t).GetComponent <SkinnedMeshRenderer>(); if (Object.op_Implicit((Object)component1)) { int length = component1.get_bones().Length; Transform[] transformArray = new Transform[length]; GameObject gameObject = (GameObject)null; for (int index = 0; index < length; ++index) { if (this.dictBone.TryGetValue(((Object)component1.get_bones()[index]).get_name(), out gameObject)) { transformArray[index] = gameObject.get_transform(); } } component1.set_bones(transformArray); component1.set_localBounds(bounds); Cloth component2 = (Cloth)((Component)component1).get_gameObject().GetComponent <Cloth>(); if (Object.op_Implicit((Object)rootBone) && Object.op_Equality((Object)null, (Object)component2)) { component1.set_rootBone(rootBone); } else if (Object.op_Implicit((Object)component1.get_rootBone()) && this.dictBone.TryGetValue(((Object)component1.get_rootBone()).get_name(), out gameObject)) { component1.set_rootBone(gameObject.get_transform()); } } IEnumerator enumerator = ((Component)t).get_gameObject().get_transform().GetEnumerator(); try { while (enumerator.MoveNext()) { this.AssignedWeightsAndSetBoundsLoop((Transform)enumerator.Current, bounds, rootBone); } } finally { if (enumerator is IDisposable disposable) { disposable.Dispose(); } } }
private void DoEquipClothes(int equipId, EquipBody dataEB, Action <bool> finished) { EquipCustomizationTool.GetInstantiateClothes(dataEB, delegate(SkinnedMeshRenderer renderer) { if (this.ActorTarget == null) { finished.Invoke(false); return; } if (equipId != this.mClothesId) { finished.Invoke(false); return; } Transform transform = XUtility.RecursiveFindTransform(this.ActorTarget.get_transform(), dataEB.slot); if (transform == null) { Debug.LogError("slot is no find, GameData.EquipBody id = " + dataEB.id); finished.Invoke(false); return; } SkinnedMeshRenderer component = transform.GetComponent <SkinnedMeshRenderer>(); if (renderer != null) { component.set_sharedMesh(renderer.get_sharedMesh()); List <Transform> list = new List <Transform>(); for (int i = 0; i < renderer.get_bones().Length; i++) { Transform transform2 = XUtility.RecursiveFindTransform(this.ActorTarget.get_transform(), renderer.get_bones()[i].get_name()); list.Add(transform2); } component.set_bones(list.ToArray()); component.set_shadowCastingMode(0); component.set_receiveShadows(false); component.set_useLightProbes(false); component.set_material(renderer.get_sharedMaterial()); } if (finished != null) { finished.Invoke(true); } }); }
private static int set_bones(IntPtr L) { object obj = null; int result; try { obj = ToLua.ToObject(L, 1); SkinnedMeshRenderer skinnedMeshRenderer = (SkinnedMeshRenderer)obj; Transform[] bones = ToLua.CheckObjectArray <Transform>(L, 2); skinnedMeshRenderer.set_bones(bones); result = 0; } catch (Exception ex) { result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.get_Message() : "attempt to index bones on a nil value"); } return(result); }
public void Process(GameObject obj, float Seed) { List <SkinnedMeshRenderer> list = (List <SkinnedMeshRenderer>)Pool.GetList <SkinnedMeshRenderer>(); obj.GetComponentsInChildren <SkinnedMeshRenderer>(true, (List <M0>)list); using (List <SkinnedMeshRenderer> .Enumerator enumerator = list.GetEnumerator()) { while (enumerator.MoveNext()) { SkinnedMeshRenderer current = enumerator.Current; if (!Object.op_Equality((Object)current.get_sharedMesh(), (Object)null) && !Object.op_Equality((Object)((Renderer)current).get_sharedMaterial(), (Object)null)) { string name1 = ((Object)current.get_sharedMesh()).get_name(); string name2 = ((Object)((Renderer)current).get_sharedMaterial()).get_name(); for (int index = 0; index < this.MeshReplacements.Length; ++index) { if (this.MeshReplacements[index].Test(name1)) { SkinnedMeshRenderer skinnedMeshRenderer = this.MeshReplacements[index].Get(Seed); current.set_sharedMesh(skinnedMeshRenderer.get_sharedMesh()); current.set_rootBone(skinnedMeshRenderer.get_rootBone()); current.set_bones(skinnedMeshRenderer.get_bones()); } } for (int index = 0; index < this.MaterialReplacements.Length; ++index) { if (this.MaterialReplacements[index].Test(name2)) { ((Renderer)current).set_sharedMaterial(this.MaterialReplacements[index].Get(Seed)); } } } } } // ISSUE: cast to a reference type Pool.FreeList <SkinnedMeshRenderer>((List <M0>&) ref list); }
public void Process( PlayerModelHair playerModelHair, HairDyeCollection dyeCollection, HairDye dye, MaterialPropertyBlock block) { List <SkinnedMeshRenderer> list = (List <SkinnedMeshRenderer>)Pool.GetList <SkinnedMeshRenderer>(); ((Component)playerModelHair).get_gameObject().GetComponentsInChildren <SkinnedMeshRenderer>(true, (List <M0>)list); using (List <SkinnedMeshRenderer> .Enumerator enumerator = list.GetEnumerator()) { while (enumerator.MoveNext()) { SkinnedMeshRenderer current = enumerator.Current; if (!Object.op_Equality((Object)current.get_sharedMesh(), (Object)null) && !Object.op_Equality((Object)((Renderer)current).get_sharedMaterial(), (Object)null)) { string name = ((Object)current.get_sharedMesh()).get_name(); ((Object)((Renderer)current).get_sharedMaterial()).get_name(); if (!((Component)current).get_gameObject().get_activeSelf()) { ((Component)current).get_gameObject().SetActive(true); } for (int index = 0; index < this.MeshReplacements.Length; ++index) { if (this.MeshReplacements[index].Test(name)) { SkinnedMeshRenderer replace = this.MeshReplacements[index].Replace; if (Object.op_Equality((Object)replace, (Object)null)) { ((Component)current).get_gameObject().SetActive(false); } else { current.set_sharedMesh(replace.get_sharedMesh()); current.set_rootBone(replace.get_rootBone()); current.set_bones(this.MeshReplacements[index].GetBones()); } } } PlayerModelHair.RendererMaterials rendererMaterials; if (playerModelHair.Materials.TryGetValue((Renderer)current, out rendererMaterials)) { Array.Copy((Array)rendererMaterials.original, (Array)rendererMaterials.replacement, rendererMaterials.original.Length); for (int index1 = 0; index1 < rendererMaterials.original.Length; ++index1) { for (int index2 = 0; index2 < this.MaterialReplacements.Length; ++index2) { if (this.MaterialReplacements[index2].Test(rendererMaterials.names[index1])) { rendererMaterials.replacement[index1] = this.MaterialReplacements[index2].Replace; } } } ((Renderer)current).set_sharedMaterials(rendererMaterials.replacement); } else { Debug.LogWarning((object)("[HairSet.Process] Missing cached renderer materials in " + ((Object)playerModelHair).get_name())); } if (dye != null && ((Component)current).get_gameObject().get_activeSelf()) { dye.Apply(dyeCollection, block); } } } } // ISSUE: cast to a reference type Pool.FreeList <SkinnedMeshRenderer>((List <M0>&) ref list); }