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


C# UnityEditor.MaterialEditor类代码示例

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


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

示例1: ShaderPropertiesGUI

        bool ShaderPropertiesGUI(MaterialEditor materialEditor)
        {
            EditorGUI.BeginChangeCheck();

            materialEditor.ShaderProperty(_colorMode, "Color Mode");

            if (_colorMode.floatValue > 0)
            {
                var rect = EditorGUILayout.GetControlRect();
                rect.x += EditorGUIUtility.labelWidth;
                rect.width = (rect.width - EditorGUIUtility.labelWidth) / 2 - 2;
                materialEditor.ShaderProperty(rect, _color, "");
                rect.x += rect.width + 4;
                materialEditor.ShaderProperty(rect, _color2, "");
            }
            else
            {
                materialEditor.ShaderProperty(_color, " ");
            }

            EditorGUILayout.Space();

            materialEditor.ShaderProperty(_metallic, "Metallic");
            materialEditor.ShaderProperty(_smoothness, "Smoothness");

            EditorGUILayout.Space();

            materialEditor.TexturePropertySingleLine(_albedoText, _albedoMap, null);
            materialEditor.TexturePropertySingleLine(_normalMapText, _normalMap, _normalMap.textureValue ? _normalScale : null);
            materialEditor.TexturePropertySingleLine(_occlusionText, _occlusionMap, _occlusionMap.textureValue ? _occlusionStr : null);
            materialEditor.TextureScaleOffsetProperty(_albedoMap);

            return EditorGUI.EndChangeCheck();
        }
开发者ID:Zero-Ax,项目名称:Mouse-position-Drag,代码行数:34,代码来源:SpraySurfaceMaterialEditor.cs

示例2: 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

示例3: ShaderPropertiesGUI

        bool ShaderPropertiesGUI(MaterialEditor materialEditor)
        {
            EditorGUI.BeginChangeCheck();

            // albedo
            materialEditor.TexturePropertySingleLine(_albedoText, _mainTex, _color);

            // metallic / smoothness
            if (_metallicGlossMap.textureValue == null)
                materialEditor.TexturePropertyTwoLines(_metallicText, _metallicGlossMap, _metallic, _smoothnessText, _glossiness);
            else
                materialEditor.TexturePropertySingleLine(_metallicText, _metallicGlossMap);

            // normal map
            materialEditor.TexturePropertySingleLine(_normalMapText, _bumpMap, _bumpMap.textureValue != null ? _bumpScale : null);

            // occlusion
            materialEditor.TexturePropertySingleLine(_occlusionText, _occlusionMap, _occlusionMap.textureValue != null ? _occlusionStrength : null);

            // emission
            bool hadEmissionTexture = _emissionMap.textureValue != null;
            materialEditor.TexturePropertyWithHDRColor(_emissionText, _emissionMap, _emissionColor, _colorPickerHDRConfig, false);

            // if texture was assigned and color was black set color to white
            if (_emissionMap.textureValue != null && !hadEmissionTexture)
                if (_emissionColor.colorValue.maxColorComponent <= 0)
                    _emissionColor.colorValue = Color.white;

            return EditorGUI.EndChangeCheck();
        }
开发者ID:dgkae,项目名称:SpektrSubatomic,代码行数:30,代码来源:SubatomicStandardMaterialEditor.cs

示例4: 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

示例5: 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

示例6: 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

示例7: ShaderPropertiesGUI

        bool ShaderPropertiesGUI(MaterialEditor materialEditor)
        {
            EditorGUI.BeginChangeCheck();

            materialEditor.ShaderProperty(_blendMode, "Blend Mode");
            materialEditor.ShaderProperty(_colorMode, "Color Mode");

            if (_colorMode.floatValue > 0)
            {
                var rect = EditorGUILayout.GetControlRect();
                rect.x += EditorGUIUtility.labelWidth;
                rect.width = (rect.width - EditorGUIUtility.labelWidth) / 2 - 2;
                materialEditor.ShaderProperty(rect, _color, "");
                rect.x += rect.width + 4;
                materialEditor.ShaderProperty(rect, _color2, "");
            }
            else
            {
                materialEditor.ShaderProperty(_color, " ");
            }

            materialEditor.ShaderProperty(_mainTex, "Texture");

            return EditorGUI.EndChangeCheck();
        }
开发者ID:Zero-Ax,项目名称:Mouse-position-Drag,代码行数:25,代码来源:SprayUnlitMaterialEditor.cs

示例8: OnGUI

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

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

示例9: 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

示例10: 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

示例11: GetPropertyHeight

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

示例12: 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

示例13: ShaderPropertiesGUI

 bool ShaderPropertiesGUI(MaterialEditor materialEditor)
 {
     EditorGUI.BeginChangeCheck();
     materialEditor.TexturePropertySingleLine(_textCubemap, _cubemap, _tint);
     Vector3Property(materialEditor, _euler, "Rotation");
     materialEditor.ShaderProperty(_exposure, "Exposure");
     materialEditor.ShaderProperty(_saturation, "Saturation");
     return EditorGUI.EndChangeCheck();
 }
开发者ID:esther5576,项目名称:SW-game-project,代码行数:9,代码来源:CubemapMaterialEditor.cs

示例14: GetPropertyHeight

		override public float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor) {
			bool inactiveFlag=false;
			if (!checkSpecUsage(editor.target as Material, label)) return -2;
			if (!checkEmissiveUsage(editor.target as Material, label)) return -2;
			if (checkVisible(editor, ref inactiveFlag)) {
				return MaterialEditor.GetDefaultPropertyHeight(prop);
			}
			return -2;
		}
开发者ID:andrewstarnes,项目名称:wwtd2,代码行数:9,代码来源:PropBlockDrawer.cs

示例15: OnGUI

        public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props)
        {
            m_MaterialEditor = materialEditor;

            Material material = materialEditor.target as Material;

            FindProperties (material, props);
            ShaderPropertiesGUI (material);
        }
开发者ID:Evellex,项目名称:Eldrinth,代码行数:9,代码来源:EMMaterialInspector.cs


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