public Material(string technique, MaterialMode mode1, Texture[] texture) { guid = 0; // Defined by the model pointer this.id = ++UNIQUE_ID; this.mode = mode1; this.technique = technique; this.textures = texture; this.delta = 0; this.color = new Color4(1, 1, 1, 1); }
public static SharpDX.Direct3D11.BlendState GetRenderState(MaterialMode mode) { if (mode == MaterialMode.Solid) { return(DeviceStates.blendStateSolid); } else if (mode == MaterialMode.Additif) { return(DeviceStates.blendStateAdd); } else if (mode == MaterialMode.Transparent) { return(DeviceStates.blendStateTrans); } return(DeviceStates.blendStateSolid); }
public Material(RawMaterial mat) { guid = 0; // Defined by the model pointer if (mat.id == 0) { mat.id = ++UNIQUE_ID; } this.id = mat.id; this.mode = mat.mode; this.technique = mat.technique; this.textures = new Texture[mat.textures.Length]; for (int i = 0; i < mat.textures.Length; i++) { this.textures[i] = Resources.GetTexture(mat.textures[i]); } this.delta = mat.delta; this.color = new Color4(mat.color); }
public static void DrawItemProperty(TSSItem item, string propertyName, string displayPropertyName = null, GUILayoutOption displayPropertyOption = null, bool shortCheckBox = false, bool alternative = false) { GUI.color = Color.white; GUI.backgroundColor = Color.white; if (!ItemPropertyIsValid(propertyName)) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.HelpBox(string.Format(invalidPropertyName.text, propertyName), MessageType.Warning); EditorGUILayout.EndHorizontal(); return; } if (string.IsNullOrEmpty(displayPropertyName)) { displayPropertyName = propertyName; } if (displayPropertyOption == null) { displayPropertyOption = TSSEditorUtils.max100pxWidth; } Type propertyType = GetItemPropertyType(propertyName); EditorGUI.BeginChangeCheck(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(TSSText.GetHumanReadableString(displayPropertyName), displayPropertyOption); if (propertyType == typeof(float)) { float displayedValue = GetItemValue <float>(item, propertyName); bool itemValuesIdentical = ValuesIsIdentical(GetSelectedItemsValues <float>(propertyName)); if (!itemValuesIdentical) { EditorGUI.showMixedValue = true; } float enteredValue = Mathf.Clamp(EditorGUILayout.FloatField(displayedValue), 0, float.MaxValue); if (EditorGUI.EndChangeCheck()) { SelectedItemsSetValue(propertyName, enteredValue); } } else if (propertyType == typeof(bool)) { bool displayedValue = GetItemValue <bool>(item, propertyName); bool itemValuesIdentical = ValuesIsIdentical(GetSelectedItemsValues <bool>(propertyName)); if (!itemValuesIdentical) { EditorGUI.showMixedValue = true; } bool enteredValue = EditorGUILayout.Toggle(displayedValue, shortCheckBox ? TSSEditorUtils.max18pxWidth : TSSEditorUtils.max120pxWidth); if (EditorGUI.EndChangeCheck()) { SelectedItemsSetValue(propertyName, enteredValue); } } else if (propertyType == typeof(string)) { string displayedValue = GetItemValue <string>(item, propertyName); bool itemValuesIdentical = ValuesIsIdentical(GetSelectedItemsValues <string>(propertyName)); if (!itemValuesIdentical) { EditorGUI.showMixedValue = true; } string enteredValue = EditorGUILayout.TextField(displayedValue); if (EditorGUI.EndChangeCheck()) { SelectedItemsSetValue(propertyName, enteredValue); } } else if (propertyType == typeof(int)) { int displayedValue = GetItemValue <int>(item, propertyName); bool itemValuesIdentical = ValuesIsIdentical(GetSelectedItemsValues <int>(propertyName)); if (!itemValuesIdentical) { EditorGUI.showMixedValue = true; } int enteredValue = EditorGUILayout.IntField(displayedValue); if (EditorGUI.EndChangeCheck()) { SelectedItemsSetValue(propertyName, enteredValue); } } else if (propertyType == typeof(ChainDirection)) { ChainDirection displayedValue = GetItemValue <ChainDirection>(item, propertyName); bool itemValuesIdentical = ValuesIsIdentical(GetSelectedItemsValues <ChainDirection>(propertyName)); if (!itemValuesIdentical) { EditorGUI.showMixedValue = true; } ChainDirection enteredValue = (ChainDirection)EditorGUILayout.EnumPopup(displayedValue); if (EditorGUI.EndChangeCheck()) { SelectedItemsSetValue(propertyName, enteredValue); } } else if (propertyType == typeof(RotationMode)) { RotationMode displayedValue = GetItemValue <RotationMode>(item, propertyName); bool itemValuesIdentical = ValuesIsIdentical(GetSelectedItemsValues <RotationMode>(propertyName)); if (!itemValuesIdentical) { EditorGUI.showMixedValue = true; } RotationMode enteredValue = (RotationMode)EditorGUILayout.EnumPopup(displayedValue); if (EditorGUI.EndChangeCheck()) { SelectedItemsSetValue(propertyName, enteredValue); } } else if (propertyType == typeof(MaterialMode)) { MaterialMode displayedValue = GetItemValue <MaterialMode>(item, propertyName); bool itemValuesIdentical = ValuesIsIdentical(GetSelectedItemsValues <MaterialMode>(propertyName)); if (!itemValuesIdentical) { EditorGUI.showMixedValue = true; } MaterialMode enteredValue = (MaterialMode)EditorGUILayout.EnumPopup(displayedValue); if (EditorGUI.EndChangeCheck()) { SelectedItemsSetValue(propertyName, enteredValue); } } else if (propertyType == typeof(AnimationCurve)) { AnimationCurve displayedValue = GetItemValue <AnimationCurve>(item, propertyName); bool itemValuesIdentical = ValuesIsIdentical(GetSelectedItemsValues <AnimationCurve>(propertyName)); if (!itemValuesIdentical) { EditorGUI.showMixedValue = true; } AnimationCurve enteredValue = (AnimationCurve)EditorGUILayout.CurveField(displayedValue); if (EditorGUI.EndChangeCheck()) { SelectedItemsSetValue(propertyName, enteredValue); } } else if (propertyType == typeof(TSSProfile)) { TSSProfile displayedValue = GetItemValue <TSSProfile>(item, propertyName); bool itemValuesIdentical = ValuesIsIdentical(GetSelectedItemsValues <TSSProfile>(propertyName)); if (!itemValuesIdentical) { EditorGUI.showMixedValue = true; } TSSProfile enteredValue = (TSSProfile)EditorGUILayout.ObjectField(displayedValue, typeof(TSSProfile), false); if (EditorGUI.EndChangeCheck()) { SelectedItemsSetValue(propertyName, enteredValue); if (enteredValue != null && EditorUtility.DisplayDialog(confirmRevertTitle.text, string.Format(confirmRevertMessage.text, item.profile.name), "Yes", "No")) { TSSProfile.ProfileRevert(item, item.profile); } } } else if (propertyType == typeof(ActivationMode)) { if (alternative) { ItemLoopModePattern displayedValue = ActivationModeToLoopPattern(GetItemValue <ActivationMode>(item, propertyName)); bool itemValuesIdentical = ValuesIsIdentical(GetSelectedItemsValues <ActivationMode>(propertyName)); if (!itemValuesIdentical) { EditorGUI.showMixedValue = true; } ItemLoopModePattern enteredValue = (ItemLoopModePattern)EditorGUILayout.EnumPopup(displayedValue); if (EditorGUI.EndChangeCheck()) { SelectedItemsSetValue(propertyName, LoopPatternToActivationMode(enteredValue)); } } else { ActivationMode displayedValue = GetItemValue <ActivationMode>(item, propertyName); bool itemValuesIdentical = ValuesIsIdentical(GetSelectedItemsValues <ActivationMode>(propertyName)); if (!itemValuesIdentical) { EditorGUI.showMixedValue = true; } ActivationMode enteredValue = (ActivationMode)EditorGUILayout.EnumPopup(displayedValue); if (EditorGUI.EndChangeCheck()) { SelectedItemsSetValue(propertyName, enteredValue); } } } else if (propertyType == typeof(ButtonDirection)) { ButtonDirection displayedValue = GetItemValue <ButtonDirection>(item, propertyName); bool itemValuesIdentical = ValuesIsIdentical(GetSelectedItemsValues <ButtonDirection>(propertyName)); if (!itemValuesIdentical) { EditorGUI.showMixedValue = true; } ButtonDirection enteredValue = (ButtonDirection)EditorGUILayout.EnumPopup(displayedValue); if (EditorGUI.EndChangeCheck()) { SelectedItemsSetValue(propertyName, enteredValue); } } else if (propertyType == typeof(ItemUpdateType)) { ItemUpdateType displayedValue = GetItemValue <ItemUpdateType>(item, propertyName); bool itemValuesIdentical = ValuesIsIdentical(GetSelectedItemsValues <ItemUpdateType>(propertyName)); if (!itemValuesIdentical) { EditorGUI.showMixedValue = true; } ItemUpdateType enteredValue = (ItemUpdateType)EditorGUILayout.EnumPopup(displayedValue); if (EditorGUI.EndChangeCheck()) { SelectedItemsSetValue(propertyName, enteredValue); } } else if (propertyType == typeof(PathNormal)) { PathNormal displayedValue = GetItemValue <PathNormal>(item, propertyName); bool itemValuesIdentical = ValuesIsIdentical(GetSelectedItemsValues <PathNormal>(propertyName)); if (!itemValuesIdentical) { EditorGUI.showMixedValue = true; } PathNormal enteredValue = (PathNormal)EditorGUILayout.EnumPopup(displayedValue); if (EditorGUI.EndChangeCheck()) { SelectedItemsSetValue(propertyName, enteredValue); } } EditorGUILayout.EndHorizontal(); EditorGUI.showMixedValue = false; }
public void SetMaterialMode(MaterialMode mode) { PrevalidateMaterial(); _currentMaterial = _currentMaterial.UpdateMaterialMode(mode); }
public void RemoveMaterialMode(MaterialMode mode) { PrevalidateMaterial(); _currentMaterial = _currentMaterial.RemoveMaterialMode(mode); }
public void AddMaterialMode(MaterialMode mode) { PrevalidateMaterial(); _currentMaterial = _currentMaterial.AddMaterialMode(mode); }