Add blend contrast slider

This commit is contained in:
Lukas Aldershaab 2021-01-02 03:20:18 +01:00
parent 6f23dd191d
commit 1ffec9ab56
7 changed files with 152 additions and 29 deletions

View file

@ -511,7 +511,7 @@
anchorLeft = "1";
anchorRight = "0";
position = "6 122";
extent = "185 80";
extent = "185 100";
minExtent = "8 2";
horizSizing = "width";
vertSizing = "bottom";
@ -712,7 +712,7 @@
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiSliderCtrl(TerrainMaterialDlgBlendDepthSlider) {
new GuiSliderCtrl(TerrainMaterialDlgBlendHeightBaseSlider) {
range = "-0.5 0.5";
ticks = "0";
snap = "0";
@ -731,12 +731,12 @@
tooltipProfile = "ToolsGuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
internalName = "blendDepthSliderCtrl";
internalName = "blendHeightBaseSliderCtrl";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiTextCtrl() {
text = "Blend Depth";
text = "Blend Height";
maxLength = "1024";
margin = "0 0 0 0";
padding = "0 0 0 0";
@ -758,7 +758,7 @@
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiTextEditCtrl(TerrainMaterialDlgBlendDepthTextEdit) {
new GuiTextEditCtrl(TerrainMaterialDlgBlendHeightBaseTextEdit) {
historySize = "0";
tabComplete = "0";
sinkAllKeyEvents = "0";
@ -783,7 +783,82 @@
tooltipProfile = "ToolsGuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
internalName = "blendDepthTextEditCtrl";
internalName = "blendHeightBaseTextEditCtrl";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiSliderCtrl(TerrainMaterialDlgBlendHeightContrastSlider) {
range = "0.0 5.0";
ticks = "0";
snap = "0";
value = "1.0";
useFillBar = "0";
fillBarColor = "255 255 255 255";
renderTicks = "1";
position = "39 81";
extent = "70 14";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "ToolsGuiSliderProfile";
visible = "1";
active = "1";
tooltipProfile = "ToolsGuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
internalName = "blendHeightContrastSliderCtrl";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiTextCtrl() {
text = "Blend Contrast";
maxLength = "1024";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "115 81";
extent = "58 15";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "ToolsGuiTextProfile";
visible = "1";
active = "1";
tooltipProfile = "ToolsGuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiTextEditCtrl(TerrainMaterialDlgBlendHeightContrastTextEdit) {
historySize = "0";
tabComplete = "0";
sinkAllKeyEvents = "0";
password = "0";
passwordMask = "*";
text = "0.3";
maxLength = "1024";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "0";
anchorBottom = "0";
anchorLeft = "0";
anchorRight = "0";
position = "1 79";
extent = "35 18";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "ToolsGuiTextEditProfile";
visible = "1";
active = "1";
tooltipProfile = "ToolsGuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
internalName = "blendHeightContrastTextEditCtrl";
canSave = "1";
canSaveDynamicFields = "0";
};
@ -792,7 +867,7 @@
bitmap = "tools/gui/images/separator-v";
color = "255 255 255 255";
wrap = "0";
position = "6 202";
position = "6 222";
extent = "175 2";
minExtent = "8 2";
horizSizing = "width";
@ -813,7 +888,7 @@
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "6 209";
position = "6 229";
extent = "185 64";
minExtent = "8 2";
horizSizing = "width";
@ -1008,7 +1083,7 @@
bitmap = "tools/gui/images/separator-v";
color = "255 255 255 255";
wrap = "0";
position = "6 279";
position = "6 299";
extent = "175 2";
minExtent = "8 2";
horizSizing = "width";
@ -1029,7 +1104,7 @@
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "6 286";
position = "6 306";
extent = "185 72";
minExtent = "8 2";
horizSizing = "width";
@ -1513,7 +1588,7 @@
bitmap = "tools/gui/images/separator-v";
color = "255 255 255 255";
wrap = "0";
position = "6 361";
position = "6 381";
extent = "175 2";
minExtent = "8 2";
horizSizing = "width";
@ -1534,7 +1609,7 @@
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "6 368";
position = "6 388";
extent = "185 72";
minExtent = "8 2";
horizSizing = "width";

View file

@ -444,9 +444,13 @@ function TerrainMaterialDlg::setActiveMaterial( %this, %mat )
%this-->sideProjectionCtrl.setValue( %mat.useSideProjection );
%this-->parallaxScaleCtrl.setText( %mat.parallaxScale );
%blendDepth = mFloor(%mat.blendDepth * 1000)/1000;
%this-->blendDepthTextEditCtrl.setText( %blendDepth );
%this-->blendDepthSliderCtrl.setValue( %mat.blendDepth );
%blendHeightBase = mFloor(%mat.blendHeightBase * 1000)/1000;
%this-->blendHeightBaseTextEditCtrl.setText( %blendHeightBase );
%this-->blendHeightBaseSliderCtrl.setValue( %mat.blendHeightBase );
%blendHeightContrast = mFloor(%mat.blendHeightContrast * 1000)/1000;
%this-->blendHeightContrastTextEditCtrl.setText( %blendHeightContrast );
%this-->blendHeightContrastSliderCtrl.setValue( %mat.blendHeightContrast );
%this-->macroSizeCtrl.setText( %mat.macroSize );
%this-->macroStrengthCtrl.setText( %mat.macroStrength );
@ -508,7 +512,8 @@ function TerrainMaterialDlg::saveDirtyMaterial( %this, %mat )
%detailDistance = %this-->detDistanceCtrl.getText();
%useSideProjection = %this-->sideProjectionCtrl.getValue();
%parallaxScale = %this-->parallaxScaleCtrl.getText();
%blendDepth = %this-->blendDepthTextEditCtrl.getText();
%blendHeightBase = %this-->blendHeightBaseTextEditCtrl.getText();
%blendHeightContrast = %this-->blendHeightContrastTextEditCtrl.getText();
%macroSize = %this-->macroSizeCtrl.getText();
%macroStrength = %this-->macroStrengthCtrl.getText();
@ -535,11 +540,12 @@ function TerrainMaterialDlg::saveDirtyMaterial( %this, %mat )
%mat.macroStrength == %macroStrength &&
%mat.macroDistance == %macroDistance &&
%mat.parallaxScale == %parallaxScale &&
%mat.blendDepth == %blendDepth &&
%mat.blendHeightBase == %blendHeightBase &&
%mat.blendHeightContrast == %blendHeightContrast &&
%mat.isSRGB == %isSRGB &&
%mat.invertRoughness == %invertRoughness)
%mat.invertRoughness == %invertRoughness && false)
return;
// Make sure the material name is unique.
if( %mat.internalName !$= %newName )
@ -573,7 +579,8 @@ function TerrainMaterialDlg::saveDirtyMaterial( %this, %mat )
%mat.macroDistance = %macroDistance;
%mat.useSideProjection = %useSideProjection;
%mat.parallaxScale = %parallaxScale;
%mat.blendDepth = %blendDepth;
%mat.blendHeightBase = %blendHeightBase;
%mat.blendHeightContrast = %blendHeightContrast;
%mat.isSRGB = %isSRGB;
%mat.invertRoughness = %invertRoughness;
@ -626,7 +633,8 @@ function TerrainMaterialDlg::snapshotMaterials( %this )
macroDistance = %mat.macroDistance;
useSideProjection = %mat.useSideProjection;
parallaxScale = %mat.parallaxScale;
blendDepth = %mat.blendDepth;
blendHeightBase = %mat.blendHeightBase;
blendHeightContrast = %mat.blendHeightContrast;
isSRGB = %mat.isSRGB;
invertRoughness = %mat.invertRoughness;
};
@ -664,7 +672,8 @@ function TerrainMaterialDlg::restoreMaterials( %this )
%mat.macroDistance = %obj.macroDistance;
%mat.useSideProjection = %obj.useSideProjection;
%mat.parallaxScale = %obj.parallaxScale;
%mat.blendDepth = %obj.blendDepth;
%mat.blendHeightBase = %obj.blendHeightBase;
%mat.blendHeightContrast = %obj.blendHeightContrast;
%mat.isSRGB = %obj.isSRGB;
%mat.invertRoughness = %obj.invertRoughness;
}
@ -703,16 +712,30 @@ function TerrainMaterialDlg::_selectTextureFileDialog( %this, %defaultFileName )
return %file;
}
function TerrainMaterialDlgBlendDepthSlider::onMouseDragged(%this)
function TerrainMaterialDlgBlendHeightBaseSlider::onMouseDragged(%this)
{
%value = mFloor(%this.value * 1000)/1000;
TerrainMaterialDlgBlendDepthTextEdit.setText(%value);
TerrainMaterialDlg.activeMat.blendDepth = %this.value;
TerrainMaterialDlgBlendHeightBaseTextEdit.setText(%value);
TerrainMaterialDlg.activeMat.blendHeightBase = %this.value;
}
function TerrainMaterialDlgBlendDepthTextEdit::onValidate(%this)
function TerrainMaterialDlgBlendHeightBaseTextEdit::onValidate(%this)
{
TerrainMaterialDlgBlendDepthSlider.setValue(%this.getText());
TerrainMaterialDlg.activeMat.blendDepth = %this.getText();
TerrainMaterialDlgBlendHeightBaseSlider.setValue(%this.getText());
TerrainMaterialDlg.activeMat.blendHeightBase = %this.getText();
}
function TerrainMaterialDlgBlendHeightContrastSlider::onMouseDragged(%this)
{
%value = mFloor(%this.value * 1000)/1000;
TerrainMaterialDlgBlendHeightContrastTextEdit.setText(%value);
TerrainMaterialDlg.activeMat.blendHeightContrast = %this.value;
}
function TerrainMaterialDlgBlendHeightContrastTextEdit::onValidate(%this)
{
TerrainMaterialDlgBlendHeightContrastSlider.setValue(%this.getText());
TerrainMaterialDlg.activeMat.blendHeightContrast = %this.getText();
}