Added a scale slider for models in the AssetBrowser
This commit is contained in:
committed by
Matthias Mailänder
parent
6907081c2b
commit
40c728269c
@@ -53,6 +53,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
bool isLoadError = false;
|
||||
int currentFrame;
|
||||
WRot modelOrientation;
|
||||
float modelScale;
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public AssetBrowserLogic(Widget widget, Action onExit, ModData modData, WorldRenderer worldRenderer)
|
||||
@@ -106,10 +107,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
{
|
||||
modelWidget.GetVoxel = () => currentVoxel;
|
||||
currentPalette = modelWidget.Palette;
|
||||
modelScale = modelWidget.Scale;
|
||||
modelWidget.GetPalette = () => currentPalette;
|
||||
modelWidget.GetPlayerPalette = () => currentPalette;
|
||||
modelWidget.GetRotation = () => modelOrientation;
|
||||
modelWidget.IsVisible = () => !isVideoLoaded && !isLoadError && currentVoxel != null;
|
||||
modelWidget.GetScale = () => modelScale;
|
||||
}
|
||||
|
||||
var errorLabelWidget = panel.GetOrNull("ERROR");
|
||||
@@ -285,6 +288,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
yawSlider.GetValue = () => modelOrientation.Yaw.Angle;
|
||||
}
|
||||
|
||||
var modelScaleSlider = panel.GetOrNull<SliderWidget>("MODEL_SCALE_SLIDER");
|
||||
if (modelScaleSlider != null)
|
||||
{
|
||||
modelScaleSlider.OnChange += x => modelScale = x;
|
||||
modelScaleSlider.GetValue = () => modelScale;
|
||||
}
|
||||
|
||||
var assetBrowserModData = modData.Manifest.Get<AssetBrowser>();
|
||||
allowedSpriteExtensions = assetBrowserModData.SpriteExtensions;
|
||||
allowedModelExtensions = assetBrowserModData.ModelExtensions;
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
public string PlayerPalette = "player";
|
||||
public string NormalsPalette = "normals";
|
||||
public string ShadowPalette = "shadow";
|
||||
public float Scale = 12f;
|
||||
public float Scale = 10f;
|
||||
public int LightPitch = 142;
|
||||
public int LightYaw = 682;
|
||||
public float[] LightAmbientColor = new float[] { 0.6f, 0.6f, 0.6f };
|
||||
|
||||
Reference in New Issue
Block a user