public void RemoveMaterialTextureProperty(int id, string materialName, string property, TexturePropertyType propertyType) { var textureProperty = MaterialTexturePropertyList.FirstOrDefault(x => x.ID == id && x.MaterialName == materialName && x.Property == property); if (textureProperty != null) { if (propertyType == TexturePropertyType.Texture) { Logger.LogMessage("Save and reload character or change outfits to refresh textures."); textureProperty.TexID = null; if (textureProperty.NullCheck()) { MaterialTexturePropertyList.Remove(textureProperty); } } else if (propertyType == TexturePropertyType.Offset) { textureProperty.Offset = null; textureProperty.OffsetOriginal = null; if (textureProperty.NullCheck()) { MaterialTexturePropertyList.Remove(textureProperty); } } else if (propertyType == TexturePropertyType.Scale) { textureProperty.Scale = null; textureProperty.ScaleOriginal = null; if (textureProperty.NullCheck()) { MaterialTexturePropertyList.Remove(textureProperty); } } } }
public void AddMaterialTextureProperty(int id, string materialName, string property, TexturePropertyType propertyType, Vector2 value, Vector2 valueOriginal) { var textureProperty = MaterialTexturePropertyList.FirstOrDefault(x => x.ID == id && x.MaterialName == materialName && x.Property == property); if (textureProperty == null) { if (propertyType == TexturePropertyType.Offset) { MaterialTexturePropertyList.Add(new MaterialTextureProperty(id, materialName, property, offset: value, offsetOriginal: valueOriginal)); } else if (propertyType == TexturePropertyType.Scale) { MaterialTexturePropertyList.Add(new MaterialTextureProperty(id, materialName, property, scale: value, scaleOriginal: valueOriginal)); } } else { if (propertyType == TexturePropertyType.Offset) { if (value == textureProperty.OffsetOriginal) { textureProperty.Offset = null; textureProperty.OffsetOriginal = null; if (textureProperty.NullCheck()) { MaterialTexturePropertyList.Remove(textureProperty); } } else { textureProperty.Offset = value; textureProperty.OffsetOriginal = valueOriginal; } } else if (propertyType == TexturePropertyType.Scale) { if (value == textureProperty.ScaleOriginal) { textureProperty.Scale = null; textureProperty.ScaleOriginal = null; if (textureProperty.NullCheck()) { MaterialTexturePropertyList.Remove(textureProperty); } } else { textureProperty.Scale = value; textureProperty.ScaleOriginal = valueOriginal; } } } }
public Vector2?GetMaterialTexturePropertyValueOriginal(int id, string materialName, string property, TexturePropertyType propertyType) { var textureProperty = MaterialTexturePropertyList.FirstOrDefault(x => x.ID == id && x.MaterialName == materialName && x.Property == property); if (propertyType == TexturePropertyType.Offset) { return(textureProperty?.OffsetOriginal); } if (propertyType == TexturePropertyType.Scale) { return(textureProperty?.ScaleOriginal); } if (propertyType == TexturePropertyType.Texture) { return(textureProperty?.TexID == null ? null : (Vector2?)new Vector2(-1, -1)); } return(null); }
public Vector2?GetMaterialTexturePropertyValueOriginal(int id, string materialName, string property, TexturePropertyType propertyType) => null;
public void RemoveMaterialTextureProperty(int id, string materialName, string property, TexturePropertyType propertyType) { }
public void AddMaterialTextureProperty(int id, string materialName, string property, TexturePropertyType propertyType, Vector2 value, Vector2 valueOriginal) { }
private static bool SetTextureProperty(GameObject go, string materialName, string property, TexturePropertyType propertyType, Vector2 value, ObjectType objectType) { bool didSet = false; foreach (var obj in GetRendererList(go, objectType)) { foreach (var objMat in obj.materials) { if (objMat.NameFormatted() == materialName) { if (propertyType == TexturePropertyType.Offset) { objMat.SetTextureOffset($"_{property}", value); } else { objMat.SetTextureScale($"_{property}", value); } didSet = true; } } } return(didSet); }
private static bool SetTextureProperty(GameObject go, string materialName, string property, TexturePropertyType propertyType, Vector2?value, ObjectType objectType) => value == null ? false : SetTextureProperty(go, materialName, property, propertyType, (Vector2)value, objectType);
private static bool SetTextureProperty(ChaControl chaControl, string materialName, string property, TexturePropertyType propertyType, Vector2 value) { if (value == null) { return(false); } bool didSet = false; Material mat = null; if (materialName == chaControl.customMatBody.NameFormatted()) { mat = chaControl.customMatBody; } else if (materialName == chaControl.customMatFace.NameFormatted()) { mat = chaControl.customMatFace; } if (mat != null) { if (propertyType == TexturePropertyType.Offset) { mat.SetTextureOffset($"_{property}", value); } else { mat.SetTextureScale($"_{property}", value); } didSet = true; } return(didSet ? didSet : SetTextureProperty(chaControl.gameObject, materialName, property, propertyType, value, ObjectType.Character)); }
private static bool SetTextureProperty(ChaControl chaControl, string materialName, string property, TexturePropertyType propertyType, Vector2?value) => value == null ? false : SetTextureProperty(chaControl, materialName, property, propertyType, (Vector2)value);