mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-23 08:33:50 +00:00
Fixes setter issue for image/shape/material custom inspector fields where it was not correctly passing through the changed value from the Asset Browser select
Swapped the water's disableTrueReflections variable to be enableTrueReflections for simplicity and consistency(also fixed a persistent typo) Swapped disableVerticalSync to be enableVerticalSync for simplicity and consistency Swapped disableParallaxMapping to be enableParallaxMapping for simplicity and consistency Fix click detection on slider mode entries for guiGameSettingsCtrl so the click position correctly matches the percentage Fixed problem where postFX initialization would always exec default.postfxpreset.tscript, even if a level's got it's own preset, which can cause problems Fixed range field type behavior so that editing the values applies in real time, and also consistently applies between slider and text field
This commit is contained in:
parent
280fca2fbe
commit
cd82186231
20 changed files with 91 additions and 102 deletions
|
|
@ -491,7 +491,7 @@ GuiControl* GuiInspectorTypeImageAssetPtr::constructEditControl()
|
|||
{
|
||||
//if we don't have a target object, we'll be manipulating the desination value directly
|
||||
char szBuffer[512];
|
||||
dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"ImageAsset\", \"AssetBrowser.changeAsset\", %s, %s);",
|
||||
dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"ImageAsset\", \"AssetBrowser.changeAsset\", %s, \"%s\");",
|
||||
mInspector->getIdString(), mVariableName);
|
||||
mBrowseButton->setField("Command", szBuffer);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -491,7 +491,7 @@ GuiControl* GuiInspectorTypeMaterialAssetPtr::constructEditControl()
|
|||
else
|
||||
{
|
||||
//if we don't have a target object, we'll be manipulating the desination value directly
|
||||
dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"MaterialAsset\", \"AssetBrowser.changeAsset\", %s, %s);",
|
||||
dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"MaterialAsset\", \"AssetBrowser.changeAsset\", %s, \"%s\");",
|
||||
mInspector->getIdString(), mVariableName);
|
||||
mBrowseButton->setField("Command", szBuffer);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -760,7 +760,7 @@ GuiControl* GuiInspectorTypeShapeAssetPtr::constructEditControl()
|
|||
else
|
||||
{
|
||||
//if we don't have a target object, we'll be manipulating the desination value directly
|
||||
dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"ShapeAsset\", \"AssetBrowser.changeAsset\", %s, %s);",
|
||||
dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"ShapeAsset\", \"AssetBrowser.changeAsset\", %s, \"%s\");",
|
||||
mInspector->getIdString(), mVariableName);
|
||||
mBrowseButton->setField("Command", szBuffer);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ void WaterMatParams::init( BaseMatInstance* matInst )
|
|||
|
||||
|
||||
bool WaterObject::smWireframe = false;
|
||||
bool WaterObject::smDisableTrueReflections = false;
|
||||
bool WaterObject::smEnableTrueReflections = true;
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// WaterObject Class
|
||||
|
|
@ -406,7 +406,7 @@ void WaterObject::consoleInit()
|
|||
{
|
||||
Parent::consoleInit();
|
||||
|
||||
Con::addVariable( "$pref::Water::disableTrueReflections", TypeBool, &WaterObject::smDisableTrueReflections,
|
||||
Con::addVariable( "$pref::Water::EnableTrueReflections", TypeBool, &WaterObject::smEnableTrueReflections,
|
||||
"Force all water objects to use static cubemap reflections.\n"
|
||||
"@ingroup Water");
|
||||
}
|
||||
|
|
@ -438,7 +438,7 @@ bool WaterObject::_setFullReflect( void *object, const char *index, const char *
|
|||
{
|
||||
bool isEnabled = water->mPlaneReflector.isEnabled();
|
||||
|
||||
bool enable = water->mFullReflect && !smDisableTrueReflections;
|
||||
bool enable = water->mFullReflect && smEnableTrueReflections;
|
||||
|
||||
if ( enable && !isEnabled )
|
||||
water->mPlaneReflector.registerReflector( water, &water->mReflectorDesc );
|
||||
|
|
@ -582,7 +582,7 @@ void WaterObject::unpackUpdate( NetConnection * conn, BitStream *stream )
|
|||
mReflectorDesc.useOcclusionQuery = stream->readFlag();
|
||||
mReflectorDesc.texSize = stream->readInt( 32 );
|
||||
|
||||
if ( isProperlyAdded() && !mPlaneReflector.isEnabled() && !smDisableTrueReflections )
|
||||
if ( isProperlyAdded() && !mPlaneReflector.isEnabled() && smEnableTrueReflections )
|
||||
mPlaneReflector.registerReflector( this, &mReflectorDesc );
|
||||
}
|
||||
else
|
||||
|
|
@ -868,8 +868,8 @@ bool WaterObject::onAdd()
|
|||
if ( !Parent::onAdd() )
|
||||
return false;
|
||||
|
||||
Con::NotifyDelegate clbk( this, &WaterObject::_onDisableTrueRelfections );
|
||||
Con::addVariableNotify( "$pref::Water::disableTrueReflections", clbk );
|
||||
Con::NotifyDelegate clbk( this, &WaterObject::_onEnableTrueReflections );
|
||||
Con::addVariableNotify( "$pref::Water::EnableTrueReflections", clbk );
|
||||
|
||||
if ( isClientObject() )
|
||||
{
|
||||
|
|
@ -886,7 +886,7 @@ bool WaterObject::onAdd()
|
|||
|
||||
initTextures();
|
||||
|
||||
if ( mFullReflect && !smDisableTrueReflections )
|
||||
if ( mFullReflect && smEnableTrueReflections )
|
||||
mPlaneReflector.registerReflector( this, &mReflectorDesc );
|
||||
}
|
||||
|
||||
|
|
@ -895,8 +895,8 @@ bool WaterObject::onAdd()
|
|||
|
||||
void WaterObject::onRemove()
|
||||
{
|
||||
Con::NotifyDelegate clbk( this, &WaterObject::_onDisableTrueRelfections );
|
||||
Con::removeVariableNotify( "$pref::Water::disableTrueReflections", clbk );
|
||||
Con::NotifyDelegate clbk( this, &WaterObject::_onEnableTrueReflections );
|
||||
Con::removeVariableNotify( "$pref::Water::EnableTrueReflections", clbk );
|
||||
|
||||
if ( isClientObject() )
|
||||
{
|
||||
|
|
@ -911,14 +911,14 @@ void WaterObject::onRemove()
|
|||
Parent::onRemove();
|
||||
}
|
||||
|
||||
void WaterObject::_onDisableTrueRelfections()
|
||||
void WaterObject::_onEnableTrueReflections()
|
||||
{
|
||||
// Same code as _setFullReflect
|
||||
if ( isProperlyAdded() && isClientObject() )
|
||||
{
|
||||
bool isEnabled = mPlaneReflector.isEnabled();
|
||||
|
||||
bool enable = mFullReflect && !smDisableTrueReflections;
|
||||
bool enable = mFullReflect && smEnableTrueReflections;
|
||||
|
||||
if ( enable && !isEnabled )
|
||||
mPlaneReflector.registerReflector( this, &mReflectorDesc );
|
||||
|
|
|
|||
|
|
@ -199,8 +199,8 @@ protected:
|
|||
|
||||
virtual void _getWaterPlane( const Point3F &camPos, PlaneF &outPlane, Point3F &outPos ) {}
|
||||
|
||||
/// Callback used internally when smDisableTrueReflections changes.
|
||||
void _onDisableTrueRelfections();
|
||||
/// Callback used internally when smEnableTrueReflections changes.
|
||||
void _onEnableTrueReflections();
|
||||
|
||||
void onRippleTexChanged() {}
|
||||
void onFoamTexChanged() {}
|
||||
|
|
@ -307,7 +307,7 @@ protected:
|
|||
static bool smWireframe;
|
||||
|
||||
/// Force all water objects to use static cubemap reflections
|
||||
static bool smDisableTrueReflections;
|
||||
static bool smEnableTrueReflections;
|
||||
|
||||
// Rendering
|
||||
bool mBasicLighting;
|
||||
|
|
|
|||
|
|
@ -228,7 +228,7 @@ DXGI_SWAP_CHAIN_DESC GFXD3D11Device::setupPresentParams(const GFXVideoMode &mode
|
|||
|
||||
mMultisampleDesc = sampleDesc;
|
||||
|
||||
d3dpp.BufferCount = !smDisableVSync ? 2 : 1; // triple buffering when vsync is on.
|
||||
d3dpp.BufferCount = smEnableVSync ? 2 : 1; // triple buffering when vsync is on.
|
||||
d3dpp.BufferDesc.Width = mode.resolution.x;
|
||||
d3dpp.BufferDesc.Height = mode.resolution.y;
|
||||
d3dpp.BufferDesc.Format = GFXD3D11TextureFormat[GFXFormatR8G8B8A8_SRGB];
|
||||
|
|
|
|||
|
|
@ -367,7 +367,7 @@ GFXFormat GFXD3D11WindowTarget::getFormat()
|
|||
|
||||
bool GFXD3D11WindowTarget::present()
|
||||
{
|
||||
HRESULT hr = mSwapChain->Present(!D3D11->smDisableVSync, 0);
|
||||
HRESULT hr = mSwapChain->Present(D3D11->smEnableVSync, 0);
|
||||
if (hr == DXGI_ERROR_DEVICE_REMOVED)
|
||||
{
|
||||
HRESULT result = D3D11->getDevice()->GetDeviceRemovedReason();
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
|
||||
GFXDevice * GFXDevice::smGFXDevice = NULL;
|
||||
bool GFXDevice::smWireframe = false;
|
||||
bool GFXDevice::smDisableVSync = true;
|
||||
bool GFXDevice::smEnableVSync = false;
|
||||
F32 GFXDevice::smForcedPixVersion = -1.0f;
|
||||
bool GFXDevice::smDisableOcclusionQuery = false;
|
||||
bool gDisassembleAllShaders = false;
|
||||
|
|
@ -71,8 +71,8 @@ void GFXDevice::initConsole()
|
|||
"them to return only the visibile state.\n"
|
||||
"@ingroup GFX\n" );
|
||||
|
||||
Con::addVariable( "$pref::Video::disableVerticalSync", TypeBool, &smDisableVSync,
|
||||
"Disables vertical sync on the active device.\n"
|
||||
Con::addVariable( "$pref::Video::enableVerticalSync", TypeBool, &smEnableVSync,
|
||||
"Enables vertical sync on the active device.\n"
|
||||
"@note The video mode must be reset for the change to take affect.\n"
|
||||
"@ingroup GFX\n" );
|
||||
|
||||
|
|
|
|||
|
|
@ -525,7 +525,7 @@ protected:
|
|||
static bool smWireframe;
|
||||
|
||||
/// The global vsync state.
|
||||
static bool smDisableVSync;
|
||||
static bool smEnableVSync;
|
||||
|
||||
/// The forced shader model version if non-zero.
|
||||
static F32 smForcedPixVersion;
|
||||
|
|
|
|||
|
|
@ -180,11 +180,11 @@ void GFXGLDevice::initGLState()
|
|||
}
|
||||
#endif
|
||||
|
||||
PlatformGL::setVSync(smDisableVSync ? 0 : 1);
|
||||
PlatformGL::setVSync(smEnableVSync);
|
||||
|
||||
//install vsync callback
|
||||
Con::NotifyDelegate clbk(this, &GFXGLDevice::vsyncCallback);
|
||||
Con::addVariableNotify("$pref::Video::disableVerticalSync", clbk);
|
||||
Con::addVariableNotify("$pref::Video::enableVerticalSync", clbk);
|
||||
|
||||
//OpenGL 3 need a binded VAO for render
|
||||
GLuint vao;
|
||||
|
|
@ -200,7 +200,7 @@ void GFXGLDevice::initGLState()
|
|||
|
||||
void GFXGLDevice::vsyncCallback()
|
||||
{
|
||||
PlatformGL::setVSync(smDisableVSync ? 0 : 1);
|
||||
PlatformGL::setVSync(smEnableVSync);
|
||||
}
|
||||
|
||||
GFXGLDevice::GFXGLDevice(U32 adapterIndex) :
|
||||
|
|
|
|||
|
|
@ -776,55 +776,38 @@ IMPLEMENT_CONOBJECT(GuiGameSettingsCtrl);
|
|||
|
||||
void GuiGameSettingsCtrl::clickSlider(S32 xPos)
|
||||
{
|
||||
F32 xScale = (float)getWidth();
|
||||
RectI sliderRect;
|
||||
|
||||
S32 leftArrowX1 = mColumnSplit;
|
||||
S32 leftArrowX2 = leftArrowX1 + mArrowSize;
|
||||
S32 sliderOffset = 5;
|
||||
S32 height = getHeight();
|
||||
|
||||
S32 rightArrowX2 = getWidth() - mRightPad;
|
||||
S32 rightArrowX1 = rightArrowX2 - mArrowSize;
|
||||
RectI optionRect;
|
||||
|
||||
S32 sliderWidth = rightArrowX1 - leftArrowX2;
|
||||
sliderWidth *= 0.6; //remove the number text spacing
|
||||
sliderRect.point.x = mColumnSplit + mArrowSize;
|
||||
sliderRect.point.y = sliderOffset;
|
||||
|
||||
/*if ((leftArrowX1 <= xPos) && (xPos <= leftArrowX2))
|
||||
sliderRect.extent.x = (getWidth() - mRightPad - mArrowSize) - sliderRect.point.x;
|
||||
sliderRect.extent.y = height - sliderOffset * 2;
|
||||
|
||||
optionRect = sliderRect;
|
||||
|
||||
S32 textWidth = sliderRect.extent.x * 0.3;
|
||||
sliderRect.extent.x -= textWidth;
|
||||
|
||||
//Now adjust the bar to match-to our value
|
||||
|
||||
S32 barStart = sliderRect.point.x;
|
||||
S32 barEnd = sliderRect.point.x + sliderRect.extent.x;
|
||||
|
||||
if (xPos >= barStart && xPos <= barEnd)
|
||||
{
|
||||
mValue -= mStepSize;
|
||||
//find the position
|
||||
F32 newValue = (((xPos - barStart) * (mRange.y - mRange.x)) / (barEnd - barStart)) + mRange.x;
|
||||
|
||||
mValue = mRound(mValue / mStepSize) * mStepSize;
|
||||
|
||||
if (mValue < mRange.x)
|
||||
mValue = mRange.x;
|
||||
newValue = mRound(newValue / mStepSize) * mStepSize;
|
||||
|
||||
mValue = newValue;
|
||||
}
|
||||
else if ((rightArrowX1 <= xPos) && (xPos <= rightArrowX2))
|
||||
{
|
||||
//F32 snap = mValue % mStepSize;
|
||||
//mValue.y -= snap;
|
||||
|
||||
mValue += mStepSize;
|
||||
|
||||
mValue = mRound(mValue / mStepSize) * mStepSize;
|
||||
|
||||
if (mValue > mRange.y)
|
||||
mValue = mRange.y;
|
||||
}
|
||||
else
|
||||
{*/
|
||||
//see if we clicked on the sliderbar itself
|
||||
S32 barStart = leftArrowX2;
|
||||
S32 barEnd = barStart + sliderWidth;
|
||||
|
||||
if (xPos >= barStart && xPos <= barEnd)
|
||||
{
|
||||
//find the position
|
||||
F32 newValue = (((xPos - barStart) * (mRange.y - mRange.x)) / (barEnd - barStart)) + mRange.x;
|
||||
|
||||
newValue = mRound(newValue / mStepSize) * mStepSize;
|
||||
|
||||
mValue = newValue;
|
||||
}
|
||||
//}
|
||||
|
||||
onChange_callback();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,8 +87,8 @@ MaterialManager::MaterialManager()
|
|||
Con::addVariableNotify( "$pref::Video::disableNormalMapping", callabck2 );
|
||||
Con::setVariable( "$pref::Video::disableCubemapping", "false" );
|
||||
Con::addVariableNotify( "$pref::Video::disableCubemapping", callabck2 );
|
||||
Con::setVariable( "$pref::Video::disableParallaxMapping", "false" );
|
||||
Con::addVariableNotify( "$pref::Video::disableParallaxMapping", callabck2 );
|
||||
Con::setVariable( "$pref::Video::enableParallaxMapping", "true" );
|
||||
Con::addVariableNotify( "$pref::Video::enableParallaxMapping", callabck2 );
|
||||
}
|
||||
|
||||
MaterialManager::~MaterialManager()
|
||||
|
|
@ -472,7 +472,7 @@ void MaterialManager::recalcFeaturesFromPrefs()
|
|||
Con::getBoolVariable( "$pref::Video::disableCubemapping", false ) );
|
||||
|
||||
mExclusionFeatures.setFeature( MFT_Parallax,
|
||||
Con::getBoolVariable( "$pref::Video::disableParallaxMapping", false ) );
|
||||
!Con::getBoolVariable( "$pref::Video::enableParallaxMapping", true ) );
|
||||
}
|
||||
|
||||
bool MaterialManager::_handleGFXEvent( GFXDevice::GFXDeviceEventType event_ )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue