当前位置: 首页>>代码示例>>C#>>正文


C# UnityEditor.MaterialProperty类代码示例

本文整理汇总了C#中UnityEditor.MaterialProperty的典型用法代码示例。如果您正苦于以下问题:C# MaterialProperty类的具体用法?C# MaterialProperty怎么用?C# MaterialProperty使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MaterialProperty类属于UnityEditor命名空间,在下文中一共展示了MaterialProperty类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnGUI

		public void OnGUI(ref Rect position, MaterialProperty prop, string label, MaterialEditor editor)
		{
			float num = position.height;
			position.height = 0f;
			if (this.m_DecoratorDrawers != null)
			{
				foreach (MaterialPropertyDrawer current in this.m_DecoratorDrawers)
				{
					position.height = current.GetPropertyHeight(prop, label, editor);
					float labelWidth = EditorGUIUtility.labelWidth;
					float fieldWidth = EditorGUIUtility.fieldWidth;
					current.OnGUI(position, prop, label, editor);
					EditorGUIUtility.labelWidth = labelWidth;
					EditorGUIUtility.fieldWidth = fieldWidth;
					position.y += position.height;
					num -= position.height;
				}
			}
			position.height = num;
			if (this.m_PropertyDrawer != null)
			{
				float labelWidth = EditorGUIUtility.labelWidth;
				float fieldWidth = EditorGUIUtility.fieldWidth;
				this.m_PropertyDrawer.OnGUI(position, prop, label, editor);
				EditorGUIUtility.labelWidth = labelWidth;
				EditorGUIUtility.fieldWidth = fieldWidth;
			}
		}
开发者ID:guozanhua,项目名称:UnityDecompiled,代码行数:28,代码来源:MaterialPropertyHandler.cs

示例2: Apply

 public override void Apply(MaterialProperty prop)
 {
   base.Apply(prop);
   if (!MaterialToggleDrawer.IsPropertyTypeSuitable(prop) || prop.hasMixedValue)
     return;
   this.SetKeyword(prop, (double) Math.Abs(prop.floatValue) > 1.0 / 1000.0);
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:7,代码来源:MaterialToggleDrawer.cs

示例3: OnGUI

		override public void OnGUI(Rect position, MaterialProperty prop, string label, MaterialEditor editor) {
			if (!checkVisible (editor)) return;

			Color col = GUI.contentColor;
			Color bcol = GUI.backgroundColor;
			GUI.contentColor = new Color(1f, 1f, 0.8f, 1f);
			GUI.backgroundColor = backgroundColor;
			//position.y -= 15;
			Rect pos=new Rect(position);
			pos.y += 3;
			pos.height -= 3;
			//if (visibilityProp1==null || visibilityProp1=="indent") {
	//			pos.height -= 10;
	//			pos.y += 10;
			//}

			if (visibilityProp1!=null) {
				pos.x+=12;
				pos.width-=12;
			}
	//		pos.height = 17;
			EditorGUI.HelpBox(pos, (foldoutFlag ? "     ":"")+label, MessageType.None);

			if (foldoutFlag) {
				Rect fpos = new Rect(pos);
				fpos.x += 15;
				fpos.y += 1;
				bool state = EditorGUI.Foldout(fpos, prop.floatValue==1, "", true);
				prop.floatValue = state ? 1 : 0;
			}

			GUI.contentColor = col;
			GUI.backgroundColor = bcol;
		}
开发者ID:andrewstarnes,项目名称:wwtd2,代码行数:34,代码来源:BlockInfoDrawer.cs

示例4: FindProperties

 public void FindProperties(MaterialProperty[] props)
 {
     blendMode = FindProperty("_Mode", props);
     albedoMap = FindProperty("_MainTex", props);
     albedoColor = FindProperty("_Color", props);
     alphaCutoff = FindProperty("_Cutoff", props);
     specularMap = FindProperty("_SpecGlossMap", props, false);
     specularColor = FindProperty("_SpecColor", props, false);
     metallicMap = FindProperty("_MetallicGlossMap", props, false);
     metallic = FindProperty("_Metallic", props, false);
     if (specularMap != null && specularColor != null)
         m_WorkflowMode = WorkflowMode.Specular;
     else if (metallicMap != null && metallic != null)
         m_WorkflowMode = WorkflowMode.Metallic;
     else
         m_WorkflowMode = WorkflowMode.Dielectric;
     smoothness = FindProperty("_Glossiness", props);
     bumpScale = FindProperty("_BumpScale", props);
     bumpMap = FindProperty("_BumpMap", props);
     heigtMapScale = FindProperty("_Parallax", props);
     heightMap = FindProperty("_ParallaxMap", props);
     occlusionStrength = FindProperty("_OcclusionStrength", props);
     occlusionMap = FindProperty("_OcclusionMap", props);
     emissionScaleUI = FindProperty("_EmissionScaleUI", props);
     emissionColorUI = FindProperty("_EmissionColorUI", props);
     emissionColorForRendering = FindProperty("_EmissionColor", props);
     emissionMap = FindProperty("_EmissionMap", props);
     detailMask = FindProperty("_DetailMask", props);
     detailAlbedoMap = FindProperty("_DetailAlbedoMap", props);
     detailNormalMapScale = FindProperty("_DetailNormalMapScale", props);
     detailNormalMap = FindProperty("_DetailNormalMap", props);
     uvSetSecondary = FindProperty("_UVSec", props);
     vertexColor = FindProperty("_IntensityVC", props);
 }
开发者ID:Cabostein,项目名称:V0xel_Sp4ce,代码行数:34,代码来源:StandardShaderVCGUI.cs

示例5: FindProperties

        public static int FindProperties(ShaderGUIBase _inst, MaterialProperty[] _properties)
        {
            int _cnt = 0;
            var _flags = System.Reflection.BindingFlags.Instance
                | System.Reflection.BindingFlags.NonPublic
                | System.Reflection.BindingFlags.Public;

            _inst.m_Keywords.Clear ();

            foreach (var _field in _inst.GetType ().GetFields (_flags))
            {
                foreach (var _attr in _field.GetCustomAttributes (true))
                {
                    var _propAttr = _attr as MaterialPropertyAttribute;
                    if (null != _propAttr && _field.FieldType == typeof(MaterialProperty))
                    {
                        var _prop = FindProperty (_propAttr.Name, _properties);
                        if (null == _prop)
                        {
                            Log.E ("Material Property {0} not found!", _propAttr.Name);
                            continue;
                        }

                        var _keyword = _propAttr.Keyword;
                        if (null != _keyword)
                            _inst.m_Keywords.Add (_prop.name, _keyword);

                        _field.SetValue (_inst, _prop);

                        ++_cnt;
                    }
                }
            }
            return _cnt;
        }
开发者ID:ming4883,项目名称:mud,代码行数:35,代码来源:ShaderGUIBase.cs

示例6: ApplyMaterialModificationToAnimationRecording

        public static bool ApplyMaterialModificationToAnimationRecording(MaterialProperty materialProp, int changedMask, Renderer target, object oldValue)
        {
            switch (materialProp.type)
            {
                case MaterialProperty.PropType.Color:
                    SetupMaterialPropertyBlock(materialProp, changedMask, target);
                    ApplyMaterialModificationToAnimationRecording(materialProp, target, (Color) oldValue);
                    return true;

                case MaterialProperty.PropType.Vector:
                    SetupMaterialPropertyBlock(materialProp, changedMask, target);
                    ApplyMaterialModificationToAnimationRecording(materialProp, target, (Color) ((Vector4) oldValue));
                    return true;

                case MaterialProperty.PropType.Float:
                case MaterialProperty.PropType.Range:
                    SetupMaterialPropertyBlock(materialProp, changedMask, target);
                    ApplyMaterialModificationToAnimationRecording(materialProp, target, (float) oldValue);
                    return true;

                case MaterialProperty.PropType.Texture:
                {
                    if (!MaterialProperty.IsTextureOffsetAndScaleChangedMask(changedMask))
                    {
                        return false;
                    }
                    string name = materialProp.name + "_ST";
                    SetupMaterialPropertyBlock(materialProp, changedMask, target);
                    ApplyMaterialModificationToAnimationRecording(name, target, (Vector4) oldValue);
                    return true;
                }
            }
            return false;
        }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:34,代码来源:MaterialAnimationUtility.cs

示例7: OnGUI

 public void OnGUI(ref Rect position, MaterialProperty prop, string label, MaterialEditor editor)
 {
   float height = position.height;
   position.height = 0.0f;
   if (this.m_DecoratorDrawers != null)
   {
     using (List<MaterialPropertyDrawer>.Enumerator enumerator = this.m_DecoratorDrawers.GetEnumerator())
     {
       while (enumerator.MoveNext())
       {
         MaterialPropertyDrawer current = enumerator.Current;
         position.height = current.GetPropertyHeight(prop, label, editor);
         float labelWidth = EditorGUIUtility.labelWidth;
         float fieldWidth = EditorGUIUtility.fieldWidth;
         current.OnGUI(position, prop, label, editor);
         EditorGUIUtility.labelWidth = labelWidth;
         EditorGUIUtility.fieldWidth = fieldWidth;
         position.y += position.height;
         height -= position.height;
       }
     }
   }
   position.height = height;
   if (this.m_PropertyDrawer == null)
     return;
   float labelWidth1 = EditorGUIUtility.labelWidth;
   float fieldWidth1 = EditorGUIUtility.fieldWidth;
   this.m_PropertyDrawer.OnGUI(position, prop, label, editor);
   EditorGUIUtility.labelWidth = labelWidth1;
   EditorGUIUtility.fieldWidth = fieldWidth1;
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:31,代码来源:MaterialPropertyHandler.cs

示例8: FindProperties

 public void FindProperties(MaterialProperty[] props)
 {
   this.blendMode = ShaderGUI.FindProperty("_Mode", props);
   this.albedoMap = ShaderGUI.FindProperty("_MainTex", props);
   this.albedoColor = ShaderGUI.FindProperty("_Color", props);
   this.alphaCutoff = ShaderGUI.FindProperty("_Cutoff", props);
   this.specularMap = ShaderGUI.FindProperty("_SpecGlossMap", props, false);
   this.specularColor = ShaderGUI.FindProperty("_SpecColor", props, false);
   this.metallicMap = ShaderGUI.FindProperty("_MetallicGlossMap", props, false);
   this.metallic = ShaderGUI.FindProperty("_Metallic", props, false);
   this.m_WorkflowMode = this.specularMap == null || this.specularColor == null ? (this.metallicMap == null || this.metallic == null ? StandardShaderGUI.WorkflowMode.Dielectric : StandardShaderGUI.WorkflowMode.Metallic) : StandardShaderGUI.WorkflowMode.Specular;
   this.smoothness = ShaderGUI.FindProperty("_Glossiness", props);
   this.bumpScale = ShaderGUI.FindProperty("_BumpScale", props);
   this.bumpMap = ShaderGUI.FindProperty("_BumpMap", props);
   this.heigtMapScale = ShaderGUI.FindProperty("_Parallax", props);
   this.heightMap = ShaderGUI.FindProperty("_ParallaxMap", props);
   this.occlusionStrength = ShaderGUI.FindProperty("_OcclusionStrength", props);
   this.occlusionMap = ShaderGUI.FindProperty("_OcclusionMap", props);
   this.emissionColorForRendering = ShaderGUI.FindProperty("_EmissionColor", props);
   this.emissionMap = ShaderGUI.FindProperty("_EmissionMap", props);
   this.detailMask = ShaderGUI.FindProperty("_DetailMask", props);
   this.detailAlbedoMap = ShaderGUI.FindProperty("_DetailAlbedoMap", props);
   this.detailNormalMapScale = ShaderGUI.FindProperty("_DetailNormalMapScale", props);
   this.detailNormalMap = ShaderGUI.FindProperty("_DetailNormalMap", props);
   this.uvSetSecondary = ShaderGUI.FindProperty("_UVSec", props);
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:26,代码来源:StandardShaderGUI.cs

示例9: FindProperties

	public void FindProperties (MaterialProperty[] props)
	{
		cullMode = FindProperty ("_CullMode", props, false);
		albedoMap = FindProperty ("_MainTex", props);
		albedoColor = FindProperty ("_Color", props);
		specularMap = FindProperty ("_SpecGlossMap", props, false);
		specularColor = FindProperty ("_SpecColor", props, false);
		metallicMap = FindProperty ("_MetallicGlossMap", props, false);
		metallic = FindProperty ("_Metallic", props, false);
		if (specularMap != null && specularColor != null)
			m_WorkflowMode = WorkflowMode.Specular;
		else if (metallicMap != null && metallic != null)
			m_WorkflowMode = WorkflowMode.Metallic;
		else
			m_WorkflowMode = WorkflowMode.Dielectric;
		smoothness = FindProperty ("_Glossiness", props);
		smoothnessTweak1 = FindProperty ("_SmoothnessTweak1", props, false);
		smoothnessTweak2 = FindProperty ("_SmoothnessTweak2", props, false);
		smoothnessTweaks = FindProperty ("_SmoothnessTweaks", props, false);
		specularMapColorTweak = FindProperty ("_SpecularMapColorTweak", props, false);

		bumpScale = FindProperty ("_BumpScale", props);
		bumpMap = FindProperty ("_BumpMap", props);
		orthoNormalize = FindProperty ("_Orthonormalize", props, false);
		occlusionStrength = FindProperty ("_OcclusionStrength", props);
		occlusionMap = FindProperty ("_OcclusionMap", props);
		detailMask = FindProperty ("_DetailMask", props);
		detailAlbedoMap = FindProperty ("_DetailAlbedoMap", props);
		detailNormalMapScale = FindProperty ("_DetailNormalMapScale", props);
		detailNormalMap = FindProperty ("_DetailNormalMap", props);
		uvSetSecondary = FindProperty ("_UVSec", props);
		smoothnessInAlbedo = FindProperty ("_SmoothnessInAlbedo", props, false);
	}
开发者ID:jamahalwin,项目名称:silhouette-z,代码行数:33,代码来源:HairShaderGUI.cs

示例10: OnGUI

 public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props)
 {
   base.OnGUI(materialEditor, props);
   materialEditor.LightmapEmissionProperty(0);
   foreach (Material target in materialEditor.targets)
     target.globalIlluminationFlags &= ~MaterialGlobalIlluminationFlags.EmissiveIsBlack;
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:7,代码来源:LegacyIlluminShaderGUI.cs

示例11: SetupMaterialPropertyBlock

 public static void SetupMaterialPropertyBlock(MaterialProperty materialProp, int changedMask, Renderer target)
 {
   MaterialPropertyBlock materialPropertyBlock = new MaterialPropertyBlock();
   target.GetPropertyBlock(materialPropertyBlock);
   materialProp.WriteToMaterialPropertyBlock(materialPropertyBlock, changedMask);
   target.SetPropertyBlock(materialPropertyBlock);
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:7,代码来源:MaterialAnimationUtility.cs

示例12: OnGUI

 public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties)
 {
     FindProperties(properties);
     if (ShaderPropertiesGUI(materialEditor) || _initial)
         foreach (Material m in materialEditor.targets)
             UpdateMaterial(m);
     _initial = false;
 }
开发者ID:dgkae,项目名称:Teatro,代码行数:8,代码来源:GradientsMaterialEditor.cs

示例13: GetPropertyHeight

		public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
		{
			if (prop.type != MaterialProperty.PropType.Range)
			{
				return 40f;
			}
			return base.GetPropertyHeight(prop, label, editor);
		}
开发者ID:guozanhua,项目名称:UnityDecompiled,代码行数:8,代码来源:MaterialPowerSliderDrawer.cs

示例14: Vector3Property

 void Vector3Property(MaterialEditor materialEditor, MaterialProperty prop, string label)
 {
     EditorGUI.BeginChangeCheck();
     EditorGUI.showMixedValue = prop.hasMixedValue;
     var newValue = EditorGUILayout.Vector3Field(label, prop.vectorValue);
     EditorGUI.showMixedValue = false;
     if (EditorGUI.EndChangeCheck()) prop.vectorValue = newValue;
 }
开发者ID:esther5576,项目名称:SW-game-project,代码行数:8,代码来源:CubemapMaterialEditor.cs

示例15: OnGUI

        public override void OnGUI(MaterialEditor _materialEditor, MaterialProperty[] _properties)
        {
            FindProperties(this, _properties);

            DoGeneral(_materialEditor);
            DoNormalMap(_materialEditor);
            DoRim(_materialEditor);
        }
开发者ID:ming4883,项目名称:mud,代码行数:8,代码来源:NPRHairUI.cs


注:本文中的UnityEditor.MaterialProperty类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。