示例#1
0
        private IEnumerator Execute()
        {
            //EditorGUI.BeginChangeCheck();
            serializedObject.Update();

            // name
            SerializedProperty nameProp = serializedObject.FindProperty("m_ParsedForm.m_Name");

            this.name = nameProp.stringValue;
            //fallback
            SerializedProperty fallbackProp = serializedObject.FindProperty("m_ParsedForm.m_FallbackName");

            this.fallback = fallbackProp.stringValue;

            // props
            SerializedProperty propsproperty = serializedObject.FindProperty("m_ParsedForm.m_PropInfo.m_Props");

            propInfos = new List <PropInfo>(propsproperty.arraySize);
            for (int i = 0; i < propsproperty.arraySize; ++i)
            {
                var prop     = propsproperty.GetArrayElementAtIndex(i);
                var propInfo = new PropInfo(prop);
                propInfos.Add(propInfo);
            }
            yield return(null);

            // subShaders
            SerializedProperty subShadersProp = serializedObject.FindProperty("m_ParsedForm.m_SubShaders");
            int subShaderNum = subShadersProp.arraySize;

            subShaderInfos = new List <SubShaderInfo>(subShaderNum);
            yieldChk.SetSubshaderCount(subShaderNum);

            for (int i = 0; i < subShadersProp.arraySize; ++i)
            {
                var currentSubShaderProp = subShadersProp.GetArrayElementAtIndex(i);
                var info = new SubShaderInfo(currentSubShaderProp, yieldChk);
                while (info.MoveNext())
                {
                    yield return(null);
                }
                this.subShaderInfos.Add(info);
                // yield chk
                yieldChk.CompleteSubShaderIdx(i);
                if (yieldChk.ShouldYield())
                {
                    yield return(null);
                }
            }
            this.IsComplete = true;
        }
示例#2
0
        public ShaderDumpInfo(Shader shader)
        {
            var obj = new SerializedObject(shader);

            //EditorGUI.BeginChangeCheck();
            obj.Update();

            // name
            SerializedProperty nameProp = obj.FindProperty("m_ParsedForm.m_Name");

            this.name = nameProp.stringValue;
            //fallback
            SerializedProperty fallbackProp = obj.FindProperty("m_ParsedForm.m_FallbackName");

            this.fallback = fallbackProp.stringValue;

            // props
            SerializedProperty propsproperty = obj.FindProperty("m_ParsedForm.m_PropInfo.m_Props");

            propInfos = new List <PropInfo>(propsproperty.arraySize);
            for (int i = 0; i < propsproperty.arraySize; ++i)
            {
                var prop     = propsproperty.GetArrayElementAtIndex(i);
                var propInfo = new PropInfo(prop);
                propInfos.Add(propInfo);
            }

            // subShaders
            SerializedProperty subShadersProp = obj.FindProperty("m_ParsedForm.m_SubShaders");

            subShaderInfos = new List <SubShaderInfo>(subShadersProp.arraySize);
            for (int i = 0; i < subShadersProp.arraySize; ++i)
            {
                var currentSubShaderProp = subShadersProp.GetArrayElementAtIndex(i);
                var info = new SubShaderInfo(currentSubShaderProp);
                this.subShaderInfos.Add(info);
            }
        }