當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。