Space Engineers

Space Engineers

Visual Overrides API
Echthros  [developer] 14 Apr, 2024 @ 11:20am
Visual Overrides Mod API
Setup Steps:
1. Copy VisualOverridesApiClient.cs file to your code project.
2. Instantiate the VisualOverridesApiclass in the main MySessionComponentBase and store it in a property. (i.e. public VisualOverridesApi VisualOverridesApi = new VisualOverridesApi();)
3. Add the VisualOverridesApi.Load() call to the LoadData() method and the VisualOverridesApi.Unload() call to the UnloadData() override methods in the main MySessionComponentBase.
4. Use the API methods as you please.

Usage:
When an override value is set, it is added to the list of active overrides of that control value at the given priority. Every frame, the highest priority value will be applied to the control. If there are multiple overrides with the same priority, their values will be multiplied together before being applied.

If the highest priority override is set to null and no other overrides of that priority are defined, then the control value will be set to null (i.e. inactive). If there are multiple overrides with the same highest priority, all null values will be ignored (unless they are all null).

The SunIntensityOverride overrides will be multiplied by 150 (default sun brightness) internally before being applied.

For the atmosphere value multipliers, they are applied on a per-planet basis and are only applied when changed.

Methods:
void SetFogAtmoOverride(string key, int priority, float? value)
Sets an override to the FogAtmoOverride value at a given priority. If the same key is assigned, it will replace the old override value for that key.

float? GetFogAtmoOverride(string key)
Gets the override value for a particular key. If null is passed in, the value returned is the final override value that is currently being applied to the control.

void RemoveFogAtmoOverride(string key)
Removes the override value with the given key.

void SetFogColorOverride(string key, int priority, Vector3? value)
Vector3? GetFogColorOverride(string key)
void RemoveFogColorOverride(string key)

void SetFogDensityOverride(string key, int priority, float? value)
float? GetFogDensityOverride(string key)
void RemoveFogDensityOverride(string key)

void SetFogMultiplierOverride(string key, int priority, float? value)
float? GetFogMultiplierOverride(string key)
void RemoveFogMultiplierOverride(string key)

void SetFogSkyboxOverride(string key, int priority, float? value)
float? GetFogSkyboxOverride(string key)
void RemoveFogSkyboxOverride(string key)

void SetSunIntensityOverride(string key, int priority, float? value)
float? GetSunIntensityOverride(string key)
void RemoveSunIntensityOverride(string key)



Vector3? GetAtmoSettingRayleighScatteringDefault(MyDefinitionId planetId)
Returns the RayleighScattering default value for the input planet generator id. This is the true value that you would see in the planet definition, rather than the multiplier returned by the "Multiplier" functions. Returns null if planet does not have a valid atmosphere.

Vector3? GetAtmoSettingRayleighScatteringMultiplier(MyPlanet planet, string key)
Returns the current override multiplier applied to the planet's RayleighScattering atmo value for a given key. This value is a straight multiplier, so a value of 1 means no modification to the base value. If null is passed in, the value returned is the final override multiplier that is currently being applied to the value.

bool SetAtmoSettingRayleighScattering(MyPlanet planet, string key, int priority, Vector3 val)
Sets an override to the RayleighScattering atmo value at a given priority. If the same key is assigned, it will replace the old override value for that key.

void RemoveAtmoSettingRayleighScattering(MyPlanet planet, string key)
Removes the override value with the given key.

float? GetAtmoSettingMieScatteringDefault(MyDefinitionId planetId)
float? GetAtmoSettingMieScatteringMultiplier(MyPlanet planet, string key)
bool SetAtmoSettingMieScattering(MyPlanet planet, string key, int priority, float val)
void RemoveAtmoSettingMieScattering(MyPlanet planet, string key)

Vector3? GetAtmoSettingMieColorScatteringDefault(MyDefinitionId planetId)
Vector3? GetAtmoSettingMieColorScatteringMultiplier(MyPlanet planet, string key)
bool SetAtmoSettingMieColorScattering(MyPlanet planet, string key, int priority, Vector3 val)
void RemoveAtmoSettingMieColorScattering(MyPlanet planet, string key)

float? GetAtmoSettingRayleighHeightDefault(MyDefinitionId planetId)
float? GetAtmoSettingRayleighHeightMultiplier(MyPlanet planet, string key)
bool SetAtmoSettingRayleighHeight(MyPlanet planet, string key, int priority, float val)
void RemoveAtmoSettingRayleighHeight(MyPlanet planet, string key)

float? GetAtmoSettingRayleighHeightSpaceDefault(MyDefinitionId planetId)
float? GetAtmoSettingRayleighHeightSpaceMultiplier(MyPlanet planet, string key)
bool SetAtmoSettingRayleighHeightSpace(MyPlanet planet, string key, int priority, float val)
void RemoveAtmoSettingRayleighHeightSpace(MyPlanet planet, string key)

float? GetAtmoSettingRayleighTransitionModifierDefault(MyDefinitionId planetId)
float? GetAtmoSettingRayleighTransitionModifierMultiplier(MyPlanet planet, string key)
bool SetAtmoSettingRayleighTransitionModifier(MyPlanet planet, string key, int priority, float val)
void RemoveAtmoSettingRayleighTransitionModifier(MyPlanet planet, string key)

float? GetAtmoSettingMieHeightDefault(MyDefinitionId planetId)
float? GetAtmoSettingMieHeightMultiplier(MyPlanet planet, string key)
bool SetAtmoSettingMieHeight(MyPlanet planet, string key, int priority, float val)
void RemoveAtmoSettingMieHeight(MyPlanet planet, string key)

float? GetAtmoSettingMieGDefault(MyDefinitionId planetId)
float? GetAtmoSettingMieGMultiplier(MyPlanet planet, string key)
bool SetAtmoSettingMieG(MyPlanet planet, string key, int priority, float val)
void RemoveAtmoSettingMieG(MyPlanet planet, string key)

float? GetAtmoSettingIntensityDefault(MyDefinitionId planetId)
float? GetAtmoSettingIntensityMultiplier(MyPlanet planet, string key)
bool SetAtmoSettingIntensity(MyPlanet planet, string key, int priority, float val)
void RemoveAtmoSettingIntensity(MyPlanet planet, string key)

float? GetAtmoSettingFogIntensityDefault(MyDefinitionId planetId)
float? GetAtmoSettingFogIntensityMultiplier(MyPlanet planet, string key)
bool SetAtmoSettingFogIntensity(MyPlanet planet, string key, int priority, float val)
void RemoveAtmoSettingFogIntensity(MyPlanet planet, string key)

float? GetAtmoSettingSeaLevelModifierDefault(MyDefinitionId planetId)
float? GetAtmoSettingSeaLevelModifierMultiplier(MyPlanet planet, string key)
bool SetAtmoSettingSeaLevelModifier(MyPlanet planet, string key, int priority, float val)
void RemoveAtmoSettingSeaLevelModifier(MyPlanet planet, string key)

float? GetAtmoSettingAtmosphereTopModifierDefault(MyDefinitionId planetId)
float? GetAtmoSettingAtmosphereTopModifierMultiplier(MyPlanet planet, string key)
bool SetAtmoSettingAtmosphereTopModifier(MyPlanet planet, string key, int priority, float val)
void RemoveAtmoSettingAtmosphereTopModifier(MyPlanet planet, string key)

float? GetAtmoSettingScaleDefault(MyDefinitionId planetId)
float? GetAtmoSettingScaleMultiplier(MyPlanet planet, string key)
bool SetAtmoSettingScale(MyPlanet planet, string key, int priority, float val)
void RemoveAtmoSettingScale(MyPlanet planet, string key)

Vector3? GetAtmoSettingSunColorDefault(MyDefinitionId planetId)
Vector3? GetAtmoSettingSunColorMultiplier(MyPlanet planet, string key)
bool SetAtmoSettingSunColor(MyPlanet planet, string key, int priority, Vector3 val)
void RemoveAtmoSettingSunColor(MyPlanet planet, string key)

Vector3? GetAtmoSettingSunSpecularColorDefault(MyDefinitionId planetId)
Vector3? GetAtmoSettingSunSpecularColorMultiplier(MyPlanet planet, string key)
bool SetAtmoSettingSunSpecularColor(MyPlanet planet, string key, int priority, Vector3 val)
void RemoveAtmoSettingSunSpecularColor(MyPlanet planet, string key)
Last edited by Echthros; 3 May, 2024 @ 3:00am