private void AddNullComponentDetail(GameObject rootGo, GameObject refGo) { ComponentDetail detail = null; foreach (var v in CheckList) { if (v.checkObject == null) { detail = v as ComponentDetail; } } if (detail == null) { detail = new ComponentDetail(null, this); detail.AddObjectReference(rootGo, refGo); detail.isWarningDetail = true; detail.flag |= ObjectDetailFlag.Warning; } }
public override void AddObjectDetail(Object obj, Object refObj, Object detailRefObj) { Component com = obj as Component; if (com == null) { MonoScript script = obj as MonoScript; if (script == null) { return; } } ComponentDetail detail = null; foreach (var d in CheckList) { if (d == null) { continue; } if (d.checkObject is Component) { if (d.checkObject.GetType() == obj.GetType()) { detail = d as ComponentDetail; } } else if (d.checkObject is MonoScript) { if (d.checkObject == obj) { detail = d as ComponentDetail; } } } if (detail == null) { detail = new ComponentDetail(obj, this); } detail.AddObjectReference(refObj, com); detail.allRefIsEnabled &= IsComponentEnabled(com); detail.checkMap[comEnabledItem] = detail.allRefIsEnabled.ToString(); }
void FindAssets() { objList.Clear(); if (mode == FA_MODE) { if (assetType == MATERIALS) { foreach (Renderer renderer in FindObjects <Renderer>()) { if (ignoreInactive && !renderer.gameObject.activeInHierarchy) { continue; } foreach (Material material in renderer.sharedMaterials) { if (material == null || !material.shader.name.StartsWith(shaderName)) { continue; } if (!objList.Contains(material) && Filter(material)) { objList.Add(material); } } } type = typeof(Material); } else if (assetType == TEXTURES) { foreach (Renderer renderer in FindObjects <Renderer>()) { if (ignoreInactive && !renderer.gameObject.activeInHierarchy) { continue; } foreach (Material material in renderer.sharedMaterials) { if (material != null) { Shader s = material.shader; if (!s.name.StartsWith(shaderName)) { continue; } int propCount = ShaderUtil.GetPropertyCount(s); for (int i = 0; i < propCount; i++) { if (ShaderUtil.GetPropertyType(s, i) == ShaderUtil.ShaderPropertyType.TexEnv) { string propName = ShaderUtil.GetPropertyName(s, i); if ((materialPropertyName.Equals("") || materialPropertyName.Equals(propName)) && material.HasProperty(propName)) { Texture texture = material.GetTexture(propName); if (texture != null && !objList.Contains(texture) && Filter(texture)) { objList.Add(texture); } } } } } } } type = typeof(Texture); } else if (assetType == MESHES) { if (searchMeshFilters) { foreach (MeshFilter mf in FindObjects <MeshFilter>()) { if (ignoreInactive && !mf.gameObject.activeInHierarchy) { continue; } Mesh mesh = mf.sharedMesh; if (mesh != null && !objList.Contains(mesh) && Filter(mesh)) { objList.Add(mesh); } } } if (searchSkinnedMeshRenderers) { foreach (SkinnedMeshRenderer smr in FindObjects <SkinnedMeshRenderer>()) { if (ignoreInactive && !smr.gameObject.activeInHierarchy) { continue; } Mesh mesh = smr.sharedMesh; if (mesh != null && !objList.Contains(mesh) && Filter(mesh)) { objList.Add(mesh); } } } if (searchMeshColliders) { foreach (MeshCollider mc in FindObjects <MeshCollider>()) { if (ignoreInactive && !mc.gameObject.activeInHierarchy) { continue; } Mesh mesh = mc.sharedMesh; if (mesh != null && !objList.Contains(mesh) && Filter(mesh)) { objList.Add(mesh); } } } type = typeof(Mesh); } else if (assetType == AUDIO_CLIPS) { foreach (AudioSource audioSource in FindObjects <AudioSource>()) { if (ignoreInactive && !audioSource.gameObject.activeInHierarchy) { continue; } AudioClip audio = audioSource.clip; if (audio != null && !objList.Contains(audio) && Filter(audio)) { objList.Add(audio); } } type = typeof(AudioClip); } else if (assetType == ANIMATION_CLIPS) { foreach (Animator animator in FindObjects <Animator>()) { if (ignoreInactive && !animator.gameObject.activeInHierarchy) { continue; } if (animator.runtimeAnimatorController == null) { continue; } foreach (AnimationClip anim in animator.runtimeAnimatorController.animationClips) { if (anim != null && !objList.Contains(anim) && Filter(anim)) { objList.Add(anim); } } } // foreach (Animation animation in FindObjects<Animation>()){ // if (ignoreInactive && !animation.gameObject.activeInHierarchy) continue; // foreach (AnimationState animState in animation){//Updates on PlayMode only // AnimationClip anim = animState.clip;//Check null state // if (anim!=null && !objList.Contains(anim) && Filter(anim)) // { // objList.Add(anim); // } // } // } type = typeof(AnimationClip); } } else if (mode == FU_MODE) { if (assetType == MATERIALS) { if (filterMaterial != null) { foreach (Renderer renderer in FindObjects <Renderer>()) { GameObject go = renderer.gameObject; if (ignoreInactive && !go.activeInHierarchy) { continue; } foreach (Material material in renderer.sharedMaterials) { //if (material == null || !material.shader.name.StartsWith(shaderName)) continue; //Ignore shader filter, it's redundant. if (material == filterMaterial && Filter(go)) { objList.Add(go); break; } } } } type = typeof(GameObject); } else if (assetType == TEXTURES) { if (filterTexture != null) { foreach (Renderer renderer in FindObjects <Renderer>()) { GameObject go = renderer.gameObject; if (ignoreInactive && !go.activeInHierarchy) { continue; } foreach (Material material in renderer.sharedMaterials) { if (material != null) { Shader s = material.shader; if (!s.name.StartsWith(shaderName)) { continue; } int propCount = ShaderUtil.GetPropertyCount(s); for (int i = 0; i < propCount; i++) { if (ShaderUtil.GetPropertyType(s, i) == ShaderUtil.ShaderPropertyType.TexEnv) { string propName = ShaderUtil.GetPropertyName(s, i); if ((materialPropertyName.Equals("") || materialPropertyName.Equals(propName)) && material.HasProperty(propName)) { Texture texture = material.GetTexture(propName); if (texture == filterTexture && !objList.Contains(go) && Filter(go)) { objList.Add(go); break; } } } } } } } } type = typeof(GameObject); } else if (assetType == MESHES) { if (filterMesh != null) { if (searchMeshFilters) { foreach (MeshFilter mf in FindObjects <MeshFilter>()) { GameObject go = mf.gameObject; if (ignoreInactive && !go.activeInHierarchy) { continue; } Mesh mesh = mf.sharedMesh; if (mesh == filterMesh && !objList.Contains(go) && Filter(go)) { objList.Add(go); } } } if (searchSkinnedMeshRenderers) { foreach (SkinnedMeshRenderer smr in FindObjects <SkinnedMeshRenderer>()) { GameObject go = smr.gameObject; if (ignoreInactive && !go.activeInHierarchy) { continue; } Mesh mesh = smr.sharedMesh; if (mesh == filterMesh && !objList.Contains(go) && Filter(go)) { objList.Add(go); } } } if (searchMeshColliders) { foreach (MeshCollider mc in FindObjects <MeshCollider>()) { GameObject go = mc.gameObject; if (ignoreInactive && !go.activeInHierarchy) { continue; } Mesh mesh = mc.sharedMesh; if (mesh == filterMesh && !objList.Contains(go) && Filter(go)) { objList.Add(go); } } } } type = typeof(GameObject); } else if (assetType == AUDIO_CLIPS) { foreach (AudioSource audioSource in FindObjects <AudioSource>()) { GameObject go = audioSource.gameObject; if (ignoreInactive && !go.activeInHierarchy) { continue; } AudioClip audio = audioSource.clip; if (audio == filterAudio && !objList.Contains(go) && Filter(go)) { objList.Add(go); } } type = typeof(GameObject); } else if (assetType == ANIMATION_CLIPS) { foreach (Animator animator in FindObjects <Animator>()) { GameObject go = animator.gameObject; if (ignoreInactive && !go.activeInHierarchy) { continue; } if (animator.runtimeAnimatorController == null) { continue; } foreach (AnimationClip anim in animator.runtimeAnimatorController.animationClips) { if (anim == filterAnim && !objList.Contains(go) && Filter(go)) { objList.Add(go); } } } // foreach (Animation animation in FindObjects<Animation>()) // { // GameObject go = animation.gameObject; // if (ignoreInactive && !go.activeInHierarchy) continue; // foreach (AnimationState animState in animation){//Updates in playmode only // AnimationClip anim = animState.clip; // if (anim == filterAnim && !objList.Contains(go) && Filter(go)) // { // objList.Add(go); // } // } // } type = typeof(GameObject); } } if (sortByName) { objList.Sort((obj1, obj2) => obj1.name.CompareTo(obj2.name)); } objDetailList = new List <ObjectDetail>(objList.Count); foreach (Object obj in objList) { ObjectDetail detail; if (obj is GameObject) { detail = ComponentDetail.CreateDetail(obj, this); } else { detail = new AssetDetail(obj); } objDetailList.Add(detail); } listIsDirty = false; //Fix selection info if (firstObjSelected != null && (!objList.Contains(firstObjSelected) || !ArrayUtility.Contains <Object>(Selection.objects, firstObjSelected))) { firstObjSelected = null; lastObjSelected = null; } if (lastObjSelected != null && (!objList.Contains(lastObjSelected) || !ArrayUtility.Contains <Object>(Selection.objects, lastObjSelected))) { lastObjSelected = firstObjSelected; } if (firstObjSelected == null || lastObjSelected == null) { firstObjSelected = objList.Find(obj => ArrayUtility.Contains <Object>(Selection.objects, obj)); lastObjSelected = objList.FindLast(obj => ArrayUtility.Contains <Object>(Selection.objects, obj)); } }