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;
|
bool isLoadError = false;
|
||||||
int currentFrame;
|
int currentFrame;
|
||||||
WRot modelOrientation;
|
WRot modelOrientation;
|
||||||
|
float modelScale;
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public AssetBrowserLogic(Widget widget, Action onExit, ModData modData, WorldRenderer worldRenderer)
|
public AssetBrowserLogic(Widget widget, Action onExit, ModData modData, WorldRenderer worldRenderer)
|
||||||
@@ -106,10 +107,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
modelWidget.GetVoxel = () => currentVoxel;
|
modelWidget.GetVoxel = () => currentVoxel;
|
||||||
currentPalette = modelWidget.Palette;
|
currentPalette = modelWidget.Palette;
|
||||||
|
modelScale = modelWidget.Scale;
|
||||||
modelWidget.GetPalette = () => currentPalette;
|
modelWidget.GetPalette = () => currentPalette;
|
||||||
modelWidget.GetPlayerPalette = () => currentPalette;
|
modelWidget.GetPlayerPalette = () => currentPalette;
|
||||||
modelWidget.GetRotation = () => modelOrientation;
|
modelWidget.GetRotation = () => modelOrientation;
|
||||||
modelWidget.IsVisible = () => !isVideoLoaded && !isLoadError && currentVoxel != null;
|
modelWidget.IsVisible = () => !isVideoLoaded && !isLoadError && currentVoxel != null;
|
||||||
|
modelWidget.GetScale = () => modelScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
var errorLabelWidget = panel.GetOrNull("ERROR");
|
var errorLabelWidget = panel.GetOrNull("ERROR");
|
||||||
@@ -285,6 +288,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
yawSlider.GetValue = () => modelOrientation.Yaw.Angle;
|
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>();
|
var assetBrowserModData = modData.Manifest.Get<AssetBrowser>();
|
||||||
allowedSpriteExtensions = assetBrowserModData.SpriteExtensions;
|
allowedSpriteExtensions = assetBrowserModData.SpriteExtensions;
|
||||||
allowedModelExtensions = assetBrowserModData.ModelExtensions;
|
allowedModelExtensions = assetBrowserModData.ModelExtensions;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
public string PlayerPalette = "player";
|
public string PlayerPalette = "player";
|
||||||
public string NormalsPalette = "normals";
|
public string NormalsPalette = "normals";
|
||||||
public string ShadowPalette = "shadow";
|
public string ShadowPalette = "shadow";
|
||||||
public float Scale = 12f;
|
public float Scale = 10f;
|
||||||
public int LightPitch = 142;
|
public int LightPitch = 142;
|
||||||
public int LightYaw = 682;
|
public int LightYaw = 682;
|
||||||
public float[] LightAmbientColor = new float[] { 0.6f, 0.6f, 0.6f };
|
public float[] LightAmbientColor = new float[] { 0.6f, 0.6f, 0.6f };
|
||||||
|
|||||||
@@ -233,6 +233,21 @@ Background@ASSETBROWSER_PANEL:
|
|||||||
Height: 20
|
Height: 20
|
||||||
MinimumValue: 1
|
MinimumValue: 1
|
||||||
MaximumValue: 1023
|
MaximumValue: 1023
|
||||||
|
Label@MODEL_SCALE:
|
||||||
|
X: 150
|
||||||
|
Y: 30
|
||||||
|
Width: 40
|
||||||
|
Height: 25
|
||||||
|
Font: TinyBold
|
||||||
|
Align: Left
|
||||||
|
Text: Scale
|
||||||
|
Slider@MODEL_SCALE_SLIDER:
|
||||||
|
X: 190
|
||||||
|
Y: 32
|
||||||
|
Width: 100
|
||||||
|
Height: 20
|
||||||
|
MinimumValue: 10
|
||||||
|
MaximumValue: 64
|
||||||
Button@CLOSE_BUTTON:
|
Button@CLOSE_BUTTON:
|
||||||
Key: escape
|
Key: escape
|
||||||
X: PARENT_RIGHT - 180
|
X: PARENT_RIGHT - 180
|
||||||
|
|||||||
Reference in New Issue
Block a user