From f633ef3a3d3f9bce06b1970dccffc541676efbcf Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Sun, 9 Mar 2025 11:53:23 -0500 Subject: [PATCH] fill in the validated variables --- Engine/source/T3D/aiPlayer.cpp | 8 +- .../source/T3D/assets/ShapeAnimationAsset.cpp | 7 +- Engine/source/T3D/assets/SoundAsset.cpp | 42 ++--- Engine/source/T3D/assets/assetImporter.cpp | 8 +- Engine/source/T3D/camera.cpp | 2 +- Engine/source/T3D/debris.cpp | 33 ++-- Engine/source/T3D/decal/decalData.cpp | 20 +-- Engine/source/T3D/fps/guiHealthBarHud.cpp | 4 +- Engine/source/T3D/fps/guiHealthTextHud.cpp | 6 +- Engine/source/T3D/fps/guiShapeNameHud.cpp | 4 +- Engine/source/T3D/fx/explosion.cpp | 80 +++++---- Engine/source/T3D/fx/fxFoliageReplicator.cpp | 56 +++--- Engine/source/T3D/fx/fxShapeReplicator.cpp | 50 +++--- Engine/source/T3D/fx/groundCover.cpp | 60 +++---- Engine/source/T3D/fx/lightning.cpp | 10 +- Engine/source/T3D/fx/particle.cpp | 65 ++++--- Engine/source/T3D/fx/particleEmitter.cpp | 34 ++-- Engine/source/T3D/fx/particleEmitter.h | 2 +- Engine/source/T3D/fx/particleEmitterNode.cpp | 5 +- Engine/source/T3D/fx/precipitation.cpp | 34 ++-- Engine/source/T3D/fx/ribbon.cpp | 14 +- Engine/source/T3D/fx/splash.cpp | 32 ++-- Engine/source/T3D/gameBase/gameBase.cpp | 2 +- Engine/source/T3D/groundPlane.cpp | 8 +- Engine/source/T3D/guiObjectView.cpp | 8 +- Engine/source/T3D/item.cpp | 31 ++-- Engine/source/T3D/levelInfo.cpp | 20 +-- Engine/source/T3D/lightAnimData.cpp | 45 ++--- Engine/source/T3D/lightAnimData.h | 11 +- Engine/source/T3D/lightBase.cpp | 10 +- Engine/source/T3D/lightDescription.cpp | 14 +- Engine/source/T3D/lightFlareData.cpp | 8 +- .../T3D/lighting/boxEnvironmentProbe.cpp | 1 - .../source/T3D/lighting/reflectionProbe.cpp | 4 +- Engine/source/T3D/missionArea.cpp | 5 +- Engine/source/T3D/missionMarker.cpp | 2 +- Engine/source/T3D/physicalZone.cpp | 6 +- Engine/source/T3D/physics/physicsDebris.cpp | 24 +-- Engine/source/T3D/physics/physicsShape.cpp | 20 +-- Engine/source/T3D/player.cpp | 163 +++++++++--------- Engine/source/T3D/pointLight.cpp | 2 +- Engine/source/T3D/projectile.cpp | 18 +- Engine/source/T3D/proximityMine.cpp | 12 +- Engine/source/T3D/rigidShape.cpp | 48 +++--- Engine/source/T3D/sfx/sfxEmitter.cpp | 18 +- Engine/source/T3D/shapeBase.cpp | 29 ++-- Engine/source/T3D/shapeImage.cpp | 52 +++--- Engine/source/T3D/spotLight.cpp | 6 +- Engine/source/T3D/tsStatic.cpp | 12 +- Engine/source/T3D/turret/aiTurretShape.cpp | 18 +- Engine/source/T3D/turret/turretShape.cpp | 12 +- Engine/source/T3D/vehicles/flyingVehicle.cpp | 30 ++-- Engine/source/T3D/vehicles/guiSpeedometer.cpp | 12 +- Engine/source/T3D/vehicles/hoverVehicle.cpp | 38 ++-- Engine/source/T3D/vehicles/vehicle.cpp | 20 +-- Engine/source/T3D/vehicles/wheeledVehicle.cpp | 38 ++-- Engine/source/afx/afxEffectGroup.cpp | 10 +- Engine/source/afx/afxEffectWrapper.cpp | 29 ++-- Engine/source/afx/afxEffectron.cpp | 4 +- Engine/source/afx/afxMagicMissile.cpp | 39 +++-- Engine/source/afx/afxMagicSpell.cpp | 20 +-- Engine/source/afx/afxSelectron.cpp | 18 +- Engine/source/afx/ce/afxAnimClip.cpp | 4 +- Engine/source/afx/ce/afxAreaDamage.cpp | 6 +- Engine/source/afx/ce/afxAudioBank.cpp | 3 +- Engine/source/afx/ce/afxCameraShake.cpp | 4 +- Engine/source/afx/ce/afxDamage.cpp | 8 +- Engine/source/afx/ce/afxLightBase_T3D.cpp | 10 +- Engine/source/afx/ce/afxMachineGun.cpp | 3 +- Engine/source/afx/ce/afxModel.cpp | 8 +- Engine/source/afx/ce/afxParticleEmitter.cpp | 10 +- Engine/source/afx/ce/afxPhraseEffect.cpp | 4 +- Engine/source/afx/ce/afxPhysicalZone.cpp | 6 +- Engine/source/afx/ce/afxPlayerMovement.cpp | 2 +- Engine/source/afx/ce/afxPointLight_T3D.cpp | 2 +- Engine/source/afx/ce/afxSpotLight_T3D.cpp | 6 +- Engine/source/afx/ce/afxZodiac.cpp | 20 +-- Engine/source/afx/ce/afxZodiacPlane.cpp | 12 +- Engine/source/afx/ea/afxEA_Zodiac.cpp | 2 +- Engine/source/afx/forces/afxF_Drag.cpp | 4 +- Engine/source/afx/forces/afxF_Gravity.cpp | 2 +- Engine/source/afx/rpg/afxRPGMagicSpell.cpp | 6 +- Engine/source/afx/ui/afxGuiTextHud.cpp | 4 +- Engine/source/afx/util/afxParticlePool.cpp | 2 +- Engine/source/afx/util/afxPath.cpp | 8 +- .../source/afx/xm/afxXM_AltitudeConform.cpp | 2 +- Engine/source/afx/xm/afxXM_BoxAdapt.cpp | 2 +- Engine/source/afx/xm/afxXM_Freeze.cpp | 2 +- Engine/source/afx/xm/afxXM_GroundConform.cpp | 2 +- Engine/source/afx/xm/afxXM_Oscillate.cpp | 2 +- .../afx/xm/afxXM_OscillateZodiacColor.cpp | 2 +- Engine/source/afx/xm/afxXM_RandomRot.cpp | 8 +- Engine/source/afx/xm/afxXM_Shockwave.cpp | 2 +- Engine/source/afx/xm/afxXM_Spin.cpp | 8 +- Engine/source/afx/xm/afxXM_VelocityOffset.cpp | 2 +- Engine/source/afx/xm/afxXM_WaveBase.cpp | 18 +- Engine/source/afx/xm/afxXfmMod.cpp | 10 +- Engine/source/environment/VolumetricFog.cpp | 16 +- Engine/source/environment/basicClouds.cpp | 6 +- Engine/source/environment/cloudLayer.cpp | 12 +- Engine/source/environment/decalRoad.cpp | 7 +- .../editors/guiMeshRoadEditorCtrl.cpp | 4 +- .../editors/guiRiverEditorCtrl.cpp | 4 +- .../environment/editors/guiRoadEditorCtrl.cpp | 2 +- Engine/source/environment/meshRoad.cpp | 7 +- Engine/source/environment/river.cpp | 11 +- Engine/source/environment/scatterSky.cpp | 31 ++-- Engine/source/environment/skyBox.cpp | 2 +- Engine/source/environment/skySphere.cpp | 2 +- Engine/source/environment/sun.cpp | 10 +- Engine/source/environment/timeOfDay.cpp | 15 +- Engine/source/environment/waterBlock.cpp | 12 +- Engine/source/environment/waterObject.cpp | 74 ++++---- Engine/source/environment/waterPlane.cpp | 5 +- .../forest/editor/forestBrushElement.cpp | 24 +-- .../source/forest/editor/forestBrushTool.cpp | 14 +- Engine/source/forest/forest.cpp | 2 +- Engine/source/forest/forestItem.cpp | 20 +-- Engine/source/forest/forestWindEmitter.cpp | 18 +- Engine/source/gui/3d/guiTSControl.cpp | 6 +- .../source/gui/buttons/guiIconButtonCtrl.cpp | 4 +- .../gui/containers/guiAutoScrollCtrl.cpp | 8 +- .../gui/containers/guiCtrlArrayCtrl.cpp | 8 +- .../gui/containers/guiDragAndDropCtrl.cpp | 3 + .../containers/guiDynamicCtrlArrayCtrl.cpp | 12 +- Engine/source/gui/containers/guiFrameCtrl.cpp | 4 +- .../source/gui/containers/guiRolloutCtrl.cpp | 2 +- .../source/gui/containers/guiScrollCtrl.cpp | 2 +- .../gui/containers/guiSplitContainer.cpp | 4 +- .../source/gui/containers/guiSplitContainer.h | 2 +- Engine/source/gui/containers/guiStackCtrl.cpp | 2 +- .../source/gui/containers/guiTabBookCtrl.cpp | 34 +++- .../source/gui/containers/guiWindowCtrl.cpp | 2 +- .../source/gui/controls/guiAnimBitmapCtrl.cpp | 22 ++- .../source/gui/controls/guiBitmapBarCtrl.cpp | 2 +- Engine/source/gui/controls/guiBitmapCtrl.cpp | 2 +- Engine/source/gui/controls/guiColorPicker.cpp | 24 ++- .../gui/controls/guiGameListMenuCtrl.cpp | 5 +- .../gui/controls/guiGameListOptionsCtrl.cpp | 4 +- .../gui/controls/guiGameSettingsCtrl.cpp | 7 +- Engine/source/gui/controls/guiMLTextCtrl.cpp | 9 +- Engine/source/gui/controls/guiPopUpCtrl.cpp | 2 +- Engine/source/gui/controls/guiPopUpCtrlEx.cpp | 5 +- Engine/source/gui/controls/guiTextCtrl.cpp | 2 +- .../source/gui/controls/guiTextEditCtrl.cpp | 3 +- .../gui/controls/guiTextEditSliderCtrl.cpp | 2 + .../source/gui/controls/guiTextListCtrl.cpp | 3 +- .../source/gui/controls/guiTreeViewCtrl.cpp | 4 +- Engine/source/gui/core/guiControl.cpp | 3 +- Engine/source/gui/core/guiTypes.cpp | 7 +- Engine/source/gui/editor/guiEaseViewCtrl.cpp | 2 +- Engine/source/gui/editor/guiEditCtrl.cpp | 2 +- Engine/source/gui/editor/guiFilterCtrl.cpp | 3 +- Engine/source/gui/editor/guiGraphCtrl.cpp | 4 +- Engine/source/gui/editor/guiMenuBar.cpp | 5 +- Engine/source/gui/editor/guiRectHandles.cpp | 3 +- Engine/source/gui/editor/guiSeparatorCtrl.cpp | 5 +- .../source/gui/editor/guiShapeEdPreview.cpp | 2 +- .../source/gui/game/guiFadeinBitmapCtrl.cpp | 6 +- .../gui/game/guiIdleCamFadeBitmapCtrl.cpp | 5 +- .../source/gui/game/guiMessageVectorCtrl.cpp | 7 +- .../gui/shaderEditor/guiShaderEditor.cpp | 2 +- Engine/source/gui/shiny/guiAudioCtrl.cpp | 11 +- Engine/source/gui/worldEditor/editTSCtrl.cpp | 13 +- .../materials/customMaterialDefinition.cpp | 2 +- .../source/materials/materialDefinition.cpp | 74 ++++---- Engine/source/materials/materialDefinition.h | 6 +- Engine/source/materials/shaderData.cpp | 3 +- Engine/source/navigation/coverPoint.cpp | 2 +- Engine/source/navigation/navMesh.cpp | 45 ++--- Engine/source/navigation/navPath.cpp | 2 +- Engine/source/postFx/postEffect.cpp | 2 +- .../renderInstance/renderBinManager.cpp | 4 +- Engine/source/scene/reflector.cpp | 14 +- Engine/source/scene/sceneObject.cpp | 4 +- Engine/source/scene/simPath.cpp | 13 +- Engine/source/scene/zones/sceneSimpleZone.cpp | 16 +- Engine/source/sfx/sfxAmbience.cpp | 4 +- Engine/source/sfx/sfxDescription.cpp | 69 ++++---- Engine/source/sfx/sfxEnvironment.cpp | 47 ++--- Engine/source/sfx/sfxPlayList.cpp | 27 +-- Engine/source/sfx/sfxPlayList.h | 5 + Engine/source/terrain/terrData.cpp | 4 +- Engine/source/terrain/terrMaterial.cpp | 26 +-- 184 files changed, 1359 insertions(+), 1216 deletions(-) diff --git a/Engine/source/T3D/aiPlayer.cpp b/Engine/source/T3D/aiPlayer.cpp index abc84435c..7548cc282 100644 --- a/Engine/source/T3D/aiPlayer.cpp +++ b/Engine/source/T3D/aiPlayer.cpp @@ -136,27 +136,27 @@ void AIPlayer::initPersistFields() docsURL; addGroup( "AI" ); - addField( "mMoveTolerance", TypeF32, Offset( mMoveTolerance, AIPlayer ), + addFieldV( "mMoveTolerance", TypeRangedF32, Offset( mMoveTolerance, AIPlayer ), &CommonValidators::PositiveFloat, "@brief Distance from destination before stopping.\n\n" "When the AIPlayer is moving to a given destination it will move to within " "this distance of the destination and then stop. By providing this tolerance " "it helps the AIPlayer from never reaching its destination due to minor obstacles, " "rounding errors on its position calculation, etc. By default it is set to 0.25.\n"); - addField( "moveStuckTolerance", TypeF32, Offset( mMoveStuckTolerance, AIPlayer ), + addFieldV( "moveStuckTolerance", TypeRangedF32, Offset( mMoveStuckTolerance, AIPlayer ), &CommonValidators::PositiveFloat, "@brief Distance tolerance on stuck check.\n\n" "When the AIPlayer is moving to a given destination, if it ever moves less than " "this tolerance during a single tick, the AIPlayer is considered stuck. At this point " "the onMoveStuck() callback is called on the datablock.\n"); - addField( "moveStuckTestDelay", TypeS32, Offset( mMoveStuckTestDelay, AIPlayer ), + addFieldV( "moveStuckTestDelay", TypeRangedS32, Offset( mMoveStuckTestDelay, AIPlayer ), &CommonValidators::PositiveInt, "@brief The number of ticks to wait before testing if the AIPlayer is stuck.\n\n" "When the AIPlayer is asked to move, this property is the number of ticks to wait " "before the AIPlayer starts to check if it is stuck. This delay allows the AIPlayer " "to accelerate to full speed without its initial slow start being considered as stuck.\n" "@note Set to zero to have the stuck test start immediately.\n"); - addField( "AttackRadius", TypeF32, Offset( mAttackRadius, AIPlayer ), + addFieldV( "AttackRadius", TypeRangedF32, Offset( mAttackRadius, AIPlayer ), &CommonValidators::PositiveFloat, "@brief Distance considered in firing range for callback purposes."); endGroup( "AI" ); diff --git a/Engine/source/T3D/assets/ShapeAnimationAsset.cpp b/Engine/source/T3D/assets/ShapeAnimationAsset.cpp index e84283734..160951627 100644 --- a/Engine/source/T3D/assets/ShapeAnimationAsset.cpp +++ b/Engine/source/T3D/assets/ShapeAnimationAsset.cpp @@ -45,6 +45,7 @@ // Debug Profiling. #include "platform/profiler.h" +#include "console/typeValidators.h" //----------------------------------------------------------------------------- IMPLEMENT_CONOBJECT(ShapeAnimationAsset); @@ -133,10 +134,10 @@ void ShapeAnimationAsset::initPersistFields() addField("isBlend", TypeBool, Offset(mIsBlend, ShapeAnimationAsset), "Is this animation blended with another?"); addField("blendRefAnimation", TypeString, Offset(mBlendAnimAssetName, ShapeAnimationAsset), "AssetID of the animation to reference for our blending"); - addField("blendFrame", TypeS32, Offset(mBlendFrame, ShapeAnimationAsset), "Which frame of the reference animation do we use for our blending"); + addFieldV("blendFrame", TypeRangedS32, Offset(mBlendFrame, ShapeAnimationAsset), &CommonValidators::PositiveInt, "Which frame of the reference animation do we use for our blending"); - addField("startFrame", TypeS32, Offset(mStartFrame, ShapeAnimationAsset), "What frame does this animation clip start on"); - addField("endFrame", TypeS32, Offset(mEndFrame, ShapeAnimationAsset), "What fram does this animation clip end on"); + addFieldV("startFrame", TypeRangedS32, Offset(mStartFrame, ShapeAnimationAsset), &CommonValidators::PositiveInt, "What frame does this animation clip start on"); + addFieldV("endFrame", TypeRangedS32, Offset(mEndFrame, ShapeAnimationAsset), &CommonValidators::PositiveInt, "What fram does this animation clip end on"); addField("padRotation", TypeBool, Offset(mPadRotation, ShapeAnimationAsset), "Are the rotation values padded"); addField("padTransforms", TypeBool, Offset(mPadTransforms, ShapeAnimationAsset), "Are the transform values padded"); } diff --git a/Engine/source/T3D/assets/SoundAsset.cpp b/Engine/source/T3D/assets/SoundAsset.cpp index a71c08f5b..dc7b4c6f9 100644 --- a/Engine/source/T3D/assets/SoundAsset.cpp +++ b/Engine/source/T3D/assets/SoundAsset.cpp @@ -53,6 +53,7 @@ #include "sfx/sfxTypes.h" #include "SoundAssetInspectors.h" +#include "console/typeValidators.h" //----------------------------------------------------------------------------- @@ -184,7 +185,6 @@ SoundAsset::~SoundAsset() } //----------------------------------------------------------------------------- - void SoundAsset::initPersistFields() { docsURL; @@ -207,55 +207,55 @@ void SoundAsset::initPersistFields() "Behavior when moving out of this slot.\n" "After the #detailTimeOut has expired (if any), this slot determines what the controller " "will do before moving on to the next slot."); - addField("delayTimeIn", TypeF32, Offset(mPlaylist.mSlots.mDelayTimeIn.mValue, SoundAsset), SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, + addFieldV("delayTimeIn", TypeRangedF32, Offset(mPlaylist.mSlots.mDelayTimeIn.mValue, SoundAsset), &CommonValidators::PositiveFloat, SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, "Seconds to wait after moving into slot before #transitionIn."); addField("delayTimeInVariance", TypePoint2F, Offset(mPlaylist.mSlots.mDelayTimeIn.mVariance, SoundAsset), SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, "Bounds on randomization of #delayTimeIn.\n\n" "@ref SFXPlayList_randomization\n"); - addField("delayTimeOut", TypeF32, Offset(mPlaylist.mSlots.mDelayTimeOut.mValue, SoundAsset), SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, + addFieldV("delayTimeOut", TypeRangedF32, Offset(mPlaylist.mSlots.mDelayTimeOut.mValue, SoundAsset), &CommonValidators::PositiveFloat, SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, "Seconds to wait before moving out of slot after #transitionOut."); addField("delayTimeOutVariance", TypePoint2F, Offset(mPlaylist.mSlots.mDelayTimeOut.mVariance, SoundAsset), SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, "Bounds on randomization of #delayTimeOut.\n\n" "@ref SFXPlayList_randomization\n"); - addField("fadeTimeIn", TypeF32, Offset(mPlaylist.mSlots.mFadeTimeIn.mValue, SoundAsset), SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, + addFieldV("fadeTimeIn", TypeRangedF32, Offset(mPlaylist.mSlots.mFadeTimeIn.mValue, SoundAsset), &CommonValidators::PositiveFloat, SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, "Seconds to fade sound in (-1 to use the track's own fadeInTime.)\n" "@see SFXDescription::fadeTimeIn"); addField("fadeTimeInVariance", TypePoint2F, Offset(mPlaylist.mSlots.mFadeTimeIn.mVariance, SoundAsset), SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, "Bounds on randomization of #fadeInTime.\n\n" "@ref SFXPlayList_randomization\n"); - addField("fadeTimeOut", TypeF32, Offset(mPlaylist.mSlots.mFadeTimeOut.mValue, SoundAsset), SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, + addFieldV("fadeTimeOut", TypeRangedF32, Offset(mPlaylist.mSlots.mFadeTimeOut.mValue, SoundAsset), &CommonValidators::PositiveFloat, SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, "Seconds to fade sound out (-1 to use the track's own fadeOutTime.)\n" "@see SFXDescription::fadeTimeOut"); addField("fadeTimeOutVariance", TypePoint2F, Offset(mPlaylist.mSlots.mFadeTimeOut.mVariance, SoundAsset), SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, "Bounds on randomization of #fadeOutTime\n\n" "@ref SFXPlayList_randomization\n"); - addField("referenceDistance", TypeF32, Offset(mPlaylist.mSlots.mMinDistance.mValue, SoundAsset), SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, + addFieldV("referenceDistance", TypeRangedF32, Offset(mPlaylist.mSlots.mMinDistance.mValue, SoundAsset), &CommonValidators::PositiveFloat, SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, "@c referenceDistance to set for 3D sounds in this slot (<1 to use @c referenceDistance of track's own description).\n" "@see SFXDescription::referenceDistance"); addField("referenceDistanceVariance", TypePoint2F, Offset(mPlaylist.mSlots.mMinDistance.mVariance, SoundAsset), SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, "Bounds on randomization of #referenceDistance.\n\n" "@ref SFXPlayList_randomization\n"); - addField("maxDistance", TypeF32, Offset(mPlaylist.mSlots.mMaxDistance.mValue, SoundAsset), SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, + addFieldV("maxDistance", TypeRangedF32, Offset(mPlaylist.mSlots.mMaxDistance.mValue, SoundAsset), &CommonValidators::PositiveFloat, SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, "@c maxDistance to apply to 3D sounds in this slot (<1 to use @c maxDistance of track's own description).\n" "@see SFXDescription::maxDistance"); addField("maxDistanceVariance", TypePoint2F, Offset(mPlaylist.mSlots.mMaxDistance.mVariance, SoundAsset), SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, "Bounds on randomization of #maxDistance.\n\n" "@ref SFXPlayList_randomization\n"); - addField("volumeScale", TypeF32, Offset(mPlaylist.mSlots.mVolumeScale.mValue, SoundAsset), SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, + addFieldV("volumeScale", TypeRangedF32, Offset(mPlaylist.mSlots.mVolumeScale.mValue, SoundAsset), &CommonValidators::PositiveFloat, SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, "Scale factor to apply to volume of sounds played on this list slot.\n" "This value will scale the actual volume level set on the track assigned to the slot, i.e. a value of 0.5 will " "cause the track to play at half-volume."); addField("volumeScaleVariance", TypePoint2F, Offset(mPlaylist.mSlots.mVolumeScale.mVariance, SoundAsset), SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, "Bounds on randomization of #volumeScale.\n\n" "@ref SFXPlayList_randomization\n"); - addField("pitchScale", TypeF32, Offset(mPlaylist.mSlots.mPitchScale.mValue, SoundAsset), SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, + addFieldV("pitchScale", TypeRangedF32, Offset(mPlaylist.mSlots.mPitchScale.mValue, SoundAsset), &CommonValidators::PositiveFloat, SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, "Scale factor to apply to pitch of sounds played on this list slot.\n" "This value will scale the actual pitch set on the track assigned to the slot, i.e. a value of 0.5 will " "cause the track to play at half its assigned speed."); addField("pitchScaleVariance", TypePoint2F, Offset(mPlaylist.mSlots.mPitchScale.mVariance, SoundAsset), SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, "Bounds on randomization of #pitchScale.\n\n" "@ref SFXPlayList_randomization\n"); - addField("repeatCount", TypeS32, Offset(mPlaylist.mSlots.mRepeatCount, SoundAsset), SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, + addFieldV("repeatCount", TypeRangedS32, Offset(mPlaylist.mSlots.mRepeatCount, SoundAsset), &CommonValidators::PositiveInt, SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, "Number of times to loop this slot."); addField("state", TypeSFXStateName, Offset(mPlaylist.mSlots.mState, SoundAsset), SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, "State that must be active for this slot to play.\n\n" @@ -267,8 +267,8 @@ void SoundAsset::initPersistFields() endGroup("SoundSlots"); addGroup("General Profile"); - addField("pitchAdjust", TypeF32, Offset(mProfileDesc.mPitch, SoundAsset), "Adjustment of the pitch value 1 is default."); - addField("volumeAdjust", TypeF32, Offset(mProfileDesc.mVolume, SoundAsset), "Adjustment to the volume."); + addFieldV("pitchAdjust", TypeRangedF32, Offset(mProfileDesc.mPitch, SoundAsset), &CommonValidators::PositiveFloat, "Adjustment of the pitch value 1 is default."); + addFieldV("volumeAdjust", TypeRangedF32, Offset(mProfileDesc.mVolume, SoundAsset), &CommonValidators::PositiveFloat, "Adjustment to the volume."); addField("is3D", TypeBool, Offset(mProfileDesc.mIs3D, SoundAsset), "Set this sound to 3D."); addField("isLooping", TypeBool, Offset(mProfileDesc.mIsLooping, SoundAsset), "Does this sound loop."); // if streaming, a default packet size should be chosen for all sounds. @@ -280,27 +280,27 @@ void SoundAsset::initPersistFields() endGroup("General Profile"); addGroup("Fading"); - addField("fadeInTime", TypeF32, Offset(mProfileDesc.mFadeInTime, SoundAsset), "Number of seconds to gradually fade in volume from zero when playback starts."); - addField("fadeOutTime", TypeF32, Offset(mProfileDesc.mFadeOutTime, SoundAsset), "Number of seconds to gradually fade out volume down to zero when playback is stopped or paused."); + addFieldV("fadeInTime", TypeRangedF32, Offset(mProfileDesc.mFadeInTime, SoundAsset), &CommonValidators::PositiveFloat, "Number of seconds to gradually fade in volume from zero when playback starts."); + addFieldV("fadeOutTime", TypeRangedF32, Offset(mProfileDesc.mFadeOutTime, SoundAsset), &CommonValidators::PositiveFloat, "Number of seconds to gradually fade out volume down to zero when playback is stopped or paused."); addField("fadeInEase", TypeEaseF, Offset(mProfileDesc.mFadeInEase, SoundAsset), "Easing curve for fade-in transition."); addField("fadeOutEase", TypeEaseF, Offset(mProfileDesc.mFadeOutEase, SoundAsset), "Easing curve for fade-out transition."); addField("fadeLoops", TypeBool, Offset(mProfileDesc.mFadeLoops, SoundAsset), "Fade each cycle of a loop in and/or out; otherwise only fade-in first cycle."); endGroup("Fading"); addGroup("3D"); - addField("minDistance", TypeF32, Offset(mProfileDesc.mMinDistance, SoundAsset), "Minimum distance for sound."); - addField("maxDistance", TypeF32, Offset(mProfileDesc.mMaxDistance, SoundAsset), "Max distance for sound."); - addField("coneInsideAngle", TypeS32, Offset(mProfileDesc.mConeInsideAngle, SoundAsset), "Cone inside angle."); - addField("coneOutsideAngle", TypeS32, Offset(mProfileDesc.mConeOutsideAngle, SoundAsset), "Cone outside angle."); - addField("coneOutsideVolume", TypeF32, Offset(mProfileDesc.mConeOutsideVolume, SoundAsset), "Cone outside volume."); - addField("rolloffFactor", TypeF32, Offset(mProfileDesc.mRolloffFactor, SoundAsset), "Rolloff factor."); + addFieldV("minDistance", TypeRangedF32, Offset(mProfileDesc.mMinDistance, SoundAsset), &CommonValidators::PositiveFloat, "Minimum distance for sound."); + addFieldV("maxDistance", TypeRangedF32, Offset(mProfileDesc.mMaxDistance, SoundAsset), &CommonValidators::PositiveFloat, "Max distance for sound."); + addFieldV("coneInsideAngle", TypeRangedS32, Offset(mProfileDesc.mConeInsideAngle, SoundAsset), &CommonValidators::S32_PosDegreeRange, "Cone inside angle."); + addFieldV("coneOutsideAngle", TypeRangedS32, Offset(mProfileDesc.mConeOutsideAngle, SoundAsset), &CommonValidators::S32_PosDegreeRange, "Cone outside angle."); + addFieldV("coneOutsideVolume", TypeRangedF32, Offset(mProfileDesc.mConeOutsideVolume, SoundAsset), &CommonValidators::NormalizedFloat, "Cone outside volume."); + addFieldV("rolloffFactor", TypeRangedF32, Offset(mProfileDesc.mRolloffFactor, SoundAsset), &CommonValidators::PositiveFloat, "Rolloff factor."); addField("scatterDistance", TypePoint3F, Offset(mProfileDesc.mScatterDistance, SoundAsset), "Randomization to the spacial position of the sound."); endGroup("3D"); addGroup("Playlist settings"); addField("random", TYPEID< SFXPlayList::ERandomMode >(), Offset(mPlaylist.mRandomMode, SoundAsset), "Slot playback order randomization pattern."); addField("loopMode", TYPEID< SFXPlayList::ELoopMode >(), Offset(mPlaylist.mLoopMode, SoundAsset), "Behavior when description has looping enabled."); - addField("numSlotsToPlay", TypeS32, Offset(mPlaylist.mNumSlotsToPlay, SoundAsset), "Number of slots to play."); + addFieldV("numSlotsToPlay", TypeRangedS32, Offset(mPlaylist.mNumSlotsToPlay, SoundAsset), &playlistSlotRange, "Number of slots to play."); addField("trace", TypeBool, Offset(mPlaylist.mTrace, SoundAsset), "Enable/disable execution tracing for this playlist (local only)."); endGroup("Playlist settings"); } diff --git a/Engine/source/T3D/assets/assetImporter.cpp b/Engine/source/T3D/assets/assetImporter.cpp index dd529cd7f..ae179e195 100644 --- a/Engine/source/T3D/assets/assetImporter.cpp +++ b/Engine/source/T3D/assets/assetImporter.cpp @@ -153,7 +153,7 @@ void AssetImportConfig::initPersistFields() addField("DoUpAxisOverride", TypeBool, Offset(DoUpAxisOverride, AssetImportConfig), "Indicates if the up axis in the model file should be overridden"); addField("UpAxisOverride", TypeRealString, Offset(UpAxisOverride, AssetImportConfig), "If overriding, what axis should be used as up. Options are X_AXIS, Y_AXIS, Z_AXIS"); addField("DoScaleOverride", TypeBool, Offset(DoScaleOverride, AssetImportConfig), "Indicates if the scale in the model file should be overridden"); - addField("ScaleOverride", TypeF32, Offset(ScaleOverride, AssetImportConfig), "If overriding, what scale should be used"); + addFieldV("ScaleOverride", TypeRangedF32, Offset(ScaleOverride, AssetImportConfig), &CommonValidators::PositiveFloat, "If overriding, what scale should be used"); addField("IgnoreNodeScale", TypeBool, Offset(IgnoreNodeScale, AssetImportConfig), "Indicates if scale of nodes should be ignored"); addField("AdjustCenter", TypeBool, Offset(AdjustCenter, AssetImportConfig), "Indicates if the center of the model file should be automatically recentered"); addField("AdjustFloor", TypeBool, Offset(AdjustFloor, AssetImportConfig), "Indicates if the floor height of the model file should be automatically zero'd"); @@ -223,15 +223,15 @@ void AssetImportConfig::initPersistFields() addField("UseMips", TypeBool, Offset(UseMips, AssetImportConfig), "Indicates if images imported with this configuration utilize mipmaps"); addField("IsHDR", TypeBool, Offset(IsHDR, AssetImportConfig), "Indicates if images imported with this configuration are in an HDR format"); - addField("Scaling", TypeF32, Offset(Scaling, AssetImportConfig), "Indicates what amount of scaling images imported with this configuration use"); + addFieldV("Scaling", TypeRangedF32, Offset(Scaling, AssetImportConfig), &CommonValidators::PositiveFloat, "Indicates what amount of scaling images imported with this configuration use"); addField("ImagesCompressed", TypeBool, Offset(ImagesCompressed, AssetImportConfig), "Indicates if images imported with this configuration are compressed"); addField("GenerateMaterialOnImport", TypeBool, Offset(GenerateMaterialOnImport, AssetImportConfig), "Indicates if images imported with this configuration generate a parent material for it as well"); endGroup("Images"); addGroup("Sounds"); addField("importSounds", TypeBool, Offset(importSounds, AssetImportConfig), "Indicates if sounds are imported with this configuration"); - addField("VolumeAdjust", TypeF32, Offset(VolumeAdjust, AssetImportConfig), "Indicates what amount the volume is adjusted on sounds imported with this configuration"); - addField("PitchAdjust", TypeF32, Offset(PitchAdjust, AssetImportConfig), "Indicates what amount the pitch is adjusted on sounds imported with this configuration"); + addFieldV("VolumeAdjust", TypeRangedF32, Offset(VolumeAdjust, AssetImportConfig), &CommonValidators::PositiveFloat, "Indicates what amount the volume is adjusted on sounds imported with this configuration"); + addFieldV("PitchAdjust", TypeRangedF32, Offset(PitchAdjust, AssetImportConfig), &CommonValidators::PositiveFloat, "Indicates what amount the pitch is adjusted on sounds imported with this configuration"); addField("SoundsCompressed", TypeBool, Offset(SoundsCompressed, AssetImportConfig), "Indicates if sounds imported with this configuration are compressed"); endGroup("Sounds"); } diff --git a/Engine/source/T3D/camera.cpp b/Engine/source/T3D/camera.cpp index 4d235f754..41056f833 100644 --- a/Engine/source/T3D/camera.cpp +++ b/Engine/source/T3D/camera.cpp @@ -1322,7 +1322,7 @@ void Camera::initPersistFields() "Apply smoothing (acceleration and damping) to camera rotations." ); addProtectedField( "mass", TypeF32, Offset(mMass, Camera), &_setNewtonField, &defaultProtectedGetFn, "The camera's mass (Newton mode only). Default value is 10." ); - addProtectedField( "drag", TypeF32, Offset(mDrag, Camera), &_setNewtonField, &defaultProtectedGetFn, + addProtectedFieldV( "drag", TypeRangedF32, Offset(mDrag, Camera), &_setNewtonField, &defaultProtectedGetFn, &CommonValidators::PositiveNonZeroFloat, "Drag on camera when moving (Newton mode only). Default value is 2." ); addProtectedField( "force", TypeF32, Offset(mFlyForce, Camera), &_setNewtonField, &defaultProtectedGetFn, "Force applied on camera when asked to move (Newton mode only). Default value is 500." ); diff --git a/Engine/source/T3D/debris.cpp b/Engine/source/T3D/debris.cpp index 58a4373fb..7c05e3ec5 100644 --- a/Engine/source/T3D/debris.cpp +++ b/Engine/source/T3D/debris.cpp @@ -293,6 +293,11 @@ bool DebrisData::preload(bool server, String &errorStr) return true; } +FRangeValidator debElasticityRange(-10.0f, 10.0f); +FRangeValidator debFrictionRange(-10.0f, 10.0f); +IRangeValidator debBounceRange(0, 10000); +FRangeValidator debSpinSpeedRange(-10000.0f, 10000.0f); +FRangeValidator debLifetimeRange(0.0f, 1000.0f); void DebrisData::initPersistFields() { docsURL; @@ -312,33 +317,33 @@ void DebrisData::initPersistFields() endGroup("Datablocks"); addGroup("Physics"); - addField("elasticity", TypeF32, Offset(elasticity, DebrisData), + addFieldV("elasticity", TypeRangedF32, Offset(elasticity, DebrisData), &debElasticityRange, "@brief A floating-point value specifying how 'bouncy' this object is.\n\nMust be in the range of -10 to 10.\n"); - addField("friction", TypeF32, Offset(friction, DebrisData), + addFieldV("friction", TypeRangedF32, Offset(friction, DebrisData), &debFrictionRange, "@brief A floating-point value specifying how much velocity is lost to impact and sliding friction.\n\nMust be in the range of -10 to 10.\n"); - addField("numBounces", TypeS32, Offset(numBounces, DebrisData), + addFieldV("numBounces", TypeRangedS32, Offset(numBounces, DebrisData), &debBounceRange, "@brief How many times to allow this debris object to bounce until it either explodes, becomes static or snaps (defined in explodeOnMaxBounce, staticOnMaxBounce, snapOnMaxBounce).\n\n" "Must be within the range of 0 to 10000.\n" "@see bounceVariance\n"); - addField("bounceVariance", TypeS32, Offset(bounceVariance, DebrisData), + addFieldV("bounceVariance", TypeRangedS32, Offset(bounceVariance, DebrisData), &debBounceRange, "@brief Allowed variance in the value of numBounces.\n\nMust be less than numBounces.\n@see numBounces\n"); - addField("minSpinSpeed", TypeF32, Offset(minSpinSpeed, DebrisData), + addFieldV("minSpinSpeed", TypeRangedF32, Offset(minSpinSpeed, DebrisData),&debSpinSpeedRange, "@brief Minimum speed that this debris object will rotate.\n\nMust be in the range of -10000 to 1000, and must be less than maxSpinSpeed.\n@see maxSpinSpeed\n"); - addField("maxSpinSpeed", TypeF32, Offset(maxSpinSpeed, DebrisData), + addFieldV("maxSpinSpeed", TypeRangedF32, Offset(maxSpinSpeed, DebrisData), &debSpinSpeedRange, "@brief Maximum speed that this debris object will rotate.\n\nMust be in the range of -10000 to 10000.\n@see minSpinSpeed\n"); - addField("gravModifier", TypeF32, Offset(gravModifier, DebrisData), "How much gravity affects debris."); - addField("terminalVelocity", TypeF32, Offset(terminalVelocity, DebrisData), "Max velocity magnitude."); - addField("velocity", TypeF32, Offset(velocity, DebrisData), + addFieldV("gravModifier", TypeRangedF32, Offset(gravModifier, DebrisData), &CommonValidators::F32Range, "How much gravity affects debris."); + addFieldV("terminalVelocity", TypeRangedF32, Offset(terminalVelocity, DebrisData), &CommonValidators::PositiveFloat, "Max velocity magnitude."); + addFieldV("velocity", TypeRangedF32, Offset(velocity, DebrisData), &CommonValidators::PositiveFloat, "@brief Speed at which this debris object will move.\n\n@see velocityVariance\n"); - addField("velocityVariance", TypeF32, Offset(velocityVariance, DebrisData), + addFieldV("velocityVariance", TypeRangedF32, Offset(velocityVariance, DebrisData), &CommonValidators::PositiveFloat, "@brief Allowed variance in the value of velocity\n\nMust be less than velocity.\n@see velocity\n"); - addField("lifetime", TypeF32, Offset(lifetime, DebrisData), + addFieldV("lifetime", TypeRangedF32, Offset(lifetime, DebrisData), &debLifetimeRange, "@brief Amount of time until this debris object is destroyed.\n\nMust be in the range of 0 to 1000.\n@see lifetimeVariance"); - addField("lifetimeVariance", TypeF32, Offset(lifetimeVariance, DebrisData), + addFieldV("lifetimeVariance", TypeRangedF32, Offset(lifetimeVariance, DebrisData), &debLifetimeRange, "@brief Allowed variance in the value of lifetime.\n\nMust be less than lifetime.\n@see lifetime\n"); addField("useRadiusMass", TypeBool, Offset(useRadiusMass, DebrisData), "@brief Use mass calculations based on radius.\n\nAllows for the adjustment of elasticity and friction based on the Debris size.\n@see baseRadius\n"); - addField("baseRadius", TypeF32, Offset(baseRadius, DebrisData), + addFieldV("baseRadius", TypeRangedF32, Offset(baseRadius, DebrisData), &CommonValidators::PositiveFloat, "@brief Radius at which the standard elasticity and friction apply.\n\nOnly used when useRaduisMass is true.\n@see useRadiusMass.\n"); endGroup("Physics"); @@ -571,7 +576,7 @@ void Debris::initPersistFields() docsURL; addGroup( "Debris" ); - addField( "lifetime", TypeF32, Offset(mLifetime, Debris), + addFieldV( "lifetime", TypeRangedF32, Offset(mLifetime, Debris), &CommonValidators::PositiveFloat, "@brief Length of time for this debris object to exist. When expired, the object will be deleted.\n\n" "The initial lifetime value comes from the DebrisData datablock.\n" "@see DebrisData::lifetime\n" diff --git a/Engine/source/T3D/decal/decalData.cpp b/Engine/source/T3D/decal/decalData.cpp index 371de1294..30e61cf28 100644 --- a/Engine/source/T3D/decal/decalData.cpp +++ b/Engine/source/T3D/decal/decalData.cpp @@ -141,15 +141,15 @@ void DecalData::initPersistFields() docsURL; addGroup( "Decal" ); - addField( "size", TypeF32, Offset( size, DecalData ), + addFieldV( "size", TypeRangedF32, Offset( size, DecalData ), &CommonValidators::PositiveFloat, "Width and height of the decal in meters before scale is applied." ); INITPERSISTFIELD_MATERIALASSET(Material, DecalData, "Material to use for this decal."); - addField( "lifeSpan", TypeS32, Offset( lifeSpan, DecalData ), + addFieldV( "lifeSpan", TypeRangedS32, Offset( lifeSpan, DecalData ), &CommonValidators::PositiveInt, "Time (in milliseconds) before this decal will be automatically deleted." ); - addField( "fadeTime", TypeS32, Offset( fadeTime, DecalData ), + addFieldV( "fadeTime", TypeRangedS32, Offset( fadeTime, DecalData ), &CommonValidators::PositiveInt, "@brief Time (in milliseconds) over which to fade out the decal before " "deleting it at the end of its lifetime.\n\n" "@see lifeSpan" ); @@ -158,13 +158,13 @@ void DecalData::initPersistFields() addGroup( "Rendering" ); - addField( "fadeStartPixelSize", TypeF32, Offset( fadeStartPixelSize, DecalData ), + addFieldV( "fadeStartPixelSize", TypeRangedF32, Offset( fadeStartPixelSize, DecalData ), &CommonValidators::NegDefaultF32, "@brief LOD value - size in pixels at which decals of this type begin " "to fade out.\n\n" "This should be a larger value than #fadeEndPixelSize. However, you may " "also set this to a negative value to disable lod-based fading." ); - addField( "fadeEndPixelSize", TypeF32, Offset( fadeEndPixelSize, DecalData ), + addFieldV( "fadeEndPixelSize", TypeRangedF32, Offset( fadeEndPixelSize, DecalData ), &CommonValidators::PositiveFloat, "@brief LOD value - size in pixels at which decals of this type are " "fully faded out.\n\n" "This should be a smaller value than #fadeStartPixelSize." ); @@ -173,7 +173,7 @@ void DecalData::initPersistFields() "Default renderPriority for decals of this type (determines draw " "order when decals overlap)." ); - addField( "clippingAngle", TypeF32, Offset( clippingAngle, DecalData ), + addFieldV( "clippingAngle", TypeRangedF32, Offset( clippingAngle, DecalData ), &CommonValidators::PosDegreeRangeQuarter, "The angle in degrees used to clip geometry that faces away from the " "decal projection direction." ); @@ -181,23 +181,23 @@ void DecalData::initPersistFields() addGroup( "Texturing" ); - addField( "frame", TypeS32, Offset( frame, DecalData ), + addFieldV( "frame", TypeRangedS32, Offset( frame, DecalData ), &CommonValidators::PositiveInt, "Index of the texture rectangle within the imagemap to use for this decal." ); addField( "randomize", TypeBool, Offset( randomize, DecalData ), "If true, a random frame from the imagemap is selected for each " "instance of the decal." ); - addField( "textureCoordCount", TypeS32, Offset( texCoordCount, DecalData ), + addFieldV( "textureCoordCount", TypeRangedS32, Offset( texCoordCount, DecalData ), &CommonValidators::PositiveInt, "Number of individual frames in the imagemap (maximum 16)." ); - addField( "texRows", TypeS32, Offset( texRows, DecalData ), + addFieldV( "texRows", TypeRangedS32, Offset( texRows, DecalData ), &CommonValidators::PositiveInt, "@brief Number of rows in the supplied imagemap.\n\n" "Use #texRows and #texCols if the imagemap frames are arranged in a " "grid; use #textureCoords to manually specify UV coordinates for " "irregular sized frames." ); - addField( "texCols", TypeS32, Offset( texCols, DecalData ), + addFieldV( "texCols", TypeRangedS32, Offset( texCols, DecalData ), &CommonValidators::PositiveInt, "@brief Number of columns in the supplied imagemap.\n\n" "Use #texRows and #texCols if the imagemap frames are arranged in a " "grid; use #textureCoords to manually specify UV coordinates for " diff --git a/Engine/source/T3D/fps/guiHealthBarHud.cpp b/Engine/source/T3D/fps/guiHealthBarHud.cpp index b2c387aca..602d242b1 100644 --- a/Engine/source/T3D/fps/guiHealthBarHud.cpp +++ b/Engine/source/T3D/fps/guiHealthBarHud.cpp @@ -120,8 +120,8 @@ void GuiHealthBarHud::initPersistFields() endGroup("Colors"); addGroup("Pulse"); - addField( "pulseRate", TypeS32, Offset( mPulseRate, GuiHealthBarHud ), "Speed at which the control will pulse." ); - addField( "pulseThreshold", TypeF32, Offset( mPulseThreshold, GuiHealthBarHud ), "Health level the control must be under before the control will pulse." ); + addFieldV( "pulseRate", TypeRangedS32, Offset( mPulseRate, GuiHealthBarHud ), &CommonValidators::PositiveInt, "Speed at which the control will pulse." ); + addFieldV( "pulseThreshold", TypeRangedF32, Offset( mPulseThreshold, GuiHealthBarHud ), &CommonValidators::PositiveFloat, "Health level the control must be under before the control will pulse." ); endGroup("Pulse"); addGroup("Misc"); diff --git a/Engine/source/T3D/fps/guiHealthTextHud.cpp b/Engine/source/T3D/fps/guiHealthTextHud.cpp index 9bde220de..1c202906c 100644 --- a/Engine/source/T3D/fps/guiHealthTextHud.cpp +++ b/Engine/source/T3D/fps/guiHealthTextHud.cpp @@ -132,9 +132,9 @@ void GuiHealthTextHud::initPersistFields() endGroup("View"); addGroup("Alert"); - addField("warnThreshold", TypeF32, Offset(mWarnLevel, GuiHealthTextHud), "The health level at which to use the warningColor."); - addField("pulseThreshold", TypeF32, Offset(mPulseThreshold, GuiHealthTextHud), "Health level at which to begin pulsing."); - addField("pulseRate", TypeS32, Offset(mPulseRate, GuiHealthTextHud), "Speed at which the control will pulse."); + addFieldV("warnThreshold", TypeRangedF32, Offset(mWarnLevel, GuiHealthTextHud), &CommonValidators::PositiveFloat, "The health level at which to use the warningColor."); + addFieldV("pulseThreshold", TypeRangedF32, Offset(mPulseThreshold, GuiHealthTextHud), &CommonValidators::PositiveFloat, "Health level at which to begin pulsing."); + addFieldV("pulseRate", TypeRangedS32, Offset(mPulseRate, GuiHealthTextHud), &CommonValidators::PositiveInt, "Speed at which the control will pulse."); endGroup("Alert"); Parent::initPersistFields(); diff --git a/Engine/source/T3D/fps/guiShapeNameHud.cpp b/Engine/source/T3D/fps/guiShapeNameHud.cpp index 377b05d92..0e1525bfd 100644 --- a/Engine/source/T3D/fps/guiShapeNameHud.cpp +++ b/Engine/source/T3D/fps/guiShapeNameHud.cpp @@ -141,8 +141,8 @@ void GuiShapeNameHud::initPersistFields() addField( "showLabelFill", TypeBool, Offset( mShowLabelFill, GuiShapeNameHud ), "If true, we draw a background for each shape name label." ); addField( "showLabelFrame", TypeBool, Offset( mShowLabelFrame, GuiShapeNameHud ), "If true, we draw a frame around each shape name label." ); addField( "labelPadding", TypePoint2I, Offset( mLabelPadding, GuiShapeNameHud ), "The padding (in pixels) between the label text and the frame." ); - addField( "verticalOffset", TypeF32, Offset( mVerticalOffset, GuiShapeNameHud ), "Amount to vertically offset the control in relation to the ShapeBase object in focus." ); - addField( "distanceFade", TypeF32, Offset( mDistanceFade, GuiShapeNameHud ), "Visibility distance (how far the player must be from the ShapeBase object in focus) for this control to render." ); + addFieldV( "verticalOffset", TypeRangedF32, Offset( mVerticalOffset, GuiShapeNameHud ), &CommonValidators::F32Range, "Amount to vertically offset the control in relation to the ShapeBase object in focus." ); + addFieldV( "distanceFade", TypeRangedF32, Offset( mDistanceFade, GuiShapeNameHud ), &CommonValidators::PositiveFloat, "Visibility distance (how far the player must be from the ShapeBase object in focus) for this control to render." ); endGroup("Misc"); Parent::initPersistFields(); } diff --git a/Engine/source/T3D/fx/explosion.cpp b/Engine/source/T3D/fx/explosion.cpp index d4d621cdf..f10543198 100644 --- a/Engine/source/T3D/fx/explosion.cpp +++ b/Engine/source/T3D/fx/explosion.cpp @@ -384,7 +384,11 @@ ExplosionData* ExplosionData::cloneAndPerformSubstitutions(const SimObject* owne return sub_explosion_db; } - +IRangeValidator expPartDensityRange(0, 1<<14); +IRangeValidator expDebrisNumRange(0, 1000); +FRangeValidator expPlaySpeedRange(0.05f, FLT_MAX); +FRangeValidator expLightRadiusRange(0.0f, MaxLightRadius,1<<8); +FRangeValidator expTimeRange(0.0f, 1.0f, 1 << 8); void ExplosionData::initPersistFields() { docsURL; @@ -409,10 +413,10 @@ void ExplosionData::initPersistFields() "The second effect spawns the list of ParticleEmitters given by the emitter[] " "field. These emitters generate particles in the normal way throughout the " "lifetime of the explosion." ); - addField( "particleDensity", TypeS32, Offset(particleDensity, ExplosionData), + addFieldV( "particleDensity", TypeRangedS32, Offset(particleDensity, ExplosionData), &expPartDensityRange, "@brief Density of the particle cloud created at the start of the explosion.\n\n" "@see particleEmitter" ); - addField( "particleRadius", TypeF32, Offset(particleRadius, ExplosionData), + addFieldV( "particleRadius", TypeRangedF32, Offset(particleRadius, ExplosionData),&CommonValidators::PositiveFloat, "@brief Radial distance from the explosion center at which cloud particles " "are emitted.\n\n" "@see particleEmitter" ); @@ -425,21 +429,21 @@ void ExplosionData::initPersistFields() addGroup("Debris"); addField( "debris", TYPEID< DebrisData >(), Offset(debrisList, ExplosionData), EC_NUM_DEBRIS_TYPES, "List of DebrisData objects to spawn with this explosion." ); - addField( "debrisThetaMin", TypeF32, Offset(debrisThetaMin, ExplosionData), + addFieldV( "debrisThetaMin", TypeRangedF32, Offset(debrisThetaMin, ExplosionData), &CommonValidators::PosDegreeRangeHalf, "Minimum angle, from the horizontal plane, to eject debris from." ); - addField( "debrisThetaMax", TypeF32, Offset(debrisThetaMax, ExplosionData), + addFieldV( "debrisThetaMax", TypeRangedF32, Offset(debrisThetaMax, ExplosionData), &CommonValidators::PosDegreeRangeHalf, "Maximum angle, from the horizontal plane, to eject debris from." ); - addField( "debrisPhiMin", TypeF32, Offset(debrisPhiMin, ExplosionData), + addFieldV( "debrisPhiMin", TypeRangedF32, Offset(debrisPhiMin, ExplosionData), &CommonValidators::PosDegreeRange, "Minimum reference angle, from the vertical plane, to eject debris from." ); - addField( "debrisPhiMax", TypeF32, Offset(debrisPhiMax, ExplosionData), + addFieldV( "debrisPhiMax", TypeRangedF32, Offset(debrisPhiMax, ExplosionData), &CommonValidators::PosDegreeRange, "Maximum reference angle, from the vertical plane, to eject debris from." ); - addField( "debrisNum", TypeS32, Offset(debrisNum, ExplosionData), + addFieldV( "debrisNum", TypeRangedS32, Offset(debrisNum, ExplosionData), &expDebrisNumRange, "Number of debris objects to create." ); - addField( "debrisNumVariance", TypeS32, Offset(debrisNumVariance, ExplosionData), + addFieldV( "debrisNumVariance", TypeRangedS32, Offset(debrisNumVariance, ExplosionData), &expDebrisNumRange, "Variance in the number of debris objects to create (must be from 0 - debrisNum)." ); - addField( "debrisVelocity", TypeF32, Offset(debrisVelocity, ExplosionData), + addFieldV( "debrisVelocity", TypeRangedF32, Offset(debrisVelocity, ExplosionData), &CommonValidators::PositiveFloat, "Velocity to toss debris at." ); - addField( "debrisVelocityVariance", TypeF32, Offset(debrisVelocityVariance, ExplosionData), + addFieldV( "debrisVelocityVariance", TypeRangedF32, Offset(debrisVelocityVariance, ExplosionData), &CommonValidators::PositiveFloat, "Variance in the debris initial velocity (must be >= 0)." ); addField( "subExplosion", TYPEID< ExplosionData >(), Offset(explosionList, ExplosionData), EC_MAX_SUB_EXPLOSIONS, "List of additional ExplosionData objects to create at the start of the explosion." ); @@ -450,27 +454,27 @@ void ExplosionData::initPersistFields() addField("explosionScale", TypePoint3F, Offset(explosionScale, ExplosionData), "\"X Y Z\" scale factor applied to the explosionShape model at the start " "of the explosion."); - addField("playSpeed", TypeF32, Offset(playSpeed, ExplosionData), + addFieldV("playSpeed", TypeRangedF32, Offset(playSpeed, ExplosionData),&expPlaySpeedRange, "Time scale at which to play the explosionShape ambient sequence."); - addField( "delayMS", TypeS32, Offset(delayMS, ExplosionData), + addFieldV( "delayMS", TypeRangedS32, Offset(delayMS, ExplosionData), &CommonValidators::PositiveInt, "Amount of time, in milliseconds, to delay the start of the explosion effect " "from the creation of the Explosion object." ); - addField( "delayVariance", TypeS32, Offset(delayVariance, ExplosionData), + addFieldV( "delayVariance", TypeRangedS32, Offset(delayVariance, ExplosionData), &CommonValidators::PositiveInt, "Variance, in milliseconds, of delayMS." ); - addField( "lifetimeMS", TypeS32, Offset(lifetimeMS, ExplosionData), + addFieldV( "lifetimeMS", TypeRangedS32, Offset(lifetimeMS, ExplosionData), &CommonValidators::PositiveInt, "@brief Lifetime, in milliseconds, of the Explosion object.\n\n" "@note If explosionShape is defined and contains an ambient animation, " "this field is ignored, and the playSpeed scaled duration of the animation " "is used instead." ); - addField( "lifetimeVariance", TypeS32, Offset(lifetimeVariance, ExplosionData), + addFieldV( "lifetimeVariance", TypeRangedS32, Offset(lifetimeVariance, ExplosionData), &CommonValidators::PositiveInt, "Variance, in milliseconds, of the lifetimeMS of the Explosion object.\n" ); - addField( "offset", TypeF32, Offset(offset, ExplosionData), + addFieldV( "offset", TypeRangedF32, Offset(offset, ExplosionData), &CommonValidators::PositiveFloat, "@brief Offset distance (in a random direction) of the center of the explosion " "from the Explosion object position.\n\n" "Most often used to create some variance in position for subExplosion effects." ); - addField( "times", TypeF32, Offset(times, ExplosionData), EC_NUM_TIME_KEYS, + addFieldV( "times", TypeRangedF32, Offset(times, ExplosionData), &expTimeRange, EC_NUM_TIME_KEYS, "@brief Time keyframes used to scale the explosionShape model.\n\n" "Values should be in increasing order from 0.0 - 1.0, and correspond to " "the life of the Explosion where 0 is the beginning and 1 is the end of " @@ -491,22 +495,22 @@ void ExplosionData::initPersistFields() addField( "camShakeAmp", TypePoint3F, Offset(camShakeAmp, ExplosionData), "@brief Amplitude of camera shaking, defined in the \"X Y Z\" axes.\n\n" "Set any value to 0 to disable shaking in that axis." ); - addField( "camShakeDuration", TypeF32, Offset(camShakeDuration, ExplosionData), + addFieldV( "camShakeDuration", TypeRangedF32, Offset(camShakeDuration, ExplosionData), &CommonValidators::PositiveFloat, "Duration (in seconds) to shake the camera." ); - addField( "camShakeRadius", TypeF32, Offset(camShakeRadius, ExplosionData), + addFieldV( "camShakeRadius", TypeRangedF32, Offset(camShakeRadius, ExplosionData), &CommonValidators::PositiveFloat, "Radial distance that a camera's position must be within relative to the " "center of the explosion to be shaken." ); - addField( "camShakeFalloff", TypeF32, Offset(camShakeFalloff, ExplosionData), + addFieldV( "camShakeFalloff", TypeRangedF32, Offset(camShakeFalloff, ExplosionData), &CommonValidators::PositiveFloat, "Falloff value for the camera shake." ); endGroup("Camera Shake"); addGroup("Light Emitter"); - addField( "lightStartRadius", TypeF32, Offset(lightStartRadius, ExplosionData), + addFieldV( "lightStartRadius", TypeRangedF32, Offset(lightStartRadius, ExplosionData), &expLightRadiusRange, "@brief Initial radius of the PointLight created by this explosion.\n\n" "Radius is linearly interpolated from lightStartRadius to lightEndRadius " "over the lifetime of the explosion.\n" "@see lifetimeMS" ); - addField( "lightEndRadius", TypeF32, Offset(lightEndRadius, ExplosionData), + addFieldV( "lightEndRadius", TypeRangedF32, Offset(lightEndRadius, ExplosionData), &expLightRadiusRange, "@brief Final radius of the PointLight created by this explosion.\n\n" "@see lightStartRadius" ); addField( "lightStartColor", TypeColorF, Offset(lightStartColor, ExplosionData), @@ -517,15 +521,15 @@ void ExplosionData::initPersistFields() addField( "lightEndColor", TypeColorF, Offset(lightEndColor, ExplosionData), "@brief Final color of the PointLight created by this explosion.\n\n" "@see lightStartColor" ); - addField( "lightStartBrightness", TypeF32, Offset(lightStartBrightness, ExplosionData), + addFieldV( "lightStartBrightness", TypeRangedF32, Offset(lightStartBrightness, ExplosionData), &expLightRadiusRange, "@brief Initial brightness of the PointLight created by this explosion.\n\n" "Brightness is linearly interpolated from lightStartBrightness to " "lightEndBrightness over the lifetime of the explosion.\n" "@see lifetimeMS" ); - addField("lightEndBrightness", TypeF32, Offset(lightEndBrightness, ExplosionData), + addFieldV("lightEndBrightness", TypeRangedF32, Offset(lightEndBrightness, ExplosionData), &expLightRadiusRange, "@brief Final brightness of the PointLight created by this explosion.\n\n" "@see lightStartBrightness" ); - addField( "lightNormalOffset", TypeF32, Offset(lightNormalOffset, ExplosionData), + addFieldV( "lightNormalOffset", TypeRangedF32, Offset(lightNormalOffset, ExplosionData), &CommonValidators::PositiveFloat, "Distance (in the explosion normal direction) of the PointLight position " "from the explosion center." ); endGroup("Light Emitter"); @@ -754,12 +758,12 @@ void ExplosionData::packData(BitStream* stream) // Dynamic light info stream->writeFloat(lightStartRadius/MaxLightRadius, 8); stream->writeFloat(lightEndRadius/MaxLightRadius, 8); - stream->writeFloat(lightStartColor.red,7); - stream->writeFloat(lightStartColor.green,7); - stream->writeFloat(lightStartColor.blue,7); - stream->writeFloat(lightEndColor.red,7); - stream->writeFloat(lightEndColor.green,7); - stream->writeFloat(lightEndColor.blue,7); + stream->writeFloat(lightStartColor.red,8); + stream->writeFloat(lightStartColor.green,8); + stream->writeFloat(lightStartColor.blue,8); + stream->writeFloat(lightEndColor.red,8); + stream->writeFloat(lightEndColor.green,8); + stream->writeFloat(lightEndColor.blue,8); stream->writeFloat(lightStartBrightness/MaxLightRadius, 8); stream->writeFloat(lightEndBrightness/MaxLightRadius, 8); stream->write(lightNormalOffset); @@ -858,12 +862,12 @@ void ExplosionData::unpackData(BitStream* stream) // lightStartRadius = stream->readFloat(8) * MaxLightRadius; lightEndRadius = stream->readFloat(8) * MaxLightRadius; - lightStartColor.red = stream->readFloat(7); - lightStartColor.green = stream->readFloat(7); - lightStartColor.blue = stream->readFloat(7); - lightEndColor.red = stream->readFloat(7); - lightEndColor.green = stream->readFloat(7); - lightEndColor.blue = stream->readFloat(7); + lightStartColor.red = stream->readFloat(8); + lightStartColor.green = stream->readFloat(8); + lightStartColor.blue = stream->readFloat(8); + lightEndColor.red = stream->readFloat(8); + lightEndColor.green = stream->readFloat(8); + lightEndColor.blue = stream->readFloat(8); lightStartBrightness = stream->readFloat(8) * MaxLightRadius; lightEndBrightness = stream->readFloat(8) * MaxLightRadius; stream->read( &lightNormalOffset ); diff --git a/Engine/source/T3D/fx/fxFoliageReplicator.cpp b/Engine/source/T3D/fx/fxFoliageReplicator.cpp index ca22a597e..7cc52429d 100644 --- a/Engine/source/T3D/fx/fxFoliageReplicator.cpp +++ b/Engine/source/T3D/fx/fxFoliageReplicator.cpp @@ -349,35 +349,35 @@ void fxFoliageReplicator::initPersistFields() // Add out own persistent fields. addGroup( "Debugging" ); // MM: Added Group Header. addField( "UseDebugInfo", TypeBool, Offset( mFieldData.mUseDebugInfo, fxFoliageReplicator ), "Culling bins are drawn when set to true." ); - addField( "DebugBoxHeight", TypeF32, Offset( mFieldData.mDebugBoxHeight, fxFoliageReplicator ), "Height multiplier for drawn culling bins."); + addFieldV( "DebugBoxHeight", TypeRangedF32, Offset( mFieldData.mDebugBoxHeight, fxFoliageReplicator ), &CommonValidators::PositiveFloat, "Height multiplier for drawn culling bins."); addField( "HideFoliage", TypeBool, Offset( mFieldData.mHideFoliage, fxFoliageReplicator ), "Foliage is hidden when set to true." ); addField( "ShowPlacementArea", TypeBool, Offset( mFieldData.mShowPlacementArea, fxFoliageReplicator ), "Draw placement rings when set to true." ); - addField( "PlacementAreaHeight", TypeS32, Offset( mFieldData.mPlacementBandHeight, fxFoliageReplicator ), "Height of the placement ring in world units." ); + addFieldV( "PlacementAreaHeight", TypeRangedS32, Offset( mFieldData.mPlacementBandHeight, fxFoliageReplicator ), &CommonValidators::PositiveFloat, "Height of the placement ring in world units." ); addField( "PlacementColour", TypeColorF, Offset( mFieldData.mPlaceAreaColour, fxFoliageReplicator ), "Color of the placement ring." ); endGroup( "Debugging" ); // MM: Added Group Footer. addGroup( "Media" ); // MM: Added Group Header. addField( "Seed", TypeS32, Offset( mFieldData.mSeed, fxFoliageReplicator ), "Random seed for foliage placement." ); addField( "FoliageFile", TypeFilename, Offset( mFieldData.mFoliageFile, fxFoliageReplicator ), "Image file for the foliage texture." ); - addField( "FoliageCount", TypeS32, Offset( mFieldData.mFoliageCount, fxFoliageReplicator ), "Maximum foliage instance count." ); - addField( "FoliageRetries", TypeS32, Offset( mFieldData.mFoliageRetries, fxFoliageReplicator ), "Number of times to try placing a foliage instance before giving up." ); + addFieldV( "FoliageCount", TypeRangedS32, Offset( mFieldData.mFoliageCount, fxFoliageReplicator ), &CommonValidators::NaturalNumber, "Maximum foliage instance count." ); + addFieldV( "FoliageRetries", TypeRangedS32, Offset( mFieldData.mFoliageRetries, fxFoliageReplicator ), &CommonValidators::PositiveInt, "Number of times to try placing a foliage instance before giving up." ); endGroup( "Media" ); // MM: Added Group Footer. addGroup( "Area" ); // MM: Added Group Header. - addField( "InnerRadiusX", TypeS32, Offset( mFieldData.mInnerRadiusX, fxFoliageReplicator ), "Placement area inner radius on the X axis" ); - addField( "InnerRadiusY", TypeS32, Offset( mFieldData.mInnerRadiusY, fxFoliageReplicator ), "Placement area inner radius on the Y axis" ); - addField( "OuterRadiusX", TypeS32, Offset( mFieldData.mOuterRadiusX, fxFoliageReplicator ), "Placement area outer radius on the X axis" ); - addField( "OuterRadiusY", TypeS32, Offset( mFieldData.mOuterRadiusY, fxFoliageReplicator ), "Placement area outer radius on the Y axis" ); + addFieldV( "InnerRadiusX", TypeRangedS32, Offset( mFieldData.mInnerRadiusX, fxFoliageReplicator ), &CommonValidators::PositiveInt, "Placement area inner radius on the X axis" ); + addFieldV( "InnerRadiusY", TypeRangedS32, Offset( mFieldData.mInnerRadiusY, fxFoliageReplicator ), &CommonValidators::PositiveInt, "Placement area inner radius on the Y axis" ); + addFieldV( "OuterRadiusX", TypeRangedS32, Offset( mFieldData.mOuterRadiusX, fxFoliageReplicator ), &CommonValidators::PositiveInt, "Placement area outer radius on the X axis" ); + addFieldV( "OuterRadiusY", TypeRangedS32, Offset( mFieldData.mOuterRadiusY, fxFoliageReplicator ), &CommonValidators::PositiveInt, "Placement area outer radius on the Y axis" ); endGroup( "Area" ); // MM: Added Group Footer. addGroup( "Dimensions" ); // MM: Added Group Header. - addField( "MinWidth", TypeF32, Offset( mFieldData.mMinWidth, fxFoliageReplicator ), "Minimum width of foliage billboards" ); - addField( "MaxWidth", TypeF32, Offset( mFieldData.mMaxWidth, fxFoliageReplicator ), "Maximum width of foliage billboards" ); - addField( "MinHeight", TypeF32, Offset( mFieldData.mMinHeight, fxFoliageReplicator ), "Minimum height of foliage billboards" ); - addField( "MaxHeight", TypeF32, Offset( mFieldData.mMaxHeight, fxFoliageReplicator ), "Maximum height of foliage billboards" ); + addFieldV( "MinWidth", TypeRangedF32, Offset( mFieldData.mMinWidth, fxFoliageReplicator ), &CommonValidators::PositiveFloat, "Minimum width of foliage billboards" ); + addFieldV( "MaxWidth", TypeRangedF32, Offset( mFieldData.mMaxWidth, fxFoliageReplicator ), &CommonValidators::PositiveFloat, "Maximum width of foliage billboards" ); + addFieldV( "MinHeight", TypeRangedF32, Offset( mFieldData.mMinHeight, fxFoliageReplicator ), &CommonValidators::PositiveFloat, "Minimum height of foliage billboards" ); + addFieldV( "MaxHeight", TypeRangedF32, Offset( mFieldData.mMaxHeight, fxFoliageReplicator ), &CommonValidators::PositiveFloat, "Maximum height of foliage billboards" ); addField( "FixAspectRatio", TypeBool, Offset( mFieldData.mFixAspectRatio, fxFoliageReplicator ), "Maintain aspect ratio of image if true. This option ignores MaxWidth." ); addField( "FixSizeToMax", TypeBool, Offset( mFieldData.mFixSizeToMax, fxFoliageReplicator ), "Use only MaxWidth and MaxHeight for billboard size. Ignores MinWidth and MinHeight." ); - addField( "OffsetZ", TypeF32, Offset( mFieldData.mOffsetZ, fxFoliageReplicator ), "Offset billboards by this amount vertically." ); + addFieldV( "OffsetZ", TypeRangedF32, Offset( mFieldData.mOffsetZ, fxFoliageReplicator ), &CommonValidators::F32Range, "Offset billboards by this amount vertically." ); addField( "RandomFlip", TypeBool, Offset( mFieldData.mRandomFlip, fxFoliageReplicator ), "Randomly flip billboards left-to-right." ); addField( "UseTrueBillboards", TypeBool, Offset( mFieldData.mUseTrueBillboards, fxFoliageReplicator ), "Use camera facing billboards ( including the z axis )." ); endGroup( "Dimensions" ); // MM: Added Group Footer. @@ -385,29 +385,29 @@ void fxFoliageReplicator::initPersistFields() addGroup( "Culling" ); // MM: Added Group Header. addField( "UseCulling", TypeBool, Offset( mFieldData.mUseCulling, fxFoliageReplicator ), "Use culling bins when enabled." ); addField( "CullResolution", TypeS32, Offset( mFieldData.mCullResolution, fxFoliageReplicator ), "Minimum size of culling bins. Must be >= 8 and <= OuterRadius." ); - addField( "ViewDistance", TypeF32, Offset( mFieldData.mViewDistance, fxFoliageReplicator ), "Maximum distance from camera where foliage appears." ); - addField( "ViewClosest", TypeF32, Offset( mFieldData.mViewClosest, fxFoliageReplicator ), "Minimum distance from camera where foliage appears." ); - addField( "FadeInRegion", TypeF32, Offset( mFieldData.mFadeInRegion, fxFoliageReplicator ), "Region beyond ViewDistance where foliage fades in/out." ); - addField( "FadeOutRegion", TypeF32, Offset( mFieldData.mFadeOutRegion, fxFoliageReplicator ), "Region before ViewClosest where foliage fades in/out." ); - addField( "AlphaCutoff", TypeF32, Offset( mFieldData.mAlphaCutoff, fxFoliageReplicator ), "Minimum alpha value allowed on foliage instances." ); - addField( "GroundAlpha", TypeF32, Offset( mFieldData.mGroundAlpha, fxFoliageReplicator ), "Alpha of the foliage at ground level. 0 = transparent, 1 = opaque." ); + addFieldV( "ViewDistance", TypeRangedF32, Offset( mFieldData.mViewDistance, fxFoliageReplicator ), &CommonValidators::PositiveFloat, "Maximum distance from camera where foliage appears." ); + addFieldV( "ViewClosest", TypeRangedF32, Offset( mFieldData.mViewClosest, fxFoliageReplicator ), &CommonValidators::PositiveFloat, "Minimum distance from camera where foliage appears." ); + addFieldV( "FadeInRegion", TypeRangedF32, Offset( mFieldData.mFadeInRegion, fxFoliageReplicator ), &CommonValidators::PositiveFloat, "Region beyond ViewDistance where foliage fades in/out." ); + addFieldV( "FadeOutRegion", TypeRangedF32, Offset( mFieldData.mFadeOutRegion, fxFoliageReplicator ), &CommonValidators::PositiveFloat, "Region before ViewClosest where foliage fades in/out." ); + addFieldV( "AlphaCutoff", TypeRangedF32, Offset( mFieldData.mAlphaCutoff, fxFoliageReplicator ),&CommonValidators::NormalizedFloat, "Minimum alpha value allowed on foliage instances."); + addFieldV( "GroundAlpha", TypeRangedF32, Offset( mFieldData.mGroundAlpha, fxFoliageReplicator ), &CommonValidators::NormalizedFloat, "Alpha of the foliage at ground level. 0 = transparent, 1 = opaque." ); endGroup( "Culling" ); // MM: Added Group Footer. addGroup( "Animation" ); // MM: Added Group Header. addField( "SwayOn", TypeBool, Offset( mFieldData.mSwayOn, fxFoliageReplicator ), "Foliage should sway randomly when true." ); addField( "SwaySync", TypeBool, Offset( mFieldData.mSwaySync, fxFoliageReplicator ), "Foliage instances should sway together when true and SwayOn is enabled." ); - addField( "SwayMagSide", TypeF32, Offset( mFieldData.mSwayMagnitudeSide, fxFoliageReplicator ), "Left-to-right sway magnitude." ); - addField( "SwayMagFront", TypeF32, Offset( mFieldData.mSwayMagnitudeFront, fxFoliageReplicator ), "Front-to-back sway magnitude." ); - addField( "MinSwayTime", TypeF32, Offset( mFieldData.mMinSwayTime, fxFoliageReplicator ), "Minumum sway cycle time in seconds." ); - addField( "MaxSwayTime", TypeF32, Offset( mFieldData.mMaxSwayTime, fxFoliageReplicator ), "Maximum sway cycle time in seconds." ); + addFieldV( "SwayMagSide", TypeRangedF32, Offset( mFieldData.mSwayMagnitudeSide, fxFoliageReplicator ), &CommonValidators::PositiveFloat, "Left-to-right sway magnitude." ); + addFieldV( "SwayMagFront", TypeRangedF32, Offset( mFieldData.mSwayMagnitudeFront, fxFoliageReplicator ), &CommonValidators::PositiveFloat, "Front-to-back sway magnitude." ); + addFieldV( "MinSwayTime", TypeRangedF32, Offset( mFieldData.mMinSwayTime, fxFoliageReplicator ), &CommonValidators::PositiveFloat, "Minumum sway cycle time in seconds." ); + addFieldV( "MaxSwayTime", TypeRangedF32, Offset( mFieldData.mMaxSwayTime, fxFoliageReplicator ), &CommonValidators::PositiveFloat, "Maximum sway cycle time in seconds." ); endGroup( "Animation" ); // MM: Added Group Footer. addGroup( "Lighting" ); // MM: Added Group Header. addField( "LightOn", TypeBool, Offset( mFieldData.mLightOn, fxFoliageReplicator ), "Foliage should be illuminated with changing lights when true." ); addField( "LightSync", TypeBool, Offset( mFieldData.mLightSync, fxFoliageReplicator ), "Foliage instances have the same lighting when set and LightOn is set." ); - addField( "MinLuminance", TypeF32, Offset( mFieldData.mMinLuminance, fxFoliageReplicator ), "Minimum luminance for foliage instances." ); - addField( "MaxLuminance", TypeF32, Offset( mFieldData.mMaxLuminance, fxFoliageReplicator ), "Maximum luminance for foliage instances." ); - addField( "LightTime", TypeF32, Offset( mFieldData.mLightTime, fxFoliageReplicator ), "Time before foliage illumination cycle repeats." ); + addFieldV( "MinLuminance", TypeRangedF32, Offset( mFieldData.mMinLuminance, fxFoliageReplicator ), &CommonValidators::PositiveFloat, "Minimum luminance for foliage instances." ); + addFieldV( "MaxLuminance", TypeRangedF32, Offset( mFieldData.mMaxLuminance, fxFoliageReplicator ), &CommonValidators::PositiveFloat, "Maximum luminance for foliage instances." ); + addFieldV( "LightTime", TypeRangedF32, Offset( mFieldData.mLightTime, fxFoliageReplicator ), &CommonValidators::PositiveFloat, "Time before foliage illumination cycle repeats." ); endGroup( "Lighting" ); // MM: Added Group Footer. addGroup( "Restrictions" ); // MM: Added Group Header. @@ -415,11 +415,11 @@ void fxFoliageReplicator::initPersistFields() addField( "AllowOnStatics", TypeBool, Offset( mFieldData.mAllowStatics, fxFoliageReplicator ), "Foliage will be placed on Static shapes when set." ); addField( "AllowOnWater", TypeBool, Offset( mFieldData.mAllowOnWater, fxFoliageReplicator ), "Foliage will be placed on/under water when set." ); addField( "AllowWaterSurface", TypeBool, Offset( mFieldData.mAllowWaterSurface, fxFoliageReplicator ), "Foliage will be placed on water when set. Requires AllowOnWater." ); - addField( "AllowedTerrainSlope", TypeS32, Offset( mFieldData.mAllowedTerrainSlope, fxFoliageReplicator ), "Maximum surface angle allowed for foliage instances." ); + addFieldV( "AllowedTerrainSlope", TypeRangedS32, Offset( mFieldData.mAllowedTerrainSlope, fxFoliageReplicator ), &CommonValidators::S32_PosDegreeRangeQuarter, "Maximum surface angle allowed for foliage instances." ); endGroup( "Restrictions" ); // MM: Added Group Footer. addGroup( "AFX" ); - addField( "AmbientModulationBias", TypeF32, Offset( mFieldData.mAmbientModulationBias,fxFoliageReplicator ), "Multiplier controling amount foliage is modulated by sun's ambient." ); + addFieldV( "AmbientModulationBias", TypeRangedF32, Offset( mFieldData.mAmbientModulationBias,fxFoliageReplicator ), &CommonValidators::NormalizedFloat, "Multiplier controling amount foliage is modulated by sun's ambient." ); endGroup( "AFX" ); // Initialise parents' persistent fields. Parent::initPersistFields(); diff --git a/Engine/source/T3D/fx/fxShapeReplicator.cpp b/Engine/source/T3D/fx/fxShapeReplicator.cpp index 19b97b88a..24c032472 100644 --- a/Engine/source/T3D/fx/fxShapeReplicator.cpp +++ b/Engine/source/T3D/fx/fxShapeReplicator.cpp @@ -680,30 +680,30 @@ U32 fxShapeReplicator::packUpdate(NetConnection * con, U32 mask, BitStream * str { stream->writeAffineTransform(mObjToWorld); // Replicator Position. - stream->writeInt(mFieldData.mSeed, 32); // Replicator Seed. - stream->writeInt(mFieldData.mShapeCount, 32); // Shapes Count. - stream->writeInt(mFieldData.mShapeRetries, 32); // Shapes Retries. + stream->write(mFieldData.mSeed); // Replicator Seed. + stream->write(mFieldData.mShapeCount); // Shapes Count. + stream->write(mFieldData.mShapeRetries); // Shapes Retries. stream->writeString(mFieldData.mShapeFile); - stream->writeInt(mFieldData.mInnerRadiusX, 32); // Shapes Inner Radius X. - stream->writeInt(mFieldData.mInnerRadiusY, 32); // Shapes Inner Radius Y. - stream->writeInt(mFieldData.mOuterRadiusX, 32); // Shapes Outer Radius X. - stream->writeInt(mFieldData.mOuterRadiusY, 32); // Shapes Outer Radius Y. + stream->write(mFieldData.mInnerRadiusX); // Shapes Inner Radius X. + stream->write(mFieldData.mInnerRadiusY); // Shapes Inner Radius Y. + stream->write(mFieldData.mOuterRadiusX); // Shapes Outer Radius X. + stream->write(mFieldData.mOuterRadiusY); // Shapes Outer Radius Y. mathWrite(*stream, mFieldData.mShapeScaleMin); // Shapes Scale Min. mathWrite(*stream, mFieldData.mShapeScaleMax); // Shapes Scale Max. mathWrite(*stream, mFieldData.mShapeRotateMin); // Shapes Rotate Min. mathWrite(*stream, mFieldData.mShapeRotateMax); // Shapes Rotate Max. - stream->writeSignedInt(mFieldData.mOffsetZ, 32); // Shapes Offset Z. + stream->write(mFieldData.mOffsetZ); // Shapes Offset Z. stream->writeFlag(mFieldData.mAllowOnTerrain); // Allow on Terrain. stream->writeFlag(mFieldData.mAllowStatics); // Allow on Statics. stream->writeFlag(mFieldData.mAllowOnWater); // Allow on Water. stream->writeFlag(mFieldData.mAllowWaterSurface); // Allow on Water Surface. - stream->writeSignedInt(mFieldData.mAllowedTerrainSlope, 32); // Shapes Offset Z. + stream->write(mFieldData.mAllowedTerrainSlope); // Shapes Offset Z. stream->writeFlag(mFieldData.mAlignToTerrain); // Shapes AlignToTerrain. mathWrite(*stream, mFieldData.mTerrainAlignment); // Write Terrain Alignment. stream->writeFlag(mFieldData.mHideReplications); // Hide Replications. stream->writeFlag(mFieldData.mInteractions); // Shape Interactions. stream->writeFlag(mFieldData.mShowPlacementArea); // Show Placement Area Flag. - stream->writeInt(mFieldData.mPlacementBandHeight, 32); // Placement Area Height. + stream->write(mFieldData.mPlacementBandHeight); // Placement Area Height. stream->write(mFieldData.mPlaceAreaColour); } @@ -725,30 +725,30 @@ void fxShapeReplicator::unpackUpdate(NetConnection * con, BitStream * stream) stream->readAffineTransform(&ReplicatorObjectMatrix); // Replication Position. - mFieldData.mSeed = stream->readInt(32); // Replicator Seed. - mFieldData.mShapeCount = stream->readInt(32); // Shapes Count. - mFieldData.mShapeRetries = stream->readInt(32); // Shapes Retries. + stream->read(&mFieldData.mSeed); // Replicator Seed. + stream->read(&mFieldData.mShapeCount); // Shapes Count. + stream->read(&mFieldData.mShapeRetries); // Shapes Retries. mFieldData.mShapeFile = stream->readSTString(); // Shape File. - mFieldData.mInnerRadiusX = stream->readInt(32); // Shapes Inner Radius X. - mFieldData.mInnerRadiusY = stream->readInt(32); // Shapes Inner Radius Y. - mFieldData.mOuterRadiusX = stream->readInt(32); // Shapes Outer Radius X. - mFieldData.mOuterRadiusY = stream->readInt(32); // Shapes Outer Radius Y. - mathRead(*stream, &mFieldData.mShapeScaleMin); // Shapes Scale Min. - mathRead(*stream, &mFieldData.mShapeScaleMax); // Shapes Scale Max. - mathRead(*stream, &mFieldData.mShapeRotateMin); // Shapes Rotate Min. - mathRead(*stream, &mFieldData.mShapeRotateMax); // Shapes Rotate Max. - mFieldData.mOffsetZ = stream->readSignedInt(32); // Shapes Offset Z. + stream->read(&mFieldData.mInnerRadiusX); // Shapes Inner Radius X. + stream->read(&mFieldData.mInnerRadiusY); // Shapes Inner Radius Y. + stream->read(&mFieldData.mOuterRadiusX); // Shapes Outer Radius X. + stream->read(&mFieldData.mOuterRadiusY); // Shapes Outer Radius Y. + mathRead(*stream, &mFieldData.mShapeScaleMin); // Shapes Scale Min. + mathRead(*stream, &mFieldData.mShapeScaleMax); // Shapes Scale Max. + mathRead(*stream, &mFieldData.mShapeRotateMin); // Shapes Rotate Min. + mathRead(*stream, &mFieldData.mShapeRotateMax); // Shapes Rotate Max. + stream->read(&mFieldData.mOffsetZ); // Shapes Offset Z. mFieldData.mAllowOnTerrain = stream->readFlag(); // Allow on Terrain. mFieldData.mAllowStatics = stream->readFlag(); // Allow on Statics. mFieldData.mAllowOnWater = stream->readFlag(); // Allow on Water. mFieldData.mAllowWaterSurface = stream->readFlag(); // Allow on Water Surface. - mFieldData.mAllowedTerrainSlope = stream->readSignedInt(32); // Allowed Terrain Slope. + stream->read(&mFieldData.mAllowedTerrainSlope); // Allowed Terrain Slope. mFieldData.mAlignToTerrain = stream->readFlag(); // Read AlignToTerrain. - mathRead(*stream, &mFieldData.mTerrainAlignment); // Read Terrain Alignment. + mathRead(*stream, &mFieldData.mTerrainAlignment); // Read Terrain Alignment. mFieldData.mHideReplications = stream->readFlag(); // Hide Replications. mFieldData.mInteractions = stream->readFlag(); // Read Interactions. mFieldData.mShowPlacementArea = stream->readFlag(); // Show Placement Area Flag. - mFieldData.mPlacementBandHeight = stream->readInt(32); // Placement Area Height. + stream->read(&mFieldData.mPlacementBandHeight); // Placement Area Height. stream->read(&mFieldData.mPlaceAreaColour); // Set Transform. diff --git a/Engine/source/T3D/fx/groundCover.cpp b/Engine/source/T3D/fx/groundCover.cpp index cfe618993..377f8bb63 100644 --- a/Engine/source/T3D/fx/groundCover.cpp +++ b/Engine/source/T3D/fx/groundCover.cpp @@ -545,18 +545,18 @@ void GroundCover::initPersistFields() INITPERSISTFIELD_MATERIALASSET(Material, GroundCover, "Material used by all GroundCover segments."); - addField( "radius", TypeF32, Offset( mRadius, GroundCover ), "Outer generation radius from the current camera position." ); - addField( "dissolveRadius",TypeF32, Offset( mFadeRadius, GroundCover ), "This is less than or equal to radius and defines when fading of cover elements begins." ); - addField( "reflectScale", TypeF32, Offset( mReflectRadiusScale, GroundCover ), "Scales the various culling radii when rendering a reflection. Typically for water." ); + addFieldV( "radius", TypeRangedF32, Offset( mRadius, GroundCover ), &CommonValidators::PositiveFloat, "Outer generation radius from the current camera position." ); + addFieldV( "dissolveRadius", TypeRangedF32, Offset( mFadeRadius, GroundCover ), &CommonValidators::PositiveFloat, "This is less than or equal to radius and defines when fading of cover elements begins." ); + addFieldV( "reflectScale", TypeRangedF32, Offset( mReflectRadiusScale, GroundCover ), &CommonValidators::PositiveFloat, "Scales the various culling radii when rendering a reflection. Typically for water." ); - addField( "gridSize", TypeS32, Offset( mGridSize, GroundCover ), "The number of cells per axis in the grid." ); - addField( "zOffset", TypeF32, Offset( mZOffset, GroundCover ), "Offset along the Z axis to render the ground cover." ); + addFieldV( "gridSize", TypeRangedS32, Offset( mGridSize, GroundCover ), &CommonValidators::PositiveInt, "The number of cells per axis in the grid." ); + addFieldV( "zOffset", TypeRangedF32, Offset( mZOffset, GroundCover ), &CommonValidators::F32Range, "Offset along the Z axis to render the ground cover." ); addField( "seed", TypeS32, Offset( mRandomSeed, GroundCover ), "This RNG seed is saved and sent to clients for generating the same cover." ); - addField( "maxElements", TypeS32, Offset( mMaxPlacement, GroundCover ), "The maximum amount of cover elements to include in the grid at any one time." ); + addFieldV( "maxElements", TypeRangedS32, Offset( mMaxPlacement, GroundCover ), &CommonValidators::PositiveInt, "The maximum amount of cover elements to include in the grid at any one time." ); - addField( "maxBillboardTiltAngle", TypeF32, Offset( mMaxBillboardTiltAngle, GroundCover ),"The maximum amout of degrees the billboard will tilt down to match the camera." ); - addField( "shapeCullRadius", TypeF32, Offset( mShapeCullRadius, GroundCover ), "This is the distance at which DTS elements are completely culled out." ); + addFieldV( "maxBillboardTiltAngle", TypeRangedF32, Offset( mMaxBillboardTiltAngle, GroundCover ), &CommonValidators::PosDegreeRangeHalf,"The maximum amout of degrees the billboard will tilt down to match the camera." ); + addFieldV( "shapeCullRadius", TypeRangedF32, Offset( mShapeCullRadius, GroundCover ), &CommonValidators::PositiveFloat, "This is the distance at which DTS elements are completely culled out." ); addField( "shapesCastShadows", TypeBool, Offset( mShapesCastShadows, GroundCover ), "Whether DTS elements should cast shadows or not." ); addArray( "Types", MAX_COVERTYPES ); @@ -570,37 +570,37 @@ void GroundCover::initPersistFields() addField( "invertLayer", TypeBool, Offset( mInvertLayer, GroundCover ), MAX_COVERTYPES, "Indicates that the terrain material index given in 'layer' is an exclusion mask." ); - addField( "probability", TypeF32, Offset( mProbability, GroundCover ), MAX_COVERTYPES, "The probability of one cover type verses another (relative to all cover types)." ); + addFieldV( "probability", TypeRangedF32, Offset( mProbability, GroundCover ), &CommonValidators::PositiveFloat, MAX_COVERTYPES, "The probability of one cover type verses another (relative to all cover types)." ); - addField( "sizeMin", TypeF32, Offset( mSizeMin, GroundCover ), MAX_COVERTYPES, "The minimum random size for each cover type." ); + addFieldV( "sizeMin", TypeRangedF32, Offset( mSizeMin, GroundCover ), &CommonValidators::PositiveFloat, MAX_COVERTYPES, "The minimum random size for each cover type." ); - addField( "sizeMax", TypeF32, Offset( mSizeMax, GroundCover ), MAX_COVERTYPES, "The maximum random size of this cover type." ); + addFieldV( "sizeMax", TypeRangedF32, Offset( mSizeMax, GroundCover ), &CommonValidators::PositiveFloat, MAX_COVERTYPES, "The maximum random size of this cover type." ); - addField( "sizeExponent", TypeF32, Offset( mSizeExponent, GroundCover ), MAX_COVERTYPES, "An exponent used to bias between the minimum and maximum random sizes." ); + addFieldV( "sizeExponent", TypeRangedF32, Offset( mSizeExponent, GroundCover ), &CommonValidators::PositiveFloat, MAX_COVERTYPES, "An exponent used to bias between the minimum and maximum random sizes." ); - addField( "windScale", TypeF32, Offset( mWindScale, GroundCover ), MAX_COVERTYPES, "The wind effect scale." ); + addFieldV( "windScale", TypeRangedF32, Offset( mWindScale, GroundCover ), &CommonValidators::PositiveFloat, MAX_COVERTYPES, "The wind effect scale." ); - addField( "minSlope", TypeF32, Offset(mMinSlope, GroundCover), MAX_COVERTYPES, "The minimum slope angle in degrees for placement."); + addFieldV( "minSlope", TypeRangedF32, Offset(mMinSlope, GroundCover), &CommonValidators::PosDegreeRangeQuarter, MAX_COVERTYPES, "The minimum slope angle in degrees for placement."); - addField( "maxSlope", TypeF32, Offset( mMaxSlope, GroundCover ), MAX_COVERTYPES, "The maximum slope angle in degrees for placement." ); + addFieldV( "maxSlope", TypeRangedF32, Offset( mMaxSlope, GroundCover ), &CommonValidators::PosDegreeRangeQuarter, MAX_COVERTYPES, "The maximum slope angle in degrees for placement." ); addField("conformToNormal",TypeBool, Offset(mConformToNormal, GroundCover), MAX_COVERTYPES, "Use the terrain's slope for angle"); - addField("minRotX", TypeF32, Offset(mMinRotX, GroundCover), MAX_COVERTYPES, "minumum amount of rotation along the X axis to add"); - addField("maxRotX", TypeF32, Offset(mMaxRotX, GroundCover), MAX_COVERTYPES, "maximum amount of rotation along the X axis to add"); - addField("minRotY", TypeF32, Offset(mMinRotY, GroundCover), MAX_COVERTYPES, "minumum amount of rotation along the Y axis to add"); - addField("maxRotY", TypeF32, Offset(mMaxRotY, GroundCover), MAX_COVERTYPES, "maximum amount of rotation along the Y axis to add"); + addFieldV("minRotX", TypeRangedF32, Offset(mMinRotX, GroundCover), &CommonValidators::DegreeRange, MAX_COVERTYPES, "minumum amount of rotation along the X axis to add"); + addFieldV("maxRotX", TypeRangedF32, Offset(mMaxRotX, GroundCover), &CommonValidators::DegreeRange, MAX_COVERTYPES, "maximum amount of rotation along the X axis to add"); + addFieldV("minRotY", TypeRangedF32, Offset(mMinRotY, GroundCover), &CommonValidators::DegreeRange, MAX_COVERTYPES, "minumum amount of rotation along the Y axis to add"); + addFieldV("maxRotY", TypeRangedF32, Offset(mMaxRotY, GroundCover), &CommonValidators::DegreeRange, MAX_COVERTYPES, "maximum amount of rotation along the Y axis to add"); - addField( "minElevation", TypeF32, Offset( mMinElevation, GroundCover ), MAX_COVERTYPES, "The minimum world space elevation for placement." ); + addFieldV( "minElevation", TypeRangedF32, Offset( mMinElevation, GroundCover ), &CommonValidators::F32Range, MAX_COVERTYPES, "The minimum world space elevation for placement." ); - addField( "maxElevation", TypeF32, Offset( mMaxElevation, GroundCover ), MAX_COVERTYPES, "The maximum world space elevation for placement." ); + addFieldV( "maxElevation", TypeRangedF32, Offset( mMaxElevation, GroundCover ), &CommonValidators::F32Range, MAX_COVERTYPES, "The maximum world space elevation for placement." ); - addField( "minClumpCount", TypeS32, Offset( mMinClumpCount, GroundCover ), MAX_COVERTYPES, "The minimum amount of elements in a clump." ); + addFieldV( "minClumpCount", TypeRangedS32, Offset( mMinClumpCount, GroundCover ), &CommonValidators::PositiveInt, MAX_COVERTYPES, "The minimum amount of elements in a clump." ); - addField( "maxClumpCount", TypeS32, Offset( mMaxClumpCount, GroundCover ), MAX_COVERTYPES, "The maximum amount of elements in a clump." ); + addFieldV( "maxClumpCount", TypeRangedS32, Offset( mMaxClumpCount, GroundCover ), &CommonValidators::PositiveInt, MAX_COVERTYPES, "The maximum amount of elements in a clump." ); - addField( "clumpExponent", TypeF32, Offset( mClumpCountExponent, GroundCover ), MAX_COVERTYPES, "An exponent used to bias between the minimum and maximum clump counts for a particular clump." ); + addFieldV( "clumpExponent", TypeRangedF32, Offset( mClumpCountExponent, GroundCover ), &CommonValidators::PositiveFloat, MAX_COVERTYPES, "An exponent used to bias between the minimum and maximum clump counts for a particular clump." ); - addField( "clumpRadius", TypeF32, Offset( mClumpRadius, GroundCover ), MAX_COVERTYPES, "The maximum clump radius." ); + addFieldV( "clumpRadius", TypeRangedF32, Offset( mClumpRadius, GroundCover ), &CommonValidators::PositiveFloat, MAX_COVERTYPES, "The maximum clump radius." ); endArray( "Types" ); @@ -610,12 +610,12 @@ void GroundCover::initPersistFields() addField( "windDirection", TypePoint2F, Offset( mWindDirection, GroundCover ), "The direction of the wind." ); - addField( "windGustLength", TypeF32, Offset( mWindGustLength, GroundCover ), "The length in meters between peaks in the wind gust." ); - addField( "windGustFrequency",TypeF32, Offset( mWindGustFrequency, GroundCover ), "Controls how often the wind gust peaks per second." ); - addField( "windGustStrength", TypeF32, Offset( mWindGustStrength, GroundCover ), "The maximum distance in meters that the peak wind gust will displace an element." ); + addFieldV( "windGustLength", TypeRangedF32, Offset( mWindGustLength, GroundCover ), &CommonValidators::PositiveFloat, "The length in meters between peaks in the wind gust." ); + addFieldV( "windGustFrequency", TypeRangedF32, Offset( mWindGustFrequency, GroundCover ), &CommonValidators::PositiveFloat, "Controls how often the wind gust peaks per second." ); + addFieldV( "windGustStrength", TypeRangedF32, Offset( mWindGustStrength, GroundCover ), &CommonValidators::PositiveFloat, "The maximum distance in meters that the peak wind gust will displace an element." ); - addField( "windTurbulenceFrequency", TypeF32, Offset( mWindTurbulenceFrequency, GroundCover ),"Controls the overall rapidity of the wind turbulence." ); - addField( "windTurbulenceStrength", TypeF32, Offset( mWindTurbulenceStrength, GroundCover ), "The maximum distance in meters that the turbulence can displace a ground cover element." ); + addFieldV( "windTurbulenceFrequency", TypeRangedF32, Offset( mWindTurbulenceFrequency, GroundCover ), &CommonValidators::PositiveFloat,"Controls the overall rapidity of the wind turbulence." ); + addFieldV( "windTurbulenceStrength", TypeRangedF32, Offset( mWindTurbulenceStrength, GroundCover ), &CommonValidators::PositiveFloat, "The maximum distance in meters that the turbulence can displace a ground cover element." ); endGroup( "GroundCover Wind" ); diff --git a/Engine/source/T3D/fx/lightning.cpp b/Engine/source/T3D/fx/lightning.cpp index c5fa25a6b..10447fa6f 100644 --- a/Engine/source/T3D/fx/lightning.cpp +++ b/Engine/source/T3D/fx/lightning.cpp @@ -410,12 +410,12 @@ void Lightning::initPersistFields() { docsURL; addGroup( "Strikes" ); - addField( "strikesPerMinute", TypeS32, Offset(strikesPerMinute, Lightning), + addFieldV( "strikesPerMinute", TypeRangedS32, Offset(strikesPerMinute, Lightning), &CommonValidators::PositiveInt, "@brief Number of lightning strikes to perform per minute.\n\n" "Automatically invokes strikeRandomPoint() at regular intervals." ); - addField( "strikeWidth", TypeF32, Offset(strikeWidth, Lightning), + addFieldV( "strikeWidth", TypeRangedF32, Offset(strikeWidth, Lightning), &CommonValidators::PositiveFloat, "Width of a lightning bolt." ); - addField( "strikeRadius", TypeF32, Offset(strikeRadius, Lightning), + addFieldV( "strikeRadius", TypeRangedF32, Offset(strikeRadius, Lightning), &CommonValidators::PositiveFloat, "@brief Horizontal size (XY plane) of the search box used to find and " "damage Player or Vehicle objects within range of the strike.\n\n" "Only the object at highest altitude with a clear line of sight to the " @@ -431,9 +431,9 @@ void Lightning::initPersistFields() endGroup( "Colors" ); addGroup( "Bolts" ); - addField( "chanceToHitTarget", TypeF32, Offset(chanceToHitTarget, Lightning), + addFieldV( "chanceToHitTarget", TypeRangedF32, Offset(chanceToHitTarget, Lightning), &CommonValidators::NormalizedFloat, "Percentage chance (0-1) that a given lightning bolt will hit something." ); - addField( "boltStartRadius", TypeF32, Offset(boltStartRadius, Lightning), + addFieldV( "boltStartRadius", TypeRangedF32, Offset(boltStartRadius, Lightning), &CommonValidators::PositiveFloat, "@brief Radial distance from the center of the Lightning object for the " "start point of the bolt.\n\n" "The actual start point will be a random point within this radius." ); diff --git a/Engine/source/T3D/fx/particle.cpp b/Engine/source/T3D/fx/particle.cpp index d091133ba..8e6962313 100644 --- a/Engine/source/T3D/fx/particle.cpp +++ b/Engine/source/T3D/fx/particle.cpp @@ -141,6 +141,8 @@ ParticleData::ParticleData() FRangeValidator dragCoefFValidator(0.f, 5.f); FRangeValidator gravCoefFValidator(-10.f, 10.f); FRangeValidator spinRandFValidator(-1000.f, 1000.f); +FRangeValidator particleTimeFValidator(0.0f, 1.0f, 1<<8); +FRangeValidator particleSizeFValidator(0.0f, MaxParticleSize, 1<<16); //----------------------------------------------------------------------------- // initPersistFields @@ -160,31 +162,31 @@ void ParticleData::initPersistFields() "If true, particles blend like ParticleBlendStyle NORMAL, if false, " "blend like ParticleBlendStyle ADDITIVE.\n" "@note If ParticleEmitterData::blendStyle is set, it will override this value."); - addField("lifetimeMS", TYPEID< S32 >(), Offset(lifetimeMS, ParticleData), + addFieldV("lifetimeMS", TypeRangedS32, Offset(lifetimeMS, ParticleData), &CommonValidators::PositiveInt, "Time in milliseconds before this particle is destroyed."); - addField("lifetimeVarianceMS", TYPEID< S32 >(), Offset(lifetimeVarianceMS, ParticleData), + addFieldV("lifetimeVarianceMS", TypeRangedS32, Offset(lifetimeVarianceMS, ParticleData), &CommonValidators::PositiveInt, "Variance in lifetime of particle, from 0 - lifetimeMS."); endGroup("Basic"); addGroup("Motion"); - addFieldV("dragCoefficient", TYPEID< F32 >(), Offset(dragCoefficient, ParticleData), &dragCoefFValidator, + addFieldV("dragCoefficient", TypeRangedF32, Offset(dragCoefficient, ParticleData), &dragCoefFValidator, "Particle physics drag amount."); - addField("windCoefficient", TYPEID< F32 >(), Offset(windCoefficient, ParticleData), + addFieldV("windCoefficient", TypeRangedF32, Offset(windCoefficient, ParticleData),&CommonValidators::F32Range, "Strength of wind on the particles."); - addFieldV("gravityCoefficient", TYPEID< F32 >(), Offset(gravityCoefficient, ParticleData), &gravCoefFValidator, + addFieldV("gravityCoefficient", TypeRangedF32, Offset(gravityCoefficient, ParticleData), &gravCoefFValidator, "Strength of gravity on the particles."); - addFieldV("inheritedVelFactor", TYPEID< F32 >(), Offset(inheritedVelFactor, ParticleData), &CommonValidators::NormalizedFloat, + addFieldV("inheritedVelFactor", TypeRangedF32, Offset(inheritedVelFactor, ParticleData), &CommonValidators::NormalizedFloat, "Amount of emitter velocity to add to particle initial velocity."); - addField("constantAcceleration", TYPEID< F32 >(), Offset(constantAcceleration, ParticleData), + addFieldV("constantAcceleration", TypeRangedF32, Offset(constantAcceleration, ParticleData), &CommonValidators::F32Range, "Constant acceleration to apply to this particle."); endGroup("Motion"); addGroup("Spin"); - addField("spinSpeed", TYPEID< F32 >(), Offset(spinSpeed, ParticleData), + addFieldV("spinSpeed", TypeRangedF32, Offset(spinSpeed, ParticleData), &spinRandFValidator, "Speed at which to spin the particle."); - addFieldV("spinRandomMin", TYPEID< F32 >(), Offset(spinRandomMin, ParticleData), &spinRandFValidator, + addFieldV("spinRandomMin", TypeRangedF32, Offset(spinRandomMin, ParticleData), &spinRandFValidator, "Minimum allowed spin speed of this particle, between -1000 and spinRandomMax."); - addFieldV("spinRandomMax", TYPEID< F32 >(), Offset(spinRandomMax, ParticleData), &spinRandFValidator, + addFieldV("spinRandomMax", TypeRangedF32, Offset(spinRandomMax, ParticleData), &spinRandFValidator, "Maximum allowed spin speed of this particle, between spinRandomMin and 1000."); endGroup("Spin"); @@ -223,16 +225,16 @@ void ParticleData::initPersistFields() // Interpolation variables addGroup("Over Time"); - addProtectedField("times", TYPEID< F32 >(), Offset(times, ParticleData), &protectedSetTimes, - &defaultProtectedGetFn, PDC_NUM_KEYS, + addProtectedFieldV("times", TypeRangedF32, Offset(times, ParticleData), &protectedSetTimes, + &defaultProtectedGetFn, &particleTimeFValidator, PDC_NUM_KEYS, "@brief Time keys used with the colors and sizes keyframes.\n\n" "Values are from 0.0 (particle creation) to 1.0 (end of lifespace)."); addField( "colors", TYPEID< LinearColorF >(), Offset(colors, ParticleData), PDC_NUM_KEYS, "@brief Particle RGBA color keyframe values.\n\n" "The particle color will linearly interpolate between the color/time keys " "over the lifetime of the particle." ); - addProtectedField( "sizes", TYPEID< F32 >(), Offset(sizes, ParticleData), &protectedSetSizes, - &defaultProtectedGetFn, PDC_NUM_KEYS, + addProtectedFieldV( "sizes", TypeRangedF32, Offset(sizes, ParticleData), &protectedSetSizes, + &defaultProtectedGetFn, &particleSizeFValidator, PDC_NUM_KEYS, "@brief Particle size keyframe values.\n\n" "The particle size will linearly interpolate between the size/time keys " "over the lifetime of the particle." ); @@ -242,10 +244,10 @@ void ParticleData::initPersistFields() addProtectedField("textureExtName", TypeFilename, Offset(mTextureExtName, ParticleData), _setTextureExtData, &defaultProtectedGetFn, "", AbstractClassRep::FIELD_HideInInspectors); INITPERSISTFIELD_IMAGEASSET(TextureExt, ParticleData, ""); addField("constrainPos", TypeBool, Offset(constrain_pos, ParticleData)); - addField("angle", TypeF32, Offset(start_angle, ParticleData)); - addField("angleVariance", TypeF32, Offset(angle_variance, ParticleData)); - addField("sizeBias", TypeF32, Offset(sizeBias, ParticleData)); - addField("spinBias", TypeF32, Offset(spinBias, ParticleData)); + addFieldV("angle", TypeRangedF32, Offset(start_angle, ParticleData), &CommonValidators::DegreeRange); + addFieldV("angleVariance", TypeRangedF32, Offset(angle_variance, ParticleData), &CommonValidators::DegreeRange); + addFieldV("sizeBias", TypeRangedF32, Offset(sizeBias, ParticleData), &CommonValidators::F32Range); + addFieldV("spinBias", TypeRangedF32, Offset(spinBias, ParticleData), &CommonValidators::F32Range); addField("randomizeSpinDir", TypeBool, Offset(randomizeSpinDir, ParticleData)); endGroup("AFX"); Parent::initPersistFields(); @@ -296,10 +298,10 @@ void ParticleData::packData(BitStream* stream) for( i=0; iwriteFloat( colors[i].red, 7); - stream->writeFloat( colors[i].green, 7); - stream->writeFloat( colors[i].blue, 7); - stream->writeFloat( colors[i].alpha, 7); + stream->writeFloat( colors[i].red, 8); + stream->writeFloat( colors[i].green, 8); + stream->writeFloat( colors[i].blue, 8); + stream->writeFloat( colors[i].alpha, 8); // AFX bits raised from 14 to 16 to allow larger sizes stream->writeFloat( sizes[i]/MaxParticleSize, 16); stream->writeFloat( times[i], 8); @@ -381,10 +383,10 @@ void ParticleData::unpackData(BitStream* stream) S32 count = stream->readInt(3) + 1; for(i = 0;i < count; i++) { - colors[i].red = stream->readFloat(7); - colors[i].green = stream->readFloat(7); - colors[i].blue = stream->readFloat(7); - colors[i].alpha = stream->readFloat(7); + colors[i].red = stream->readFloat(8); + colors[i].green = stream->readFloat(8); + colors[i].blue = stream->readFloat(8); + colors[i].alpha = stream->readFloat(8); // AFX bits raised from 14 to 16 to allow larger sizes sizes[i] = stream->readFloat(16) * MaxParticleSize; times[i] = stream->readFloat(8); @@ -443,6 +445,17 @@ bool ParticleData::protectedSetTimes( void *object, const char *index, const cha pData->times[i] = mClampF( val, 0.f, 1.f ); + pData->times[0] = 0.0f; + + S32 last = i - 1; + S32 next = i + 1; + if (last >= 0 && next < PDC_NUM_KEYS-1) + { + if ((pData->times[last] != -1.0f) && (pData->times[i] < pData->times[last])) + pData->times[i] = pData->times[last]; + else if ((pData->times[next] != -1.0f) && (pData->times[i] > pData->times[next])) + pData->times[i] = pData->times[next]; + } return false; } diff --git a/Engine/source/T3D/fx/particleEmitter.cpp b/Engine/source/T3D/fx/particleEmitter.cpp index a512e893c..1817e51f0 100644 --- a/Engine/source/T3D/fx/particleEmitter.cpp +++ b/Engine/source/T3D/fx/particleEmitter.cpp @@ -199,8 +199,6 @@ IRangeValidator ejectPeriodIValidator(1, 2047); IRangeValidator periodVarianceIValidator(0, 2047); FRangeValidator ejectionFValidator(0.f, 655.35f); FRangeValidator velVarianceFValidator(0.f, 163.83f); -FRangeValidator thetaFValidator(0.f, 180.f); -FRangeValidator phiFValidator(0.f, 360.f); //----------------------------------------------------------------------------- // initPersistFields @@ -210,45 +208,45 @@ void ParticleEmitterData::initPersistFields() docsURL; addGroup( "ParticleEmitterData" ); - addFieldV("ejectionPeriodMS", TYPEID< S32 >(), Offset(ejectionPeriodMS, ParticleEmitterData), &ejectPeriodIValidator, + addFieldV("ejectionPeriodMS", TypeRangedS32, Offset(ejectionPeriodMS, ParticleEmitterData), &ejectPeriodIValidator, "Time (in milliseconds) between each particle ejection." ); - addFieldV("periodVarianceMS", TYPEID< S32 >(), Offset(periodVarianceMS, ParticleEmitterData), &periodVarianceIValidator, + addFieldV("periodVarianceMS", TypeRangedS32, Offset(periodVarianceMS, ParticleEmitterData), &periodVarianceIValidator, "Variance in ejection period, from 1 - ejectionPeriodMS." ); - addFieldV( "ejectionVelocity", TYPEID< F32 >(), Offset(ejectionVelocity, ParticleEmitterData), &ejectionFValidator, + addFieldV( "ejectionVelocity", TypeRangedF32, Offset(ejectionVelocity, ParticleEmitterData), &ejectionFValidator, "Particle ejection velocity." ); - addFieldV( "velocityVariance", TYPEID< F32 >(), Offset(velocityVariance, ParticleEmitterData), &velVarianceFValidator, + addFieldV( "velocityVariance", TypeRangedF32, Offset(velocityVariance, ParticleEmitterData), &velVarianceFValidator, "Variance for ejection velocity, from 0 - ejectionVelocity." ); - addFieldV( "ejectionOffset", TYPEID< F32 >(), Offset(ejectionOffset, ParticleEmitterData), &ejectionFValidator, + addFieldV( "ejectionOffset", TypeRangedF32, Offset(ejectionOffset, ParticleEmitterData), &ejectionFValidator, "Distance along ejection Z axis from which to eject particles." ); - addFieldV( "ejectionOffsetVariance", TYPEID< F32 >(), Offset(ejectionOffsetVariance, ParticleEmitterData), &ejectionFValidator, + addFieldV( "ejectionOffsetVariance", TypeRangedF32, Offset(ejectionOffsetVariance, ParticleEmitterData), &ejectionFValidator, "Distance Padding along ejection Z axis from which to eject particles." ); - addFieldV( "thetaMin", TYPEID< F32 >(), Offset(thetaMin, ParticleEmitterData), &thetaFValidator, + addFieldV( "thetaMin", TypeRangedF32, Offset(thetaMin, ParticleEmitterData), &CommonValidators::PosDegreeRangeHalf, "Minimum angle, from the horizontal plane, to eject from." ); - addFieldV( "thetaMax", TYPEID< F32 >(), Offset(thetaMax, ParticleEmitterData), &thetaFValidator, + addFieldV( "thetaMax", TypeRangedF32, Offset(thetaMax, ParticleEmitterData), &CommonValidators::PosDegreeRangeHalf, "Maximum angle, from the horizontal plane, to eject particles from." ); - addFieldV( "thetaVariance", TYPEID< F32 >(), Offset(thetaVariance, ParticleEmitterData), &thetaFValidator, + addFieldV( "thetaVariance", TypeRangedF32, Offset(thetaVariance, ParticleEmitterData), &CommonValidators::PosDegreeRangeHalf, "Angle variance from the previous particle, from 0 - 180." ); - addFieldV( "phiReferenceVel", TYPEID< F32 >(), Offset(phiReferenceVel, ParticleEmitterData), &phiFValidator, + addFieldV( "phiReferenceVel", TypeRangedF32, Offset(phiReferenceVel, ParticleEmitterData), &CommonValidators::PosDegreeRange, "Reference angle, from the vertical plane, to eject particles from." ); - addFieldV( "phiVariance", TYPEID< F32 >(), Offset(phiVariance, ParticleEmitterData), &phiFValidator, + addFieldV( "phiVariance", TypeRangedF32, Offset(phiVariance, ParticleEmitterData), &CommonValidators::PosDegreeRange, "Variance from the reference angle, from 0 - 360." ); - addField( "softnessDistance", TYPEID< F32 >(), Offset(softnessDistance, ParticleEmitterData), + addFieldV( "softnessDistance", TypeRangedF32, Offset(softnessDistance, ParticleEmitterData), &CommonValidators::PositiveFloat, "For soft particles, the distance (in meters) where particles will be " "faded based on the difference in depth between the particle and the " "scene geometry." ); - addField( "ambientFactor", TYPEID< F32 >(), Offset(ambientFactor, ParticleEmitterData), + addFieldV( "ambientFactor", TypeRangedF32, Offset(ambientFactor, ParticleEmitterData), &CommonValidators::NormalizedFloat, "Used to generate the final particle color by controlling interpolation " "between the particle color and the particle color multiplied by the " "ambient light color." ); @@ -272,10 +270,10 @@ void ParticleEmitterData::initPersistFields() "A random one of these datablocks is selected each time a particle is " "emitted." ); - addField( "lifetimeMS", TYPEID< S32 >(), Offset(lifetimeMS, ParticleEmitterData), + addFieldV( "lifetimeMS", TypeRangedS32, Offset(lifetimeMS, ParticleEmitterData), &CommonValidators::PositiveInt, "Lifetime of emitted particles (in milliseconds)." ); - addField("lifetimeVarianceMS", TYPEID< S32 >(), Offset(lifetimeVarianceMS, ParticleEmitterData), + addFieldV("lifetimeVarianceMS", TypeRangedS32, Offset(lifetimeVarianceMS, ParticleEmitterData), &CommonValidators::PositiveInt, "Variance in particle lifetime from 0 - lifetimeMS." ); addField( "useEmitterSizes", TYPEID< bool >(), Offset(useEmitterSizes, ParticleEmitterData), @@ -338,7 +336,7 @@ void ParticleEmitterData::initPersistFields() #if defined(AFX_CAP_PARTICLE_POOLS) addGroup("AFX Pooled Particles"); addField("poolData", TYPEID(), Offset(pool_datablock, ParticleEmitterData)); - addField("poolIndex", TypeS32, Offset(pool_index, ParticleEmitterData)); + addFieldV("poolIndex", TypeRangedS32, Offset(pool_index, ParticleEmitterData), &CommonValidators::PositiveInt); addField("poolDepthFade", TypeBool, Offset(pool_depth_fade, ParticleEmitterData)); addField("poolRadialFade", TypeBool, Offset(pool_radial_fade, ParticleEmitterData)); endGroup("AFX Pooled Particles"); diff --git a/Engine/source/T3D/fx/particleEmitter.h b/Engine/source/T3D/fx/particleEmitter.h index 2f7b7d3a3..8186e7d02 100644 --- a/Engine/source/T3D/fx/particleEmitter.h +++ b/Engine/source/T3D/fx/particleEmitter.h @@ -98,7 +98,7 @@ class ParticleEmitterData : public GameBaseData F32 ambientFactor; S32 lifetimeMS; ///< Lifetime of particles - U32 lifetimeVarianceMS; ///< Varience in lifetime from 0 to n + S32 lifetimeVarianceMS; ///< Varience in lifetime from 0 to n bool overrideAdvance; ///< bool orientParticles; ///< Particles always face the screen diff --git a/Engine/source/T3D/fx/particleEmitterNode.cpp b/Engine/source/T3D/fx/particleEmitterNode.cpp index fbc717bbd..26e8a71b4 100644 --- a/Engine/source/T3D/fx/particleEmitterNode.cpp +++ b/Engine/source/T3D/fx/particleEmitterNode.cpp @@ -87,10 +87,11 @@ ParticleEmitterNodeData::~ParticleEmitterNodeData() //----------------------------------------------------------------------------- // initPersistFields //----------------------------------------------------------------------------- +FRangeValidator emTimeMultipleRange(0.01f,100.0f); void ParticleEmitterNodeData::initPersistFields() { docsURL; - addField( "timeMultiple", TYPEID< F32 >(), Offset(timeMultiple, ParticleEmitterNodeData), + addFieldV( "timeMultiple", TypeRangedF32, Offset(timeMultiple, ParticleEmitterNodeData), &emTimeMultipleRange, "@brief Time multiplier for particle emitter nodes.\n\n" "Increasing timeMultiple is like running the emitter at a faster rate - single-shot " "emitters will complete in a shorter time, and continuous emitters will generate " @@ -187,7 +188,7 @@ void ParticleEmitterNode::initPersistFields() "Controls whether particles are emitted from this node." ); addField( "emitter", TYPEID< ParticleEmitterData >(), Offset(mEmitterDatablock, ParticleEmitterNode), "Datablock to use when emitting particles." ); - addField( "velocity", TYPEID< F32 >(), Offset(mVelocity, ParticleEmitterNode), + addFieldV( "velocity", TypeRangedF32, Offset(mVelocity, ParticleEmitterNode), &CommonValidators::F32Range, "Velocity to use when emitting particles (in the direction of the " "ParticleEmitterNode object's up (Z) axis)." ); diff --git a/Engine/source/T3D/fx/precipitation.cpp b/Engine/source/T3D/fx/precipitation.cpp index d57ef3bd6..805e87e43 100644 --- a/Engine/source/T3D/fx/precipitation.cpp +++ b/Engine/source/T3D/fx/precipitation.cpp @@ -173,11 +173,11 @@ void PrecipitationData::initPersistFields() addField( "splashShader", TypeString, Offset(mSplashShaderName, PrecipitationData), "The name of the shader used for splashes." ); - addField( "dropsPerSide", TypeS32, Offset(mDropsPerSide, PrecipitationData), + addFieldV( "dropsPerSide", TypeRangedS32, Offset(mDropsPerSide, PrecipitationData), &CommonValidators::PositiveInt, "@brief How many rows and columns are in the raindrop texture.\n\n" "For example, if the texture has 16 raindrops arranged in a grid, this " "field should be set to 4." ); - addField( "splashesPerSide", TypeS32, Offset(mSplashesPerSide, PrecipitationData), + addFieldV( "splashesPerSide", TypeRangedS32, Offset(mSplashesPerSide, PrecipitationData), &CommonValidators::PositiveInt, "@brief How many rows and columns are in the splash texture.\n\n" "For example, if the texture has 9 splashes arranged in a grid, this " "field should be set to 3." ); @@ -368,45 +368,45 @@ void Precipitation::initPersistFields() docsURL; addGroup("Precipitation"); - addFieldV( "numDrops", TypeS32, Offset(mNumDrops, Precipitation), &ValidNumDropsRange, + addFieldV( "numDrops", TypeRangedS32, Offset(mNumDrops, Precipitation), &ValidNumDropsRange, "@brief Maximum number of drops allowed to exist in the precipitation " "box at any one time.\n\n" "The actual number of drops in the effect depends on the current " "percentage, which can change over time using modifyStorm()." ); - addField( "boxWidth", TypeF32, Offset(mBoxWidth, Precipitation), + addFieldV( "boxWidth", TypeRangedF32, Offset(mBoxWidth, Precipitation), &CommonValidators::PositiveFloat, "Width and depth (horizontal dimensions) of the precipitation box." ); - addField( "boxHeight", TypeF32, Offset(mBoxHeight, Precipitation), + addFieldV( "boxHeight", TypeRangedF32, Offset(mBoxHeight, Precipitation), &CommonValidators::PositiveFloat, "Height (vertical dimension) of the precipitation box." ); endGroup("Precipitation"); addGroup("Rendering"); - addField( "dropSize", TypeF32, Offset(mDropSize, Precipitation), + addFieldV( "dropSize", TypeRangedF32, Offset(mDropSize, Precipitation), &CommonValidators::PositiveFloat, "Size of each drop of precipitation. This will scale the texture." ); - addField( "splashSize", TypeF32, Offset(mSplashSize, Precipitation), + addFieldV( "splashSize", TypeRangedF32, Offset(mSplashSize, Precipitation), &CommonValidators::PositiveFloat, "Size of each splash animation when a drop collides with another surface." ); - addField( "splashMS", TypeS32, Offset(mSplashMS, Precipitation), + addFieldV( "splashMS", TypeRangedS32, Offset(mSplashMS, Precipitation), &CommonValidators::PositiveInt, "Lifetime of splashes in milliseconds." ); addField( "animateSplashes", TypeBool, Offset(mAnimateSplashes, Precipitation), "Set to true to enable splash animations when drops collide with other surfaces." ); - addField( "dropAnimateMS", TypeS32, Offset(mDropAnimateMS, Precipitation), + addFieldV( "dropAnimateMS", TypeRangedS32, Offset(mDropAnimateMS, Precipitation), &CommonValidators::PositiveInt, "@brief Length (in milliseconds) to display each drop frame.\n\n" "If #dropAnimateMS <= 0, drops select a single random frame at creation " "that does not change throughout the drop's lifetime. If #dropAnimateMS " "> 0, each drop cycles through the the available frames in the drop " "texture at the given rate." ); - addField( "fadeDist", TypeF32, Offset(mFadeDistance, Precipitation), + addFieldV( "fadeDist", TypeRangedF32, Offset(mFadeDistance, Precipitation), &CommonValidators::PositiveFloat, "The distance at which drops begin to fade out." ); - addField( "fadeDistEnd", TypeF32, Offset(mFadeDistanceEnd, Precipitation), + addFieldV( "fadeDistEnd", TypeRangedF32, Offset(mFadeDistanceEnd, Precipitation), &CommonValidators::PositiveFloat, "The distance at which drops are completely faded out." ); addField( "useTrueBillboards", TypeBool, Offset(mUseTrueBillboards, Precipitation), @@ -459,23 +459,23 @@ void Precipitation::initPersistFields() "Controls whether drops are affected by wind.\n" "@see ForestWindEmitter" ); - addField( "minSpeed", TypeF32, Offset(mMinSpeed, Precipitation), + addFieldV( "minSpeed", TypeRangedF32, Offset(mMinSpeed, Precipitation), &CommonValidators::PositiveFloat, "@brief Minimum speed at which a drop will fall.\n\n" "On creation, the drop will be assigned a random speed between #minSpeed " "and #maxSpeed." ); - addField( "maxSpeed", TypeF32, Offset(mMaxSpeed, Precipitation), + addFieldV( "maxSpeed", TypeRangedF32, Offset(mMaxSpeed, Precipitation), &CommonValidators::PositiveFloat, "@brief Maximum speed at which a drop will fall.\n\n" "On creation, the drop will be assigned a random speed between #minSpeed " "and #maxSpeed." ); - addField( "minMass", TypeF32, Offset(mMinMass, Precipitation), + addFieldV( "minMass", TypeRangedF32, Offset(mMinMass, Precipitation), &CommonValidators::PositiveFloat, "@brief Minimum mass of a drop.\n\n" "Drop mass determines how strongly the drop is affected by wind and " "turbulence. On creation, the drop will be assigned a random speed " "between #minMass and #minMass." ); - addField( "maxMass", TypeF32, Offset(mMaxMass, Precipitation), + addFieldV( "maxMass", TypeRangedF32, Offset(mMaxMass, Precipitation), &CommonValidators::PositiveFloat, "@brief Maximum mass of a drop.\n\n" "Drop mass determines how strongly the drop is affected by wind and " "turbulence. On creation, the drop will be assigned a random speed " @@ -489,10 +489,10 @@ void Precipitation::initPersistFields() "Check to enable turbulence. This causes precipitation drops to spiral " "while falling." ); - addField( "maxTurbulence", TypeF32, Offset(mMaxTurbulence, Precipitation), + addFieldV( "maxTurbulence", TypeRangedF32, Offset(mMaxTurbulence, Precipitation), &CommonValidators::PositiveFloat, "Radius at which precipitation drops spiral when turbulence is enabled." ); - addField( "turbulenceSpeed", TypeF32, Offset(mTurbulenceSpeed, Precipitation), + addFieldV( "turbulenceSpeed", TypeRangedF32, Offset(mTurbulenceSpeed, Precipitation), &CommonValidators::PositiveFloat, "Speed at which precipitation drops spiral when turbulence is enabled." ); endGroup("Turbulence"); diff --git a/Engine/source/T3D/fx/ribbon.cpp b/Engine/source/T3D/fx/ribbon.cpp index 2580d57fe..d3a00c25b 100644 --- a/Engine/source/T3D/fx/ribbon.cpp +++ b/Engine/source/T3D/fx/ribbon.cpp @@ -73,27 +73,27 @@ void RibbonData::initPersistFields() addGroup("Ribbon"); - addField("size", TypeF32, Offset(mSizes, RibbonData), NumFields, + addFieldV("size", TypeRangedF32, Offset(mSizes, RibbonData), &CommonValidators::PositiveFloat, NumFields, "The size of the ribbon at the specified keyframe."); addField("color", TypeColorF, Offset(mColours, RibbonData), NumFields, "The colour of the ribbon at the specified keyframe."); - addField("position", TypeF32, Offset(mTimes, RibbonData), NumFields, + addFieldV("position", TypeRangedF32, Offset(mTimes, RibbonData), &CommonValidators::PositiveFloat, NumFields, "The position of the keyframe along the lifetime of the ribbon."); - addField("ribbonLength", TypeS32, Offset(mRibbonLength, RibbonData), + addFieldV("ribbonLength", TypeRangedS32, Offset(mRibbonLength, RibbonData), &CommonValidators::NaturalNumber, "The amount of segments the Ribbon can maximally have in length."); - addField("segmentsPerUpdate", TypeS32, Offset(segmentsPerUpdate, RibbonData), + addFieldV("segmentsPerUpdate", TypeRangedS32, Offset(segmentsPerUpdate, RibbonData), &CommonValidators::NaturalNumber, "How many segments to add each update."); - addField("skipAmount", TypeS32, Offset(mSegmentSkipAmount, RibbonData), + addFieldV("skipAmount", TypeRangedS32, Offset(mSegmentSkipAmount, RibbonData), &CommonValidators::PositiveInt, "The amount of segments to skip each update."); addField("useFadeOut", TypeBool, Offset(mUseFadeOut, RibbonData), "If true, the ribbon will fade away after deletion."); - addField("fadeAwayStep", TypeF32, Offset(mFadeAwayStep, RibbonData), + addFieldV("fadeAwayStep", TypeRangedF32, Offset(mFadeAwayStep, RibbonData), &CommonValidators::PositiveFloat, "How much to fade the ribbon with each update, after deletion."); addField("ribbonMaterial", TypeString, Offset(mMatName, RibbonData), "The material the ribbon uses for rendering."); - addField("tileScale", TypeF32, Offset(mTileScale, RibbonData), + addFieldV("tileScale", TypeRangedF32, Offset(mTileScale, RibbonData), &CommonValidators::NormalizedFloat, "How much to scale each 'tile' with, where 1 means the material is stretched" "across the whole ribbon. (If TexcoordsRelativeToDistance is true, this is in meters.)"); addField("fixedTexcoords", TypeBool, Offset(mFixedTexcoords, RibbonData), diff --git a/Engine/source/T3D/fx/splash.cpp b/Engine/source/T3D/fx/splash.cpp index 07c3a52f3..fbe43fb03 100644 --- a/Engine/source/T3D/fx/splash.cpp +++ b/Engine/source/T3D/fx/splash.cpp @@ -121,26 +121,26 @@ void SplashData::initPersistFields() addField("scale", TypePoint3F, Offset(scale, SplashData), "The scale of this splashing effect, defined as the F32 points X, Y, Z.\n"); addField("emitter", TYPEID< ParticleEmitterData >(), Offset(emitterList, SplashData), NUM_EMITTERS, "List of particle emitters to create at the point of this Splash effect.\n"); - addField("delayMS", TypeS32, Offset(delayMS, SplashData), "Time to delay, in milliseconds, before actually starting this effect.\n"); - addField("delayVariance", TypeS32, Offset(delayVariance, SplashData), "Time variance for delayMS.\n"); - addField("lifetimeMS", TypeS32, Offset(lifetimeMS, SplashData), "Lifetime for this effect, in milliseconds.\n"); - addField("lifetimeVariance", TypeS32, Offset(lifetimeVariance, SplashData), "Time variance for lifetimeMS.\n"); - addField("width", TypeF32, Offset(width, SplashData), "Width for the X and Y coordinates to create this effect within."); - addField("numSegments", TypeS32, Offset(numSegments, SplashData), "Number of ejection points in the splash ring.\n"); - addField("velocity", TypeF32, Offset(velocity, SplashData), "Velocity for the splash effect to travel.\n"); - addField("height", TypeF32, Offset(height, SplashData), "Height for the splash to reach.\n"); - addField("acceleration", TypeF32, Offset(acceleration, SplashData), "Constant acceleration value to place upon the splash effect.\n"); - addField("times", TypeF32, Offset(times, SplashData), NUM_TIME_KEYS, "Times to transition through the splash effect. Up to 4 allowed. Values are 0.0 - 1.0, and corrispond to the life of the particle where 0 is first created and 1 is end of lifespace.\n" ); + addFieldV("delayMS", TypeRangedS32, Offset(delayMS, SplashData), &CommonValidators::PositiveInt, "Time to delay, in milliseconds, before actually starting this effect.\n"); + addFieldV("delayVariance", TypeRangedS32, Offset(delayVariance, SplashData), &CommonValidators::PositiveInt, "Time variance for delayMS.\n"); + addFieldV("lifetimeMS", TypeRangedS32, Offset(lifetimeMS, SplashData), &CommonValidators::PositiveInt, "Lifetime for this effect, in milliseconds.\n"); + addFieldV("lifetimeVariance", TypeRangedS32, Offset(lifetimeVariance, SplashData), &CommonValidators::PositiveInt, "Time variance for lifetimeMS.\n"); + addFieldV("width", TypeRangedF32, Offset(width, SplashData), &CommonValidators::PositiveFloat, "Width for the X and Y coordinates to create this effect within."); + addFieldV("numSegments", TypeRangedS32, Offset(numSegments, SplashData), &CommonValidators::NaturalNumber, "Number of ejection points in the splash ring.\n"); + addFieldV("velocity", TypeRangedF32, Offset(velocity, SplashData), &CommonValidators::PositiveFloat, "Velocity for the splash effect to travel.\n"); + addFieldV("height", TypeRangedF32, Offset(height, SplashData), &CommonValidators::PositiveFloat, "Height for the splash to reach.\n"); + addFieldV("acceleration", TypeRangedF32, Offset(acceleration, SplashData), &CommonValidators::PositiveFloat, "Constant acceleration value to place upon the splash effect.\n"); + addFieldV("times", TypeRangedF32, Offset(times, SplashData), &CommonValidators::NormalizedFloat, NUM_TIME_KEYS, "Times to transition through the splash effect. Up to 4 allowed. Values are 0.0 - 1.0, and corrispond to the life of the particle where 0 is first created and 1 is end of lifespace.\n" ); addField("colors", TypeColorF, Offset(colors, SplashData), NUM_TIME_KEYS, "Color values to set the splash effect, rgba. Up to 4 allowed. Will transition through colors based on values set in the times value. Example: colors[0] = \"0.6 1.0 1.0 0.5\".\n" ); INITPERSISTFIELD_IMAGEASSET_ARRAY(Texture, NUM_TEX, SplashData, "Image to use as the texture for the splash effect.\n"); - addField("texWrap", TypeF32, Offset(texWrap, SplashData), "Amount to wrap the texture around the splash ring, 0.0f - 1.0f.\n"); - addField("texFactor", TypeF32, Offset(texFactor, SplashData), "Factor in which to apply the texture to the splash ring, 0.0f - 1.0f.\n"); - addField("ejectionFreq", TypeF32, Offset(ejectionFreq, SplashData), "Frequency in which to emit splash rings.\n"); - addField("ejectionAngle", TypeF32, Offset(ejectionAngle, SplashData), "Rotational angle to create a splash ring.\n"); - addField("ringLifetime", TypeF32, Offset(ringLifetime, SplashData), "Lifetime, in milliseconds, for a splash ring.\n"); - addField("startRadius", TypeF32, Offset(startRadius, SplashData), "Starting radius size of a splash ring.\n"); + addFieldV("texWrap", TypeRangedF32, Offset(texWrap, SplashData), &CommonValidators::NormalizedFloat, "Amount to wrap the texture around the splash ring, 0.0f - 1.0f.\n"); + addFieldV("texFactor", TypeRangedF32, Offset(texFactor, SplashData), &CommonValidators::NormalizedFloat, "Factor in which to apply the texture to the splash ring, 0.0f - 1.0f.\n"); + addFieldV("ejectionFreq", TypeRangedF32, Offset(ejectionFreq, SplashData), &CommonValidators::PositiveFloat, "Frequency in which to emit splash rings.\n"); + addFieldV("ejectionAngle", TypeRangedF32, Offset(ejectionAngle, SplashData), &CommonValidators::DegreeRange, "Rotational angle to create a splash ring.\n"); + addFieldV("ringLifetime", TypeRangedF32, Offset(ringLifetime, SplashData), &CommonValidators::PositiveFloat, "Lifetime, in milliseconds, for a splash ring.\n"); + addFieldV("startRadius", TypeRangedF32, Offset(startRadius, SplashData), &CommonValidators::PositiveFloat, "Starting radius size of a splash ring.\n"); addField("explosion", TYPEID< ExplosionData >(), Offset(explosion, SplashData), "ExplosionData object to create at the creation position of this splash effect.\n"); Parent::initPersistFields(); diff --git a/Engine/source/T3D/gameBase/gameBase.cpp b/Engine/source/T3D/gameBase/gameBase.cpp index 86225702f..8775f94b3 100644 --- a/Engine/source/T3D/gameBase/gameBase.cpp +++ b/Engine/source/T3D/gameBase/gameBase.cpp @@ -127,7 +127,7 @@ IMPLEMENT_CALLBACK( GameBase, setControl, void, ( bool controlled ), ( controlle GameBaseData::GameBaseData() { - mCategory = ""; + mCategory = StringTable->EmptyString(); mPacked = false; } GameBaseData::GameBaseData(const GameBaseData& other, bool temp_clone) : SimDataBlock(other, temp_clone) diff --git a/Engine/source/T3D/groundPlane.cpp b/Engine/source/T3D/groundPlane.cpp index 08898c3b5..6f0c1f52c 100644 --- a/Engine/source/T3D/groundPlane.cpp +++ b/Engine/source/T3D/groundPlane.cpp @@ -100,15 +100,15 @@ GroundPlane::~GroundPlane() mConvexList->nukeList(); SAFE_DELETE( mConvexList ); } - +FRangeValidator squareSizeRange(sMIN_SQUARE_SIZE, FLT_MAX); void GroundPlane::initPersistFields() { docsURL; addGroup( "Plane" ); - addField( "squareSize", TypeF32, Offset( mSquareSize, GroundPlane ), "Square size in meters to which %GroundPlane subdivides its geometry." ); - addField( "scaleU", TypeF32, Offset( mScaleU, GroundPlane ), "Scale of texture repeat in the U direction." ); - addField( "scaleV", TypeF32, Offset( mScaleV, GroundPlane ), "Scale of texture repeat in the V direction." ); + addFieldV( "squareSize", TypeRangedF32, Offset( mSquareSize, GroundPlane ),&squareSizeRange, "Square size in meters to which %GroundPlane subdivides its geometry." ); + addFieldV( "scaleU", TypeRangedF32, Offset( mScaleU, GroundPlane ), &CommonValidators::PositiveFloat, "Scale of texture repeat in the U direction." ); + addFieldV( "scaleV", TypeRangedF32, Offset( mScaleV, GroundPlane ), &CommonValidators::PositiveFloat, "Scale of texture repeat in the V direction." ); INITPERSISTFIELD_MATERIALASSET(Material, GroundPlane, "The material used to render the ground plane."); diff --git a/Engine/source/T3D/guiObjectView.cpp b/Engine/source/T3D/guiObjectView.cpp index b22d68a29..cc29f453b 100644 --- a/Engine/source/T3D/guiObjectView.cpp +++ b/Engine/source/T3D/guiObjectView.cpp @@ -171,13 +171,13 @@ void GuiObjectView::initPersistFields() addGroup( "Camera" ); - addField( "orbitDiststance", TypeF32, Offset( mOrbitDist, GuiObjectView ), + addFieldV( "orbitDiststance", TypeRangedF32, Offset( mOrbitDist, GuiObjectView ), &CommonValidators::PositiveFloat, "Distance from which to render the model." ); - addField( "minOrbitDiststance", TypeF32, Offset( mMinOrbitDist, GuiObjectView ), + addFieldV( "minOrbitDiststance", TypeRangedF32, Offset( mMinOrbitDist, GuiObjectView ), &CommonValidators::PositiveFloat, "Maxiumum distance to which the camera can be zoomed out." ); - addField( "maxOrbitDiststance", TypeF32, Offset( mMaxOrbitDist, GuiObjectView ), + addFieldV( "maxOrbitDiststance", TypeRangedF32, Offset( mMaxOrbitDist, GuiObjectView ), &CommonValidators::PositiveFloat, "Minimum distance below which the camera will not zoom in further." ); - addField( "cameraSpeed", TypeF32, Offset( mCameraSpeed, GuiObjectView ), + addFieldV( "cameraSpeed", TypeRangedF32, Offset( mCameraSpeed, GuiObjectView ), &CommonValidators::PositiveFloat, "Multiplier for mouse camera operations." ); addField( "cameraRotation", TypePoint3F, Offset( mCameraRotation, GuiObjectView ), "Set the camera rotation." ); diff --git a/Engine/source/T3D/item.cpp b/Engine/source/T3D/item.cpp index 80090a7e6..6c5395452 100644 --- a/Engine/source/T3D/item.cpp +++ b/Engine/source/T3D/item.cpp @@ -135,20 +135,23 @@ ImplementEnumType( ItemLightType, { Item::PulsingLight, "PulsingLight", "The item has a pulsing light attached.\n" } EndImplementEnumType; +FRangeValidator itemFrictionRange(0.0f, FLT_MAX, 1<<10); +FRangeValidator itemElasticityRange(0.0f, FLT_MAX, 1<<10); +FRangeValidator itemGravityModRange(FLT_MIN, FLT_MAX, 1<<10); void ItemData::initPersistFields() { docsURL; Parent::initPersistFields(); addGroup("Physics"); - addField("friction", TypeF32, Offset(friction, ItemData), "A floating-point value specifying how much velocity is lost to impact and sliding friction."); - addField("elasticity", TypeF32, Offset(elasticity, ItemData), "A floating-point value specifying how 'bouncy' this ItemData is."); + addFieldV("friction", TypeRangedF32, Offset(friction, ItemData), &itemFrictionRange, "A floating-point value specifying how much velocity is lost to impact and sliding friction."); + addFieldV("elasticity", TypeRangedF32, Offset(elasticity, ItemData) ,&itemElasticityRange, "A floating-point value specifying how 'bouncy' this ItemData is."); addField("sticky", TypeBool, Offset(sticky, ItemData), "@brief If true, ItemData will 'stick' to any surface it collides with.\n\n" "When an item does stick to a surface, the Item::onStickyCollision() callback is called. The Item has methods to retrieve " "the world position and normal the Item is stuck to.\n" "@note Valid objects to stick to must be of StaticShapeObjectType.\n"); - addField("gravityMod", TypeF32, Offset(gravityMod, ItemData), "Floating point value to multiply the existing gravity with, just for this ItemData."); - addField("maxVelocity", TypeF32, Offset(maxVelocity, ItemData), "Maximum velocity that this ItemData is able to move."); + addFieldV("gravityMod", TypeRangedF32, Offset(gravityMod, ItemData),&itemGravityModRange, "Floating point value to multiply the existing gravity with, just for this ItemData."); + addFieldV("maxVelocity", TypeRangedF32, Offset(maxVelocity, ItemData), &CommonValidators::PositiveFloat, "Maximum velocity that this ItemData is able to move."); addField("simpleServerCollision", TypeBool, Offset(simpleServerCollision, ItemData), "@brief Determines if only simple server-side collision will be used (for pick ups).\n\n" "If set to true then only simple, server-side collision detection will be used. This is often the case " @@ -164,10 +167,10 @@ void ItemData::initPersistFields() addField("lightColor", TypeColorF, Offset(lightColor, ItemData), "@brief Color value to make this light. Example: \"1.0,1.0,1.0\"\n\n" "@see lightType\n"); - addField("lightTime", TypeS32, Offset(lightTime, ItemData), + addFieldV("lightTime", TypeRangedS32, Offset(lightTime, ItemData), &CommonValidators::NaturalNumber, "@brief Time value for the light of this ItemData, used to control the pulse speed of the PulsingLight LightType.\n\n" "@see lightType\n"); - addField("lightRadius", TypeF32, Offset(lightRadius, ItemData), + addFieldV("lightRadius", TypeRangedF32, Offset(lightRadius, ItemData), &CommonValidators::PositiveFloat, "@brief Distance from the center point of this ItemData for the light to affect\n\n" "@see lightType\n"); addField("lightOnlyStatic", TypeBool, Offset(lightOnlyStatic, ItemData), @@ -191,10 +194,10 @@ void ItemData::packData(BitStream* stream) { AssertFatal(Item::NumLightTypes < (1 << 2), "ItemData: light type needs more bits"); stream->writeInt(lightType, 2); - stream->writeFloat(lightColor.red, 7); - stream->writeFloat(lightColor.green, 7); - stream->writeFloat(lightColor.blue, 7); - stream->writeFloat(lightColor.alpha, 7); + stream->writeFloat(lightColor.red, 8); + stream->writeFloat(lightColor.green, 8); + stream->writeFloat(lightColor.blue, 8); + stream->writeFloat(lightColor.alpha, 8); stream->write(lightTime); stream->write(lightRadius); stream->writeFlag(lightOnlyStatic); @@ -222,10 +225,10 @@ void ItemData::unpackData(BitStream* stream) if(stream->readFlag()) { lightType = stream->readInt(2); - lightColor.red = stream->readFloat(7); - lightColor.green = stream->readFloat(7); - lightColor.blue = stream->readFloat(7); - lightColor.alpha = stream->readFloat(7); + lightColor.red = stream->readFloat(8); + lightColor.green = stream->readFloat(8); + lightColor.blue = stream->readFloat(8); + lightColor.alpha = stream->readFloat(8); stream->read(&lightTime); stream->read(&lightRadius); lightOnlyStatic = stream->readFlag(); diff --git a/Engine/source/T3D/levelInfo.cpp b/Engine/source/T3D/levelInfo.cpp index 74280ffaf..f583e2515 100644 --- a/Engine/source/T3D/levelInfo.cpp +++ b/Engine/source/T3D/levelInfo.cpp @@ -123,20 +123,18 @@ LevelInfo::~LevelInfo() //----------------------------------------------------------------------------- -FRangeValidator ValiDampnessRange(0.0f, 1.0f); - void LevelInfo::initPersistFields() { docsURL; addGroup( "Visibility" ); - addField( "nearClip", TypeF32, Offset( mNearClip, LevelInfo ), "Closest distance from the camera's position to render the world." ); - addField( "visibleDistance", TypeF32, Offset( mVisibleDistance, LevelInfo ), "Furthest distance from the camera's position to render the world." ); - addField( "visibleGhostDistance", TypeF32, Offset( mVisibleGhostDistance, LevelInfo ), "Furthest distance from the camera's position to render players. Defaults to visibleDistance." ); - addField( "decalBias", TypeF32, Offset( mDecalBias, LevelInfo ), + addFieldV( "nearClip", TypeRangedF32, Offset( mNearClip, LevelInfo ), &CommonValidators::PositiveFloat, "Closest distance from the camera's position to render the world." ); + addFieldV( "visibleDistance", TypeRangedF32, Offset( mVisibleDistance, LevelInfo ), &CommonValidators::PositiveFloat, "Furthest distance from the camera's position to render the world." ); + addFieldV( "visibleGhostDistance", TypeRangedF32, Offset( mVisibleGhostDistance, LevelInfo ), &CommonValidators::PositiveFloat, "Furthest distance from the camera's position to render players. Defaults to visibleDistance." ); + addFieldV( "decalBias", TypeRangedF32, Offset( mDecalBias, LevelInfo ), &CommonValidators::PositiveFloat, "NearPlane bias used when rendering Decal and DecalRoad. This should be tuned to the visibleDistance in your level." ); - addFieldV("dampness", TypeF32, Offset(mDampness, LevelInfo), &ValiDampnessRange, + addFieldV("dampness", TypeRangedF32, Offset(mDampness, LevelInfo), &CommonValidators::NormalizedFloat, "@brief dampness influence"); endGroup( "Visibility" ); @@ -145,13 +143,13 @@ void LevelInfo::initPersistFields() addField( "fogColor", TypeColorF, Offset( mFogData.color, LevelInfo ), "The default color for the scene fog." ); - addField( "fogDensity", TypeF32, Offset( mFogData.density, LevelInfo ), + addFieldV( "fogDensity", TypeRangedF32, Offset( mFogData.density, LevelInfo ), &CommonValidators::NormalizedFloat, "The 0 to 1 density value for the exponential fog falloff." ); - addField( "fogDensityOffset", TypeF32, Offset( mFogData.densityOffset, LevelInfo ), + addFieldV( "fogDensityOffset", TypeRangedF32, Offset( mFogData.densityOffset, LevelInfo ), &CommonValidators::PositiveFloat, "An offset from the camera in meters for moving the start of the fog effect." ); - addField( "fogAtmosphereHeight", TypeF32, Offset( mFogData.atmosphereHeight, LevelInfo ), + addFieldV( "fogAtmosphereHeight", TypeRangedF32, Offset( mFogData.atmosphereHeight, LevelInfo ), &CommonValidators::PositiveFloat, "A height in meters for altitude fog falloff." ); endGroup( "Fog" ); @@ -165,7 +163,7 @@ void LevelInfo::initPersistFields() addGroup( "Lighting" ); - addField( "ambientLightBlendPhase", TypeF32, Offset( mAmbientLightBlendPhase, LevelInfo ), + addFieldV( "ambientLightBlendPhase", TypeRangedF32, Offset( mAmbientLightBlendPhase, LevelInfo ), &CommonValidators::PositiveFloat, "Number of seconds it takes to blend from one ambient light color to a different one." ); addField( "ambientLightBlendCurve", TypeEaseF, Offset( mAmbientLightBlendCurve, LevelInfo ), diff --git a/Engine/source/T3D/lightAnimData.cpp b/Engine/source/T3D/lightAnimData.cpp index 8a5cc7793..47686cc57 100644 --- a/Engine/source/T3D/lightAnimData.cpp +++ b/Engine/source/T3D/lightAnimData.cpp @@ -65,77 +65,80 @@ void LightAnimData::initPersistFields() docsURL; addGroup( "Offset", "The XYZ translation animation state relative to the light position." ); - - addField( "offsetA", TypeF32, Offset( mOffset.value1, LightAnimData ), 3, + addArray("XYZ Pan", Axis); + addFieldV( "offsetA", TypeRangedF32, Offset( mOffset.value1, LightAnimData ), &CommonValidators::PositiveFloat, Axis, "The value of the A key in the keyframe sequence." ); - addField( "offsetZ", TypeF32, Offset( mOffset.value2, LightAnimData ), 3, + addFieldV( "offsetZ", TypeRangedF32, Offset( mOffset.value2, LightAnimData ), &CommonValidators::PositiveFloat, Axis, "The value of the Z key in the keyframe sequence." ); - addField( "offsetPeriod", TypeF32, Offset( mOffset.period, LightAnimData ), 3, + addFieldV( "offsetPeriod", TypeRangedF32, Offset( mOffset.period, LightAnimData ), &CommonValidators::PositiveFloat, Axis, "The animation time for keyframe sequence." ); - addField( "offsetKeys", TypeString, Offset( mOffset.keys, LightAnimData ), 3, + addField( "offsetKeys", TypeString, Offset( mOffset.keys, LightAnimData ), Axis, "The keyframe sequence encoded into a string where characters from A to Z define " "a position between the two animation values." ); - addField( "offsetSmooth", TypeBool, Offset( mOffset.smooth, LightAnimData ), 3, + addField( "offsetSmooth", TypeBool, Offset( mOffset.smooth, LightAnimData ), Axis, "If true the transition between keyframes will be smooth." ); - + endArray("XYZ Pan"); endGroup( "Offset" ); addGroup( "Rotation", "The XYZ rotation animation state relative to the light orientation." ); + addArray("XYZ Rot", Axis); - addField( "rotA", TypeF32, Offset( mRot.value1, LightAnimData ), 3, + addFieldV( "rotA", TypeRangedF32, Offset( mRot.value1, LightAnimData ), &CommonValidators::DegreeRange, Axis, "The value of the A key in the keyframe sequence." ); - addField( "rotZ", TypeF32, Offset( mRot.value2, LightAnimData ), 3, + addFieldV( "rotZ", TypeRangedF32, Offset( mRot.value2, LightAnimData ), &CommonValidators::DegreeRange, Axis, "The value of the Z key in the keyframe sequence." ); - addField( "rotPeriod", TypeF32, Offset( mRot.period, LightAnimData ), 3, + addFieldV( "rotPeriod", TypeRangedF32, Offset( mRot.period, LightAnimData ), &CommonValidators::PositiveFloat, Axis, "The animation time for keyframe sequence." ); - addField( "rotKeys", TypeString, Offset( mRot.keys, LightAnimData ), 3, + addField( "rotKeys", TypeString, Offset( mRot.keys, LightAnimData ), Axis, "The keyframe sequence encoded into a string where characters from A to Z define " "a position between the two animation values." ); - addField( "rotSmooth", TypeBool, Offset( mRot.smooth, LightAnimData ), 3, + addField( "rotSmooth", TypeBool, Offset( mRot.smooth, LightAnimData ), Axis, "If true the transition between keyframes will be smooth." ); - + endArray("XYZ Rot"); endGroup( "Rotation" ); addGroup( "Color", "The RGB color animation state." ); + addArray("RGB", Channel); - addField( "colorA", TypeF32, Offset( mColor.value1, LightAnimData ), 3, + addFieldV( "colorA", TypeRangedF32, Offset( mColor.value1, LightAnimData ), &CommonValidators::F32_8BitPercent, Channel, "The value of the A key in the keyframe sequence." ); - addField( "colorZ", TypeF32, Offset( mColor.value2, LightAnimData ), 3, + addFieldV( "colorZ", TypeRangedF32, Offset( mColor.value2, LightAnimData ), &CommonValidators::F32_8BitPercent, Channel, "The value of the Z key in the keyframe sequence." ); - addField( "colorPeriod", TypeF32, Offset( mColor.period, LightAnimData ), 3, + addFieldV( "colorPeriod", TypeRangedF32, Offset( mColor.period, LightAnimData ), &CommonValidators::PositiveFloat, Channel, "The animation time for keyframe sequence." ); - addField( "colorKeys", TypeString, Offset( mColor.keys, LightAnimData ), 3, + addField( "colorKeys", TypeString, Offset( mColor.keys, LightAnimData ), Channel, "The keyframe sequence encoded into a string where characters from A to Z define " "a position between the two animation values." ); - addField( "colorSmooth", TypeBool, Offset( mColor.smooth, LightAnimData ), 3, + addField( "colorSmooth", TypeBool, Offset( mColor.smooth, LightAnimData ), Channel, "If true the transition between keyframes will be smooth." ); + endArray("RGB"); endGroup( "Color" ); addGroup( "Brightness", "The brightness animation state." ); - addField( "brightnessA", TypeF32, Offset( mBrightness.value1, LightAnimData ), + addFieldV( "brightnessA", TypeRangedF32, Offset( mBrightness.value1, LightAnimData ), &CommonValidators::PositiveFloat, "The value of the A key in the keyframe sequence." ); - addField( "brightnessZ", TypeF32, Offset( mBrightness.value2, LightAnimData ), + addFieldV( "brightnessZ", TypeRangedF32, Offset( mBrightness.value2, LightAnimData ), &CommonValidators::PositiveFloat, "The value of the Z key in the keyframe sequence." ); - addField( "brightnessPeriod", TypeF32, Offset( mBrightness.period, LightAnimData ), + addFieldV( "brightnessPeriod", TypeRangedF32, Offset( mBrightness.period, LightAnimData ), &CommonValidators::PositiveFloat, "The animation time for keyframe sequence." ); addField( "brightnessKeys", TypeString, Offset( mBrightness.keys, LightAnimData ), diff --git a/Engine/source/T3D/lightAnimData.h b/Engine/source/T3D/lightAnimData.h index be6314bdd..bba14644f 100644 --- a/Engine/source/T3D/lightAnimData.h +++ b/Engine/source/T3D/lightAnimData.h @@ -164,14 +164,19 @@ public: void read( BitStream *stream ); }; + enum animEnums + { + Axis = 3, + Channel = 3 + }; /// The positional animation parameters for x, y, and z. - AnimValue<3> mOffset; + AnimValue mOffset; /// The rotational animation parameters for x, y, and z. - AnimValue<3> mRot; + AnimValue mRot; /// The color animation parameters for r, g, and b. - AnimValue<3> mColor; + AnimValue mColor; /// The brightness animation parameter. AnimValue<1> mBrightness; diff --git a/Engine/source/T3D/lightBase.cpp b/Engine/source/T3D/lightBase.cpp index 3ef40f4ca..aea08615c 100644 --- a/Engine/source/T3D/lightBase.cpp +++ b/Engine/source/T3D/lightBase.cpp @@ -97,11 +97,11 @@ void LightBase::initPersistFields() addField( "isEnabled", TypeBool, Offset( mIsEnabled, LightBase ), "Enables/Disables the object rendering and functionality in the scene." ); addField( "color", TypeColorF, Offset( mColor, LightBase ), "Changes the base color hue of the light." ); - addField( "brightness", TypeF32, Offset( mBrightness, LightBase ), "Adjusts the lights power, 0 being off completely." ); + addFieldV( "brightness", TypeRangedF32, Offset( mBrightness, LightBase ), &CommonValidators::PositiveFloat, "Adjusts the lights power, 0 being off completely." ); addField( "castShadows", TypeBool, Offset( mCastShadows, LightBase ), "Enables/disabled shadow casts by this light." ); //addField( "staticRefreshFreq", TypeS32, Offset( mStaticRefreshFreq, LightBase ), "static shadow refresh rate (milliseconds)" ); //addField( "dynamicRefreshFreq", TypeS32, Offset( mDynamicRefreshFreq, LightBase ), "dynamic shadow refresh rate (milliseconds)"); - addField( "priority", TypeF32, Offset( mPriority, LightBase ), "Used for sorting of lights by the light manager. " + addFieldV( "priority", TypeRangedF32, Offset( mPriority, LightBase ), &CommonValidators::PositiveFloat, "Used for sorting of lights by the light manager. " "Priority determines if a light has a stronger effect than, those with a lower value" ); endGroup( "Light" ); @@ -110,15 +110,15 @@ void LightBase::initPersistFields() addField( "animate", TypeBool, Offset( mAnimState.active, LightBase ), "Toggles animation for the light on and off" ); addField( "animationType", TYPEID< LightAnimData >(), Offset( mAnimationData, LightBase ), "Datablock containing light animation information (LightAnimData)" ); - addFieldV( "animationPeriod", TypeF32, Offset( mAnimState.animationPeriod, LightBase ), &CommonValidators::PositiveNonZeroFloat, "The length of time in seconds for a single playback of the light animation (must be > 0)" ); - addField( "animationPhase", TypeF32, Offset( mAnimState.animationPhase, LightBase ), "The phase used to offset the animation start time to vary the animation of nearby lights." ); + addFieldV( "animationPeriod", TypeRangedF32, Offset( mAnimState.animationPeriod, LightBase ), &CommonValidators::PositiveNonZeroFloat, "The length of time in seconds for a single playback of the light animation (must be > 0)" ); + addFieldV( "animationPhase", TypeRangedF32, Offset( mAnimState.animationPhase, LightBase ), &CommonValidators::PositiveFloat, "The phase used to offset the animation start time to vary the animation of nearby lights." ); endGroup( "Light Animation" ); addGroup( "Misc" ); addField( "flareType", TYPEID< LightFlareData >(), Offset( mFlareData, LightBase ), "Datablock containing light flare information (LightFlareData)" ); - addField( "flareScale", TypeF32, Offset( mFlareScale, LightBase ), "Globally scales all features of the light flare" ); + addFieldV( "flareScale", TypeRangedF32, Offset( mFlareScale, LightBase ), &CommonValidators::PositiveFloat, "Globally scales all features of the light flare" ); endGroup( "Misc" ); diff --git a/Engine/source/T3D/lightDescription.cpp b/Engine/source/T3D/lightDescription.cpp index 52c29b641..024bd2475 100644 --- a/Engine/source/T3D/lightDescription.cpp +++ b/Engine/source/T3D/lightDescription.cpp @@ -29,6 +29,7 @@ #include "core/stream/bitStream.h" #include "lighting/lightInfo.h" #include "console/engineAPI.h" +#include "console/typeValidators.h" LightDescription::LightDescription() @@ -94,26 +95,27 @@ void LightDescription::initPersistFields() addGroup( "Light" ); addField( "color", TypeColorF, Offset( color, LightDescription ), "Changes the base color hue of the light." ); - addField( "brightness", TypeF32, Offset( brightness, LightDescription ), "Adjusts the lights power, 0 being off completely." ); - addField( "range", TypeF32, Offset( range, LightDescription ), "Controls the size (radius) of the light" ); + addFieldV( "brightness", TypeRangedF32, Offset( brightness, LightDescription ), &CommonValidators::PositiveFloat, "Adjusts the lights power, 0 being off completely." ); + addFieldV( "range", TypeRangedF32, Offset( range, LightDescription ), &CommonValidators::PositiveFloat, "Controls the size (radius) of the light" ); addField( "castShadows", TypeBool, Offset( castShadows, LightDescription ), "Enables/disabled shadow casts by this light." ); + /* addField( "staticRefreshFreq", TypeS32, Offset( mStaticRefreshFreq, LightDescription ), "static shadow refresh rate (milliseconds)" ); addField( "dynamicRefreshFreq", TypeS32, Offset( mDynamicRefreshFreq, LightDescription ), "dynamic shadow refresh rate (milliseconds)"); - + */ endGroup( "Light" ); addGroup( "Light Animation" ); addField( "animationType", TYPEID< LightAnimData >(), Offset( animationData, LightDescription ), "Datablock containing light animation information (LightAnimData)" ); - addField( "animationPeriod", TypeF32, Offset( animationPeriod, LightDescription ), "The length of time in seconds for a single playback of the light animation" ); - addField( "animationPhase", TypeF32, Offset( animationPhase, LightDescription ), "The phase used to offset the animation start time to vary the animation of nearby lights." ); + addFieldV( "animationPeriod", TypeRangedF32, Offset( animationPeriod, LightDescription ), &CommonValidators::PositiveFloat, "The length of time in seconds for a single playback of the light animation" ); + addFieldV( "animationPhase", TypeRangedF32, Offset( animationPhase, LightDescription ), &CommonValidators::PositiveFloat, "The phase used to offset the animation start time to vary the animation of nearby lights." ); endGroup( "Light Animation" ); addGroup( "Misc" ); addField( "flareType", TYPEID< LightFlareData >(), Offset( flareData, LightDescription ), "Datablock containing light flare information (LightFlareData)" ); - addField( "flareScale", TypeF32, Offset( flareScale, LightDescription ), "Globally scales all features of the light flare" ); + addFieldV( "flareScale", TypeRangedF32, Offset( flareScale, LightDescription ), &CommonValidators::PositiveFloat, "Globally scales all features of the light flare" ); endGroup( "Misc" ); diff --git a/Engine/source/T3D/lightFlareData.cpp b/Engine/source/T3D/lightFlareData.cpp index fa4477ff9..89fb86048 100644 --- a/Engine/source/T3D/lightFlareData.cpp +++ b/Engine/source/T3D/lightFlareData.cpp @@ -145,10 +145,10 @@ void LightFlareData::initPersistFields() docsURL; addGroup( "LightFlareData" ); - addField( "overallScale", TypeF32, Offset( mScale, LightFlareData ), + addFieldV( "overallScale", TypeRangedF32, Offset( mScale, LightFlareData ), &CommonValidators::PositiveFloat, "Size scale applied to all elements of the flare." ); - addField( "occlusionRadius", TypeF32, Offset( mOcclusionRadius, LightFlareData ), + addFieldV( "occlusionRadius", TypeRangedF32, Offset( mOcclusionRadius, LightFlareData ), &CommonValidators::PositiveFloat, "If positive an occlusion query is used to test flare visibility, else it uses simple raycasts." ); addField( "renderReflectPass", TypeBool, Offset( mRenderReflectPass, LightFlareData ), @@ -168,10 +168,10 @@ void LightFlareData::initPersistFields() addField( "elementRect", TypeRectF, Offset( mElementRect, LightFlareData ), MAX_ELEMENTS, "A rectangle specified in pixels of the flareTexture image." ); - addField( "elementDist", TypeF32, Offset( mElementDist, LightFlareData ), MAX_ELEMENTS, + addFieldV( "elementDist", TypeRangedF32, Offset( mElementDist, LightFlareData ), &CommonValidators::PositiveFloat, MAX_ELEMENTS, "Where this element appears along the flare beam." ); - addField( "elementScale", TypeF32, Offset( mElementScale, LightFlareData ), MAX_ELEMENTS, + addFieldV( "elementScale", TypeRangedF32, Offset( mElementScale, LightFlareData ), &CommonValidators::PositiveFloat, MAX_ELEMENTS, "Size scale applied to this element." ); addField( "elementTint", TypeColorF, Offset( mElementTint, LightFlareData ), MAX_ELEMENTS, diff --git a/Engine/source/T3D/lighting/boxEnvironmentProbe.cpp b/Engine/source/T3D/lighting/boxEnvironmentProbe.cpp index cf2ed7e15..28f4c59e0 100644 --- a/Engine/source/T3D/lighting/boxEnvironmentProbe.cpp +++ b/Engine/source/T3D/lighting/boxEnvironmentProbe.cpp @@ -92,7 +92,6 @@ void BoxEnvironmentProbe::initPersistFields() docsURL; // SceneObject already handles exposing the transform Parent::initPersistFields(); - removeField("radius"); } diff --git a/Engine/source/T3D/lighting/reflectionProbe.cpp b/Engine/source/T3D/lighting/reflectionProbe.cpp index d932dfdcb..793f7dd1d 100644 --- a/Engine/source/T3D/lighting/reflectionProbe.cpp +++ b/Engine/source/T3D/lighting/reflectionProbe.cpp @@ -157,11 +157,11 @@ void ReflectionProbe::initPersistFields() addProtectedField("enabled", TypeBool, Offset(mEnabled, ReflectionProbe), &_setEnabled, &defaultProtectedGetFn, "Is the probe enabled or not"); addField("canDamp", TypeBool, Offset(mCanDamp, ReflectionProbe),"wetness allowed"); - addField("attenuation", TypeF32, Offset(mAtten, ReflectionProbe), "falloff percent"); + addFieldV("attenuation", TypeRangedF32, Offset(mAtten, ReflectionProbe), &CommonValidators::NormalizedFloat, "falloff percent"); endGroup("Rendering"); addGroup("Reflection"); - addProtectedField("radius", TypeF32, Offset(mRadius, ReflectionProbe), &_setRadius, &defaultProtectedGetFn, + addProtectedFieldV("radius", TypeRangedF32, Offset(mRadius, ReflectionProbe), &_setRadius, &defaultProtectedGetFn, &CommonValidators::PositiveFloat, "The name of the material used to render the mesh."); addProtectedField("EditPosOffset", TypeBool, Offset(mEditPosOffset, ReflectionProbe), diff --git a/Engine/source/T3D/missionArea.cpp b/Engine/source/T3D/missionArea.cpp index a5f9670a6..5a764fb15 100644 --- a/Engine/source/T3D/missionArea.cpp +++ b/Engine/source/T3D/missionArea.cpp @@ -22,6 +22,7 @@ #include "T3D/missionArea.h" #include "console/consoleTypes.h" +#include "console/typeValidators.h" #include "core/stream/bitStream.h" #include "math/mathIO.h" #include "console/engineAPI.h" @@ -133,8 +134,8 @@ void MissionArea::initPersistFields() docsURL; addGroup("Dimensions"); addField("area", TypeRectI, Offset(mArea, MissionArea), "Four corners (X1, X2, Y1, Y2) that makes up the level's boundaries"); - addField("flightCeiling", TypeF32, Offset(mFlightCeiling, MissionArea), "Represents the top of the mission area, used by FlyingVehicle. "); - addField("flightCeilingRange", TypeF32, Offset(mFlightCeilingRange, MissionArea), "Distance from ceiling before FlyingVehicle thrust is cut off. "); + addFieldV("flightCeiling", TypeRangedF32, Offset(mFlightCeiling, MissionArea),&CommonValidators::F32Range, "Represents the top of the mission area, used by FlyingVehicle. "); + addFieldV("flightCeilingRange", TypeRangedF32, Offset(mFlightCeilingRange, MissionArea), &CommonValidators::F32Range, "Distance from ceiling before FlyingVehicle thrust is cut off. "); endGroup("Dimensions"); Parent::initPersistFields(); diff --git a/Engine/source/T3D/missionMarker.cpp b/Engine/source/T3D/missionMarker.cpp index 994cd7518..5fac601ce 100644 --- a/Engine/source/T3D/missionMarker.cpp +++ b/Engine/source/T3D/missionMarker.cpp @@ -489,7 +489,7 @@ void SpawnSphere::initPersistFields() endGroup( "Spawn" ); addGroup( "Dimensions" ); - addField( "radius", TypeF32, Offset(mRadius, SpawnSphere), "Deprecated" ); + addFieldV( "radius", TypeRangedF32, Offset(mRadius, SpawnSphere), &CommonValidators::PositiveFloat, "Deprecated" ); endGroup( "Dimensions" ); addGroup( "Weight" ); diff --git a/Engine/source/T3D/physicalZone.cpp b/Engine/source/T3D/physicalZone.cpp index 138222302..c264bb953 100644 --- a/Engine/source/T3D/physicalZone.cpp +++ b/Engine/source/T3D/physicalZone.cpp @@ -146,12 +146,14 @@ void PhysicalZone::consoleInit() "@ingroup EnviroMisc\n"); } +FRangeValidator velocityModRange(-40.0f, 40.0f); +FRangeValidator gravityModRange(-40.0f, 40.0f); void PhysicalZone::initPersistFields() { docsURL; addGroup("Misc"); - addField("velocityMod", TypeF32, Offset(mVelocityMod, PhysicalZone), "Multiply velocity of objects entering zone by this value every tick."); - addField("gravityMod", TypeF32, Offset(mGravityMod, PhysicalZone), "Gravity in PhysicalZone. Multiplies against standard gravity."); + addFieldV("velocityMod", TypeRangedF32, Offset(mVelocityMod, PhysicalZone), &velocityModRange, "Multiply velocity of objects entering zone by this value every tick."); + addFieldV("gravityMod", TypeRangedF32, Offset(mGravityMod, PhysicalZone), &gravityModRange, "Gravity in PhysicalZone. Multiplies against standard gravity."); addField("appliedForce", TypePoint3F, Offset(mAppliedForce, PhysicalZone), "Three-element floating point value representing forces in three axes to apply to objects entering PhysicalZone."); addField("polyhedron", TypeTriggerPolyhedron, Offset(mPolyhedron, PhysicalZone), "The polyhedron type is really a quadrilateral and consists of a corner" diff --git a/Engine/source/T3D/physics/physicsDebris.cpp b/Engine/source/T3D/physics/physicsDebris.cpp index 79b8183e0..d6d5eff8e 100644 --- a/Engine/source/T3D/physics/physicsDebris.cpp +++ b/Engine/source/T3D/physics/physicsDebris.cpp @@ -128,29 +128,29 @@ void PhysicsDebrisData::initPersistFields() addGroup( "Physics" ); - addField("lifetime", TypeF32, Offset( lifetime, PhysicsDebrisData ), + addFieldV("lifetime", TypeRangedF32, Offset( lifetime, PhysicsDebrisData ), &CommonValidators::PositiveFloat, "@brief Base time, in seconds, that debris persists after time of creation.\n\n" "@note A %PhysicsDebris' lifetime multiplied by it's $pref::PhysicsDebris::lifetimeScale " "must be equal to or greater than 1.0.\n\n"); - addField("lifetimeVariance", TypeF32, Offset( lifetimeVariance, PhysicsDebrisData ), + addFieldV("lifetimeVariance", TypeRangedF32, Offset( lifetimeVariance, PhysicsDebrisData ), &CommonValidators::PositiveFloat, "@brief Range of variation randomly applied to lifetime when debris is created.\n\n" "Represents the maximum amount of seconds that will be added or subtracted to a shape's base lifetime. " "A value of 0 will apply the same lifetime to each shape created.\n\n"); - addField( "mass", TypeF32, Offset( mass, PhysicsDebrisData ), + addFieldV( "mass", TypeRangedF32, Offset( mass, PhysicsDebrisData ), &CommonValidators::PositiveFloat, "@brief Value representing the mass of the shape.\n\n" "A shape's mass influences the magnitude of any force applied to it. " "@note All PhysicsDebris objects are dynamic."); - addField( "friction", TypeF32, Offset( dynamicFriction, PhysicsDebrisData ), + addFieldV( "friction", TypeRangedF32, Offset( dynamicFriction, PhysicsDebrisData ), &CommonValidators::PositiveFloat, "@brief Coefficient of kinetic %friction to be applied to the shape.\n\n" "Kinetic %friction reduces the velocity of a moving object while it is in contact with a surface. " "A larger coefficient will result in a larger reduction in velocity. " "A shape's friction should be smaller than it's staticFriction, but greater than 0.\n\n" "@note This value is only applied while an object is in motion. For an object starting at rest, see PhysicsDebrisData::staticFriction"); - addField( "staticFriction", TypeF32, Offset( staticFriction, PhysicsDebrisData ), + addFieldV( "staticFriction", TypeRangedF32, Offset( staticFriction, PhysicsDebrisData ), &CommonValidators::PositiveFloat, "@brief Coefficient of static %friction to be applied to the shape.\n\n" "Static %friction determines the force needed to start moving an at-rest object in contact with a surface. " "If the force applied onto shape cannot overcome the force of static %friction, the shape will remain at rest. " @@ -158,7 +158,7 @@ void PhysicsDebrisData::initPersistFields() "This value should be both greater than 0 and the PhysicsDebrisData::friction.\n\n" "@note This value is only applied while an object is at rest. For an object in motion, see PhysicsDebrisData::friction"); - addField( "restitution", TypeF32, Offset( restitution, PhysicsDebrisData ), + addFieldV( "restitution", TypeRangedF32, Offset( restitution, PhysicsDebrisData ), &CommonValidators::PositiveFloat, "@brief Bounce coeffecient applied to the shape in response to a collision.\n\n" "Restitution is a ratio of a shape's velocity before and after a collision. " "A value of 0 will zero out a shape's post-collision velocity, making it stop on contact. " @@ -167,29 +167,29 @@ void PhysicsDebrisData::initPersistFields() "@note Values near or equaling 1.0 are likely to cause undesirable results in the physics simulation." " Because of this, it is reccomended to avoid values close to 1.0"); - addField( "linearDamping", TypeF32, Offset( linearDamping, PhysicsDebrisData ), + addFieldV( "linearDamping", TypeRangedF32, Offset( linearDamping, PhysicsDebrisData ), &CommonValidators::PositiveFloat, "@brief Value that reduces an object's linear velocity over time.\n\n" "Larger values will cause velocity to decay quicker.\n\n" ); - addField( "angularDamping", TypeF32, Offset( angularDamping, PhysicsDebrisData ), + addFieldV( "angularDamping", TypeRangedF32, Offset( angularDamping, PhysicsDebrisData ), &CommonValidators::PositiveFloat, "@brief Value that reduces an object's rotational velocity over time.\n\n" "Larger values will cause velocity to decay quicker.\n\n" ); - addField( "linearSleepThreshold", TypeF32, Offset( linearSleepThreshold, PhysicsDebrisData ), + addFieldV( "linearSleepThreshold", TypeRangedF32, Offset( linearSleepThreshold, PhysicsDebrisData ), &CommonValidators::PositiveFloat, "@brief Minimum linear velocity before the shape can be put to sleep.\n\n" "This should be a positive value. Shapes put to sleep will not be simulated in order to save system resources.\n\n" "@note The shape must be dynamic."); - addField( "angularSleepThreshold", TypeF32, Offset( angularSleepThreshold, PhysicsDebrisData ), + addFieldV( "angularSleepThreshold", TypeRangedF32, Offset( angularSleepThreshold, PhysicsDebrisData ), &CommonValidators::PositiveFloat, "@brief Minimum rotational velocity before the shape can be put to sleep.\n\n" "This should be a positive value. Shapes put to sleep will not be simulated in order to save system resources.\n\n" "@note The shape must be dynamic."); - addField( "waterDampingScale", TypeF32, Offset( waterDampingScale, PhysicsDebrisData ), + addFieldV( "waterDampingScale", TypeRangedF32, Offset( waterDampingScale, PhysicsDebrisData ), &CommonValidators::PositiveFloat, "@brief Scale to apply to linear and angular dampening while underwater.\n\n " "@see angularDamping linearDamping" ); - addField( "buoyancyDensity", TypeF32, Offset( buoyancyDensity, PhysicsDebrisData ), + addFieldV( "buoyancyDensity", TypeRangedF32, Offset( buoyancyDensity, PhysicsDebrisData ), &CommonValidators::PositiveFloat, "@brief The density of this shape for purposes of calculating buoyant forces.\n\n" "The result of the calculated buoyancy is relative to the density of the WaterObject the PhysicsDebris is within." "@see WaterObject::density"); diff --git a/Engine/source/T3D/physics/physicsShape.cpp b/Engine/source/T3D/physics/physicsShape.cpp index d504ffdce..805531c8b 100644 --- a/Engine/source/T3D/physics/physicsShape.cpp +++ b/Engine/source/T3D/physics/physicsShape.cpp @@ -106,21 +106,21 @@ void PhysicsShapeData::initPersistFields() addGroup( "Physics" ); - addField( "mass", TypeF32, Offset( mass, PhysicsShapeData ), + addFieldV( "mass", TypeRangedF32, Offset( mass, PhysicsShapeData ), &CommonValidators::PositiveFloat, "@brief Value representing the mass of the shape.\n\n" "A shape's mass influences the magnitude of any force exerted on it. " "For example, a PhysicsShape with a large mass requires a much larger force to move than " "the same shape with a smaller mass.\n" "@note A mass of zero will create a kinematic shape while anything greater will create a dynamic shape."); - addField( "friction", TypeF32, Offset( dynamicFriction, PhysicsShapeData ), + addFieldV( "friction", TypeRangedF32, Offset( dynamicFriction, PhysicsShapeData ), &CommonValidators::PositiveFloat, "@brief Coefficient of kinetic %friction to be applied to the shape.\n\n" "Kinetic %friction reduces the velocity of a moving object while it is in contact with a surface. " "A higher coefficient will result in a larger velocity reduction. " "A shape's friction should be lower than it's staticFriction, but larger than 0.\n\n" "@note This value is only applied while an object is in motion. For an object starting at rest, see PhysicsShape::staticFriction"); - addField( "staticFriction", TypeF32, Offset( staticFriction, PhysicsShapeData ), + addFieldV( "staticFriction", TypeRangedF32, Offset( staticFriction, PhysicsShapeData ), &CommonValidators::PositiveFloat, "@brief Coefficient of static %friction to be applied to the shape.\n\n" "Static %friction determines the force needed to start moving an at-rest object in contact with a surface. " "If the force applied onto shape cannot overcome the force of static %friction, the shape will remain at rest. " @@ -128,7 +128,7 @@ void PhysicsShapeData::initPersistFields() "This value should be larger than zero and the physicsShape's friction.\n\n" "@note This value is only applied while an object is at rest. For an object in motion, see PhysicsShape::friction"); - addField( "restitution", TypeF32, Offset( restitution, PhysicsShapeData ), + addFieldV( "restitution", TypeRangedF32, Offset( restitution, PhysicsShapeData ), &CommonValidators::PositiveFloat, "@brief Coeffecient of a bounce applied to the shape in response to a collision.\n\n" "Restitution is a ratio of a shape's velocity before and after a collision. " "A value of 0 will zero out a shape's post-collision velocity, making it stop on contact. " @@ -137,30 +137,30 @@ void PhysicsShapeData::initPersistFields() "@note Values near or equaling 1.0 are likely to cause undesirable results in the physics simulation." " Because of this it is reccomended to avoid values close to 1.0"); - addField( "linearDamping", TypeF32, Offset( linearDamping, PhysicsShapeData ), + addFieldV( "linearDamping", TypeRangedF32, Offset( linearDamping, PhysicsShapeData ), &CommonValidators::PositiveFloat, "@brief Value that reduces an object's linear velocity over time.\n\n" "Larger values will cause velocity to decay quicker.\n\n" ); - addField( "angularDamping", TypeF32, Offset( angularDamping, PhysicsShapeData ), + addFieldV( "angularDamping", TypeRangedF32, Offset( angularDamping, PhysicsShapeData ), &CommonValidators::PositiveFloat, "@brief Value that reduces an object's rotational velocity over time.\n\n" "Larger values will cause velocity to decay quicker.\n\n" ); - addField( "linearSleepThreshold", TypeF32, Offset( linearSleepThreshold, PhysicsShapeData ), + addFieldV( "linearSleepThreshold", TypeRangedF32, Offset( linearSleepThreshold, PhysicsShapeData ), &CommonValidators::PositiveFloat, "@brief Minimum linear velocity before the shape can be put to sleep.\n\n" "This should be a positive value. Shapes put to sleep will not be simulated in order to save system resources.\n\n" "@note The shape must be dynamic."); - addField( "angularSleepThreshold", TypeF32, Offset( angularSleepThreshold, PhysicsShapeData ), + addFieldV( "angularSleepThreshold", TypeRangedF32, Offset( angularSleepThreshold, PhysicsShapeData ), &CommonValidators::PositiveFloat, "@brief Minimum rotational velocity before the shape can be put to sleep.\n\n" "This should be a positive value. Shapes put to sleep will not be simulated in order to save system resources.\n\n" "@note The shape must be dynamic."); - addField( "waterDampingScale", TypeF32, Offset( waterDampingScale, PhysicsShapeData ), + addFieldV( "waterDampingScale", TypeRangedF32, Offset( waterDampingScale, PhysicsShapeData ), &CommonValidators::PositiveFloat, "@brief Scale to apply to linear and angular dampening while underwater.\n\n " "Used with the waterViscosity of the " "@see angularDamping linearDamping" ); - addField( "buoyancyDensity", TypeF32, Offset( buoyancyDensity, PhysicsShapeData ), + addFieldV( "buoyancyDensity", TypeRangedF32, Offset( buoyancyDensity, PhysicsShapeData ), &CommonValidators::PositiveFloat, "@brief The density of the shape for calculating buoyant forces.\n\n" "The result of the calculated buoyancy is relative to the density of the WaterObject the PhysicsShape is within.\n\n" "@see WaterObject::density"); diff --git a/Engine/source/T3D/player.cpp b/Engine/source/T3D/player.cpp index dd0ee8ed9..e474ec7de 100644 --- a/Engine/source/T3D/player.cpp +++ b/Engine/source/T3D/player.cpp @@ -699,19 +699,20 @@ bool PlayerData::isJumpAction(U32 action) { return (action == JumpAnim || action == StandJumpAnim); } +IRangeValidator jumpDelayRange(0, 1 << PlayerData::JumpDelayBits); void PlayerData::initPersistFields() { docsURL; Parent::initPersistFields(); - addField( "pickupRadius", TypeF32, Offset(pickupRadius, PlayerData), + addFieldV( "pickupRadius", TypeRangedF32, Offset(pickupRadius, PlayerData), &CommonValidators::PositiveFloat, "@brief Radius around the player to collide with Items in the scene (on server).\n\n" "Internally the pickupRadius is added to the larger side of the initial bounding box " "to determine the actual distance, to a maximum of 2 times the bounding box size. The " "initial bounding box is that used for the root pose, and therefore doesn't take into " "account the change in pose.\n"); - addField( "maxTimeScale", TypeF32, Offset(maxTimeScale, PlayerData), + addFieldV( "maxTimeScale", TypeRangedF32, Offset(maxTimeScale, PlayerData), &CommonValidators::PositiveFloat, "@brief Maximum time scale for action animations.\n\n" "If an action animation has a defined ground frame, it is automatically scaled to match the " "player's ground velocity. This field limits the maximum time scale used even if " @@ -725,13 +726,13 @@ void PlayerData::initPersistFields() addField( "firstPersonShadows", TypeBool, Offset(firstPersonShadows, PlayerData), "@brief Forces shadows to be rendered in first person when renderFirstPerson is disabled. Defaults to false.\n\n" ); - addField( "minLookAngle", TypeF32, Offset(minLookAngle, PlayerData), + addFieldV( "minLookAngle", TypeRangedF32, Offset(minLookAngle, PlayerData), &CommonValidators::PositiveFloat, "@brief Lowest angle (in radians) the player can look.\n\n" "@note An angle of zero is straight ahead, with positive up and negative down." ); - addField( "maxLookAngle", TypeF32, Offset(maxLookAngle, PlayerData), + addFieldV( "maxLookAngle", TypeRangedF32, Offset(maxLookAngle, PlayerData), &CommonValidators::PositiveFloat, "@brief Highest angle (in radians) the player can look.\n\n" "@note An angle of zero is straight ahead, with positive up and negative down." ); - addField( "maxFreelookAngle", TypeF32, Offset(maxFreelookAngle, PlayerData), + addFieldV( "maxFreelookAngle", TypeRangedF32, Offset(maxFreelookAngle, PlayerData), &CommonValidators::PositiveFloat, "@brief Defines the maximum left and right angles (in radians) the player can " "look in freelook mode.\n\n" ); @@ -739,72 +740,72 @@ void PlayerData::initPersistFields() addGroup( "Movement" ); - addField( "maxStepHeight", TypeF32, Offset(maxStepHeight, PlayerData), + addFieldV( "maxStepHeight", TypeRangedF32, Offset(maxStepHeight, PlayerData), &CommonValidators::PositiveFloat, "@brief Maximum height the player can step up.\n\n" "The player will automatically step onto changes in ground height less " "than maxStepHeight. The player will collide with ground height changes " "greater than this." ); - addField( "runForce", TypeF32, Offset(runForce, PlayerData), + addFieldV( "runForce", TypeRangedF32, Offset(runForce, PlayerData), &CommonValidators::PositiveFloat, "@brief Force used to accelerate the player when running.\n\n" ); - addField( "runEnergyDrain", TypeF32, Offset(runEnergyDrain, PlayerData), + addFieldV( "runEnergyDrain", TypeRangedF32, Offset(runEnergyDrain, PlayerData), &CommonValidators::PositiveFloat, "@brief Energy value drained each tick that the player is moving.\n\n" "The player will not be able to move when his energy falls below " "minRunEnergy.\n" "@note Setting this to zero will disable any energy drain.\n" "@see minRunEnergy\n"); - addField( "minRunEnergy", TypeF32, Offset(minRunEnergy, PlayerData), + addFieldV( "minRunEnergy", TypeRangedF32, Offset(minRunEnergy, PlayerData), &CommonValidators::PositiveFloat, "@brief Minimum energy level required to run or swim.\n\n" "@see runEnergyDrain\n"); - addField( "maxForwardSpeed", TypeF32, Offset(maxForwardSpeed, PlayerData), + addFieldV( "maxForwardSpeed", TypeRangedF32, Offset(maxForwardSpeed, PlayerData), &CommonValidators::PositiveFloat, "@brief Maximum forward speed when running." ); - addField( "maxBackwardSpeed", TypeF32, Offset(maxBackwardSpeed, PlayerData), + addFieldV( "maxBackwardSpeed", TypeRangedF32, Offset(maxBackwardSpeed, PlayerData), &CommonValidators::PositiveFloat, "@brief Maximum backward speed when running." ); - addField( "maxSideSpeed", TypeF32, Offset(maxSideSpeed, PlayerData), + addFieldV( "maxSideSpeed", TypeRangedF32, Offset(maxSideSpeed, PlayerData), &CommonValidators::PositiveFloat, "@brief Maximum sideways speed when running." ); - addField( "runSurfaceAngle", TypeF32, Offset(runSurfaceAngle, PlayerData), + addFieldV( "runSurfaceAngle", TypeRangedF32, Offset(runSurfaceAngle, PlayerData), &CommonValidators::PosDegreeRangeQuarter, "@brief Maximum angle from vertical (in degrees) the player can run up.\n\n" ); - addField( "minImpactSpeed", TypeF32, Offset(minImpactSpeed, PlayerData), + addFieldV( "minImpactSpeed", TypeRangedF32, Offset(minImpactSpeed, PlayerData), &CommonValidators::PositiveFloat, "@brief Minimum impact speed to apply falling damage.\n\n" "This field also sets the minimum speed for the onImpact callback " "to be invoked.\n" "@see ShapeBaseData::onImpact()\n"); - addField( "minLateralImpactSpeed", TypeF32, Offset(minLateralImpactSpeed, PlayerData), + addFieldV( "minLateralImpactSpeed", TypeRangedF32, Offset(minLateralImpactSpeed, PlayerData), &CommonValidators::PositiveFloat, "@brief Minimum impact speed to apply non-falling damage.\n\n" "This field also sets the minimum speed for the onLateralImpact callback " "to be invoked.\n" "@see ShapeBaseData::onLateralImpact()\n"); - addField( "horizMaxSpeed", TypeF32, Offset(horizMaxSpeed, PlayerData), + addFieldV( "horizMaxSpeed", TypeRangedF32, Offset(horizMaxSpeed, PlayerData), &CommonValidators::PositiveFloat, "@brief Maximum horizontal speed.\n\n" "@note This limit is only enforced if the player's horizontal speed " "exceeds horizResistSpeed.\n" "@see horizResistSpeed\n" "@see horizResistFactor\n" ); - addField( "horizResistSpeed", TypeF32, Offset(horizResistSpeed, PlayerData), + addFieldV( "horizResistSpeed", TypeRangedF32, Offset(horizResistSpeed, PlayerData), &CommonValidators::PositiveFloat, "@brief Horizontal speed at which resistence will take place.\n\n" "@see horizMaxSpeed\n" "@see horizResistFactor\n" ); - addField( "horizResistFactor", TypeF32, Offset(horizResistFactor, PlayerData), + addFieldV( "horizResistFactor", TypeRangedF32, Offset(horizResistFactor, PlayerData), &CommonValidators::PositiveFloat, "@brief Factor of resistence once horizResistSpeed has been reached.\n\n" "@see horizMaxSpeed\n" "@see horizResistSpeed\n" ); - addField( "upMaxSpeed", TypeF32, Offset(upMaxSpeed, PlayerData), + addFieldV( "upMaxSpeed", TypeRangedF32, Offset(upMaxSpeed, PlayerData), &CommonValidators::PositiveFloat, "@brief Maximum upwards speed.\n\n" "@note This limit is only enforced if the player's upward speed exceeds " "upResistSpeed.\n" "@see upResistSpeed\n" "@see upResistFactor\n" ); - addField( "upResistSpeed", TypeF32, Offset(upResistSpeed, PlayerData), + addFieldV( "upResistSpeed", TypeRangedF32, Offset(upResistSpeed, PlayerData), &CommonValidators::PositiveFloat, "@brief Upwards speed at which resistence will take place.\n\n" "@see upMaxSpeed\n" "@see upResistFactor\n" ); - addField( "upResistFactor", TypeF32, Offset(upResistFactor, PlayerData), + addFieldV( "upResistFactor", TypeRangedF32, Offset(upResistFactor, PlayerData), &CommonValidators::PositiveFloat, "@brief Factor of resistence once upResistSpeed has been reached.\n\n" "@see upMaxSpeed\n" "@see upResistSpeed\n" ); @@ -813,29 +814,29 @@ void PlayerData::initPersistFields() addGroup( "Movement: Jumping" ); - addField( "jumpForce", TypeF32, Offset(jumpForce, PlayerData), + addFieldV( "jumpForce", TypeRangedF32, Offset(jumpForce, PlayerData), &CommonValidators::PositiveFloat, "@brief Force used to accelerate the player when a jump is initiated.\n\n" ); - addField( "jumpEnergyDrain", TypeF32, Offset(jumpEnergyDrain, PlayerData), + addFieldV( "jumpEnergyDrain", TypeRangedF32, Offset(jumpEnergyDrain, PlayerData), &CommonValidators::PositiveFloat, "@brief Energy level drained each time the player jumps.\n\n" "@note Setting this to zero will disable any energy drain\n" "@see minJumpEnergy\n"); - addField( "minJumpEnergy", TypeF32, Offset(minJumpEnergy, PlayerData), + addFieldV( "minJumpEnergy", TypeRangedF32, Offset(minJumpEnergy, PlayerData), &CommonValidators::PositiveFloat, "@brief Minimum energy level required to jump.\n\n" "@see jumpEnergyDrain\n"); - addField( "minJumpSpeed", TypeF32, Offset(minJumpSpeed, PlayerData), + addFieldV( "minJumpSpeed", TypeRangedF32, Offset(minJumpSpeed, PlayerData), &CommonValidators::PositiveFloat, "@brief Minimum speed needed to jump.\n\n" "If the player's own z velocity is greater than this, then it is used to scale " "the jump speed, up to maxJumpSpeed.\n" "@see maxJumpSpeed\n"); - addField( "maxJumpSpeed", TypeF32, Offset(maxJumpSpeed, PlayerData), + addFieldV( "maxJumpSpeed", TypeRangedF32, Offset(maxJumpSpeed, PlayerData), &CommonValidators::PositiveFloat, "@brief Maximum vertical speed before the player can no longer jump.\n\n" ); - addField( "jumpSurfaceAngle", TypeF32, Offset(jumpSurfaceAngle, PlayerData), + addFieldV( "jumpSurfaceAngle", TypeRangedF32, Offset(jumpSurfaceAngle, PlayerData), &CommonValidators::PosDegreeRangeQuarter, "@brief Angle from vertical (in degrees) where the player can jump.\n\n" ); - addField( "jumpDelay", TypeS32, Offset(jumpDelay, PlayerData), + addFieldV( "jumpDelay", TypeRangedS32, Offset(jumpDelay, PlayerData), &jumpDelayRange, "@brief Delay time in number of ticks ticks between jumps.\n\n" ); - addField( "airControl", TypeF32, Offset(airControl, PlayerData), + addFieldV( "airControl", TypeRangedF32, Offset(airControl, PlayerData), &CommonValidators::PositiveFloat, "@brief Amount of movement control the player has when in the air.\n\n" "This is applied as a multiplier to the player's x and y motion.\n"); addField( "jumpTowardsNormal", TypeBool, Offset(jumpTowardsNormal, PlayerData), @@ -849,31 +850,31 @@ void PlayerData::initPersistFields() addGroup( "Movement: Sprinting" ); - addField( "sprintForce", TypeF32, Offset(sprintForce, PlayerData), + addFieldV( "sprintForce", TypeRangedF32, Offset(sprintForce, PlayerData), &CommonValidators::PositiveFloat, "@brief Force used to accelerate the player when sprinting.\n\n" ); - addField( "sprintEnergyDrain", TypeF32, Offset(sprintEnergyDrain, PlayerData), + addFieldV( "sprintEnergyDrain", TypeRangedF32, Offset(sprintEnergyDrain, PlayerData), &CommonValidators::PositiveFloat, "@brief Energy value drained each tick that the player is sprinting.\n\n" "The player will not be able to move when his energy falls below " "sprintEnergyDrain.\n" "@note Setting this to zero will disable any energy drain.\n" "@see minSprintEnergy\n"); - addField( "minSprintEnergy", TypeF32, Offset(minSprintEnergy, PlayerData), + addFieldV( "minSprintEnergy", TypeRangedF32, Offset(minSprintEnergy, PlayerData), &CommonValidators::PositiveFloat, "@brief Minimum energy level required to sprint.\n\n" "@see sprintEnergyDrain\n"); - addField( "maxSprintForwardSpeed", TypeF32, Offset(maxSprintForwardSpeed, PlayerData), + addFieldV( "maxSprintForwardSpeed", TypeRangedF32, Offset(maxSprintForwardSpeed, PlayerData), &CommonValidators::PositiveFloat, "@brief Maximum forward speed when sprinting." ); - addField( "maxSprintBackwardSpeed", TypeF32, Offset(maxSprintBackwardSpeed, PlayerData), + addFieldV( "maxSprintBackwardSpeed", TypeRangedF32, Offset(maxSprintBackwardSpeed, PlayerData), &CommonValidators::PositiveFloat, "@brief Maximum backward speed when sprinting." ); - addField( "maxSprintSideSpeed", TypeF32, Offset(maxSprintSideSpeed, PlayerData), + addFieldV( "maxSprintSideSpeed", TypeRangedF32, Offset(maxSprintSideSpeed, PlayerData), &CommonValidators::PositiveFloat, "@brief Maximum sideways speed when sprinting." ); - addField( "sprintStrafeScale", TypeF32, Offset(sprintStrafeScale, PlayerData), + addFieldV( "sprintStrafeScale", TypeRangedF32, Offset(sprintStrafeScale, PlayerData), &CommonValidators::PositiveFloat, "@brief Amount to scale strafing motion vector while sprinting." ); - addField( "sprintYawScale", TypeF32, Offset(sprintYawScale, PlayerData), + addFieldV( "sprintYawScale", TypeRangedF32, Offset(sprintYawScale, PlayerData), &CommonValidators::PositiveFloat, "@brief Amount to scale yaw motion while sprinting." ); - addField( "sprintPitchScale", TypeF32, Offset(sprintPitchScale, PlayerData), + addFieldV( "sprintPitchScale", TypeRangedF32, Offset(sprintPitchScale, PlayerData), &CommonValidators::PositiveFloat, "@brief Amount to scale pitch motion while sprinting." ); addField( "sprintCanJump", TypeBool, Offset(sprintCanJump, PlayerData), @@ -883,82 +884,82 @@ void PlayerData::initPersistFields() addGroup( "Movement: Swimming" ); - addField( "swimForce", TypeF32, Offset(swimForce, PlayerData), + addFieldV( "swimForce", TypeRangedF32, Offset(swimForce, PlayerData), &CommonValidators::PositiveFloat, "@brief Force used to accelerate the player when swimming.\n\n" ); - addField( "maxUnderwaterForwardSpeed", TypeF32, Offset(maxUnderwaterForwardSpeed, PlayerData), + addFieldV( "maxUnderwaterForwardSpeed", TypeRangedF32, Offset(maxUnderwaterForwardSpeed, PlayerData), &CommonValidators::PositiveFloat, "@brief Maximum forward speed when underwater.\n\n" ); - addField( "maxUnderwaterBackwardSpeed", TypeF32, Offset(maxUnderwaterBackwardSpeed, PlayerData), + addFieldV( "maxUnderwaterBackwardSpeed", TypeRangedF32, Offset(maxUnderwaterBackwardSpeed, PlayerData), &CommonValidators::PositiveFloat, "@brief Maximum backward speed when underwater.\n\n" ); - addField( "maxUnderwaterSideSpeed", TypeF32, Offset(maxUnderwaterSideSpeed, PlayerData), + addFieldV( "maxUnderwaterSideSpeed", TypeRangedF32, Offset(maxUnderwaterSideSpeed, PlayerData), &CommonValidators::PositiveFloat, "@brief Maximum sideways speed when underwater.\n\n" ); endGroup( "Movement: Swimming" ); addGroup( "Movement: Crouching" ); - addField( "crouchForce", TypeF32, Offset(crouchForce, PlayerData), + addFieldV( "crouchForce", TypeRangedF32, Offset(crouchForce, PlayerData), &CommonValidators::PositiveFloat, "@brief Force used to accelerate the player when crouching.\n\n" ); - addField( "maxCrouchForwardSpeed", TypeF32, Offset(maxCrouchForwardSpeed, PlayerData), + addFieldV( "maxCrouchForwardSpeed", TypeRangedF32, Offset(maxCrouchForwardSpeed, PlayerData), &CommonValidators::PositiveFloat, "@brief Maximum forward speed when crouching.\n\n" ); - addField( "maxCrouchBackwardSpeed", TypeF32, Offset(maxCrouchBackwardSpeed, PlayerData), + addFieldV( "maxCrouchBackwardSpeed", TypeRangedF32, Offset(maxCrouchBackwardSpeed, PlayerData), &CommonValidators::PositiveFloat, "@brief Maximum backward speed when crouching.\n\n" ); - addField( "maxCrouchSideSpeed", TypeF32, Offset(maxCrouchSideSpeed, PlayerData), + addFieldV( "maxCrouchSideSpeed", TypeRangedF32, Offset(maxCrouchSideSpeed, PlayerData), &CommonValidators::PositiveFloat, "@brief Maximum sideways speed when crouching.\n\n" ); endGroup( "Movement: Crouching" ); addGroup( "Movement: Prone" ); - addField( "proneForce", TypeF32, Offset(proneForce, PlayerData), + addFieldV( "proneForce", TypeRangedF32, Offset(proneForce, PlayerData), &CommonValidators::PositiveFloat, "@brief Force used to accelerate the player when prone (laying down).\n\n" ); - addField( "maxProneForwardSpeed", TypeF32, Offset(maxProneForwardSpeed, PlayerData), + addFieldV( "maxProneForwardSpeed", TypeRangedF32, Offset(maxProneForwardSpeed, PlayerData), &CommonValidators::PositiveFloat, "@brief Maximum forward speed when prone (laying down).\n\n" ); - addField( "maxProneBackwardSpeed", TypeF32, Offset(maxProneBackwardSpeed, PlayerData), + addFieldV( "maxProneBackwardSpeed", TypeRangedF32, Offset(maxProneBackwardSpeed, PlayerData), &CommonValidators::PositiveFloat, "@brief Maximum backward speed when prone (laying down).\n\n" ); - addField( "maxProneSideSpeed", TypeF32, Offset(maxProneSideSpeed, PlayerData), + addFieldV( "maxProneSideSpeed", TypeRangedF32, Offset(maxProneSideSpeed, PlayerData), &CommonValidators::PositiveFloat, "@brief Maximum sideways speed when prone (laying down).\n\n" ); endGroup( "Movement: Prone" ); addGroup( "Movement: Jetting" ); - addField( "jetJumpForce", TypeF32, Offset(jetJumpForce, PlayerData), + addFieldV( "jetJumpForce", TypeRangedF32, Offset(jetJumpForce, PlayerData), &CommonValidators::PositiveFloat, "@brief Force used to accelerate the player when a jet jump is initiated.\n\n" ); - addField( "jetJumpEnergyDrain", TypeF32, Offset(jetJumpEnergyDrain, PlayerData), + addFieldV( "jetJumpEnergyDrain", TypeRangedF32, Offset(jetJumpEnergyDrain, PlayerData), &CommonValidators::PositiveFloat, "@brief Energy level drained each time the player jet jumps.\n\n" "@note Setting this to zero will disable any energy drain\n" "@see jetMinJumpEnergy\n"); - addField( "jetMinJumpEnergy", TypeF32, Offset(jetMinJumpEnergy, PlayerData), + addFieldV( "jetMinJumpEnergy", TypeRangedF32, Offset(jetMinJumpEnergy, PlayerData), &CommonValidators::PositiveFloat, "@brief Minimum energy level required to jet jump.\n\n" "@see jetJumpEnergyDrain\n"); - addField( "jetMinJumpSpeed", TypeF32, Offset(jetMinJumpSpeed, PlayerData), + addFieldV( "jetMinJumpSpeed", TypeRangedF32, Offset(jetMinJumpSpeed, PlayerData), &CommonValidators::PositiveFloat, "@brief Minimum speed needed to jet jump.\n\n" "If the player's own z velocity is greater than this, then it is used to scale " "the jet jump speed, up to jetMaxJumpSpeed.\n" "@see jetMaxJumpSpeed\n"); - addField( "jetMaxJumpSpeed", TypeF32, Offset(jetMaxJumpSpeed, PlayerData), + addFieldV( "jetMaxJumpSpeed", TypeRangedF32, Offset(jetMaxJumpSpeed, PlayerData), &CommonValidators::PositiveFloat, "@brief Maximum vertical speed before the player can no longer jet jump.\n\n" ); - addField( "jetJumpSurfaceAngle", TypeF32, Offset(jetJumpSurfaceAngle, PlayerData), + addFieldV( "jetJumpSurfaceAngle", TypeRangedF32, Offset(jetJumpSurfaceAngle, PlayerData), &CommonValidators::PosDegreeRangeQuarter, "@brief Angle from vertical (in degrees) where the player can jet jump.\n\n" ); endGroup( "Movement: Jetting" ); addGroup( "Falling" ); - addField( "fallingSpeedThreshold", TypeF32, Offset(fallingSpeedThreshold, PlayerData), + addFieldV( "fallingSpeedThreshold", TypeRangedF32, Offset(fallingSpeedThreshold, PlayerData), &CommonValidators::PositiveFloat, "@brief Downward speed at which we consider the player falling.\n\n" ); - addField( "recoverDelay", TypeS32, Offset(recoverDelay, PlayerData), + addFieldV( "recoverDelay", TypeRangedS32, Offset(recoverDelay, PlayerData), &CommonValidators::PositiveInt, "@brief Number of ticks for the player to recover from falling.\n\n" ); - addField( "recoverRunForceScale", TypeF32, Offset(recoverRunForceScale, PlayerData), + addFieldV( "recoverRunForceScale", TypeRangedF32, Offset(recoverRunForceScale, PlayerData), &CommonValidators::PositiveFloat, "@brief Scale factor applied to runForce while in the recover state.\n\n" "This can be used to temporarily slow the player's movement after a fall, or " "prevent the player from moving at all if set to zero.\n" ); - addField( "landSequenceTime", TypeF32, Offset(landSequenceTime, PlayerData), + addFieldV( "landSequenceTime", TypeRangedF32, Offset(landSequenceTime, PlayerData), &CommonValidators::PositiveFloat, "@brief Time of land sequence play back when using new recover system.\n\n" "If greater than 0 then the legacy fall recovery system will be bypassed " "in favour of just playing the player's land sequence. The time to " @@ -988,27 +989,27 @@ void PlayerData::initPersistFields() "@brief Collision bounding box used when the player is swimming.\n\n" "@see boundingBox" ); - addField( "boxHeadPercentage", TypeF32, Offset(boxHeadPercentage, PlayerData), + addFieldV( "boxHeadPercentage", TypeRangedF32, Offset(boxHeadPercentage, PlayerData), &CommonValidators::NormalizedFloat, "@brief Percentage of the player's bounding box height that represents the head.\n\n" "Used when computing the damage location.\n" "@see Player::getDamageLocation" ); - addField( "boxTorsoPercentage", TypeF32, Offset(boxTorsoPercentage, PlayerData), + addFieldV( "boxTorsoPercentage", TypeRangedF32, Offset(boxTorsoPercentage, PlayerData), &CommonValidators::NormalizedFloat, "@brief Percentage of the player's bounding box height that represents the torso.\n\n" "Used when computing the damage location.\n" "@see Player::getDamageLocation" ); - addField( "boxHeadLeftPercentage", TypeF32, Offset(boxHeadLeftPercentage, PlayerData), + addFieldV( "boxHeadLeftPercentage", TypeRangedF32, Offset(boxHeadLeftPercentage, PlayerData), &CommonValidators::NormalizedFloat, "@brief Percentage of the player's bounding box width that represents the left side of the head.\n\n" "Used when computing the damage location.\n" "@see Player::getDamageLocation" ); - addField( "boxHeadRightPercentage", TypeF32, Offset(boxHeadRightPercentage, PlayerData), + addFieldV( "boxHeadRightPercentage", TypeRangedF32, Offset(boxHeadRightPercentage, PlayerData), &CommonValidators::NormalizedFloat, "@brief Percentage of the player's bounding box width that represents the right side of the head.\n\n" "Used when computing the damage location.\n" "@see Player::getDamageLocation" ); - addField( "boxHeadBackPercentage", TypeF32, Offset(boxHeadBackPercentage, PlayerData), + addFieldV( "boxHeadBackPercentage", TypeRangedF32, Offset(boxHeadBackPercentage, PlayerData), &CommonValidators::NormalizedFloat, "@brief Percentage of the player's bounding box depth that represents the back side of the head.\n\n" "Used when computing the damage location.\n" "@see Player::getDamageLocation" ); - addField( "boxHeadFrontPercentage", TypeF32, Offset(boxHeadFrontPercentage, PlayerData), + addFieldV( "boxHeadFrontPercentage", TypeRangedF32, Offset(boxHeadFrontPercentage, PlayerData), &CommonValidators::NormalizedFloat, "@brief Percentage of the player's bounding box depth that represents the front side of the head.\n\n" "Used when computing the damage location.\n" "@see Player::getDamageLocation" ); @@ -1022,12 +1023,12 @@ void PlayerData::initPersistFields() "walks along the ground).\n\n" "@note The generation of foot puffs requires the appropriate triggeres to be defined in the " "player's animation sequences. Without these, no foot puffs will be generated.\n"); - addField( "footPuffNumParts", TypeS32, Offset(footPuffNumParts, PlayerData), + addFieldV( "footPuffNumParts", TypeRangedS32, Offset(footPuffNumParts, PlayerData), &CommonValidators::PositiveInt, "@brief Number of footpuff particles to generate each step.\n\n" "Each foot puff is randomly placed within the defined foot puff radius. This " "includes having footPuffNumParts set to one.\n" "@see footPuffRadius\n"); - addField( "footPuffRadius", TypeF32, Offset(footPuffRadius, PlayerData), + addFieldV( "footPuffRadius", TypeRangedF32, Offset(footPuffRadius, PlayerData), &CommonValidators::PositiveFloat, "@brief Particle creation radius for footpuff particles.\n\n" "This is applied to each foot puff particle, even if footPuffNumParts is set to one. So " "set this value to zero if you want a single foot puff placed at exactly the same location " @@ -1038,7 +1039,7 @@ void PlayerData::initPersistFields() addField( "decalData", TYPEID< DecalData >(), Offset(decalData, PlayerData), "@brief Decal to place on the ground for player footsteps.\n\n" ); - addField( "decalOffset",TypeF32, Offset(decalOffset, PlayerData), + addFieldV( "decalOffset", TypeRangedF32, Offset(decalOffset, PlayerData), &CommonValidators::PositiveFloat, "@brief Distance from the center of the model to the right foot.\n\n" "While this defines the distance to the right foot, it is also used to place " "the left foot decal as well. Just on the opposite side of the player." ); @@ -1054,37 +1055,37 @@ void PlayerData::initPersistFields() addField( "splash", TYPEID< SplashData >(), Offset(splash, PlayerData), "@brief SplashData datablock used to create splashes when the player moves " "through water.\n\n" ); - addField( "splashVelocity", TypeF32, Offset(splashVelocity, PlayerData), + addFieldV( "splashVelocity", TypeRangedF32, Offset(splashVelocity, PlayerData), &CommonValidators::PositiveFloat, "@brief Minimum velocity when moving through water to generate splashes.\n\n" ); - addField( "splashAngle", TypeF32, Offset(splashAngle, PlayerData), + addFieldV( "splashAngle", TypeRangedF32, Offset(splashAngle, PlayerData), &CommonValidators::PosDegreeRange, "@brief Maximum angle (in degrees) from pure vertical movement in water to " "generate splashes.\n\n" ); - addField( "splashFreqMod", TypeF32, Offset(splashFreqMod, PlayerData), + addFieldV( "splashFreqMod", TypeRangedF32, Offset(splashFreqMod, PlayerData), &CommonValidators::PositiveFloat, "@brief Multipled by speed to determine the number of splash particles to generate.\n\n" ); - addField( "splashVelEpsilon", TypeF32, Offset(splashVelEpsilon, PlayerData), + addFieldV( "splashVelEpsilon", TypeRangedF32, Offset(splashVelEpsilon, PlayerData), &CommonValidators::PositiveFloat, "@brief Minimum speed to generate splash particles.\n\n" ); - addField( "bubbleEmitTime", TypeF32, Offset(bubbleEmitTime, PlayerData), + addFieldV( "bubbleEmitTime", TypeRangedF32, Offset(bubbleEmitTime, PlayerData), &CommonValidators::PositiveFloat, "@brief Time in seconds to generate bubble particles after entering the water.\n\n" ); addField( "splashEmitter", TYPEID< ParticleEmitterData >(), Offset(splashEmitterList, PlayerData), NUM_SPLASH_EMITTERS, "@brief Particle emitters used to generate splash particles.\n\n" ); - addField( "footstepSplashHeight", TypeF32, Offset(footSplashHeight, PlayerData), + addFieldV( "footstepSplashHeight", TypeRangedF32, Offset(footSplashHeight, PlayerData), &CommonValidators::PositiveFloat, "@brief Water coverage level to choose between FootShallowSound and FootWadingSound.\n\n" "@see FootShallowSound\n" "@see FootWadingSound\n"); - addField( "mediumSplashSoundVelocity", TypeF32, Offset(medSplashSoundVel, PlayerData), + addFieldV( "mediumSplashSoundVelocity", TypeRangedF32, Offset(medSplashSoundVel, PlayerData), &CommonValidators::PositiveFloat, "@brief Minimum velocity when entering the water for choosing between the impactWaterEasy and " "impactWaterMedium sounds to play.\n\n" "@see impactWaterEasy\n" "@see impactWaterMedium\n" ); - addField( "hardSplashSoundVelocity", TypeF32, Offset(hardSplashSoundVel, PlayerData), + addFieldV( "hardSplashSoundVelocity", TypeRangedF32, Offset(hardSplashSoundVel, PlayerData), &CommonValidators::PositiveFloat, "@brief Minimum velocity when entering the water for choosing between the impactWaterMedium and " "impactWaterHard sound to play.\n\n" "@see impactWaterMedium\n" "@see impactWaterHard\n" ); - addField( "exitSplashSoundVelocity", TypeF32, Offset(exitSplashSoundVel, PlayerData), + addFieldV( "exitSplashSoundVelocity", TypeRangedF32, Offset(exitSplashSoundVel, PlayerData), &CommonValidators::PositiveFloat, "@brief Minimum velocity when leaving the water for the exitingWater sound to " "play.\n\n" "@see exitingWater"); @@ -1093,7 +1094,7 @@ void PlayerData::initPersistFields() addGroup( "Interaction: Ground Impact" ); - addField( "groundImpactMinSpeed", TypeF32, Offset(groundImpactMinSpeed, PlayerData), + addFieldV( "groundImpactMinSpeed", TypeRangedF32, Offset(groundImpactMinSpeed, PlayerData), &CommonValidators::PositiveFloat, "@brief Minimum falling impact speed to apply damage and initiate the camera " "shaking effect.\n\n" ); addField( "groundImpactShakeFreq", TypePoint3F, Offset(groundImpactShakeFreq, PlayerData), @@ -1102,10 +1103,10 @@ void PlayerData::initPersistFields() addField( "groundImpactShakeAmp", TypePoint3F, Offset(groundImpactShakeAmp, PlayerData), "@brief Amplitude of the camera shake effect after falling.\n\n" "This is how much to shake the camera.\n"); - addField( "groundImpactShakeDuration", TypeF32, Offset(groundImpactShakeDuration, PlayerData), + addFieldV( "groundImpactShakeDuration", TypeRangedF32, Offset(groundImpactShakeDuration, PlayerData), &CommonValidators::PositiveFloat, "@brief Duration (in seconds) of the camera shake effect after falling.\n\n" "This is how long to shake the camera.\n"); - addField( "groundImpactShakeFalloff", TypeF32, Offset(groundImpactShakeFalloff, PlayerData), + addFieldV( "groundImpactShakeFalloff", TypeRangedF32, Offset(groundImpactShakeFalloff, PlayerData), &CommonValidators::PositiveFloat, "@brief Falloff factor of the camera shake effect after falling.\n\n" "This is how to fade the camera shake over the duration.\n"); diff --git a/Engine/source/T3D/pointLight.cpp b/Engine/source/T3D/pointLight.cpp index 98fc16404..bf7947d33 100644 --- a/Engine/source/T3D/pointLight.cpp +++ b/Engine/source/T3D/pointLight.cpp @@ -102,7 +102,7 @@ void PointLight::initPersistFields() docsURL; addGroup( "Light" ); - addField( "radius", TypeF32, Offset( mRadius, PointLight ), "Controls the falloff of the light emission" ); + addFieldV( "radius", TypeRangedF32, Offset( mRadius, PointLight ), &CommonValidators::PositiveFloat, "Controls the falloff of the light emission" ); endGroup( "Light" ); diff --git a/Engine/source/T3D/projectile.cpp b/Engine/source/T3D/projectile.cpp index 96bebca24..56f8af638 100644 --- a/Engine/source/T3D/projectile.cpp +++ b/Engine/source/T3D/projectile.cpp @@ -273,42 +273,42 @@ void ProjectileData::initPersistFields() endGroup("Light Emitter"); addGroup("Physics"); - addProtectedField("lifetime", TypeS32, Offset(lifetime, ProjectileData), &setLifetime, &getScaledValue, + addProtectedFieldV("lifetime", TypeRangedS32, Offset(lifetime, ProjectileData), &setLifetime, &getScaledValue, &CommonValidators::NaturalNumber, "@brief Amount of time, in milliseconds, before the projectile is removed from the simulation.\n\n" "Used with fadeDelay to determine the transparency of the projectile at a given time. " "A projectile may exist up to a maximum of 131040ms (or 4095 ticks) as defined by Projectile::MaxLivingTicks in the source code." "@see fadeDelay"); - addProtectedField("armingDelay", TypeS32, Offset(armingDelay, ProjectileData), &setArmingDelay, &getScaledValue, + addProtectedFieldV("armingDelay", TypeRangedS32, Offset(armingDelay, ProjectileData), &setArmingDelay, &getScaledValue, &CommonValidators::PositiveInt, "@brief Amount of time, in milliseconds, before the projectile will cause damage or explode on impact.\n\n" "This value must be equal to or less than the projectile's lifetime.\n\n" "@see lifetime"); - addProtectedField("fadeDelay", TypeS32, Offset(fadeDelay, ProjectileData), &setFadeDelay, &getScaledValue, + addProtectedFieldV("fadeDelay", TypeRangedS32, Offset(fadeDelay, ProjectileData), &setFadeDelay, &getScaledValue, &CommonValidators::NaturalNumber, "@brief Amount of time, in milliseconds, before the projectile begins to fade out.\n\n" "This value must be smaller than the projectile's lifetime to have an affect."); addField("isBallistic", TypeBool, Offset(isBallistic, ProjectileData), "@brief Detetmines if the projectile should be affected by gravity and whether or not " "it bounces before exploding.\n\n"); - addField("velInheritFactor", TypeF32, Offset(velInheritFactor, ProjectileData), + addFieldV("velInheritFactor", TypeRangedF32, Offset(velInheritFactor, ProjectileData), &CommonValidators::F32Range, "@brief Amount of velocity the projectile recieves from the source that created it.\n\n" "Use an amount between 0 and 1 for the best effect. " "This value is never modified by the engine.\n" "@note This value by default is not transmitted between the server and the client."); - addField("muzzleVelocity", TypeF32, Offset(muzzleVelocity, ProjectileData), + addFieldV("muzzleVelocity", TypeRangedF32, Offset(muzzleVelocity, ProjectileData), &CommonValidators::PositiveFloat, "@brief Amount of velocity the projectile recieves from the \"muzzle\" of the gun.\n\n" "Used with velInheritFactor to determine the initial velocity of the projectile. " "This value is never modified by the engine.\n\n" "@note This value by default is not transmitted between the server and the client.\n\n" "@see velInheritFactor"); - addField("impactForce", TypeF32, Offset(impactForce, ProjectileData)); - addField("bounceElasticity", TypeF32, Offset(bounceElasticity, ProjectileData), + addFieldV("impactForce", TypeRangedF32, Offset(impactForce, ProjectileData), &CommonValidators::PositiveFloat); + addFieldV("bounceElasticity", TypeRangedF32, Offset(bounceElasticity, ProjectileData), &CommonValidators::PositiveFloat, "@brief Influences post-bounce velocity of a projectile that does not explode on contact.\n\n" "Scales the velocity from a bounce after friction is taken into account. " "A value of 1.0 will leave it's velocity unchanged while values greater than 1.0 will increase it.\n"); - addField("bounceFriction", TypeF32, Offset(bounceFriction, ProjectileData), + addFieldV("bounceFriction", TypeRangedF32, Offset(bounceFriction, ProjectileData), &CommonValidators::PositiveFloat, "@brief Factor to reduce post-bounce velocity of a projectile that does not explode on contact.\n\n" "Reduces bounce velocity by this factor and a multiple of the tangent to impact. " "Used to simulate surface friction.\n"); - addField("gravityMod", TypeF32, Offset(gravityMod, ProjectileData), + addFieldV("gravityMod", TypeRangedF32, Offset(gravityMod, ProjectileData), &CommonValidators::F32Range, "@brief Scales the influence of gravity on the projectile.\n\n" "The larger this value is, the more that gravity will affect the projectile. " "A value of 1.0 will assume \"normal\" influence upon it.\n" diff --git a/Engine/source/T3D/proximityMine.cpp b/Engine/source/T3D/proximityMine.cpp index a4d054189..8ce924ea1 100644 --- a/Engine/source/T3D/proximityMine.cpp +++ b/Engine/source/T3D/proximityMine.cpp @@ -96,12 +96,12 @@ void ProximityMineData::initPersistFields() endGroup("Sounds"); addGroup( "Arming" ); - addField( "armingDelay", TypeF32, Offset(armingDelay, ProximityMineData), + addFieldV( "armingDelay", TypeRangedF32, Offset(armingDelay, ProximityMineData), &CommonValidators::PositiveFloat, "Delay (in seconds) from when the mine is placed to when it becomes active." ); endGroup( "Arming" ); addGroup( "Triggering" ); - addField( "autoTriggerDelay", TypeF32, Offset(autoTriggerDelay, ProximityMineData), + addFieldV( "autoTriggerDelay", TypeRangedF32, Offset(autoTriggerDelay, ProximityMineData), &CommonValidators::PositiveFloat, "@brief Delay (in seconds) from arming until the mine automatically " "triggers and explodes, even if no object has entered the trigger area.\n\n" "Set to 0 to disable." ); @@ -109,16 +109,16 @@ void ProximityMineData::initPersistFields() "@brief Controls whether the mine can be triggered by the object that owns it.\n\n" "For example, a player could deploy mines that are only dangerous to other " "players and not himself." ); - addField( "triggerRadius", TypeF32, Offset(triggerRadius, ProximityMineData), + addFieldV( "triggerRadius", TypeRangedF32, Offset(triggerRadius, ProximityMineData), &CommonValidators::PositiveFloat, "Distance at which an activated mine will detect other objects and explode." ); - addField( "triggerSpeed", TypeF32, Offset(triggerSpeed, ProximityMineData), + addFieldV( "triggerSpeed", TypeRangedF32, Offset(triggerSpeed, ProximityMineData), &CommonValidators::PositiveFloat, "Speed above which moving objects within the trigger radius will trigger the mine" ); - addField( "triggerDelay", TypeF32, Offset(triggerDelay, ProximityMineData), + addFieldV( "triggerDelay", TypeRangedF32, Offset(triggerDelay, ProximityMineData), &CommonValidators::PositiveFloat, "Delay (in seconds) from when the mine is triggered until it explodes." ); endGroup( "Triggering" ); addGroup( "Explosion" ); - addField( "explosionOffset", TypeF32, Offset(explosionOffset, ProximityMineData), + addFieldV( "explosionOffset", TypeRangedF32, Offset(explosionOffset, ProximityMineData), &CommonValidators::F32Range, "@brief Offset from the mine's origin where the explosion emanates from." "Sometimes a thrown mine may be slightly sunk into the ground. This can be just " "enough to cause the explosion to occur under the ground, especially on flat " diff --git a/Engine/source/T3D/rigidShape.cpp b/Engine/source/T3D/rigidShape.cpp index 217d5f2df..b8f999a0b 100644 --- a/Engine/source/T3D/rigidShape.cpp +++ b/Engine/source/T3D/rigidShape.cpp @@ -517,12 +517,12 @@ void RigidShapeData::initPersistFields() addGroup( "Particle Effects" ); addField("dustEmitter", TYPEID< ParticleEmitterData >(), Offset(dustEmitter, RigidShapeData), "Array of pointers to ParticleEmitterData datablocks which will be used to emit particles at object/terrain contact point.\n"); - addField("triggerDustHeight", TypeF32, Offset(triggerDustHeight, RigidShapeData), "Maximum height from the ground at which the object will generate dust.\n"); - addField("dustHeight", TypeF32, Offset(dustHeight, RigidShapeData), "Height of dust effects.\n"); + addFieldV("triggerDustHeight", TypeRangedF32, Offset(triggerDustHeight, RigidShapeData), &CommonValidators::PositiveFloat, "Maximum height from the ground at which the object will generate dust.\n"); + addFieldV("dustHeight", TypeRangedF32, Offset(dustHeight, RigidShapeData), &CommonValidators::PositiveFloat, "Height of dust effects.\n"); addField("dustTrailEmitter", TYPEID< ParticleEmitterData >(), Offset(dustTrailEmitter, RigidShapeData), "Particle emitter used to create a dust trail for the moving object.\n"); addField("splashEmitter", TYPEID< ParticleEmitterData >(), Offset(splashEmitterList, RigidShapeData), VC_NUM_SPLASH_EMITTERS, "Array of pointers to ParticleEmitterData datablocks which will generate splash effects.\n"); - addField("splashFreqMod", TypeF32, Offset(splashFreqMod, RigidShapeData), "The simulated frequency modulation of a splash generated by this object. Multiplied along with speed and time elapsed when determining splash emition rate.\n"); - addField("splashVelEpsilon", TypeF32, Offset(splashVelEpsilon, RigidShapeData), "The threshold speed at which we consider the object's movement to have stopped when updating splash effects.\n"); + addFieldV("splashFreqMod", TypeRangedF32, Offset(splashFreqMod, RigidShapeData), &CommonValidators::PositiveFloat, "The simulated frequency modulation of a splash generated by this object. Multiplied along with speed and time elapsed when determining splash emition rate.\n"); + addFieldV("splashVelEpsilon", TypeRangedF32, Offset(splashVelEpsilon, RigidShapeData), &CommonValidators::PositiveFloat, "The threshold speed at which we consider the object's movement to have stopped when updating splash effects.\n"); endGroup( "Particle Effects" ); addGroup( "Sounds" ); @@ -534,34 +534,34 @@ void RigidShapeData::initPersistFields() "@brief Creates a representation of the object in the physics plugin.\n"); addField("massCenter", TypePoint3F, Offset(massCenter, RigidShapeData), "Center of mass for rigid body."); addField("massBox", TypePoint3F, Offset(massBox, RigidShapeData), "Size of inertial box."); - addField("bodyRestitution", TypeF32, Offset(body.restitution, RigidShapeData), "The percentage of kinetic energy kept by this object in a collision."); - addField("bodyFriction", TypeF32, Offset(body.friction, RigidShapeData), "How much friction this object has. Lower values will cause the object to appear to be more slippery."); - addField("maxDrag", TypeF32, Offset(maxDrag, RigidShapeData), "Maximum drag available to this object."); - addField("minDrag", TypeF32, Offset(minDrag, RigidShapeData), "Minimum drag available to this object."); - addField("integration", TypeS32, Offset(integration, RigidShapeData), "Number of physics steps to process per tick."); - addField("collisionTol", TypeF32, Offset(collisionTol, RigidShapeData), "Collision distance tolerance."); - addField("contactTol", TypeF32, Offset(contactTol, RigidShapeData), "Contact velocity tolerance."); - addField("dragForce", TypeF32, Offset(dragForce, RigidShapeData), "Used to simulate the constant drag acting on the object"); - addField("vertFactor", TypeF32, Offset(vertFactor, RigidShapeData), "The scalar applied to the vertical portion of the velocity drag acting on a object."); + addFieldV("bodyRestitution", TypeRangedF32, Offset(body.restitution, RigidShapeData), &CommonValidators::PositiveFloat, "The percentage of kinetic energy kept by this object in a collision."); + addFieldV("bodyFriction", TypeRangedF32, Offset(body.friction, RigidShapeData), &CommonValidators::PositiveFloat, "How much friction this object has. Lower values will cause the object to appear to be more slippery."); + addFieldV("maxDrag", TypeRangedF32, Offset(maxDrag, RigidShapeData), &CommonValidators::PositiveFloat, "Maximum drag available to this object."); + addFieldV("minDrag", TypeRangedF32, Offset(minDrag, RigidShapeData), &CommonValidators::PositiveFloat, "Minimum drag available to this object."); + addFieldV("integration", TypeRangedS32, Offset(integration, RigidShapeData), &CommonValidators::NaturalNumber, "Number of physics steps to process per tick."); + addFieldV("collisionTol", TypeRangedF32, Offset(collisionTol, RigidShapeData), &CommonValidators::PositiveFloat, "Collision distance tolerance."); + addFieldV("contactTol", TypeRangedF32, Offset(contactTol, RigidShapeData), &CommonValidators::PositiveFloat, "Contact velocity tolerance."); + addFieldV("dragForce", TypeRangedF32, Offset(dragForce, RigidShapeData), &CommonValidators::PositiveFloat, "Used to simulate the constant drag acting on the object"); + addFieldV("vertFactor", TypeRangedF32, Offset(vertFactor, RigidShapeData), &CommonValidators::PositiveFloat, "The scalar applied to the vertical portion of the velocity drag acting on a object."); endGroup("Physics"); addGroup("Collision"); - addField("minImpactSpeed", TypeF32, Offset(minImpactSpeed, RigidShapeData), + addFieldV("minImpactSpeed", TypeRangedF32, Offset(minImpactSpeed, RigidShapeData), &CommonValidators::PositiveFloat, "Minimum collision speed to classify collision as impact (triggers onImpact on server object)." ); - addField("softImpactSpeed", TypeF32, Offset(softImpactSpeed, RigidShapeData), "Minimum speed at which this object must be travelling for the soft impact sound to be played."); - addField("hardImpactSpeed", TypeF32, Offset(hardImpactSpeed, RigidShapeData), "Minimum speed at which the object must be travelling for the hard impact sound to be played."); - addField("minRollSpeed", TypeF32, Offset(minRollSpeed, RigidShapeData)); - addField("exitSplashSoundVelocity", TypeF32, Offset(exitSplashSoundVel, RigidShapeData), "The minimum velocity at which the exit splash sound will be played when emerging from water.\n"); - addField("softSplashSoundVelocity", TypeF32, Offset(softSplashSoundVel, RigidShapeData),"The minimum velocity at which the soft splash sound will be played when impacting water.\n"); - addField("mediumSplashSoundVelocity", TypeF32, Offset(medSplashSoundVel, RigidShapeData), "The minimum velocity at which the medium splash sound will be played when impacting water.\n"); - addField("hardSplashSoundVelocity", TypeF32, Offset(hardSplashSoundVel, RigidShapeData), "The minimum velocity at which the hard splash sound will be played when impacting water.\n"); + addFieldV("softImpactSpeed", TypeRangedF32, Offset(softImpactSpeed, RigidShapeData), &CommonValidators::PositiveFloat, "Minimum speed at which this object must be travelling for the soft impact sound to be played."); + addFieldV("hardImpactSpeed", TypeRangedF32, Offset(hardImpactSpeed, RigidShapeData), &CommonValidators::PositiveFloat, "Minimum speed at which the object must be travelling for the hard impact sound to be played."); + addFieldV("minRollSpeed", TypeRangedF32, Offset(minRollSpeed, RigidShapeData), &CommonValidators::PositiveFloat); + addFieldV("exitSplashSoundVelocity", TypeRangedF32, Offset(exitSplashSoundVel, RigidShapeData), &CommonValidators::PositiveFloat, "The minimum velocity at which the exit splash sound will be played when emerging from water.\n"); + addFieldV("softSplashSoundVelocity", TypeRangedF32, Offset(softSplashSoundVel, RigidShapeData), &CommonValidators::PositiveFloat,"The minimum velocity at which the soft splash sound will be played when impacting water.\n"); + addFieldV("mediumSplashSoundVelocity", TypeRangedF32, Offset(medSplashSoundVel, RigidShapeData), &CommonValidators::PositiveFloat, "The minimum velocity at which the medium splash sound will be played when impacting water.\n"); + addFieldV("hardSplashSoundVelocity", TypeRangedF32, Offset(hardSplashSoundVel, RigidShapeData), &CommonValidators::PositiveFloat, "The minimum velocity at which the hard splash sound will be played when impacting water.\n"); endGroup("Collision"); addGroup( "Camera" ); addField("cameraRoll", TypeBool, Offset(cameraRoll, RigidShapeData), "Specifies whether the camera's rotation matrix, and the render eye transform are multiplied during camera updates.\n"); - addField("cameraLag", TypeF32, Offset(cameraLag, RigidShapeData), "Scalar amount by which the third person camera lags the object, relative to the object's linear velocity.\n"); - addField("cameraDecay", TypeF32, Offset(cameraDecay, RigidShapeData), "Scalar rate at which the third person camera offset decays, per tick.\n"); - addField("cameraOffset", TypeF32, Offset(cameraOffset, RigidShapeData), "The vertical offset of the object's camera.\n"); + addFieldV("cameraLag", TypeRangedF32, Offset(cameraLag, RigidShapeData), &CommonValidators::PositiveFloat, "Scalar amount by which the third person camera lags the object, relative to the object's linear velocity.\n"); + addFieldV("cameraDecay", TypeRangedF32, Offset(cameraDecay, RigidShapeData), &CommonValidators::PositiveFloat, "Scalar rate at which the third person camera offset decays, per tick.\n"); + addFieldV("cameraOffset", TypeRangedF32, Offset(cameraOffset, RigidShapeData), &CommonValidators::PositiveFloat, "The vertical offset of the object's camera.\n"); endGroup( "Camera" ); } diff --git a/Engine/source/T3D/sfx/sfxEmitter.cpp b/Engine/source/T3D/sfx/sfxEmitter.cpp index 1ede820a3..b60efe226 100644 --- a/Engine/source/T3D/sfx/sfxEmitter.cpp +++ b/Engine/source/T3D/sfx/sfxEmitter.cpp @@ -327,19 +327,19 @@ void SFXEmitter::initPersistFields() "The SFXSource to which to assign the sound of this emitter as a child.\n" "@note This field is ignored if #useTrackDescriptionOnly is true.\n\n" "@see SFXDescription::sourceGroup" ); - addField( "volume", TypeF32, Offset( mDescription.mVolume, SFXEmitter ), + addFieldV( "volume", TypeRangedF32, Offset( mDescription.mVolume, SFXEmitter ), &CommonValidators::PositiveFloat, "Volume level to apply to the sound.\n" "@note This field is ignored if #useTrackDescriptionOnly is true.\n\n" "@see SFXDescription::volume" ); - addField( "pitch", TypeF32, Offset( mDescription.mPitch, SFXEmitter ), + addFieldV( "pitch", TypeRangedF32, Offset( mDescription.mPitch, SFXEmitter ), &CommonValidators::PositiveFloat, "Pitch shift to apply to the sound. Default is 1 = play at normal speed.\n" "@note This field is ignored if #useTrackDescriptionOnly is true.\n\n" "@see SFXDescription::pitch" ); - addField( "fadeInTime", TypeF32, Offset( mDescription.mFadeInTime, SFXEmitter ), + addFieldV( "fadeInTime", TypeRangedF32, Offset( mDescription.mFadeInTime, SFXEmitter ), &CommonValidators::PositiveFloat, "Number of seconds to gradually fade in volume from zero when playback starts.\n" "@note This field is ignored if #useTrackDescriptionOnly is true.\n\n" "@see SFXDescription::fadeInTime" ); - addField( "fadeOutTime", TypeF32, Offset( mDescription.mFadeOutTime, SFXEmitter ), + addFieldV( "fadeOutTime", TypeRangedF32, Offset( mDescription.mFadeOutTime, SFXEmitter ), &CommonValidators::PositiveFloat, "Number of seconds to gradually fade out volume down to zero when playback is stopped or paused.\n" "@note This field is ignored if #useTrackDescriptionOnly is true.\n\n" "@see SFXDescription::fadeOutTime" ); @@ -352,11 +352,11 @@ void SFXEmitter::initPersistFields() "Whether to play #fileName as a positional (3D) sound or not.\n" "If a #track is assigned, the value of this field is ignored.\n\n" "@see SFXDescription::is3D" ); - addField( "referenceDistance", TypeF32, Offset( mDescription.mMinDistance, SFXEmitter ), + addFieldV( "referenceDistance", TypeRangedF32, Offset( mDescription.mMinDistance, SFXEmitter ), &CommonValidators::PositiveFloat, "Distance at which to start volume attenuation of the 3D sound.\n" "@note This field is ignored if #useTrackDescriptionOnly is true.\n\n" "@see SFXDescription::referenceDistance" ); - addField( "maxDistance", TypeF32, Offset( mDescription.mMaxDistance, SFXEmitter ), + addFieldV( "maxDistance", TypeRangedF32, Offset( mDescription.mMaxDistance, SFXEmitter ), &CommonValidators::PositiveFloat, "Distance at which to stop volume attenuation of the 3D sound.\n" "@note This field is ignored if #useTrackDescriptionOnly is true.\n\n" "@see SFXDescription::maxDistance" ); @@ -364,15 +364,15 @@ void SFXEmitter::initPersistFields() "Bounds on random offset to apply to initial 3D sound position.\n" "@note This field is ignored if #useTrackDescriptionOnly is true.\n\n" "@see SFXDescription::scatterDistance" ); - addField( "coneInsideAngle", TypeS32, Offset( mDescription.mConeInsideAngle, SFXEmitter ), + addFieldV( "coneInsideAngle", TypeRangedS32, Offset( mDescription.mConeInsideAngle, SFXEmitter ), &CommonValidators::S32_PosDegreeRange, "Angle of inner volume cone of 3D sound in degrees.\n" "@note This field is ignored if #useTrackDescriptionOnly is true.\n\n" "@see SFXDescription::coneInsideAngle" ); - addField( "coneOutsideAngle", TypeS32, Offset( mDescription.mConeOutsideAngle, SFXEmitter ), + addFieldV( "coneOutsideAngle", TypeRangedS32, Offset( mDescription.mConeOutsideAngle, SFXEmitter ), &CommonValidators::S32_PosDegreeRange, "Angle of outer volume cone of 3D sound in degrees\n" "@note This field is ignored if #useTrackDescriptionOnly is true.\n\n" "@see SFXDescription::coneOutsideAngle" ); - addField( "coneOutsideVolume", TypeF32, Offset( mDescription.mConeOutsideVolume, SFXEmitter ), + addFieldV( "coneOutsideVolume", TypeRangedF32, Offset( mDescription.mConeOutsideVolume, SFXEmitter ), &CommonValidators::NormalizedFloat, "Volume scale factor of outside of outer volume 3D sound cone.\n" "@note This field is ignored if #useTrackDescriptionOnly is true.\n\n" "@see SFXDescription::coneOutsideVolume" ); diff --git a/Engine/source/T3D/shapeBase.cpp b/Engine/source/T3D/shapeBase.cpp index dad23da0a..968e8fb9b 100644 --- a/Engine/source/T3D/shapeBase.cpp +++ b/Engine/source/T3D/shapeBase.cpp @@ -557,26 +557,26 @@ void ShapeBaseData::initPersistFields() endGroup("Particle Effects"); addGroup( "Physics" ); - addProtectedField("mass", TypeF32, Offset(mass, ShapeBaseData), &_setMass, &defaultProtectedGetFn, "Shape mass.\nUsed in simulation of moving objects.\n" ); - addField( "drag", TypeF32, Offset(drag, ShapeBaseData), + addProtectedFieldV("mass", TypeRangedF32, Offset(mass, ShapeBaseData), &_setMass, &defaultProtectedGetFn, &CommonValidators::PositiveFloat, "Shape mass.\nUsed in simulation of moving objects.\n" ); + addFieldV( "drag", TypeRangedF32, Offset(drag, ShapeBaseData), &CommonValidators::PositiveNonZeroFloat, "Drag factor.\nReduces velocity of moving objects." ); - addField( "density", TypeF32, Offset(density, ShapeBaseData), + addFieldV( "density", TypeRangedF32, Offset(density, ShapeBaseData), &CommonValidators::PositiveNonZeroFloat, "Shape density.\nUsed when computing buoyancy when in water.\n" ); endGroup( "Physics" ); addGroup( "Damage/Energy" ); - addField( "maxEnergy", TypeF32, Offset(maxEnergy, ShapeBaseData), + addFieldV( "maxEnergy", TypeRangedF32, Offset(maxEnergy, ShapeBaseData), &CommonValidators::PositiveFloat, "Maximum energy level for this object." ); - addField( "maxDamage", TypeF32, Offset(maxDamage, ShapeBaseData), + addFieldV( "maxDamage", TypeRangedF32, Offset(maxDamage, ShapeBaseData), &CommonValidators::PositiveFloat, "Maximum damage level for this object." ); - addField( "disabledLevel", TypeF32, Offset(disabledLevel, ShapeBaseData), + addFieldV( "disabledLevel", TypeRangedF32, Offset(disabledLevel, ShapeBaseData), &CommonValidators::PositiveFloat, "Damage level above which the object is disabled.\n" "Currently unused." ); - addField( "destroyedLevel", TypeF32, Offset(destroyedLevel, ShapeBaseData), + addFieldV( "destroyedLevel", TypeRangedF32, Offset(destroyedLevel, ShapeBaseData), &CommonValidators::PositiveFloat, "Damage level above which the object is destroyed.\n" "When the damage level increases above this value, the object damage " "state is set to \"Destroyed\"." ); - addField( "repairRate", TypeF32, Offset(repairRate, ShapeBaseData), + addFieldV( "repairRate", TypeRangedF32, Offset(repairRate, ShapeBaseData), &CommonValidators::PositiveFloat, "Rate at which damage is repaired in damage units/tick.\n" "This value is subtracted from the damage level until it reaches 0." ); addField( "inheritEnergyFromMount", TypeBool, Offset(inheritEnergyFromMount, ShapeBaseData), @@ -588,19 +588,19 @@ void ShapeBaseData::initPersistFields() endGroup( "Damage/Energy" ); addGroup( "Camera", "The settings used by the shape when it is the camera." ); - addField( "cameraMaxDist", TypeF32, Offset(cameraMaxDist, ShapeBaseData), + addFieldV( "cameraMaxDist", TypeRangedF32, Offset(cameraMaxDist, ShapeBaseData), &CommonValidators::PositiveFloat, "The maximum distance from the camera to the object.\n" "Used when computing a custom camera transform for this object.\n\n" "@see observeThroughObject" ); - addField( "cameraMinDist", TypeF32, Offset(cameraMinDist, ShapeBaseData), + addFieldV( "cameraMinDist", TypeRangedF32, Offset(cameraMinDist, ShapeBaseData), &CommonValidators::PositiveFloat, "The minimum distance from the camera to the object.\n" "Used when computing a custom camera transform for this object.\n\n" "@see observeThroughObject" ); - addField( "cameraDefaultFov", TypeF32, Offset(cameraDefaultFov, ShapeBaseData), + addFieldV( "cameraDefaultFov", TypeRangedF32, Offset(cameraDefaultFov, ShapeBaseData), &CommonValidators::PosDegreeRange, "The default camera vertical FOV in degrees." ); - addField( "cameraMinFov", TypeF32, Offset(cameraMinFov, ShapeBaseData), + addFieldV( "cameraMinFov", TypeRangedF32, Offset(cameraMinFov, ShapeBaseData), &CommonValidators::PosDegreeRange, "The minimum camera vertical FOV allowed in degrees." ); - addField( "cameraMaxFov", TypeF32, Offset(cameraMaxFov, ShapeBaseData), + addFieldV( "cameraMaxFov", TypeRangedF32, Offset(cameraMaxFov, ShapeBaseData), &CommonValidators::PosDegreeRange, "The maximum camera vertical FOV allowed in degrees." ); addField( "cameraCanBank", TypeBool, Offset(cameraCanBank, ShapeBaseData), "If the derrived class supports it, allow the camera to bank." ); @@ -634,7 +634,7 @@ void ShapeBaseData::initPersistFields() onlyKeepClearSubstitutions("explosion"); onlyKeepClearSubstitutions("underwaterExplosion"); Parent::initPersistFields(); - + /* addGroup("BL Projected Shadows"); addField("shadowSize", TypeS32, Offset(shadowSize, ShapeBaseData), "Size of the projected shadow texture (must be power of 2)."); @@ -647,6 +647,7 @@ void ShapeBaseData::initPersistFields() "Scalar applied to the radius of spot shadows (initial radius is based " "on the shape bounds but can be adjusted with this field)."); endGroup("BL Projected Shadows"); + */ } diff --git a/Engine/source/T3D/shapeImage.cpp b/Engine/source/T3D/shapeImage.cpp index f1ea8022f..bf1687649 100644 --- a/Engine/source/T3D/shapeImage.cpp +++ b/Engine/source/T3D/shapeImage.cpp @@ -623,7 +623,7 @@ S32 ShapeBaseImageData::lookupState(const char* name) Con::errorf(ConsoleLogEntry::General,"ShapeBaseImageData:: Could not resolve state \"%s\" for image \"%s\"",name,getName()); return 0; } - +IRangeValidator mountRange(-1, SceneObject::NumMountPoints); void ShapeBaseImageData::initPersistFields() { docsURL; @@ -636,10 +636,10 @@ void ShapeBaseImageData::initPersistFields() addField("shellExitDir", TypePoint3F, Offset(shellExitDir, ShapeBaseImageData), "@brief Vector direction to eject shell casings.\n\n" "@see casing"); - addField("shellExitVariance", TypeF32, Offset(shellExitVariance, ShapeBaseImageData), + addFieldV("shellExitVariance", TypeRangedF32, Offset(shellExitVariance, ShapeBaseImageData), &CommonValidators::DegreeRange, "@brief Variance (in degrees) from the shellExitDir vector to eject casings.\n\n" "@see shellExitDir"); - addField("shellVelocity", TypeF32, Offset(shellVelocity, ShapeBaseImageData), + addFieldV("shellVelocity", TypeRangedF32, Offset(shellVelocity, ShapeBaseImageData), &CommonValidators::PositiveFloat, "@brief Speed at which to eject casings.\n\n" "@see casing"); addField("computeCRC", TypeBool, Offset(computeCRC, ShapeBaseImageData), @@ -680,7 +680,7 @@ void ShapeBaseImageData::initPersistFields() "@note Setting this to true causes up to four animation threads to be advanced on the server " "for each instance in use, although for most images only one or two are actually defined.\n\n" "@see useEyeNode\n"); - addField( "scriptAnimTransitionTime", TypeF32, Offset(scriptAnimTransitionTime, ShapeBaseImageData), + addFieldV( "scriptAnimTransitionTime", TypeRangedF32, Offset(scriptAnimTransitionTime, ShapeBaseImageData), &CommonValidators::PositiveFloat, "@brief The amount of time to transition between the previous sequence and new sequence when the script prefix has changed.\n\n" "When setImageScriptAnimPrefix() is used on a ShapeBase that has this image mounted, the image " "will attempt to switch to the new animation sequence based on the given script prefix. This is " @@ -697,12 +697,12 @@ void ShapeBaseImageData::initPersistFields() addField("usesEnergy", TypeBool, Offset(usesEnergy, ShapeBaseImageData), "@brief Flag indicating whether this Image uses energy instead of ammo. The energy level comes from the ShapeBase object we're mounted to.\n\n" "@see ShapeBase::setEnergyLevel()"); - addField("minEnergy", TypeF32, Offset(minEnergy, ShapeBaseImageData), + addFieldV("minEnergy", TypeRangedF32, Offset(minEnergy, ShapeBaseImageData), &CommonValidators::PositiveFloat, "@brief Minimum Image energy for it to be operable.\n\n" "@see usesEnergy"); addGroup("Mounting"); - addField( "mountPoint", TypeS32, Offset(mountPoint, ShapeBaseImageData), + addFieldV( "mountPoint", TypeRangedS32, Offset(mountPoint, ShapeBaseImageData), &mountRange, "@brief Mount node # to mount this Image to.\n\n" "This should correspond to a mount# node on the ShapeBase derived object we are mounting to." ); addField( "offset", TypeMatrixPosition, Offset(mountOffset, ShapeBaseImageData), @@ -753,12 +753,12 @@ void ShapeBaseImageData::initPersistFields() addField( "camShakeAmp", TypePoint3F, Offset(camShakeAmp, ShapeBaseImageData), "@brief Amplitude of the camera shaking effect.\n\n" "@see shakeCamera" ); - addField( "camShakeDuration", TypeF32, Offset(camShakeDuration, ShapeBaseImageData), + addFieldV( "camShakeDuration", TypeRangedF32, Offset(camShakeDuration, ShapeBaseImageData), &CommonValidators::PositiveFloat, "Duration (in seconds) to shake the camera." ); - addField( "camShakeRadius", TypeF32, Offset(camShakeRadius, ShapeBaseImageData), + addFieldV( "camShakeRadius", TypeRangedF32, Offset(camShakeRadius, ShapeBaseImageData), &CommonValidators::PositiveFloat, "Radial distance that a camera's position must be within relative to the " "center of the explosion to be shaken." ); - addField( "camShakeFalloff", TypeF32, Offset(camShakeFalloff, ShapeBaseImageData), + addFieldV( "camShakeFalloff", TypeRangedF32, Offset(camShakeFalloff, ShapeBaseImageData), &CommonValidators::PositiveFloat, "Falloff value for the camera shake." ); endGroup("Camera Shake"); @@ -769,7 +769,7 @@ void ShapeBaseImageData::initPersistFields() addField( "correctMuzzleVectorTP", TypeBool, Offset(correctMuzzleVectorTP, ShapeBaseImageData), "@brief Flag to adjust the aiming vector to the camera's LOS point when in 3rd person view.\n\n" "@see ShapeBase::getMuzzleVector()" ); - addField( "mass", TypeF32, Offset(mass, ShapeBaseImageData), + addFieldV( "mass", TypeRangedF32, Offset(mass, ShapeBaseImageData), &CommonValidators::PositiveFloat, "@brief Mass of this Image.\n\n" "This is added to the total mass of the ShapeBase object." ); addField( "accuFire", TypeBool, Offset(accuFire, ShapeBaseImageData), @@ -785,13 +785,13 @@ void ShapeBaseImageData::initPersistFields() addField( "lightColor", TypeColorF, Offset(lightColor, ShapeBaseImageData), "@brief The color of light this Image emits.\n\n" "@see lightType"); - addField( "lightDuration", TypeS32, Offset(lightDuration, ShapeBaseImageData), + addFieldV( "lightDuration", TypeRangedS32, Offset(lightDuration, ShapeBaseImageData), &CommonValidators::PositiveInt, "@brief Duration in SimTime of Pulsing and WeaponFire type lights.\n\n" "@see lightType"); - addField( "lightRadius", TypeF32, Offset(lightRadius, ShapeBaseImageData), + addFieldV( "lightRadius", TypeRangedF32, Offset(lightRadius, ShapeBaseImageData), &CommonValidators::PositiveFloat, "@brief Radius of the light this Image emits.\n\n" "@see lightType"); - addField( "lightBrightness", TypeF32, Offset(lightBrightness, ShapeBaseImageData), + addFieldV( "lightBrightness", TypeRangedF32, Offset(lightBrightness, ShapeBaseImageData), &CommonValidators::PositiveFloat, "@brief Brightness of the light this Image emits.\n\n" "Only valid for WeaponFireLight." "@see lightType"); @@ -868,7 +868,7 @@ void ShapeBaseImageData::initPersistFields() "Name of the state to transition to when the generic trigger 3 state " "changes to false." ); - addField( "stateTimeoutValue", TypeF32, Offset(stateTimeoutValue, ShapeBaseImageData), MaxStates, + addFieldV( "stateTimeoutValue", TypeRangedF32, Offset(stateTimeoutValue, ShapeBaseImageData), &CommonValidators::PositiveFloat, MaxStates, "Time in seconds to wait before transitioning to stateTransitionOnTimeout." ); addField( "stateWaitForTimeout", TypeBool, Offset(stateWaitForTimeout, ShapeBaseImageData), MaxStates, "If false, this state ignores stateTimeoutValue and transitions " @@ -884,7 +884,7 @@ void ShapeBaseImageData::initPersistFields() "client when it receives the 'reload' event." ); addField( "stateEjectShell", TypeBool, Offset(stateEjectShell, ShapeBaseImageData), MaxStates, "If true, a shell casing will be ejected in this state." ); - addField( "stateEnergyDrain", TypeF32, Offset(stateEnergyDrain, ShapeBaseImageData), MaxStates, + addFieldV( "stateEnergyDrain", TypeRangedF32, Offset(stateEnergyDrain, ShapeBaseImageData), &CommonValidators::PositiveFloat, MaxStates, "@brief Amount of energy to subtract from the Image in this state.\n\n" "Energy is drained at stateEnergyDrain units/tick as long as we are in " "this state.\n" @@ -943,7 +943,7 @@ void ShapeBaseImageData::initPersistFields() "Do we transition to the new state's sequence when we leave the state?" ); addField( "stateSequenceNeverTransition", TypeBool, Offset(stateSequenceNeverTransition, ShapeBaseImageData), MaxStates, "Never allow a transition to this sequence. Often used for a fire sequence." ); - addField( "stateSequenceTransitionTime", TypeF32, Offset(stateSequenceTransitionTime, ShapeBaseImageData), MaxStates, + addFieldV( "stateSequenceTransitionTime", TypeRangedF32, Offset(stateSequenceTransitionTime, ShapeBaseImageData), &CommonValidators::PositiveFloat, MaxStates, "The time to transition in or out of a sequence." ); addField( "stateShapeSequence", TypeString, Offset(stateShapeSequence, ShapeBaseImageData), MaxStates, @@ -963,7 +963,7 @@ void ShapeBaseImageData::initPersistFields() "@brief Emitter to generate particles in this state (from muzzle point or " "specified node).\n\n" "@see stateEmitterNode" ); - addField( "stateEmitterTime", TypeF32, Offset(stateEmitterTime, ShapeBaseImageData), MaxStates, + addFieldV( "stateEmitterTime", TypeRangedF32, Offset(stateEmitterTime, ShapeBaseImageData), &CommonValidators::PositiveFloat, MaxStates, "How long (in seconds) to emit particles on entry to this state." ); addField( "stateEmitterNode", TypeString, Offset(stateEmitterNode, ShapeBaseImageData), MaxStates, "@brief Name of the node to emit particles from.\n\n" @@ -977,7 +977,7 @@ void ShapeBaseImageData::initPersistFields() endArray( "States" ); addGroup("Sounds"); - addField( "maxConcurrentSounds", TypeS32, Offset(maxConcurrentSounds, ShapeBaseImageData), + addFieldV( "maxConcurrentSounds", TypeRangedS32, Offset(maxConcurrentSounds, ShapeBaseImageData), &CommonValidators::PositiveInt, "@brief Maximum number of sounds this Image can play at a time.\n\n" "Any value <= 0 indicates that it can play an infinite number of sounds." ); endGroup("Sounds"); @@ -1047,10 +1047,10 @@ void ShapeBaseImageData::packData(BitStream* stream) { stream->write(lightRadius); stream->write(lightDuration); - stream->writeFloat(lightColor.red, 7); - stream->writeFloat(lightColor.green, 7); - stream->writeFloat(lightColor.blue, 7); - stream->writeFloat(lightColor.alpha, 7); + stream->writeFloat(lightColor.red, 8); + stream->writeFloat(lightColor.green, 8); + stream->writeFloat(lightColor.blue, 8); + stream->writeFloat(lightColor.alpha, 8); stream->write(lightBrightness); } @@ -1232,10 +1232,10 @@ void ShapeBaseImageData::unpackData(BitStream* stream) { stream->read(&lightRadius); stream->read(&lightDuration); - lightColor.red = stream->readFloat(7); - lightColor.green = stream->readFloat(7); - lightColor.blue = stream->readFloat(7); - lightColor.alpha = stream->readFloat(7); + lightColor.red = stream->readFloat(8); + lightColor.green = stream->readFloat(8); + lightColor.blue = stream->readFloat(8); + lightColor.alpha = stream->readFloat(8); stream->read( &lightBrightness ); } diff --git a/Engine/source/T3D/spotLight.cpp b/Engine/source/T3D/spotLight.cpp index 6653a5365..cc2c8dcdb 100644 --- a/Engine/source/T3D/spotLight.cpp +++ b/Engine/source/T3D/spotLight.cpp @@ -98,9 +98,9 @@ void SpotLight::initPersistFields() docsURL; addGroup( "Light" ); - addField( "range", TypeF32, Offset( mRange, SpotLight ) ); - addField( "innerAngle", TypeF32, Offset( mInnerConeAngle, SpotLight ) ); - addField( "outerAngle", TypeF32, Offset( mOuterConeAngle, SpotLight ) ); + addFieldV( "range", TypeRangedF32, Offset( mRange, SpotLight ), &CommonValidators::PositiveFloat); + addFieldV( "innerAngle", TypeRangedF32, Offset( mInnerConeAngle, SpotLight ), &CommonValidators::DegreeRangeQuarter); + addFieldV( "outerAngle", TypeRangedF32, Offset( mOuterConeAngle, SpotLight ), &CommonValidators::DegreeRangeQuarter); endGroup( "Light" ); diff --git a/Engine/source/T3D/tsStatic.cpp b/Engine/source/T3D/tsStatic.cpp index e155fedac..7c15b9eaf 100644 --- a/Engine/source/T3D/tsStatic.cpp +++ b/Engine/source/T3D/tsStatic.cpp @@ -219,9 +219,9 @@ void TSStatic::initPersistFields() addGroup("Animation"); addField("playAmbient", TypeBool, Offset(mPlayAmbient, TSStatic), "Enables automatic playing of the animation sequence named \"ambient\" (if it exists) when the TSStatic is loaded."); - addFieldV("AnimOffset", TypeF32, Offset(mAnimOffset, TSStatic), &percentValidator, + addFieldV("AnimOffset", TypeRangedF32, Offset(mAnimOffset, TSStatic), &percentValidator, "Percent Animation Offset."); - addFieldV("AnimSpeed", TypeF32, Offset(mAnimSpeed, TSStatic), &speedValidator, + addFieldV("AnimSpeed", TypeRangedF32, Offset(mAnimSpeed, TSStatic), &speedValidator, "Percent Animation Speed."); endGroup("Animation"); @@ -253,16 +253,16 @@ void TSStatic::initPersistFields() addGroup("AlphaFade"); addField("alphaFadeEnable", TypeBool, Offset(mUseAlphaFade, TSStatic), "Turn on/off Alpha Fade"); - addField("alphaFadeStart", TypeF32, Offset(mAlphaFadeStart, TSStatic), "Distance of start Alpha Fade"); - addField("alphaFadeEnd", TypeF32, Offset(mAlphaFadeEnd, TSStatic), "Distance of end Alpha Fade"); + addFieldV("alphaFadeStart", TypeRangedF32, Offset(mAlphaFadeStart, TSStatic), &CommonValidators::PositiveFloat, "Distance of start Alpha Fade"); + addFieldV("alphaFadeEnd", TypeRangedF32, Offset(mAlphaFadeEnd, TSStatic), &CommonValidators::PositiveFloat, "Distance of end Alpha Fade"); addField("alphaFadeInverse", TypeBool, Offset(mInvertAlphaFade, TSStatic), "Invert Alpha Fade's Start & End Distance"); endGroup("AlphaFade"); addGroup("Debug"); - addField("renderNormals", TypeF32, Offset(mRenderNormalScalar, TSStatic), + addFieldV("renderNormals", TypeRangedF32, Offset(mRenderNormalScalar, TSStatic), &CommonValidators::PositiveFloat, "Debug rendering mode shows the normals for each point in the TSStatic's mesh."); - addField("forceDetail", TypeS32, Offset(mForceDetail, TSStatic), + addFieldV("forceDetail", TypeRangedS32, Offset(mForceDetail, TSStatic), &CommonValidators::PositiveInt, "Forces rendering to a particular detail level."); endGroup("Debug"); diff --git a/Engine/source/T3D/turret/aiTurretShape.cpp b/Engine/source/T3D/turret/aiTurretShape.cpp index cdf192b2d..0e5ce0248 100644 --- a/Engine/source/T3D/turret/aiTurretShape.cpp +++ b/Engine/source/T3D/turret/aiTurretShape.cpp @@ -127,28 +127,28 @@ void AITurretShapeData::initPersistFields() docsURL; Parent::initPersistFields(); addGroup("AI Steering"); - addField("maxScanHeading", TypeF32, Offset(maxScanHeading, AITurretShapeData), + addFieldV("maxScanHeading", TypeRangedF32, Offset(maxScanHeading, AITurretShapeData), &CommonValidators::PosDegreeRangeQuarter, "@brief Maximum number of degrees to scan left and right.\n\n" "@note Maximum scan heading is 90 degrees.\n"); - addField("maxScanPitch", TypeF32, Offset(maxScanPitch, AITurretShapeData), + addFieldV("maxScanPitch", TypeRangedF32, Offset(maxScanPitch, AITurretShapeData), &CommonValidators::PosDegreeRangeQuarter, "@brief Maximum number of degrees to scan up and down.\n\n" "@note Maximum scan pitch is 90 degrees.\n"); - addField("maxScanDistance", TypeF32, Offset(maxScanDistance, AITurretShapeData), + addFieldV("maxScanDistance", TypeRangedF32, Offset(maxScanDistance, AITurretShapeData), &CommonValidators::PositiveFloat, "@brief Maximum distance to scan.\n\n" "When combined with maxScanHeading and maxScanPitch this forms a 3D scanning wedge used to initially " "locate a target.\n"); - addField("scanTickFrequency", TypeS32, Offset(scanTickFrequency, AITurretShapeData), + addFieldV("scanTickFrequency", TypeRangedS32, Offset(scanTickFrequency, AITurretShapeData), &CommonValidators::NaturalNumber, "@brief How often should we perform a full scan when looking for a target.\n\n" "Expressed as the number of ticks between full scans, but no less than 1.\n"); - addField("scanTickFrequencyVariance", TypeS32, Offset(scanTickFrequencyVariance, AITurretShapeData), + addFieldV("scanTickFrequencyVariance", TypeRangedS32, Offset(scanTickFrequencyVariance, AITurretShapeData), &CommonValidators::PositiveInt, "@brief Random amount that should be added to the scan tick frequency each scan period.\n\n" "Expressed as the number of ticks to randomly add, but no less than zero.\n"); - addField("trackLostTargetTime", TypeF32, Offset(trackLostTargetTime, AITurretShapeData), + addFieldV("trackLostTargetTime", TypeRangedF32, Offset(trackLostTargetTime, AITurretShapeData), &CommonValidators::PositiveFloat, "@brief How long after the turret has lost the target should it still track it.\n\n" "Expressed in seconds.\n"); - addField("maxWeaponRange", TypeF32, Offset(maxWeaponRange, AITurretShapeData), + addFieldV("maxWeaponRange", TypeRangedF32, Offset(maxWeaponRange, AITurretShapeData), &CommonValidators::PositiveFloat, "@brief Maximum distance that the weapon will fire upon a target.\n\n"); - addField("weaponLeadVelocity", TypeF32, Offset(weaponLeadVelocity, AITurretShapeData), + addFieldV("weaponLeadVelocity", TypeRangedF32, Offset(weaponLeadVelocity, AITurretShapeData), &CommonValidators::PositiveFloat, "@brief Velocity used to lead target.\n\n" "If value <= 0, don't lead target.\n"); endGroup("AI Steering"); @@ -173,7 +173,7 @@ void AITurretShapeData::initPersistFields() addField( "stateTransitionOnTimeout", TypeString, Offset(stateTransitionTimeout, AITurretShapeData), MaxStates, "Name of the state to transition to when we have been in this state " "for stateTimeoutValue seconds." ); - addField( "stateTimeoutValue", TypeF32, Offset(stateTimeoutValue, AITurretShapeData), MaxStates, + addFieldV( "stateTimeoutValue", TypeRangedF32, Offset(stateTimeoutValue, AITurretShapeData), &CommonValidators::PositiveFloat, MaxStates, "Time in seconds to wait before transitioning to stateTransitionOnTimeout." ); addField( "stateWaitForTimeout", TypeBool, Offset(stateWaitForTimeout, AITurretShapeData), MaxStates, "If false, this state ignores stateTimeoutValue and transitions " diff --git a/Engine/source/T3D/turret/turretShape.cpp b/Engine/source/T3D/turret/turretShape.cpp index 52cd198e6..8c523588e 100644 --- a/Engine/source/T3D/turret/turretShape.cpp +++ b/Engine/source/T3D/turret/turretShape.cpp @@ -138,17 +138,17 @@ void TurretShapeData::initPersistFields() "@brief Should the turret allow only z rotations.\n\n" "True indicates that the turret may only be rotated on its z axis, just like the Item class. " "This keeps the turret always upright regardless of the surface it lands on.\n"); - addField("maxHeading", TypeF32, Offset(maxHeading, TurretShapeData), + addFieldV("maxHeading", TypeRangedF32, Offset(maxHeading, TurretShapeData), &CommonValidators::PosDegreeRangeQuarter, "@brief Maximum number of degrees to rotate from center.\n\n" "A value of 180 or more degrees indicates the turret may rotate completely around.\n"); - addField("minPitch", TypeF32, Offset(minPitch, TurretShapeData), + addFieldV("minPitch", TypeRangedF32, Offset(minPitch, TurretShapeData), &CommonValidators::PosDegreeRangeQuarter, "@brief Minimum number of degrees to rotate down from straight ahead.\n\n"); - addField("maxPitch", TypeF32, Offset(maxPitch, TurretShapeData), + addFieldV("maxPitch", TypeRangedF32, Offset(maxPitch, TurretShapeData), &CommonValidators::PosDegreeRangeQuarter, "@brief Maximum number of degrees to rotate up from straight ahead.\n\n"); - addField("headingRate", TypeF32, Offset(headingRate, TurretShapeData), + addFieldV("headingRate", TypeRangedF32, Offset(headingRate, TurretShapeData), &CommonValidators::DegreeRange, "@brief Degrees per second rotation.\n\n" "A value of 0 means no rotation is allowed. A value less than 0 means the rotation is instantaneous.\n"); - addField("pitchRate", TypeF32, Offset(pitchRate, TurretShapeData), + addFieldV("pitchRate", TypeRangedF32, Offset(pitchRate, TurretShapeData), &CommonValidators::DegreeRange, "@brief Degrees per second rotation.\n\n" "A value of 0 means no rotation is allowed. A value less than 0 means the rotation is instantaneous.\n"); endGroup("Steering"); @@ -167,7 +167,7 @@ void TurretShapeData::initPersistFields() endGroup("Weapon State"); addGroup("Camera", "The settings used by the shape when it is the camera."); - addField("cameraOffset", TypeF32, Offset(cameraOffset, TurretShapeData), + addFieldV("cameraOffset", TypeRangedF32, Offset(cameraOffset, TurretShapeData), &CommonValidators::F32Range, "Vertical (Z axis) height of the camera above the turret." ); endGroup("Camera"); } diff --git a/Engine/source/T3D/vehicles/flyingVehicle.cpp b/Engine/source/T3D/vehicles/flyingVehicle.cpp index 179d6a4ca..efe611b9a 100644 --- a/Engine/source/T3D/vehicles/flyingVehicle.cpp +++ b/Engine/source/T3D/vehicles/flyingVehicle.cpp @@ -179,52 +179,52 @@ void FlyingVehicleData::initPersistFields() Parent::initPersistFields(); addGroup("Physics"); - addField( "rollForce", TypeF32, Offset(rollForce, FlyingVehicleData), + addFieldV( "rollForce", TypeRangedF32, Offset(rollForce, FlyingVehicleData), &CommonValidators::PositiveFloat, "@brief Damping torque against rolling maneuvers (rotation about the y-axis), " "proportional to linear velocity.\n\n" "Acts to adjust roll to a stable position over time as the vehicle moves." ); - addField( "rotationalDrag", TypeF32, Offset(rotationalDrag, FlyingVehicleData), + addFieldV( "rotationalDrag", TypeRangedF32, Offset(rotationalDrag, FlyingVehicleData), &CommonValidators::PositiveFloat, "Rotational drag factor (slows vehicle rotation speed in all axes)." ); - addField( "horizontalSurfaceForce", TypeF32, Offset(horizontalSurfaceForce, FlyingVehicleData), + addFieldV( "horizontalSurfaceForce", TypeRangedF32, Offset(horizontalSurfaceForce, FlyingVehicleData), &CommonValidators::PositiveFloat, "@brief Damping force in the opposite direction to sideways velocity.\n\n" "Provides \"bite\" into the wind for climbing/diving and turning)." ); - addField( "hoverHeight", TypeF32, Offset(hoverHeight, FlyingVehicleData), + addFieldV( "hoverHeight", TypeRangedF32, Offset(hoverHeight, FlyingVehicleData), &CommonValidators::PositiveFloat, "The vehicle's height off the ground when at rest." ); - addField( "createHoverHeight", TypeF32, Offset(createHoverHeight, FlyingVehicleData), + addFieldV( "createHoverHeight", TypeRangedF32, Offset(createHoverHeight, FlyingVehicleData), &CommonValidators::PositiveFloat, "@brief The vehicle's height off the ground when useCreateHeight is active.\n\n" "This can help avoid problems with spawning the vehicle." ); endGroup("Physics"); addGroup("Steering"); - addField( "maneuveringForce", TypeF32, Offset(maneuveringForce, FlyingVehicleData), + addFieldV( "maneuveringForce", TypeRangedF32, Offset(maneuveringForce, FlyingVehicleData), &CommonValidators::PositiveFloat, "@brief Maximum X and Y (horizontal plane) maneuvering force.\n\n" "The actual force applied depends on the current thrust." ); - addField( "verticalSurfaceForce", TypeF32, Offset(verticalSurfaceForce, FlyingVehicleData), + addFieldV( "verticalSurfaceForce", TypeRangedF32, Offset(verticalSurfaceForce, FlyingVehicleData), &CommonValidators::PositiveFloat, "@brief Damping force in the opposite direction to vertical velocity.\n\n" "Controls side slip; lower numbers give more slide." ); - addField( "vertThrustMultiple", TypeF32, Offset(vertThrustMultiple, FlyingVehicleData), + addFieldV( "vertThrustMultiple", TypeRangedF32, Offset(vertThrustMultiple, FlyingVehicleData), &CommonValidators::PositiveFloat, "Multiplier applied to the jetForce (defined in VehicleData) when thrusting vertically." ); - addField( "steeringForce", TypeF32, Offset(steeringForce, FlyingVehicleData), + addFieldV( "steeringForce", TypeRangedF32, Offset(steeringForce, FlyingVehicleData), &CommonValidators::PositiveFloat, "@brief Maximum X and Z (sideways and vertical) steering force.\n\n" "The actual force applied depends on the current steering input." ); - addField( "steeringRollForce", TypeF32, Offset(steeringRollForce, FlyingVehicleData), + addFieldV( "steeringRollForce", TypeRangedF32, Offset(steeringRollForce, FlyingVehicleData), &CommonValidators::PositiveFloat, "Roll force induced by sideways steering input value (controls how much " "the vehicle rolls when turning)." ); endGroup("Steering"); addGroup("AutoCorrection"); - addField( "maxAutoSpeed", TypeF32, Offset(maxAutoSpeed, FlyingVehicleData), + addFieldV( "maxAutoSpeed", TypeRangedF32, Offset(maxAutoSpeed, FlyingVehicleData), &CommonValidators::PositiveFloat, "Maximum speed for automatic vehicle control assistance - vehicles " "travelling at speeds above this value do not get control assitance." ); - addField( "autoInputDamping", TypeF32, Offset(autoInputDamping, FlyingVehicleData), + addFieldV( "autoInputDamping", TypeRangedF32, Offset(autoInputDamping, FlyingVehicleData), &CommonValidators::PositiveFloat, "@brief Scale factor applied to steering input if speed is less than " "maxAutoSpeed to.improve handling at very low speeds.\n\n" "Smaller values make steering less sensitive." ); - addField( "autoLinearForce", TypeF32, Offset(autoLinearForce, FlyingVehicleData), + addFieldV( "autoLinearForce", TypeRangedF32, Offset(autoLinearForce, FlyingVehicleData), &CommonValidators::PositiveFloat, "@brief Corrective force applied to slow the vehicle when moving at less than " "maxAutoSpeed.\n\n" "The force is inversely proportional to vehicle speed." ); - addField( "autoAngularForce", TypeF32, Offset(autoAngularForce, FlyingVehicleData), + addFieldV( "autoAngularForce", TypeRangedF32, Offset(autoAngularForce, FlyingVehicleData), &CommonValidators::PositiveFloat, "@brief Corrective torque applied to level out the vehicle when moving at less " "than maxAutoSpeed.\n\n" "The torque is inversely proportional to vehicle speed." ); @@ -245,7 +245,7 @@ void FlyingVehicleData::initPersistFields() "and JetNozzle3." ); addField( "trailEmitter",TYPEID< ParticleEmitterData >(), Offset(jetEmitter[TrailEmitter], FlyingVehicleData), "Emitter to generate contrail particles from model nodes contrail0 - contrail3." ); - addField( "minTrailSpeed", TypeF32, Offset(minTrailSpeed, FlyingVehicleData), + addFieldV( "minTrailSpeed", TypeRangedF32, Offset(minTrailSpeed, FlyingVehicleData), &CommonValidators::PositiveFloat, "Minimum speed at which to start generating contrail particles." ); endGroup("Particle Effects"); diff --git a/Engine/source/T3D/vehicles/guiSpeedometer.cpp b/Engine/source/T3D/vehicles/guiSpeedometer.cpp index e8adae6cc..c8ffda2dc 100644 --- a/Engine/source/T3D/vehicles/guiSpeedometer.cpp +++ b/Engine/source/T3D/vehicles/guiSpeedometer.cpp @@ -111,15 +111,15 @@ void GuiSpeedometerHud::initPersistFields() docsURL; addGroup("Needle"); - addField("maxSpeed", TypeF32, Offset( mMaxSpeed, GuiSpeedometerHud ), + addFieldV("maxSpeed", TypeRangedF32, Offset( mMaxSpeed, GuiSpeedometerHud ), &CommonValidators::PositiveFloat, "Maximum Vehicle speed (in Torque units per second) to represent on the " "speedo (Vehicle speeds greater than this are clamped to maxSpeed)." ); - addField("minAngle", TypeF32, Offset( mMinAngle, GuiSpeedometerHud ), + addFieldV("minAngle", TypeRangedF32, Offset( mMinAngle, GuiSpeedometerHud ), &CommonValidators::DegreeRange, "Angle (in radians) of the needle when the Vehicle speed is 0. An angle " "of 0 points right, 90 points up etc)." ); - addField("maxAngle", TypeF32, Offset( mMaxAngle, GuiSpeedometerHud ), + addFieldV("maxAngle", TypeRangedF32, Offset( mMaxAngle, GuiSpeedometerHud ), &CommonValidators::DegreeRange, "Angle (in radians) of the needle when the Vehicle speed is >= maxSpeed. " "An angle of 0 points right, 90 points up etc)." ); @@ -130,13 +130,13 @@ void GuiSpeedometerHud::initPersistFields() "Center of the needle, offset from the GuiSpeedometerHud control top " "left corner" ); - addField("length", TypeF32, Offset( mNeedleLength, GuiSpeedometerHud ), + addFieldV("length", TypeRangedF32, Offset( mNeedleLength, GuiSpeedometerHud ), &CommonValidators::PositiveFloat, "Length of the needle from center to end" ); - addField("width", TypeF32, Offset( mNeedleWidth, GuiSpeedometerHud ), + addFieldV("width", TypeRangedF32, Offset( mNeedleWidth, GuiSpeedometerHud ), &CommonValidators::PositiveFloat, "Width of the needle" ); - addField("tail", TypeF32, Offset( mTailLength, GuiSpeedometerHud ), + addFieldV("tail", TypeRangedF32, Offset( mTailLength, GuiSpeedometerHud ), &CommonValidators::PositiveFloat, "Length of the needle from center to tail" ); endGroup("Needle"); diff --git a/Engine/source/T3D/vehicles/hoverVehicle.cpp b/Engine/source/T3D/vehicles/hoverVehicle.cpp index 1eb108ce8..7e7f748a5 100644 --- a/Engine/source/T3D/vehicles/hoverVehicle.cpp +++ b/Engine/source/T3D/vehicles/hoverVehicle.cpp @@ -175,11 +175,11 @@ void HoverVehicleData::initPersistFields() docsURL; Parent::initPersistFields(); addGroup("Physics"); - addField( "normalForce", TypeF32, Offset(normalForce, HoverVehicleData), + addFieldV( "normalForce", TypeRangedF32, Offset(normalForce, HoverVehicleData), &CommonValidators::PositiveFloat, "Force generated in the ground normal direction when the vehicle is not " "floating (within stabalizer length from the ground).\n\n" "@see stabLenMin" ); - addField( "stabLenMin", TypeF32, Offset(stabLenMin, HoverVehicleData), + addFieldV( "stabLenMin", TypeRangedF32, Offset(stabLenMin, HoverVehicleData), &CommonValidators::PositiveFloat, "Length of the base stabalizer when travelling at minimum speed (0).\n" "Each tick, the vehicle performs 2 raycasts (from the center back and " "center front of the vehicle) to check for contact with the ground. The " @@ -188,10 +188,10 @@ void HoverVehicleData::initPersistFields() "spring and ground normal forces are not applied.\n\n" "\n" "@see stabSpringConstant" ); - addField( "stabLenMax", TypeF32, Offset(stabLenMax, HoverVehicleData), + addFieldV( "stabLenMax", TypeRangedF32, Offset(stabLenMax, HoverVehicleData), &CommonValidators::PositiveFloat, "Length of the base stabalizer when travelling at maximum speed " "(maxThrustSpeed).\n\n@see stabLenMin\n\n@see mainThrustForce" ); - addField("vertFactor", TypeF32, Offset(vertFactor, HoverVehicleData), + addFieldV("vertFactor", TypeRangedF32, Offset(vertFactor, HoverVehicleData), &CommonValidators::PositiveFloat, "Scalar applied to the vertical portion of the velocity drag acting on " "the vehicle.\nFor the horizontal (X and Y) components of velocity drag, " "a factor of 0.25 is applied when the vehicle is floating, and a factor " @@ -199,49 +199,49 @@ void HoverVehicleData::initPersistFields() "is multiplied by the vehicle's dragForce, as defined above, and the " "result is subtracted from it's movement force.\n" "@note The vertFactor must be between 0.0 and 1.0 (inclusive)."); - addField("stabSpringConstant", TypeF32, Offset(stabSpringConstant, HoverVehicleData), + addFieldV("stabSpringConstant", TypeRangedF32, Offset(stabSpringConstant, HoverVehicleData), &CommonValidators::PositiveFloat, "Value used to generate stabalizer spring force. The force generated " "depends on stabilizer compression, that is how close the vehicle is " "to the ground proportional to current stabalizer length.\n\n" "@see stabLenMin"); - addField("stabDampingConstant", TypeF32, Offset(stabDampingConstant, HoverVehicleData), + addFieldV("stabDampingConstant", TypeRangedF32, Offset(stabDampingConstant, HoverVehicleData), &CommonValidators::PositiveFloat, "Damping spring force acting against changes in the stabalizer length.\n\n" "@see stabLenMin"); endGroup("Physics"); addGroup("Steering"); - addField( "steeringForce", TypeF32, Offset(steeringForce, HoverVehicleData), + addFieldV( "steeringForce", TypeRangedF32, Offset(steeringForce, HoverVehicleData), &CommonValidators::PositiveFloat, "Yaw (rotation about the Z-axis) force applied when steering in the x-axis direction." "about the vehicle's Z-axis)" ); - addField( "rollForce", TypeF32, Offset(rollForce, HoverVehicleData), + addFieldV( "rollForce", TypeRangedF32, Offset(rollForce, HoverVehicleData), &CommonValidators::PositiveFloat, "Roll (rotation about the Y-axis) force applied when steering in the x-axis direction." ); - addField( "pitchForce", TypeF32, Offset(pitchForce, HoverVehicleData), + addFieldV( "pitchForce", TypeRangedF32, Offset(pitchForce, HoverVehicleData), &CommonValidators::PositiveFloat, "Pitch (rotation about the X-axis) force applied when steering in the y-axis direction." ); - addField( "dragForce", TypeF32, Offset(dragForce, HoverVehicleData), + addFieldV( "dragForce", TypeRangedF32, Offset(dragForce, HoverVehicleData), &CommonValidators::PositiveFloat, "Drag force factor that acts opposite to the vehicle velocity.\nAlso " "used to determnine the vehicle's maxThrustSpeed.\n@see mainThrustForce" ); - addField( "mainThrustForce", TypeF32, Offset(mainThrustForce, HoverVehicleData), + addFieldV( "mainThrustForce", TypeRangedF32, Offset(mainThrustForce, HoverVehicleData), &CommonValidators::PositiveFloat, "Force generated by thrusting the vehicle forward.\nAlso used to determine " "the maxThrustSpeed:\n\n" "@tsexample\n" "maxThrustSpeed = (mainThrustForce + strafeThrustForce) / dragForce;\n" "@endtsexample\n" ); - addField( "reverseThrustForce", TypeF32, Offset(reverseThrustForce, HoverVehicleData), + addFieldV( "reverseThrustForce", TypeRangedF32, Offset(reverseThrustForce, HoverVehicleData), &CommonValidators::PositiveFloat, "Force generated by thrusting the vehicle backward." ); - addField( "strafeThrustForce", TypeF32, Offset(strafeThrustForce, HoverVehicleData), + addFieldV( "strafeThrustForce", TypeRangedF32, Offset(strafeThrustForce, HoverVehicleData), &CommonValidators::PositiveFloat, "Force generated by thrusting the vehicle to one side.\nAlso used to " "determine the vehicle's maxThrustSpeed.\n@see mainThrustForce" ); - addField( "turboFactor", TypeF32, Offset(turboFactor, HoverVehicleData), + addFieldV( "turboFactor", TypeRangedF32, Offset(turboFactor, HoverVehicleData), &CommonValidators::PositiveFloat, "Scale factor applied to the vehicle's thrust force when jetting." ); - addField( "floatingThrustFactor", TypeF32, Offset(floatingThrustFactor, HoverVehicleData), + addFieldV( "floatingThrustFactor", TypeRangedF32, Offset(floatingThrustFactor, HoverVehicleData), &CommonValidators::PositiveFloat, "Scalar applied to the vehicle's thrust force when the vehicle is floating.\n" "@note The floatingThrustFactor must be between 0.0 and 1.0 (inclusive)." ); endGroup("Steering"); addGroup("AutoCorrection"); - addField( "gyroDrag", TypeF32, Offset(gyroDrag, HoverVehicleData), + addFieldV( "gyroDrag", TypeRangedF32, Offset(gyroDrag, HoverVehicleData), &CommonValidators::PositiveFloat, "Damping torque that acts against the vehicle's current angular momentum." ); - addField( "restorativeForce", TypeF32, Offset(restorativeForce, HoverVehicleData), + addFieldV( "restorativeForce", TypeRangedF32, Offset(restorativeForce, HoverVehicleData), &CommonValidators::PositiveFloat, "Force generated to stabalize the vehicle (return it to neutral pitch/roll) " "when the vehicle is floating (more than stabalizer length from the " "ground.\n\n@see stabLenMin" ); @@ -258,12 +258,12 @@ void HoverVehicleData::initPersistFields() "\"X Y Z\" offset from the vehicle's origin from which to generate dust " "trail particles.\nBy default particles are emitted directly beneath the " "origin of the vehicle model." ); - addField( "triggerTrailHeight", TypeF32, Offset(triggerTrailHeight, HoverVehicleData), + addFieldV( "triggerTrailHeight", TypeRangedF32, Offset(triggerTrailHeight, HoverVehicleData), &CommonValidators::PositiveFloat, "Maximum height above surface to emit dust trail particles.\nIf the vehicle " "is less than triggerTrailHeight above a static surface with a material that " "has 'showDust' set to true, the vehicle will emit particles from the " "dustTrailEmitter." ); - addField( "dustTrailFreqMod", TypeF32, Offset(dustTrailFreqMod, HoverVehicleData), + addFieldV( "dustTrailFreqMod", TypeRangedF32, Offset(dustTrailFreqMod, HoverVehicleData), &CommonValidators::PositiveFloat, "Number of dust trail particles to generate based on vehicle speed.\nThe " "vehicle's speed is divided by this value to determine how many particles " "to generate each frame. Lower values give a more dense trail, higher " diff --git a/Engine/source/T3D/vehicles/vehicle.cpp b/Engine/source/T3D/vehicles/vehicle.cpp index 721bf2fba..cfbd9a876 100644 --- a/Engine/source/T3D/vehicles/vehicle.cpp +++ b/Engine/source/T3D/vehicles/vehicle.cpp @@ -297,12 +297,12 @@ void VehicleData::initPersistFields() "damageEmitterOffset[1] = \"-0.5 3 1\";\n" "numDmgEmitterAreas = 2;\n" "@endtsexample\n" ); - addField( "damageLevelTolerance", TypeF32, Offset(damageLevelTolerance, VehicleData), VC_NUM_DAMAGE_LEVELS, + addFieldV( "damageLevelTolerance", TypeRangedF32, Offset(damageLevelTolerance, VehicleData), &CommonValidators::PositiveFloat, VC_NUM_DAMAGE_LEVELS, "@brief Damage levels (as a percentage of maxDamage) above which to begin " "emitting particles from the associated damageEmitter.\n\n" "Levels should be in order of increasing damage.\n\n" "@see damageEmitterOffset" ); - addField( "numDmgEmitterAreas", TypeF32, Offset(numDmgEmitterAreas, VehicleData), + addFieldV( "numDmgEmitterAreas", TypeRangedF32, Offset(numDmgEmitterAreas, VehicleData), &CommonValidators::PositiveFloat, "Number of damageEmitterOffset values to use for each damageEmitter.\n\n" "@see damageEmitterOffset" ); endGroup("Particle Effects"); @@ -313,33 +313,33 @@ void VehicleData::initPersistFields() endGroup("Physics"); addGroup("Collision"); - addField( "collDamageThresholdVel", TypeF32, Offset(collDamageThresholdVel, VehicleData), + addFieldV( "collDamageThresholdVel", TypeRangedF32, Offset(collDamageThresholdVel, VehicleData), &CommonValidators::PositiveFloat, "Minimum collision velocity to cause damage to this vehicle.\nCurrently unused." ); - addField( "collDamageMultiplier", TypeF32, Offset(collDamageMultiplier, VehicleData), + addFieldV( "collDamageMultiplier", TypeRangedF32, Offset(collDamageMultiplier, VehicleData), &CommonValidators::PositiveFloat, "@brief Damage to this vehicle after a collision (multiplied by collision " "velocity).\n\nCurrently unused." ); endGroup("Collision"); addGroup("Steering"); - addField( "jetForce", TypeF32, Offset(jetForce, VehicleData), + addFieldV( "jetForce", TypeRangedF32, Offset(jetForce, VehicleData), &CommonValidators::PositiveFloat, "@brief Additional force applied to the vehicle when it is jetting.\n\n" "For WheeledVehicles, the force is applied in the forward direction. For " "FlyingVehicles, the force is applied in the thrust direction." ); - addField( "jetEnergyDrain", TypeF32, Offset(jetEnergyDrain, VehicleData), + addFieldV( "jetEnergyDrain", TypeRangedF32, Offset(jetEnergyDrain, VehicleData), &CommonValidators::PositiveFloat, "@brief Energy amount to drain for each tick the vehicle is jetting.\n\n" "Once the vehicle's energy level reaches 0, it will no longer be able to jet." ); - addField( "minJetEnergy", TypeF32, Offset(minJetEnergy, VehicleData), + addFieldV( "minJetEnergy", TypeRangedF32, Offset(minJetEnergy, VehicleData), &CommonValidators::PositiveFloat, "Minimum vehicle energy level to begin jetting." ); - addField( "maxSteeringAngle", TypeF32, Offset(maxSteeringAngle, VehicleData), + addFieldV( "maxSteeringAngle", TypeRangedF32, Offset(maxSteeringAngle, VehicleData), &CommonValidators::PositiveFloat, "Maximum yaw (horizontal) and pitch (vertical) steering angle in radians." ); endGroup("Steering"); addGroup("AutoCorrection"); addField( "powerSteering", TypeBool, Offset(powerSteering, VehicleData), "If true, steering does not auto-centre while the vehicle is being steered by its driver." ); - addField( "steeringReturn", TypeF32, Offset(steeringReturn, VehicleData), + addFieldV( "steeringReturn", TypeRangedF32, Offset(steeringReturn, VehicleData), &CommonValidators::PositiveFloat, "Rate at which the vehicle's steering returns to forwards when it is moving." ); - addField( "steeringReturnSpeedScale", TypeF32, Offset(steeringReturnSpeedScale, VehicleData), + addFieldV( "steeringReturnSpeedScale", TypeRangedF32, Offset(steeringReturnSpeedScale, VehicleData), &CommonValidators::PositiveFloat, "Amount of effect the vehicle's speed has on its rate of steering return." ); endGroup("AutoCorrection"); } diff --git a/Engine/source/T3D/vehicles/wheeledVehicle.cpp b/Engine/source/T3D/vehicles/wheeledVehicle.cpp index 23b3bc045..7c9b1b3a8 100644 --- a/Engine/source/T3D/vehicles/wheeledVehicle.cpp +++ b/Engine/source/T3D/vehicles/wheeledVehicle.cpp @@ -115,20 +115,20 @@ void WheeledVehicleTire::initPersistFields() docsURL; INITPERSISTFIELD_SHAPEASSET(Shape, WheeledVehicleTire, "The shape to use for the wheel."); - addField( "mass", TypeF32, Offset(mass, WheeledVehicleTire), + addFieldV( "mass", TypeRangedF32, Offset(mass, WheeledVehicleTire), &CommonValidators::PositiveFloat, "The mass of the wheel.\nCurrently unused." ); - addField( "radius", TypeF32, Offset(radius, WheeledVehicleTire), + addFieldV( "radius", TypeRangedF32, Offset(radius, WheeledVehicleTire), &CommonValidators::PositiveFloat, "@brief The radius of the wheel.\n\n" "The radius is determined from the bounding box of the shape provided " "in the shapefile field, and does not need to be specified in script. " "The tire should be built with its hub axis along the object's Y-axis." ); - addField( "staticFriction", TypeF32, Offset(staticFriction, WheeledVehicleTire), + addFieldV( "staticFriction", TypeRangedF32, Offset(staticFriction, WheeledVehicleTire), &CommonValidators::PositiveFloat, "Tire friction when the wheel is not slipping (has traction)." ); - addField( "kineticFriction", TypeF32, Offset(kineticFriction, WheeledVehicleTire), + addFieldV( "kineticFriction", TypeRangedF32, Offset(kineticFriction, WheeledVehicleTire), &CommonValidators::PositiveFloat, "Tire friction when the wheel is slipping (no traction)." ); - addField( "restitution", TypeF32, Offset(restitution, WheeledVehicleTire), + addFieldV( "restitution", TypeRangedF32, Offset(restitution, WheeledVehicleTire), &CommonValidators::PositiveFloat, "Tire restitution.\nCurrently unused." ); - addField( "lateralForce", TypeF32, Offset(lateralForce, WheeledVehicleTire), + addFieldV( "lateralForce", TypeRangedF32, Offset(lateralForce, WheeledVehicleTire, &CommonValidators::PositiveFloat), &CommonValidators::PositiveFloat, "@brief Tire force perpendicular to the direction of movement.\n\n" "Lateral force can in simple terms be considered left/right steering " "force. WheeledVehicles are acted upon by forces generated by their tires " @@ -146,14 +146,14 @@ void WheeledVehicleTire::initPersistFields() "For this field, the larger the value supplied for the lateralForce, the " "larger the effect steering maneuvers can have. In Torque tire forces are " "applied at a vehicle's wheel hubs." ); - addField( "lateralDamping", TypeF32, Offset(lateralDamping, WheeledVehicleTire), + addFieldV( "lateralDamping", TypeRangedF32, Offset(lateralDamping, WheeledVehicleTire), &CommonValidators::PositiveFloat, "Damping force applied against lateral forces generated by the tire.\n\n" "@see lateralForce" ); - addField( "lateralRelaxation", TypeF32, Offset(lateralRelaxation, WheeledVehicleTire), + addFieldV( "lateralRelaxation", TypeRangedF32, Offset(lateralRelaxation, WheeledVehicleTire), &CommonValidators::PositiveFloat, "@brief Relaxing force applied against lateral forces generated by the tire.\n\n" "The lateralRelaxation force measures how strongly the tire effectively " "un-deforms.\n\n@see lateralForce" ); - addField( "longitudinalForce", TypeF32, Offset(longitudinalForce, WheeledVehicleTire), + addFieldV( "longitudinalForce", TypeRangedF32, Offset(longitudinalForce, WheeledVehicleTire), &CommonValidators::PositiveFloat, "@brief Tire force in the direction of movement.\n\n" "Longitudinal force can in simple terms be considered forward/backward " "movement force. WheeledVehicles are acted upon by forces generated by " @@ -162,10 +162,10 @@ void WheeledVehicleTire::initPersistFields() "For this field, the larger the value, the larger the effect " "acceleration/deceleration inputs have.\n\n" "@see lateralForce" ); - addField( "longitudinalDamping", TypeF32, Offset(longitudinalDamping, WheeledVehicleTire), + addFieldV( "longitudinalDamping", TypeRangedF32, Offset(longitudinalDamping, WheeledVehicleTire), &CommonValidators::PositiveFloat, "Damping force applied against longitudinal forces generated by the tire.\n\n" "@see longitudinalForce" ); - addField( "longitudinalRelaxation", TypeF32, Offset(longitudinalRelaxation, WheeledVehicleTire), + addFieldV( "longitudinalRelaxation", TypeRangedF32, Offset(longitudinalRelaxation, WheeledVehicleTire), &CommonValidators::PositiveFloat, "@brief Relaxing force applied against longitudinal forces generated by the tire.\n\n" "The longitudinalRelaxation force measures how strongly the tire effectively " "un-deforms.\n\n" @@ -235,20 +235,20 @@ WheeledVehicleSpring::WheeledVehicleSpring() void WheeledVehicleSpring::initPersistFields() { docsURL; - addField( "length", TypeF32, Offset(length, WheeledVehicleSpring), + addFieldV( "length", TypeRangedF32, Offset(length, WheeledVehicleSpring), &CommonValidators::PositiveFloat, "@brief Maximum spring length. ie. how far the wheel can extend from the " "root hub position.\n\n" "This should be set to the vertical (Z) distance the hub travels in the " "associated spring animation." ); - addField( "force", TypeF32, Offset(force, WheeledVehicleSpring), + addFieldV( "force", TypeRangedF32, Offset(force, WheeledVehicleSpring), &CommonValidators::PositiveFloat, "@brief Maximum spring force (when compressed to minimum length, 0).\n\n" "Increasing this will make the vehicle suspension ride higher (for a given " "vehicle mass), and also make the vehicle more bouncy when landing jumps." ); - addField( "damping", TypeF32, Offset(damping, WheeledVehicleSpring), + addFieldV( "damping", TypeRangedF32, Offset(damping, WheeledVehicleSpring), &CommonValidators::PositiveFloat, "@brief Force applied to slow changes to the extension of this spring.\n\n" "Increasing this makes the suspension stiffer which can help stabilise " "bouncy vehicles." ); - addField( "antiSwayForce", TypeF32, Offset(antiSway, WheeledVehicleSpring), + addFieldV( "antiSwayForce", TypeRangedF32, Offset(antiSway, WheeledVehicleSpring), &CommonValidators::PositiveFloat, "@brief Force applied to equalize extension of the spring on the opposite " "wheel.\n\n" "This force helps to keep the suspension balanced when opposite wheels " @@ -465,17 +465,17 @@ void WheeledVehicleData::initPersistFields() endGroup("Sounds"); addGroup("Steering"); - addField("maxWheelSpeed", TypeF32, Offset(maxWheelSpeed, WheeledVehicleData), + addFieldV("maxWheelSpeed", TypeRangedF32, Offset(maxWheelSpeed, WheeledVehicleData), &CommonValidators::PositiveFloat, "@brief Maximum linear velocity of each wheel.\n\n" "This caps the maximum speed of the vehicle." ); - addField("engineTorque", TypeF32, Offset(engineTorque, WheeledVehicleData), + addFieldV("engineTorque", TypeRangedF32, Offset(engineTorque, WheeledVehicleData), &CommonValidators::PositiveFloat, "@brief Torque available from the engine at 100% throttle.\n\n" "This controls vehicle acceleration. ie. how fast it will reach maximum speed." ); - addField("engineBrake", TypeF32, Offset(engineBrake, WheeledVehicleData), + addFieldV("engineBrake", TypeRangedF32, Offset(engineBrake, WheeledVehicleData), &CommonValidators::PositiveFloat, "@brief Braking torque applied by the engine when the throttle and brake " "are both 0.\n\n" "This controls how quickly the vehicle will coast to a stop." ); - addField("brakeTorque", TypeF32, Offset(brakeTorque, WheeledVehicleData), + addFieldV("brakeTorque", TypeRangedF32, Offset(brakeTorque, WheeledVehicleData), &CommonValidators::PositiveFloat, "@brief Torque applied when braking.\n\n" "This controls how fast the vehicle will stop when the brakes are applied." ); addField("downforce", TypeF32, Offset(mDownForce, WheeledVehicleData), diff --git a/Engine/source/afx/afxEffectGroup.cpp b/Engine/source/afx/afxEffectGroup.cpp index 2bc5a858e..b26550f6e 100644 --- a/Engine/source/afx/afxEffectGroup.cpp +++ b/Engine/source/afx/afxEffectGroup.cpp @@ -143,20 +143,20 @@ void afxEffectGroupData::initPersistFields() docsURL; addField("groupEnabled", TypeBool, myOffset(group_enabled), "..."); - addField("count", TypeS32, myOffset(group_count), + addFieldV("count", TypeRangedS32, myOffset(group_count), &CommonValidators::NaturalNumber, "..."); addField("indexOffset", TypeS8, myOffset(idx_offset), "..."); addField("assignIndices", TypeBool, myOffset(assign_idx), "..."); - addField("delay", TypeF32, myOffset(timing.delay), + addFieldV("delay", TypeRangedF32, myOffset(timing.delay), &CommonValidators::PositiveFloat, "..."); - addField("lifetime", TypeF32, myOffset(timing.lifetime), + addFieldV("lifetime", TypeRangedF32, myOffset(timing.lifetime), &CommonValidators::PositiveFloat, "..."); - addField("fadeInTime", TypeF32, myOffset(timing.fade_in_time), + addFieldV("fadeInTime", TypeRangedF32, myOffset(timing.fade_in_time), &CommonValidators::PositiveFloat, "..."); - addField("fadeOutTime", TypeF32, myOffset(timing.fade_out_time), + addFieldV("fadeOutTime", TypeRangedF32, myOffset(timing.fade_out_time), &CommonValidators::PositiveFloat, "..."); // effect lists diff --git a/Engine/source/afx/afxEffectWrapper.cpp b/Engine/source/afx/afxEffectWrapper.cpp index 2a3105b9b..85dfd1d33 100644 --- a/Engine/source/afx/afxEffectWrapper.cpp +++ b/Engine/source/afx/afxEffectWrapper.cpp @@ -35,6 +35,7 @@ #include "afx/afxEffectWrapper.h" #include "afx/util/afxAnimCurve.h" #include "afx/util/afxEase.h" +#include "console/typeValidators.h" //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// // afxEffectWrapperData @@ -237,33 +238,33 @@ void afxEffectWrapperData::initPersistFields() addField("ghostIsConstraintSrc", TypeBool, myOffset(use_ghost_as_cons_obj), "..."); - addField("delay", TypeF32, myOffset(ewd_timing.delay), + addFieldV("delay", TypeRangedF32, myOffset(ewd_timing.delay), &CommonValidators::PositiveFloat, "..."); - addField("lifetime", TypeF32, myOffset(ewd_timing.lifetime), + addFieldV("lifetime", TypeRangedF32, myOffset(ewd_timing.lifetime), &CommonValidators::PositiveFloat, "..."); - addField("fadeInTime", TypeF32, myOffset(ewd_timing.fade_in_time), + addFieldV("fadeInTime", TypeRangedF32, myOffset(ewd_timing.fade_in_time), &CommonValidators::PositiveFloat, "..."); - addField("residueLifetime", TypeF32, myOffset(ewd_timing.residue_lifetime), + addFieldV("residueLifetime", TypeRangedF32, myOffset(ewd_timing.residue_lifetime), &CommonValidators::PositiveFloat, "..."); addField("fadeInEase", TypePoint2F, myOffset(ewd_timing.fadein_ease), "..."); addField("fadeOutEase", TypePoint2F, myOffset(ewd_timing.fadeout_ease), "..."); - addField("lifetimeBias", TypeF32, myOffset(ewd_timing.life_bias), + addFieldV("lifetimeBias", TypeRangedF32, myOffset(ewd_timing.life_bias), &CommonValidators::PositiveFloat, "..."); - addField("fadeOutTime", TypeF32, myOffset(user_fade_out_time), + addFieldV("fadeOutTime", TypeRangedF32, myOffset(user_fade_out_time), &CommonValidators::PositiveFloat, "..."); - addField("rateFactor", TypeF32, myOffset(rate_factor), + addFieldV("rateFactor", TypeRangedF32, myOffset(rate_factor), &CommonValidators::PositiveFloat, "..."); - addField("scaleFactor", TypeF32, myOffset(scale_factor), + addFieldV("scaleFactor", TypeRangedF32, myOffset(scale_factor), &CommonValidators::PositiveFloat, "..."); addField("isLooping", TypeBool, myOffset(is_looping), "..."); - addField("loopCount", TypeS32, myOffset(n_loops), + addFieldV("loopCount", TypeRangedS32, myOffset(n_loops), &CommonValidators::PositiveInt, "..."); - addField("loopGapTime", TypeF32, myOffset(loop_gap_time), + addFieldV("loopGapTime", TypeRangedF32, myOffset(loop_gap_time), &CommonValidators::PositiveFloat, "..."); addField("ignoreTimeFactor", TypeBool, myOffset(ignore_time_factor), @@ -296,9 +297,9 @@ void afxEffectWrapperData::initPersistFields() "..."); addField("direction", TypePoint3F, myOffset(direction), "..."); - addField("speed", TypeF32, myOffset(speed), + addFieldV("speed", TypeRangedF32, myOffset(speed), &CommonValidators::PositiveFloat, "..."); - addField("mass", TypeF32, myOffset(mass), + addFieldV("mass", TypeRangedF32, myOffset(mass), &CommonValidators::PositiveFloat, "..."); addField("borrowAltitudes", TypeBool, myOffset(borrow_altitudes), @@ -739,9 +740,9 @@ afxEffectWrapper::~afxEffectWrapper() void afxEffectWrapper::initPersistFields() { docsURL; - addField("liveScaleFactor", TypeF32, myOffset(mLive_scale_factor), + addFieldV("liveScaleFactor", TypeRangedF32, myOffset(mLive_scale_factor), &CommonValidators::PositiveFloat, "..."); - addField("liveFadeFactor", TypeF32, myOffset(mLive_fade_factor), + addFieldV("liveFadeFactor", TypeRangedF32, myOffset(mLive_fade_factor), &CommonValidators::PositiveFloat, "..."); Parent::initPersistFields(); diff --git a/Engine/source/afx/afxEffectron.cpp b/Engine/source/afx/afxEffectron.cpp index 0fd053a7f..c46f626be 100644 --- a/Engine/source/afx/afxEffectron.cpp +++ b/Engine/source/afx/afxEffectron.cpp @@ -111,9 +111,9 @@ void afxEffectronData::reloadReset() void afxEffectronData::initPersistFields() { docsURL; - addField("duration", TypeF32, myOffset(duration), + addFieldV("duration", TypeRangedF32, myOffset(duration), &CommonValidators::PositiveFloat, "..."); - addField("numLoops", TypeS32, myOffset(n_loops), + addFieldV("numLoops", TypeRangedS32, myOffset(n_loops), &CommonValidators::NegDefaultInt, "..."); // effect lists // for each of these, dummy_fx_entry is set and then a validator adds it to the appropriate effects list diff --git a/Engine/source/afx/afxMagicMissile.cpp b/Engine/source/afx/afxMagicMissile.cpp index e797c2dc1..d77ead423 100644 --- a/Engine/source/afx/afxMagicMissile.cpp +++ b/Engine/source/afx/afxMagicMissile.cpp @@ -324,8 +324,9 @@ afxMagicMissileData* afxMagicMissileData::cloneAndPerformSubstitutions(const Sim FRangeValidator muzzleVelocityValidator(0, 10000); FRangeValidator missilePrecisionValidator(0.f, 100.f); -FRangeValidator missileTrackDelayValidator(0, 100000); +IRangeValidator missileTrackDelayValidator(0, 100000); FRangeValidator missileBallisticCoefficientValidator(0, 1); +FRangeValidator missileFollowTerrainAdjustRateValidator(0.05f, FLT_MAX); void afxMagicMissileData::initPersistFields() { @@ -353,36 +354,36 @@ void afxMagicMissileData::initPersistFields() endGroup("Light Emitter"); addGroup("Physics"); - addNamedFieldV(lifetime, TypeS32, afxMagicMissileData, &ticksFromMS); - addFieldV("casterSafetyTime", TypeS32, myOffset(caster_safety_time), &ticksFromMS); + addNamedFieldV(lifetime, TypeRangedS32, afxMagicMissileData, &ticksFromMS); + addFieldV("casterSafetyTime", TypeRangedS32, myOffset(caster_safety_time), &ticksFromMS); addField("isBallistic", TypeBool, Offset(isBallistic, afxMagicMissileData)); - addNamedFieldV(muzzleVelocity, TypeF32, afxMagicMissileData, &muzzleVelocityValidator); - addNamedFieldV(ballisticCoefficient, TypeF32, afxMagicMissileData, &missileBallisticCoefficientValidator); - addField("gravityMod", TypeF32, Offset(gravityMod, afxMagicMissileData)); + addNamedFieldV(muzzleVelocity, TypeRangedF32, afxMagicMissileData, &muzzleVelocityValidator); + addNamedFieldV(ballisticCoefficient, TypeRangedF32, afxMagicMissileData, &missileBallisticCoefficientValidator); + addFieldV("gravityMod", TypeRangedF32, Offset(gravityMod, afxMagicMissileData), &CommonValidators::F32Range); addField("collisionMask", TypeS32, myOffset(collision_mask)); addField("startingVelocityVector",TypePoint3F, myOffset(starting_vel_vec)); addNamedField(acceleration, TypeF32, afxMagicMissileData); - addNamedFieldV(accelDelay, TypeS32, afxMagicMissileData, &ticksFromMS); - addNamedFieldV(accelLifetime, TypeS32, afxMagicMissileData, &ticksFromMS); + addNamedFieldV(accelDelay, TypeRangedS32, afxMagicMissileData, &ticksFromMS); + addNamedFieldV(accelLifetime, TypeRangedS32, afxMagicMissileData, &ticksFromMS); addField("reverseTargeting", TypeBool, myOffset(reverse_targeting)); endGroup("Physics"); addGroup("Physics-Tracking"); addNamedField(isGuided, TypeBool, afxMagicMissileData); - addNamedFieldV(precision, TypeF32, afxMagicMissileData, &missilePrecisionValidator); - addNamedFieldV(trackDelay, TypeS32, afxMagicMissileData, &missileTrackDelayValidator); + addNamedFieldV(precision, TypeRangedF32, afxMagicMissileData, &missilePrecisionValidator); + addNamedFieldV(trackDelay, TypeRangedS32, afxMagicMissileData, &missileTrackDelayValidator); endGroup("Physics-Tracking"); addGroup("Physics-Avoidance"); addField("followTerrain", TypeBool, myOffset(followTerrain)); - addField("followTerrainHeight", TypeF32, myOffset(followTerrainHeight)); - addField("followTerrainAdjustRate", TypeF32, myOffset(followTerrainAdjustRate)); - addFieldV("followTerrainAdjustDelay", TypeS32, myOffset(followTerrainAdjustDelay), &ticksFromMS); + addFieldV("followTerrainHeight", TypeRangedS32, myOffset(followTerrainHeight), &CommonValidators::PositiveFloat); + addFieldV("followTerrainAdjustRate", TypeRangedS32, myOffset(followTerrainAdjustRate), &missileFollowTerrainAdjustRateValidator); + addFieldV("followTerrainAdjustDelay", TypeRangedS32, myOffset(followTerrainAdjustDelay), &ticksFromMS); - addField("hoverAltitude", TypeF32, myOffset(hover_altitude)); - addField("hoverAttackDistance", TypeF32, myOffset(hover_attack_distance)); - addField("hoverAttackGradient", TypeF32, myOffset(hover_attack_gradient)); - addFieldV("hoverTime", TypeS32, myOffset(hover_time), &ticksFromMS); + addFieldV("hoverAltitude", TypeRangedF32, myOffset(hover_altitude), &CommonValidators::PositiveFloat); + addFieldV("hoverAttackDistance", TypeRangedF32, myOffset(hover_attack_distance), &CommonValidators::PositiveFloat); + addFieldV("hoverAttackGradient", TypeRangedF32, myOffset(hover_attack_gradient), &CommonValidators::PositiveNonZeroFloat); + addFieldV("hoverTime", TypeRangedS32, myOffset(hover_time), &ticksFromMS); endGroup("Physics-Avoidance"); addGroup("Physics-Launch"); @@ -391,8 +392,8 @@ void afxMagicMissileData::initPersistFields() addField("launchOffsetServer",TypePoint3F, myOffset(launch_offset_server)); addField("launchOffsetClient",TypePoint3F, myOffset(launch_offset_client)); addField("launchNodeOffset", TypePoint3F, myOffset(launch_node_offset)); - addField("launchAimPitch", TypeF32, myOffset(launch_pitch)); - addField("launchAimPan", TypeF32, myOffset(launch_pan)); + addFieldV("launchAimPitch", TypeRangedF32, myOffset(launch_pitch), &CommonValidators::DegreeRange); + addFieldV("launchAimPan", TypeRangedF32, myOffset(launch_pan), &CommonValidators::DegreeRange); addField("launchConstraintServer", TypeString, myOffset(launch_cons_s_spec)); addField("launchConstraintClient", TypeString, myOffset(launch_cons_c_spec)); addField("echoLaunchOffset", TypeBool, myOffset(echo_launch_offset)); diff --git a/Engine/source/afx/afxMagicSpell.cpp b/Engine/source/afx/afxMagicSpell.cpp index 5cb5be2eb..e8c4a9d44 100644 --- a/Engine/source/afx/afxMagicSpell.cpp +++ b/Engine/source/afx/afxMagicSpell.cpp @@ -220,22 +220,22 @@ void afxMagicSpellData::initPersistFields() // for each effect list, dummy_fx_entry is set and then a validator adds it to the appropriate effects list addGroup("Casting Stage"); - addField("castingDur", TypeF32, myOffset(mCasting_dur), + addFieldV("castingDur", TypeRangedF32, myOffset(mCasting_dur), &CommonValidators::PositiveFloat, "..."); - addField("numCastingLoops", TypeS32, myOffset(mNum_casting_loops), + addFieldV("numCastingLoops", TypeRangedS32, myOffset(mNum_casting_loops), &CommonValidators::NaturalNumber, "..."); - addField("extraCastingTime", TypeF32, myOffset(mExtra_casting_time), + addFieldV("extraCastingTime", TypeRangedF32, myOffset(mExtra_casting_time), &CommonValidators::PositiveFloat, "..."); addFieldV("addCastingEffect", TYPEID(), Offset(mDummy_fx_entry, afxMagicSpellData), &_castingPhrase, "..."); endGroup("Casting Stage"); addGroup("Delivery Stage"); - addField("deliveryDur", TypeF32, myOffset(mDelivery_dur), + addFieldV("deliveryDur", TypeRangedF32, myOffset(mDelivery_dur), &CommonValidators::PositiveFloat, "..."); - addField("numDeliveryLoops", TypeS32, myOffset(mNum_delivery_loops), + addFieldV("numDeliveryLoops", TypeRangedS32, myOffset(mNum_delivery_loops), &CommonValidators::NaturalNumber, "..."); - addField("extraDeliveryTime", TypeF32, myOffset(mExtra_delivery_time), + addFieldV("extraDeliveryTime", TypeRangedF32, myOffset(mExtra_delivery_time), &CommonValidators::PositiveFloat, "..."); addFieldV("addLaunchEffect", TYPEID(), Offset(mDummy_fx_entry, afxMagicSpellData), &_launchPhrase, "..."); @@ -244,11 +244,11 @@ void afxMagicSpellData::initPersistFields() endGroup("Delivery Stage"); addGroup("Linger Stage"); - addField("lingerDur", TypeF32, myOffset(mLinger_dur), + addFieldV("lingerDur", TypeRangedF32, myOffset(mLinger_dur), &CommonValidators::PositiveFloat, "..."); - addField("numLingerLoops", TypeS32, myOffset(mNum_linger_loops), + addFieldV("numLingerLoops", TypeRangedS32, myOffset(mNum_linger_loops), &CommonValidators::NaturalNumber, "..."); - addField("extraLingerTime", TypeF32, myOffset(mExtra_linger_time), + addFieldV("extraLingerTime", TypeRangedF32, myOffset(mExtra_linger_time), &CommonValidators::PositiveFloat, "..."); addFieldV("addImpactEffect", TYPEID(), Offset(mDummy_fx_entry, afxMagicSpellData), &_impactPhrase, "..."); @@ -259,7 +259,7 @@ void afxMagicSpellData::initPersistFields() // interrupt flags addField("allowMovementInterrupts", TypeBool, myOffset(mDo_move_interrupts), "..."); - addField("movementInterruptSpeed", TypeF32, myOffset(mMove_interrupt_speed), + addFieldV("movementInterruptSpeed", TypeRangedF32, myOffset(mMove_interrupt_speed), &CommonValidators::PositiveFloat, "..."); // delivers projectile spells diff --git a/Engine/source/afx/afxSelectron.cpp b/Engine/source/afx/afxSelectron.cpp index ccaf680e4..fcc65ccb1 100644 --- a/Engine/source/afx/afxSelectron.cpp +++ b/Engine/source/afx/afxSelectron.cpp @@ -153,17 +153,17 @@ void afxSelectronData::initPersistFields() static ewValidator _selectPhrase(SELECT_PHRASE); static ewValidator _deselectPhrase(DESELECT_PHRASE); - addField("mainDur", TypeF32, myOffset(main_dur), + addFieldV("mainDur", TypeRangedF32, myOffset(main_dur), &CommonValidators::PositiveFloat, "..."); - addField("selectDur", TypeF32, myOffset(select_dur), + addFieldV("selectDur", TypeRangedF32, myOffset(select_dur), &CommonValidators::PositiveFloat, "..."); - addField("deselectDur", TypeF32, myOffset(deselect_dur), + addFieldV("deselectDur", TypeRangedF32, myOffset(deselect_dur), &CommonValidators::PositiveFloat, "..."); - addField("mainRepeats", TypeS32, myOffset(n_main_loops), + addFieldV("mainRepeats", TypeRangedS32, myOffset(n_main_loops), &CommonValidators::NaturalNumber, "..."); - addField("selectRepeats", TypeS32, myOffset(n_select_loops), + addFieldV("selectRepeats", TypeRangedS32, myOffset(n_select_loops), &CommonValidators::NaturalNumber, "..."); - addField("deselectRepeats", TypeS32, myOffset(n_deselect_loops), + addFieldV("deselectRepeats", TypeRangedS32, myOffset(n_deselect_loops), &CommonValidators::NaturalNumber, "..."); addField("selectionTypeMask", TypeS32, myOffset(obj_type_mask), "..."); @@ -180,11 +180,11 @@ void afxSelectronData::initPersistFields() "..."); // deprecated - addField("numMainLoops", TypeS32, myOffset(n_main_loops), + addFieldV("numMainLoops", TypeRangedS32, myOffset(n_main_loops), &CommonValidators::NaturalNumber, "..."); - addField("numSelectLoops", TypeS32, myOffset(n_select_loops), + addFieldV("numSelectLoops", TypeRangedS32, myOffset(n_select_loops), &CommonValidators::NaturalNumber, "..."); - addField("numDeselectLoops", TypeS32, myOffset(n_deselect_loops), + addFieldV("numDeselectLoops", TypeRangedS32, myOffset(n_deselect_loops), &CommonValidators::NaturalNumber, "..."); Parent::initPersistFields(); diff --git a/Engine/source/afx/ce/afxAnimClip.cpp b/Engine/source/afx/ce/afxAnimClip.cpp index 5adb7642a..e431ea189 100644 --- a/Engine/source/afx/ce/afxAnimClip.cpp +++ b/Engine/source/afx/ce/afxAnimClip.cpp @@ -106,11 +106,11 @@ void afxAnimClipData::initPersistFields() "The name of an animation sequence to be played by a ShapeBase-derived object to which this effect is " "constrained. Also works on afxModel effects.\n" "default: \"\"\n"); - addField("rate", TYPEID< F32 >(), myOffset(rate), + addFieldV("rate", TypeRangedF32, myOffset(rate), &CommonValidators::F32Range, "The desired playback speed for the sequence. A value of 1.0 indicates forward playback at a normal rate. Negative " "values cause the sequence to play backwards.\n" "default: 1.0\n"); - addField("posOffset", TYPEID< F32 >(), myOffset(pos_offset), + addFieldV("posOffset", TypeRangedF32, myOffset(pos_offset), &CommonValidators::NormalizedFloat, "Sets a starting offset for the selected animation clip. It directly specifies an animation thread position in the 0.0 to " "1.0 range as a fraction of the clip's duration.\n" "default: 1.0\n"); diff --git a/Engine/source/afx/ce/afxAreaDamage.cpp b/Engine/source/afx/ce/afxAreaDamage.cpp index 6699f3793..0ef9fa7fa 100644 --- a/Engine/source/afx/ce/afxAreaDamage.cpp +++ b/Engine/source/afx/ce/afxAreaDamage.cpp @@ -79,13 +79,13 @@ void afxAreaDamageData::initPersistFields() "An arbitrary string which is passed as an argument to a spell's onDamage() script " "method. It is used to classify a type of damage such as 'melee', 'magical', or " "'fire'."); - addField("damage", TypeF32, myOffset(amount), + addFieldV("damage", TypeRangedF32, myOffset(amount), &CommonValidators::F32Range, "An amount of area damage to inflict on a target. Objects within half the radius " "receive full damage which then diminishes out to the full distance of the specified " "radius."); - addField("radius", TypeF32, myOffset(radius), + addFieldV("radius", TypeRangedF32, myOffset(radius), &CommonValidators::PositiveFloat, "Radius centered at the effect position in which damage will be applied."); - addField("impulse", TypeF32, myOffset(impulse), + addFieldV("impulse", TypeRangedF32, myOffset(impulse), &CommonValidators::F32Range, "Specifies an amount of force to apply to damaged objects. Objects within half the " "radius receive full impulse which then diminishes out to the full distance of the " "specified radius."); diff --git a/Engine/source/afx/ce/afxAudioBank.cpp b/Engine/source/afx/ce/afxAudioBank.cpp index 6398e8166..87dd505f4 100644 --- a/Engine/source/afx/ce/afxAudioBank.cpp +++ b/Engine/source/afx/ce/afxAudioBank.cpp @@ -30,6 +30,7 @@ #include "sfx/sfxDescription.h" #include "afx/ce/afxAudioBank.h" +#include "console/typeValidators.h" //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// @@ -133,7 +134,7 @@ void afxAudioBank::initPersistFields() "SFXDescription datablock to use with this set of sounds."); addField("preload", TypeBool, Offset(mPreload, afxAudioBank), "If set to true, file is pre-loaded, otherwise it is loaded on-demand."); - addField("playIndex", TypeS32, Offset(play_index, afxAudioBank), + addFieldV("playIndex", TypeRangedS32, Offset(play_index, afxAudioBank), &CommonValidators::NegDefaultInt, "An array index that selects a sound to play from the filenames[] field. Values " "outside of the range of assigned filename[] entries will not play any sound."); diff --git a/Engine/source/afx/ce/afxCameraShake.cpp b/Engine/source/afx/ce/afxCameraShake.cpp index a8ba8ad45..4875027b6 100644 --- a/Engine/source/afx/ce/afxCameraShake.cpp +++ b/Engine/source/afx/ce/afxCameraShake.cpp @@ -71,9 +71,9 @@ void afxCameraShakeData::initPersistFields() "The camera shake frequencies for all three axes: X, Y, Z."); addField("amplitude", TypePoint3F, Offset(camShakeAmp, afxCameraShakeData), "The camera shake amplitudes for all three axes: X, Y, Z."); - addField("radius", TypeF32, Offset(camShakeRadius, afxCameraShakeData), + addFieldV("radius", TypeRangedF32, Offset(camShakeRadius, afxCameraShakeData), &CommonValidators::PositiveFloat, "Radius about the effect position in which shaking will be applied."); - addField("falloff", TypeF32, Offset(camShakeFalloff, afxCameraShakeData), + addFieldV("falloff", TypeRangedF32, Offset(camShakeFalloff, afxCameraShakeData), &CommonValidators::PositiveFloat, "Magnitude by which shaking decreases over distance to radius."); Parent::initPersistFields(); diff --git a/Engine/source/afx/ce/afxDamage.cpp b/Engine/source/afx/ce/afxDamage.cpp index ee93fc507..4da6dd623 100644 --- a/Engine/source/afx/ce/afxDamage.cpp +++ b/Engine/source/afx/ce/afxDamage.cpp @@ -83,19 +83,19 @@ void afxDamageData::initPersistFields() "An arbitrary string which is passed as an argument to a spell's onDamage() script " "method. It is used to classify a type of damage such as 'melee', 'magical', or " "'fire'."); - addField("directDamage", TypeF32, myOffset(amount), + addFieldV("directDamage", TypeRangedF32, myOffset(amount), &CommonValidators::F32Range, "An amount of direct damage to inflict on a target."); addField("directDamageRepeats", TypeS8, myOffset(repeats), "The number of times to inflict the damage specified by directDamage. Values " "greater than 1 inflict damage over time, with the amount of directDamage " "repeatedly dealt at evenly spaced intervals over the lifetime of the effect."); - addField("areaDamage", TypeF32, myOffset(ad_amount), + addFieldV("areaDamage", TypeRangedF32, myOffset(ad_amount), &CommonValidators::F32Range, "An amount of area damage to inflict on a target. Objects within half the radius " "receive full damage which then diminishes out to the full distance of " "areaDamageRadius."); - addField("areaDamageRadius", TypeF32, myOffset(radius), + addFieldV("areaDamageRadius", TypeRangedF32, myOffset(radius), &CommonValidators::PositiveFloat, "Radius centered at the effect position in which damage will be applied."); - addField("areaDamageImpulse", TypeF32, myOffset(impulse), + addFieldV("areaDamageImpulse", TypeRangedF32, myOffset(impulse), &CommonValidators::F32Range, "Specifies an amount of force to apply to damaged objects. Objects within half the " "radius receive full impulse which then diminishes out to the full distance of " "areaDamageRadius."); diff --git a/Engine/source/afx/ce/afxLightBase_T3D.cpp b/Engine/source/afx/ce/afxLightBase_T3D.cpp index 3645c5720..f20a24475 100644 --- a/Engine/source/afx/ce/afxLightBase_T3D.cpp +++ b/Engine/source/afx/ce/afxLightBase_T3D.cpp @@ -104,11 +104,11 @@ void afxT3DLightBaseData::initPersistFields() "Enables/Disables the object rendering and functionality in the scene."); addField( "color", TypeColorF, Offset( mColor, afxT3DLightBaseData ), "Changes the base color hue of the light."); - addField( "brightness", TypeF32, Offset( mBrightness, afxT3DLightBaseData ), + addFieldV( "brightness", TypeRangedF32, Offset( mBrightness, afxT3DLightBaseData ), &CommonValidators::PositiveFloat, "Adjusts the lights power, 0 being off completely."); addField( "castShadows", TypeBool, Offset( mCastShadows, afxT3DLightBaseData ), "Enables/disables shadow casts by this light."); - addField( "priority", TypeF32, Offset( mPriority, afxT3DLightBaseData ), + addFieldV( "priority", TypeRangedF32, Offset( mPriority, afxT3DLightBaseData ), &CommonValidators::PositiveFloat, "Used for sorting of lights by the light manager. Priority determines if a light " "has a stronger effect than, those with a lower value"); addField( "localRenderViz", TypeBool, Offset( mLocalRenderViz, afxT3DLightBaseData ), @@ -123,9 +123,9 @@ void afxT3DLightBaseData::initPersistFields() "Toggles animation for the light on and off"); addField( "animationType", TYPEID(), Offset( mAnimationData, afxT3DLightBaseData ), "Datablock containing light animation information (LightAnimData)"); - addField( "animationPeriod", TypeF32, Offset( mAnimState.animationPeriod, afxT3DLightBaseData ), + addFieldV( "animationPeriod", TypeRangedF32, Offset( mAnimState.animationPeriod, afxT3DLightBaseData ), &CommonValidators::PositiveFloat, "The length of time in seconds for a single playback of the light animation"); - addField( "animationPhase", TypeF32, Offset( mAnimState.animationPhase, afxT3DLightBaseData ), + addFieldV( "animationPhase", TypeRangedF32, Offset( mAnimState.animationPhase, afxT3DLightBaseData ), &CommonValidators::PositiveFloat, "The phase used to offset the animation start time to vary the animation of " "nearby lights."); @@ -135,7 +135,7 @@ void afxT3DLightBaseData::initPersistFields() addField( "flareType", TYPEID(), Offset( mFlareData, afxT3DLightBaseData ), "Datablock containing light flare information (LightFlareData)"); - addField( "flareScale", TypeF32, Offset( mFlareScale, afxT3DLightBaseData ), + addFieldV( "flareScale", TypeRangedF32, Offset( mFlareScale, afxT3DLightBaseData ), &CommonValidators::PositiveFloat, "Globally scales all features of the light flare"); endGroup( "Misc" ); diff --git a/Engine/source/afx/ce/afxMachineGun.cpp b/Engine/source/afx/ce/afxMachineGun.cpp index 8a8a3d071..234f815ea 100644 --- a/Engine/source/afx/ce/afxMachineGun.cpp +++ b/Engine/source/afx/ce/afxMachineGun.cpp @@ -31,6 +31,7 @@ #include "T3D/projectile.h" #include "afx/ce/afxMachineGun.h" +#include "console/typeValidators.h" //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// // afxMachineGunData @@ -68,7 +69,7 @@ void afxMachineGunData::initPersistFields() docsURL; addField("projectile", TYPEID(), myOffset(projectile_data), "A ProjectileData datablock describing the projectile to be launched."); - addField("roundsPerMinute", TypeS32, myOffset(rounds_per_minute), + addFieldV("roundsPerMinute", TypeRangedS32, myOffset(rounds_per_minute), &CommonValidators::PositiveInt, "Specifies the number of projectiles fired over a minute of time. A value of 1200 " "will create 20 projectiles per second.\n" "Sample values for real machine guns:\n" diff --git a/Engine/source/afx/ce/afxModel.cpp b/Engine/source/afx/ce/afxModel.cpp index 57dca2d21..97746493d 100644 --- a/Engine/source/afx/ce/afxModel.cpp +++ b/Engine/source/afx/ce/afxModel.cpp @@ -180,18 +180,18 @@ void afxModelData::initPersistFields() addGroup("Animation"); addField("sequence", TypeString, myOffset(sequence), "The name of an animation sequence to play in the model."); - addField("sequenceRate", TypeF32, myOffset(seq_rate), + addFieldV("sequenceRate", TypeRangedF32, myOffset(seq_rate), &CommonValidators::F32Range, "The rate of playback for the sequence."); - addField("sequenceOffset", TypeF32, myOffset(seq_offset), + addFieldV("sequenceOffset", TypeRangedF32, myOffset(seq_offset), &CommonValidators::F32Range, "An offset in seconds indicating a starting point for the animation sequence " "specified by the sequence field. A rate of 1.0 (rather than sequenceRate) is used " "to convert from seconds to the thread offset."); endGroup("Animation"); addGroup("Rendering"); - addField("alphaMult", TypeF32, myOffset(alpha_mult), + addFieldV("alphaMult", TypeRangedF32, myOffset(alpha_mult), &CommonValidators::PositiveFloat, "An alpha multiplier used to set maximum opacity of the model."); - addField("fogMult", TypeF32, myOffset(fog_mult), ""); + addFieldV("fogMult", TypeRangedF32, myOffset(fog_mult), &CommonValidators::PositiveFloat, ""); addField("remapTextureTags", TypeString, myOffset(remap_txr_tags), "Rename one or more texture tags in the model. Texture tags are what link a " "model's textures to materials.\n" diff --git a/Engine/source/afx/ce/afxParticleEmitter.cpp b/Engine/source/afx/ce/afxParticleEmitter.cpp index afb4488cd..cadf0d3ed 100644 --- a/Engine/source/afx/ce/afxParticleEmitter.cpp +++ b/Engine/source/afx/ce/afxParticleEmitter.cpp @@ -292,9 +292,9 @@ afxParticleEmitterConeData::afxParticleEmitterConeData(const afxParticleEmitterC void afxParticleEmitterConeData::initPersistFields() { docsURL; - addField("spreadMin", TypeF32, Offset(spread_min, afxParticleEmitterConeData), + addFieldV("spreadMin", TypeRangedF32, Offset(spread_min, afxParticleEmitterConeData), &CommonValidators::PosDegreeRangeHalf, "..."); - addField("spreadMax", TypeF32, Offset(spread_max, afxParticleEmitterConeData), + addFieldV("spreadMax", TypeRangedF32, Offset(spread_max, afxParticleEmitterConeData), &CommonValidators::PosDegreeRangeHalf, "..."); Parent::initPersistFields(); @@ -416,7 +416,7 @@ void afxParticleEmitterPathData::initPersistFields() "..."); addField("groundConformInteriors", TypeBool, Offset(ground_conform_interiors, afxParticleEmitterPathData), "..."); - addField("groundConformHeight", TypeF32, Offset(ground_conform_height, afxParticleEmitterPathData), + addFieldV("groundConformHeight", TypeRangedF32, Offset(ground_conform_height, afxParticleEmitterPathData), &CommonValidators::PositiveFloat, "..."); Parent::initPersistFields(); @@ -647,9 +647,9 @@ afxParticleEmitterDiscData::afxParticleEmitterDiscData(const afxParticleEmitterD void afxParticleEmitterDiscData::initPersistFields() { docsURL; - addField("radiusMin", TypeF32, Offset(pe_radius_min, afxParticleEmitterDiscData), + addFieldV("radiusMin", TypeRangedF32, Offset(pe_radius_min, afxParticleEmitterDiscData), &CommonValidators::PositiveFloat, "..."); - addField("radiusMax", TypeF32, Offset(pe_radius_max, afxParticleEmitterDiscData), + addFieldV("radiusMax", TypeRangedF32, Offset(pe_radius_max, afxParticleEmitterDiscData), &CommonValidators::PositiveFloat, "..."); Parent::initPersistFields(); diff --git a/Engine/source/afx/ce/afxPhraseEffect.cpp b/Engine/source/afx/ce/afxPhraseEffect.cpp index d83d589bf..00cda7df3 100644 --- a/Engine/source/afx/ce/afxPhraseEffect.cpp +++ b/Engine/source/afx/ce/afxPhraseEffect.cpp @@ -140,11 +140,11 @@ EndImplementEnumType; void afxPhraseEffectData::initPersistFields() { docsURL; - addField("duration", TypeF32, myOffset(duration), + addFieldV("duration", TypeRangedF32, myOffset(duration), &CommonValidators::NegDefaultF32, "Specifies a duration for the phrase-effect. If set to infinity, the phrase-effect " "needs to have a phraseType of continuous. Set infinite duration using " "$AFX::INFINITE_TIME."); - addField("numLoops", TypeS32, myOffset(n_loops), + addFieldV("numLoops", TypeRangedS32, myOffset(n_loops), &CommonValidators::NegDefaultInt, "Specifies the number of times the phrase-effect should loop. If set to infinity, " "the phrase-effect needs to have a phraseType of continuous. Set infinite looping " "using $AFX::INFINITE_REPEATS."); diff --git a/Engine/source/afx/ce/afxPhysicalZone.cpp b/Engine/source/afx/ce/afxPhysicalZone.cpp index e63759f4c..8bb0b5a7e 100644 --- a/Engine/source/afx/ce/afxPhysicalZone.cpp +++ b/Engine/source/afx/ce/afxPhysicalZone.cpp @@ -73,13 +73,15 @@ afxPhysicalZoneData::afxPhysicalZoneData(const afxPhysicalZoneData& other, bool #define myOffset(field) Offset(field, afxPhysicalZoneData) +FRangeValidator afxVelocityModRange(-40.0f, 40.0f); +FRangeValidator afxGravityModRange(-40.0f, 40.0f); void afxPhysicalZoneData::initPersistFields() { docsURL; - addField("velocityMod", TypeF32, myOffset(mVelocityMod), + addFieldV("velocityMod", TypeRangedF32, myOffset(mVelocityMod), &afxVelocityModRange, "A multiplier that biases the velocity of an object every tick it is within the " "zone."); - addField("gravityMod", TypeF32, myOffset(mGravityMod), + addFieldV("gravityMod", TypeRangedF32, myOffset(mGravityMod), &afxGravityModRange, "A multiplier that biases the influence of gravity on objects within the zone."); addField("appliedForce", TypePoint3F, myOffset(mAppliedForce), "A three-valued vector representing a directional force applied to objects withing " diff --git a/Engine/source/afx/ce/afxPlayerMovement.cpp b/Engine/source/afx/ce/afxPlayerMovement.cpp index 94327ea22..227276ba3 100644 --- a/Engine/source/afx/ce/afxPlayerMovement.cpp +++ b/Engine/source/afx/ce/afxPlayerMovement.cpp @@ -81,7 +81,7 @@ EndImplementEnumType; void afxPlayerMovementData::initPersistFields() { docsURL; - addField("speedBias", TypeF32, myOffset(speed_bias), + addFieldV("speedBias", TypeRangedF32, myOffset(speed_bias), &CommonValidators::F32Range, "A floating-point multiplier that scales the constraint Player's movement speed."); addField("movement", TypePoint3F, myOffset(movement), ""); diff --git a/Engine/source/afx/ce/afxPointLight_T3D.cpp b/Engine/source/afx/ce/afxPointLight_T3D.cpp index a44c4092d..25dc81fc7 100644 --- a/Engine/source/afx/ce/afxPointLight_T3D.cpp +++ b/Engine/source/afx/ce/afxPointLight_T3D.cpp @@ -65,7 +65,7 @@ void afxT3DPointLightData::initPersistFields() docsURL; addGroup( "Light" ); - addField( "radius", TypeF32, Offset( mRadius, afxT3DPointLightData ), + addFieldV( "radius", TypeRangedF32, Offset( mRadius, afxT3DPointLightData ), &CommonValidators::PositiveFloat, "Controls the falloff of the light emission"); endGroup( "Light" ); diff --git a/Engine/source/afx/ce/afxSpotLight_T3D.cpp b/Engine/source/afx/ce/afxSpotLight_T3D.cpp index d2c5009a4..6f88e1665 100644 --- a/Engine/source/afx/ce/afxSpotLight_T3D.cpp +++ b/Engine/source/afx/ce/afxSpotLight_T3D.cpp @@ -69,11 +69,11 @@ void afxT3DSpotLightData::initPersistFields() docsURL; addGroup( "Light" ); - addField( "range", TypeF32, Offset( mRange, afxT3DSpotLightData ), + addFieldV( "range", TypeRangedF32, Offset( mRange, afxT3DSpotLightData ), &CommonValidators::PositiveFloat, "..."); - addField( "innerAngle", TypeF32, Offset( mInnerConeAngle, afxT3DSpotLightData ), + addFieldV( "innerAngle", TypeRangedF32, Offset( mInnerConeAngle, afxT3DSpotLightData ), &CommonValidators::DegreeRangeQuarter, "..."); - addField( "outerAngle", TypeF32, Offset( mOuterConeAngle, afxT3DSpotLightData ), + addFieldV( "outerAngle", TypeRangedF32, Offset( mOuterConeAngle, afxT3DSpotLightData ), &CommonValidators::DegreeRangeQuarter, "..."); endGroup( "Light" ); diff --git a/Engine/source/afx/ce/afxZodiac.cpp b/Engine/source/afx/ce/afxZodiac.cpp index 43717ba04..70767b54c 100644 --- a/Engine/source/afx/ce/afxZodiac.cpp +++ b/Engine/source/afx/ce/afxZodiac.cpp @@ -158,7 +158,7 @@ void afxZodiacData::initPersistFields() { docsURL; INITPERSISTFIELD_IMAGEASSET(Texture, afxZodiacData, "An image to use as the zodiac's texture."); - addField("radius", TypeF32, Offset(radius_xy, afxZodiacData), + addFieldV("radius", TypeRangedF32, Offset(radius_xy, afxZodiacData), &CommonValidators::PositiveFloat, "The zodiac's radius in scene units."); addField("verticalRange", TypePoint2F, Offset(vert_range, afxZodiacData), "For interior zodiacs only, verticalRange specifies distances above and below the " @@ -167,18 +167,18 @@ void afxZodiacData::initPersistFields() "Specifies if the zodiac's verticalRange should scale according to changes in the " "radius. When a zodiacs is used as an expanding shockwave, this value should be set " "to false, otherwise the zodiac can expand to cover an entire interior."); - addField("startAngle", TypeF32, Offset(start_ang, afxZodiacData), + addFieldV("startAngle", TypeRangedF32, Offset(start_ang, afxZodiacData), &CommonValidators::DegreeRange, "The starting angle in degrees of the zodiac's rotation."); - addField("rotationRate", TypeF32, Offset(ang_per_sec, afxZodiacData), + addFieldV("rotationRate", TypeRangedF32, Offset(ang_per_sec, afxZodiacData), &CommonValidators::DegreeRange, "The rate of rotation in degrees-per-second. Zodiacs with a positive rotationRate " "rotate clockwise, while those with negative values turn counter-clockwise."); - addField("growInTime", TypeF32, Offset(grow_in_time, afxZodiacData), + addFieldV("growInTime", TypeRangedF32, Offset(grow_in_time, afxZodiacData), &CommonValidators::PositiveFloat, "A duration of time in seconds over which the zodiac grows from a zero size to its " "full size as specified by the radius."); - addField("shrinkOutTime", TypeF32, Offset(shrink_out_time, afxZodiacData), + addFieldV("shrinkOutTime", TypeRangedF32, Offset(shrink_out_time, afxZodiacData), &CommonValidators::PositiveFloat, "A duration of time in seconds over which the zodiac shrinks from full size to " "invisible."); - addField("growthRate", TypeF32, Offset(growth_rate, afxZodiacData), + addFieldV("growthRate", TypeRangedF32, Offset(growth_rate, afxZodiacData), &CommonValidators::F32Range, "A rate in meters-per-second at which the zodiac grows in size. A negative value will " "shrink the zodiac."); addField("color", TypeColorF, Offset(color, afxZodiacData), @@ -215,20 +215,20 @@ void afxZodiacData::initPersistFields() addField("interiorIgnoreTransparent", TypeBool, Offset(interior_transp_ignore, afxZodiacData), ""); - addField("altitudeMax", TypeF32, Offset(altitude_max, afxZodiacData), + addFieldV("altitudeMax", TypeRangedF32, Offset(altitude_max, afxZodiacData), &CommonValidators::F32Range, "The altitude at which zodiac becomes invisible as the result of fading out or " "becoming too small."); - addField("altitudeFalloff", TypeF32, Offset(altitude_falloff, afxZodiacData), + addFieldV("altitudeFalloff", TypeRangedF32, Offset(altitude_falloff, afxZodiacData), &CommonValidators::F32Range, "The altitude at which zodiac begins to fade and/or shrink."); addField("altitudeShrinks", TypeBool, Offset(altitude_shrinks, afxZodiacData), "When true, zodiac becomes smaller as altitude increases."); addField("altitudeFades", TypeBool, Offset(altitude_fades, afxZodiacData), "When true, zodiac fades out as altitude increases."); - addField("distanceMax", TypeF32, Offset(distance_max, afxZodiacData), + addFieldV("distanceMax", TypeRangedF32, Offset(distance_max, afxZodiacData), &CommonValidators::PositiveFloat, "The distance from camera at which the zodiac becomes invisible as the result of " "fading out."); - addField("distanceFalloff", TypeF32, Offset(distance_falloff, afxZodiacData), + addFieldV("distanceFalloff", TypeRangedF32, Offset(distance_falloff, afxZodiacData), &CommonValidators::PositiveFloat, "The distance from camera at which the zodiac begins to fade out."); addField("useGradientRange", TypeBool, Offset(use_grade_range, afxZodiacData), diff --git a/Engine/source/afx/ce/afxZodiacPlane.cpp b/Engine/source/afx/ce/afxZodiacPlane.cpp index be645c091..c4b525511 100644 --- a/Engine/source/afx/ce/afxZodiacPlane.cpp +++ b/Engine/source/afx/ce/afxZodiacPlane.cpp @@ -114,20 +114,20 @@ void afxZodiacPlaneData::initPersistFields() docsURL; INITPERSISTFIELD_IMAGEASSET(Texture, afxZodiacPlaneData, "An image to use as the zodiac's texture."); - addField("radius", TypeF32, myOffset(radius_xy), + addFieldV("radius", TypeRangedF32, myOffset(radius_xy), &CommonValidators::PositiveFloat, "The zodiac's radius in scene units."); - addField("startAngle", TypeF32, myOffset(start_ang), + addFieldV("startAngle", TypeRangedF32, myOffset(start_ang), &CommonValidators::DegreeRange, "The starting angle in degrees of the zodiac's rotation."); - addField("rotationRate", TypeF32, myOffset(ang_per_sec), + addFieldV("rotationRate", TypeRangedF32, myOffset(ang_per_sec), &CommonValidators::DegreeRange, "The rate of rotation in degrees-per-second. Zodiacs with a positive rotationRate " "rotate clockwise, while those with negative values turn counter-clockwise."); - addField("growInTime", TypeF32, myOffset(grow_in_time), + addFieldV("growInTime", TypeRangedF32, myOffset(grow_in_time), &CommonValidators::PositiveFloat, "A duration of time in seconds over which the zodiac grows from a zero size to its " "full size as specified by the radius."); - addField("shrinkOutTime", TypeF32, myOffset(shrink_out_time), + addFieldV("shrinkOutTime", TypeRangedF32, myOffset(shrink_out_time), &CommonValidators::PositiveFloat, "A duration of time in seconds over which the zodiac shrinks from full size to " "invisible."); - addField("growthRate", TypeF32, myOffset(growth_rate), + addFieldV("growthRate", TypeRangedF32, myOffset(growth_rate), &CommonValidators::F32Range, "A rate in meters-per-second at which the zodiac grows in size. A negative value will " "shrink the zodiac."); addField("color", TypeColorF, myOffset(color), diff --git a/Engine/source/afx/ea/afxEA_Zodiac.cpp b/Engine/source/afx/ea/afxEA_Zodiac.cpp index 8ce06780d..224df0f0c 100644 --- a/Engine/source/afx/ea/afxEA_Zodiac.cpp +++ b/Engine/source/afx/ea/afxEA_Zodiac.cpp @@ -399,7 +399,7 @@ void afxEA_Zodiac::initPersistFields() docsURL; addField("liveColor", TypeColorF, myOffset(live_color), "..."); - addField("liveColorFactor", TypeF32, myOffset(live_color_factor), + addFieldV("liveColorFactor", TypeRangedF32, myOffset(live_color_factor), &CommonValidators::PositiveFloat, "..."); Parent::initPersistFields(); diff --git a/Engine/source/afx/forces/afxF_Drag.cpp b/Engine/source/afx/forces/afxF_Drag.cpp index b6f6b6879..ac111b279 100644 --- a/Engine/source/afx/forces/afxF_Drag.cpp +++ b/Engine/source/afx/forces/afxF_Drag.cpp @@ -103,9 +103,9 @@ afxF_DragData::afxF_DragData(const afxF_DragData& other, bool temp_clone) : afxF void afxF_DragData::initPersistFields() { docsURL; - addField("drag", TypeF32, myOffset(drag_coefficient), + addFieldV("drag", TypeRangedF32, myOffset(drag_coefficient), &CommonValidators::PositiveNonZeroFloat, "..."); - addField("airDensity", TypeF32, myOffset(air_density), + addFieldV("airDensity", TypeRangedF32, myOffset(air_density), &CommonValidators::PositiveNonZeroFloat, "..."); addField("crossSectionalArea", TypeF32, myOffset(cross_sectional_area), "..."); diff --git a/Engine/source/afx/forces/afxF_Gravity.cpp b/Engine/source/afx/forces/afxF_Gravity.cpp index b7dc5c6a8..e87157dc8 100644 --- a/Engine/source/afx/forces/afxF_Gravity.cpp +++ b/Engine/source/afx/forces/afxF_Gravity.cpp @@ -95,7 +95,7 @@ afxF_GravityData::afxF_GravityData(const afxF_GravityData& other, bool temp_clon void afxF_GravityData::initPersistFields() { docsURL; - addField("gravity", TypeF32, myOffset(gravity), + addFieldV("gravity", TypeRangedF32, myOffset(gravity), &CommonValidators::F32Range, "..."); Parent::initPersistFields(); diff --git a/Engine/source/afx/rpg/afxRPGMagicSpell.cpp b/Engine/source/afx/rpg/afxRPGMagicSpell.cpp index fe9f6578a..8bc150ab0 100644 --- a/Engine/source/afx/rpg/afxRPGMagicSpell.cpp +++ b/Engine/source/afx/rpg/afxRPGMagicSpell.cpp @@ -91,9 +91,9 @@ void afxRPGMagicSpellData::initPersistFields() addField("target", TYPEID< afxRPGMagicSpellData::TargetType >(), myOffset(spell_target), "..."); - addField("range", TypeF32, myOffset(spell_range), + addFieldV("range", TypeRangedF32, myOffset(spell_range), &CommonValidators::PositiveFloat, "..."); - addField("manaCost", TypeS32, myOffset(mana_cost), + addFieldV("manaCost", TypeRangedS32, myOffset(mana_cost), &CommonValidators::PositiveInt, "..."); addField("reagentCost", TypeS8, myOffset(reagent_cost), MAX_REAGENTS_PER_SPELL, "..."); @@ -101,7 +101,7 @@ void afxRPGMagicSpellData::initPersistFields() "..."); // spell phase timing - addField("castingDur", TypeF32, myOffset(casting_dur)); + addFieldV("castingDur", TypeRangedF32, myOffset(casting_dur), &CommonValidators::PositiveFloat); // interface elements addField("iconBitmap", TypeFilename, myOffset(icon_name)); diff --git a/Engine/source/afx/ui/afxGuiTextHud.cpp b/Engine/source/afx/ui/afxGuiTextHud.cpp index 46cbfc1a2..d4aeb7fb4 100644 --- a/Engine/source/afx/ui/afxGuiTextHud.cpp +++ b/Engine/source/afx/ui/afxGuiTextHud.cpp @@ -75,9 +75,9 @@ void afxGuiTextHud::initPersistFields() "..."); addField( "showFrame", TypeBool, Offset( mShowFrame, afxGuiTextHud ), "..."); - addField( "verticalOffset", TypeF32, Offset( mVerticalOffset, afxGuiTextHud ), + addFieldV( "verticalOffset", TypeRangedF32, Offset( mVerticalOffset, afxGuiTextHud ), &CommonValidators::F32Range, "..."); - addField( "distanceFade", TypeF32, Offset( mDistanceFade, afxGuiTextHud ), + addFieldV( "distanceFade", TypeRangedF32, Offset( mDistanceFade, afxGuiTextHud ), &CommonValidators::PositiveFloat, "..."); addField( "labelAllShapes", TypeBool, Offset( mLabelAllShapes, afxGuiTextHud ), "..."); diff --git a/Engine/source/afx/util/afxParticlePool.cpp b/Engine/source/afx/util/afxParticlePool.cpp index 6fe71a658..11349c2a8 100644 --- a/Engine/source/afx/util/afxParticlePool.cpp +++ b/Engine/source/afx/util/afxParticlePool.cpp @@ -75,7 +75,7 @@ void afxParticlePoolData::initPersistFields() "..."); addField("baseColor", TypeColorF, Offset(base_color, afxParticlePoolData), "..."); - addField("blendWeight", TypeF32, Offset(blend_weight, afxParticlePoolData), + addFieldV("blendWeight", TypeRangedF32, Offset(blend_weight, afxParticlePoolData), &CommonValidators::PositiveFloat, "..."); Parent::initPersistFields(); diff --git a/Engine/source/afx/util/afxPath.cpp b/Engine/source/afx/util/afxPath.cpp index cc1843333..4133a070d 100644 --- a/Engine/source/afx/util/afxPath.cpp +++ b/Engine/source/afx/util/afxPath.cpp @@ -151,13 +151,13 @@ void afxPathData::initPersistFields() "..."); addField("loop", TypeString, Offset(loop_string, afxPathData), "..."); - addField("mult", TypeF32, Offset(mult, afxPathData), + addFieldV("mult", TypeRangedF32, Offset(mult, afxPathData), &CommonValidators::F32Range, "..."); - addField("delay", TypeF32, Offset(delay, afxPathData), + addFieldV("delay", TypeRangedF32, Offset(delay, afxPathData), &CommonValidators::PositiveFloat, "..."); - addField("lifetime", TypeF32, Offset(lifetime, afxPathData), + addFieldV("lifetime", TypeRangedF32, Offset(lifetime, afxPathData), &CommonValidators::PositiveFloat, "..."); - addField("timeOffset", TypeF32, Offset(time_offset, afxPathData), + addFieldV("timeOffset", TypeRangedF32, Offset(time_offset, afxPathData), &CommonValidators::F32Range, "..."); addField("reverse", TypeBool, Offset(reverse, afxPathData), "..."); diff --git a/Engine/source/afx/xm/afxXM_AltitudeConform.cpp b/Engine/source/afx/xm/afxXM_AltitudeConform.cpp index cf5c52015..c9971873e 100644 --- a/Engine/source/afx/xm/afxXM_AltitudeConform.cpp +++ b/Engine/source/afx/xm/afxXM_AltitudeConform.cpp @@ -109,7 +109,7 @@ afxXM_AltitudeConformData::afxXM_AltitudeConformData(const afxXM_AltitudeConform void afxXM_AltitudeConformData::initPersistFields() { docsURL; - addField("height", TypeF32, Offset(height, afxXM_AltitudeConformData), + addFieldV("height", TypeRangedF32, Offset(height, afxXM_AltitudeConformData), &CommonValidators::F32Range, "..."); addField("conformToTerrain", TypeBool, Offset(do_terrain, afxXM_AltitudeConformData), "..."); diff --git a/Engine/source/afx/xm/afxXM_BoxAdapt.cpp b/Engine/source/afx/xm/afxXM_BoxAdapt.cpp index e057fab20..d1c3a109c 100644 --- a/Engine/source/afx/xm/afxXM_BoxAdapt.cpp +++ b/Engine/source/afx/xm/afxXM_BoxAdapt.cpp @@ -99,7 +99,7 @@ afxXM_BoxAdaptData::afxXM_BoxAdaptData(const afxXM_BoxAdaptData& other, bool tem void afxXM_BoxAdaptData::initPersistFields() { docsURL; - addField("scaleFactor", TypeF32, Offset(scale_factor, afxXM_BoxAdaptData), + addFieldV("scaleFactor", TypeRangedF32, Offset(scale_factor, afxXM_BoxAdaptData), &CommonValidators::PositiveFloat, "..."); addField("dimensionRange", TypePoint2F, Offset(dim_range, afxXM_BoxAdaptData), "..."); diff --git a/Engine/source/afx/xm/afxXM_Freeze.cpp b/Engine/source/afx/xm/afxXM_Freeze.cpp index 0a5841b16..db485b82b 100644 --- a/Engine/source/afx/xm/afxXM_Freeze.cpp +++ b/Engine/source/afx/xm/afxXM_Freeze.cpp @@ -163,7 +163,7 @@ void afxXM_FreezeData::initPersistFields() docsURL; addField("mask", TypeS32, Offset(mask, afxXM_FreezeData), "..."); - addField("delay", TypeF32, Offset(delay, afxXM_FreezeData), + addFieldV("delay", TypeRangedF32, Offset(delay, afxXM_FreezeData), &CommonValidators::PositiveFloat, "..."); Parent::initPersistFields(); diff --git a/Engine/source/afx/xm/afxXM_GroundConform.cpp b/Engine/source/afx/xm/afxXM_GroundConform.cpp index e661f70ca..7a067bfc7 100644 --- a/Engine/source/afx/xm/afxXM_GroundConform.cpp +++ b/Engine/source/afx/xm/afxXM_GroundConform.cpp @@ -101,7 +101,7 @@ afxXM_GroundConformData::afxXM_GroundConformData(const afxXM_GroundConformData& void afxXM_GroundConformData::initPersistFields() { docsURL; - addField("height", TypeF32, Offset(height, afxXM_GroundConformData), + addFieldV("height", TypeRangedF32, Offset(height, afxXM_GroundConformData), &CommonValidators::F32Range, "..."); addField("conformToTerrain", TypeBool, Offset(do_terrain, afxXM_GroundConformData), "..."); diff --git a/Engine/source/afx/xm/afxXM_Oscillate.cpp b/Engine/source/afx/xm/afxXM_Oscillate.cpp index 62af9492f..d1ee0add1 100644 --- a/Engine/source/afx/xm/afxXM_Oscillate.cpp +++ b/Engine/source/afx/xm/afxXM_Oscillate.cpp @@ -166,7 +166,7 @@ void afxXM_OscillateData::initPersistFields() "..."); addField("max", TypePoint3F, Offset(max, afxXM_OscillateData), "..."); - addField("speed", TypeF32, Offset(speed, afxXM_OscillateData), + addFieldV("speed", TypeRangedF32, Offset(speed, afxXM_OscillateData), &CommonValidators::PositiveFloat, "..."); addField("axis", TypePoint3F, Offset(axis, afxXM_OscillateData), "..."); diff --git a/Engine/source/afx/xm/afxXM_OscillateZodiacColor.cpp b/Engine/source/afx/xm/afxXM_OscillateZodiacColor.cpp index fd08eb953..539ed689d 100644 --- a/Engine/source/afx/xm/afxXM_OscillateZodiacColor.cpp +++ b/Engine/source/afx/xm/afxXM_OscillateZodiacColor.cpp @@ -94,7 +94,7 @@ void afxXM_OscillateZodiacColorData::initPersistFields() "..."); addField("colorB", TypeColorF, Offset(color_b, afxXM_OscillateZodiacColorData), "..."); - addField("speed", TypeF32, Offset(speed, afxXM_OscillateZodiacColorData), + addFieldV("speed", TypeRangedF32, Offset(speed, afxXM_OscillateZodiacColorData), &CommonValidators::PositiveFloat, "..."); Parent::initPersistFields(); diff --git a/Engine/source/afx/xm/afxXM_RandomRot.cpp b/Engine/source/afx/xm/afxXM_RandomRot.cpp index 7ea3217cd..5725b3ab6 100644 --- a/Engine/source/afx/xm/afxXM_RandomRot.cpp +++ b/Engine/source/afx/xm/afxXM_RandomRot.cpp @@ -109,13 +109,13 @@ void afxXM_RandomRotData::initPersistFields() docsURL; addField("axis", TypePoint3F, Offset(axis, afxXM_RandomRotData), "..."); - addField("thetaMin", TypeF32, Offset(theta_min, afxXM_RandomRotData), + addFieldV("thetaMin", TypeRangedF32, Offset(theta_min, afxXM_RandomRotData), &CommonValidators::PosDegreeRangeHalf, "..."); - addField("thetaMax", TypeF32, Offset(theta_max, afxXM_RandomRotData), + addFieldV("thetaMax", TypeRangedF32, Offset(theta_max, afxXM_RandomRotData), &CommonValidators::PosDegreeRangeHalf, "..."); - addField("phiMin", TypeF32, Offset(phi_min, afxXM_RandomRotData), + addFieldV("phiMin", TypeRangedF32, Offset(phi_min, afxXM_RandomRotData), &CommonValidators::PosDegreeRange, "..."); - addField("phiMax", TypeF32, Offset(phi_max, afxXM_RandomRotData), + addFieldV("phiMax", TypeRangedF32, Offset(phi_max, afxXM_RandomRotData), &CommonValidators::PosDegreeRange, "..."); Parent::initPersistFields(); diff --git a/Engine/source/afx/xm/afxXM_Shockwave.cpp b/Engine/source/afx/xm/afxXM_Shockwave.cpp index 27c632df0..dabbb8b0f 100644 --- a/Engine/source/afx/xm/afxXM_Shockwave.cpp +++ b/Engine/source/afx/xm/afxXM_Shockwave.cpp @@ -103,7 +103,7 @@ afxXM_ShockwaveData::afxXM_ShockwaveData(const afxXM_ShockwaveData& other, bool void afxXM_ShockwaveData::initPersistFields() { docsURL; - addField("rate", TypeF32, Offset(rate, afxXM_ShockwaveData), + addFieldV("rate", TypeRangedF32, Offset(rate, afxXM_ShockwaveData), &CommonValidators::PositiveFloat, "..."); addField("aimZOnly", TypeBool, Offset(aim_z_only, afxXM_ShockwaveData), "..."); diff --git a/Engine/source/afx/xm/afxXM_Spin.cpp b/Engine/source/afx/xm/afxXM_Spin.cpp index 2fffa6c5a..46ebba2f3 100644 --- a/Engine/source/afx/xm/afxXM_Spin.cpp +++ b/Engine/source/afx/xm/afxXM_Spin.cpp @@ -122,13 +122,13 @@ void afxXM_SpinData::initPersistFields() docsURL; addField("spinAxis", TypePoint3F, Offset(spin_axis, afxXM_SpinData), "..."); - addField("spinAngle", TypeF32, Offset(spin_angle, afxXM_SpinData), + addFieldV("spinAngle", TypeRangedF32, Offset(spin_angle, afxXM_SpinData), &CommonValidators::DegreeRange, "..."); - addField("spinAngleVariance", TypeF32, Offset(spin_angle_var, afxXM_SpinData), + addFieldV("spinAngleVariance", TypeRangedF32, Offset(spin_angle_var, afxXM_SpinData), &CommonValidators::DegreeRange, "..."); - addField("spinRate", TypeF32, Offset(spin_rate, afxXM_SpinData), + addFieldV("spinRate", TypeRangedF32, Offset(spin_rate, afxXM_SpinData), &CommonValidators::DegreeRange, "..."); - addField("spinRateVariance", TypeF32, Offset(spin_rate_var, afxXM_SpinData), + addFieldV("spinRateVariance", TypeRangedF32, Offset(spin_rate_var, afxXM_SpinData), &CommonValidators::DegreeRange, "..."); Parent::initPersistFields(); diff --git a/Engine/source/afx/xm/afxXM_VelocityOffset.cpp b/Engine/source/afx/xm/afxXM_VelocityOffset.cpp index 2c9e97eb4..95fd5acb5 100644 --- a/Engine/source/afx/xm/afxXM_VelocityOffset.cpp +++ b/Engine/source/afx/xm/afxXM_VelocityOffset.cpp @@ -166,7 +166,7 @@ afxXM_VelocityOffsetData::afxXM_VelocityOffsetData(const afxXM_VelocityOffsetDat void afxXM_VelocityOffsetData::initPersistFields() { docsURL; - addField("offsetFactor", TypeF32, Offset(offset_factor, afxXM_VelocityOffsetData), + addFieldV("offsetFactor", TypeRangedF32, Offset(offset_factor, afxXM_VelocityOffsetData), &CommonValidators::F32Range, "..."); addField("offsetPos2", TypeBool, Offset(offset_pos2, afxXM_VelocityOffsetData), "..."); diff --git a/Engine/source/afx/xm/afxXM_WaveBase.cpp b/Engine/source/afx/xm/afxXM_WaveBase.cpp index 036bc3a56..2f092f3f2 100644 --- a/Engine/source/afx/xm/afxXM_WaveBase.cpp +++ b/Engine/source/afx/xm/afxXM_WaveBase.cpp @@ -151,28 +151,28 @@ void afxXM_WaveBaseData::initPersistFields() addField("op", TYPEID< afxXM_WaveBaseData::WaveOpType >(), Offset(op, afxXM_WaveBaseData), "..."); - addField("speed", TypeF32, Offset(speed, afxXM_WaveBaseData), + addFieldV("speed", TypeRangedF32, Offset(speed, afxXM_WaveBaseData), &CommonValidators::PositiveFloat, "waves per second"); - addField("speedVariance", TypeF32, Offset(speed_vari, afxXM_WaveBaseData), + addFieldV("speedVariance", TypeRangedF32, Offset(speed_vari, afxXM_WaveBaseData), &CommonValidators::PositiveFloat, "..."); - addField("acceleration", TypeF32, Offset(accel, afxXM_WaveBaseData), + addFieldV("acceleration", TypeRangedF32, Offset(accel, afxXM_WaveBaseData), &CommonValidators::PositiveFloat, "..."); - addField("phaseShift", TypeF32, Offset(phase_shift, afxXM_WaveBaseData), + addFieldV("phaseShift", TypeRangedF32, Offset(phase_shift, afxXM_WaveBaseData), &CommonValidators::PositiveFloat, "..."); - addField("dutyCycle", TypeF32, Offset(duty_cycle, afxXM_WaveBaseData), + addFieldV("dutyCycle", TypeRangedF32, Offset(duty_cycle, afxXM_WaveBaseData), &CommonValidators::PositiveFloat, "..."); - addField("dutyShift", TypeF32, Offset(duty_shift, afxXM_WaveBaseData), + addFieldV("dutyShift", TypeRangedF32, Offset(duty_shift, afxXM_WaveBaseData), &CommonValidators::PositiveFloat, "..."); - addField("offDutyT", TypeF32, Offset(off_duty_t, afxXM_WaveBaseData), + addFieldV("offDutyT", TypeRangedF32, Offset(off_duty_t, afxXM_WaveBaseData), &CommonValidators::PositiveFloat, "..."); addField("wavesPerPulse", TypeByteRange2, Offset(waves_per_pulse, afxXM_WaveBaseData), "..."); addField("wavesPerRest", TypeByteRange2, Offset(waves_per_rest, afxXM_WaveBaseData), "..."); - addField("restDuration", TypeF32, Offset(rest_dur, afxXM_WaveBaseData), + addFieldV("restDuration", TypeRangedF32, Offset(rest_dur, afxXM_WaveBaseData), &CommonValidators::PositiveFloat, "..."); - addField("restDurationVariance", TypeF32, Offset(rest_dur_vari, afxXM_WaveBaseData), + addFieldV("restDurationVariance", TypeRangedF32, Offset(rest_dur_vari, afxXM_WaveBaseData), &CommonValidators::PositiveFloat, "..."); addField("axis", TypePoint3F, Offset(axis, afxXM_WaveBaseData), diff --git a/Engine/source/afx/xm/afxXfmMod.cpp b/Engine/source/afx/xm/afxXfmMod.cpp index 76f457b8c..d6a4bc692 100644 --- a/Engine/source/afx/xm/afxXfmMod.cpp +++ b/Engine/source/afx/xm/afxXfmMod.cpp @@ -215,19 +215,19 @@ F32 afxXM_WeightedBaseData::getWeightFactor() const void afxXM_WeightedBaseData::initPersistFields() { docsURL; - addField("delay", TypeF32, Offset(delay, afxXM_WeightedBaseData), + addFieldV("delay", TypeRangedF32, Offset(delay, afxXM_WeightedBaseData), &CommonValidators::PositiveFloat, "..."); - addField("lifetime", TypeF32, Offset(lifetime, afxXM_WeightedBaseData), + addFieldV("lifetime", TypeRangedF32, Offset(lifetime, afxXM_WeightedBaseData), &CommonValidators::PositiveFloat, "..."); - addField("fadeInTime", TypeF32, Offset(fade_in_time, afxXM_WeightedBaseData), + addFieldV("fadeInTime", TypeRangedF32, Offset(fade_in_time, afxXM_WeightedBaseData), &CommonValidators::PositiveFloat, "..."); - addField("fadeOutTime", TypeF32, Offset(fade_out_time, afxXM_WeightedBaseData), + addFieldV("fadeOutTime", TypeRangedF32, Offset(fade_out_time, afxXM_WeightedBaseData), &CommonValidators::PositiveFloat, "..."); addField("fadeInEase", TypePoint2F, Offset(fadein_ease, afxXM_WeightedBaseData), "..."); addField("fadeOutEase", TypePoint2F, Offset(fadeout_ease, afxXM_WeightedBaseData), "..."); - addField("lifetimeBias", TypeF32, Offset(life_bias, afxXM_WeightedBaseData), + addFieldV("lifetimeBias", TypeRangedF32, Offset(life_bias, afxXM_WeightedBaseData), &CommonValidators::F32Range, "..."); Parent::initPersistFields(); diff --git a/Engine/source/environment/VolumetricFog.cpp b/Engine/source/environment/VolumetricFog.cpp index a4065c8ad..1d3593b2b 100644 --- a/Engine/source/environment/VolumetricFog.cpp +++ b/Engine/source/environment/VolumetricFog.cpp @@ -174,22 +174,22 @@ void VolumetricFog::initPersistFields() addGroup("VolumetricFogData"); addField("FogColor", TypeColorI, Offset(mFogColor, VolumetricFog), "Fog color RGBA (Alpha is ignored)"); - addField("FogDensity", TypeF32, Offset(mFogDensity, VolumetricFog), + addFieldV("FogDensity", TypeRangedF32, Offset(mFogDensity, VolumetricFog), &CommonValidators::PositiveFloat, "Overal fog density value (0 disables the fog)."); addField("IgnoreWater", TypeBool, Offset(mIgnoreWater, VolumetricFog), "Set to true if volumetric fog should continue while submerged."); - addField("MinSize", TypeF32, Offset(mMinDisplaySize, VolumetricFog), + addFieldV("MinSize", TypeRangedF32, Offset(mMinDisplaySize, VolumetricFog), &CommonValidators::PositiveFloat, "Min size (in pixels) for fog to be rendered."); - addField("FadeSize", TypeF32, Offset(mFadeSize, VolumetricFog), + addFieldV("FadeSize", TypeRangedF32, Offset(mFadeSize, VolumetricFog), &CommonValidators::PositiveFloat, "Object size in pixels at which the FX-fading kicks in (0 disables fading)."); endGroup("VolumetricFogData"); addGroup("VolumetricFogModulation"); INITPERSISTFIELD_IMAGEASSET(Texture, VolumetricFog, "A texture which contains Fogdensity modulator in the red channel and color with 1-green channel. No texture disables modulation."); - addField("tiles", TypeF32, Offset(mTexTiles, VolumetricFog), + addFieldV("tiles", TypeRangedF32, Offset(mTexTiles, VolumetricFog), &CommonValidators::PositiveFloat, "How many times the texture is mapped to the object."); - addField("modStrength", TypeF32, Offset(mStrength, VolumetricFog), + addFieldV("modStrength", TypeRangedF32, Offset(mStrength, VolumetricFog), &CommonValidators::PositiveFloat, "Overall strength of the density modulation (0 disables modulation)."); addField("PrimSpeed", TypePoint2F, Offset(mSpeed1, VolumetricFog), "Overall primary speed of the density modulation (x-speed(u) y-speed(v))"); @@ -200,18 +200,18 @@ void VolumetricFog::initPersistFields() addGroup("Reflections"); addField("Reflectable", TypeBool, Offset(mReflect, VolumetricFog), "Set to true if volumetric fog should be reflected."); - addField("ReflectStrength", TypeF32, Offset(mFogReflStrength, VolumetricFog), + addFieldV("ReflectStrength", TypeRangedF32, Offset(mFogReflStrength, VolumetricFog), &CommonValidators::NormalizedFloat, "Strength of the reflections (0 disables the fog)."); endGroup("Reflections"); addGroup("PostFX"); addField("useGlow", TypeBool, Offset(mUseGlow, VolumetricFog), "Set to true if volumetric fog should use glow PostFX."); - addField("glowStrength", TypeF32, Offset(mGlowStrength, VolumetricFog), + addFieldV("glowStrength", TypeRangedF32, Offset(mGlowStrength, VolumetricFog), &CommonValidators::PositiveFloat, "Overall strength of the glow PostFX."); addField("modLightRay", TypeBool, Offset(mModifLightRays, VolumetricFog), "Set to true if volumetric fog should modify the brightness of the Lightrays."); - addField("lightRayMod", TypeF32, Offset(mLightRayMod, VolumetricFog), + addFieldV("lightRayMod", TypeRangedF32, Offset(mLightRayMod, VolumetricFog), &CommonValidators::PositiveFloat, "Modifier for LightRay PostFX when inside Fog."); endGroup("PostFX"); } diff --git a/Engine/source/environment/basicClouds.cpp b/Engine/source/environment/basicClouds.cpp index b4b7a9765..755486a03 100644 --- a/Engine/source/environment/basicClouds.cpp +++ b/Engine/source/environment/basicClouds.cpp @@ -179,19 +179,19 @@ void BasicClouds::initPersistFields() INITPERSISTFIELD_IMAGEASSET_ARRAY(Texture, TEX_COUNT, BasicClouds, "Texture for this layer."); - addField( "texScale", TypeF32, Offset( mTexScale, BasicClouds ), TEX_COUNT, + addFieldV( "texScale", TypeRangedF32, Offset( mTexScale, BasicClouds ), &CommonValidators::PositiveFloat, TEX_COUNT, "Texture repeat for this layer." ); addField( "texDirection", TypePoint2F, Offset( mTexDirection, BasicClouds ), TEX_COUNT, "Texture scroll direction for this layer, relative to the world axis." ); - addField( "texSpeed", TypeF32, Offset( mTexSpeed, BasicClouds ), TEX_COUNT, + addFieldV( "texSpeed", TypeRangedF32, Offset( mTexSpeed, BasicClouds ), &CommonValidators::PositiveFloat, TEX_COUNT, "Texture scroll speed for this layer." ); addField( "texOffset", TypePoint2F, Offset( mTexOffset, BasicClouds ), TEX_COUNT, "UV offset for this layer." ); - addField( "height", TypeF32, Offset( mHeight, BasicClouds ), TEX_COUNT, + addFieldV( "height", TypeRangedF32, Offset( mHeight, BasicClouds ), &CommonValidators::F32Range, TEX_COUNT, "Abstract number which controls the curvature and height of the dome mesh" ); endArray( "Layers" ); diff --git a/Engine/source/environment/cloudLayer.cpp b/Engine/source/environment/cloudLayer.cpp index d6de0c055..fe71d9f68 100644 --- a/Engine/source/environment/cloudLayer.cpp +++ b/Engine/source/environment/cloudLayer.cpp @@ -198,13 +198,13 @@ void CloudLayer::initPersistFields() addArray( "Textures", TEX_COUNT ); - addField( "texScale", TypeF32, Offset( mTexScale, CloudLayer ), TEX_COUNT, + addFieldV( "texScale", TypeRangedF32, Offset( mTexScale, CloudLayer ), &CommonValidators::PositiveFloat, TEX_COUNT, "Controls the texture repeat of this slot." ); addField( "texDirection", TypePoint2F, Offset( mTexDirection, CloudLayer ), TEX_COUNT, "Controls the direction this slot scrolls." ); - addField( "texSpeed", TypeF32, Offset( mTexSpeed, CloudLayer ), TEX_COUNT, + addFieldV( "texSpeed", TypeRangedF32, Offset( mTexSpeed, CloudLayer ), &CommonValidators::PositiveFloat, TEX_COUNT, "Controls the speed this slot scrolls." ); endArray( "Textures" ); @@ -212,16 +212,16 @@ void CloudLayer::initPersistFields() addField( "baseColor", TypeColorF, Offset( mBaseColor, CloudLayer ), "Base cloud color before lighting." ); - addField( "exposure", TypeF32, Offset( mExposure, CloudLayer ), + addFieldV( "exposure", TypeRangedF32, Offset( mExposure, CloudLayer ), &CommonValidators::PositiveFloat, "Brightness scale so CloudLayer can be overblown if desired." ); - addField( "coverage", TypeF32, Offset( mCoverage, CloudLayer ), + addFieldV( "coverage", TypeRangedF32, Offset( mCoverage, CloudLayer ), &CommonValidators::NormalizedFloat, "Fraction of sky covered by clouds 0-1." ); - addField( "windSpeed", TypeF32, Offset( mWindSpeed, CloudLayer ), + addFieldV( "windSpeed", TypeRangedF32, Offset( mWindSpeed, CloudLayer ), &CommonValidators::NormalizedFloat, "Overall scalar to texture scroll speed." ); - addField( "height", TypeF32, Offset( mHeight, CloudLayer ), + addFieldV( "height", TypeRangedF32, Offset( mHeight, CloudLayer ), &CommonValidators::F32Range, "Abstract number which controls the curvature and height of the dome mesh." ); endGroup( "CloudLayer" ); diff --git a/Engine/source/environment/decalRoad.cpp b/Engine/source/environment/decalRoad.cpp index 23e607f88..d11a02344 100644 --- a/Engine/source/environment/decalRoad.cpp +++ b/Engine/source/environment/decalRoad.cpp @@ -40,6 +40,7 @@ #include "materials/baseMatInstance.h" #include "environment/nodeListManager.h" #include "lighting/lightQuery.h" +#include "console/typeValidators.h" extern F32 gDecalBias; @@ -300,7 +301,7 @@ IMPLEMENT_CO_NETOBJECT_V1(DecalRoad); // ConsoleObject - +FRangeValidator drTextureLengthV(0.1f,FLT_MAX); void DecalRoad::initPersistFields() { docsURL; @@ -308,10 +309,10 @@ void DecalRoad::initPersistFields() INITPERSISTFIELD_MATERIALASSET(Material, DecalRoad, "Material used for rendering."); - addProtectedField( "textureLength", TypeF32, Offset( mTextureLength, DecalRoad ), &DecalRoad::ptSetTextureLength, &defaultProtectedGetFn, + addProtectedFieldV("textureLength", TypeRangedF32, Offset(mTextureLength, DecalRoad), &DecalRoad::ptSetTextureLength, &defaultProtectedGetFn, &drTextureLengthV, "The length in meters of textures mapped to the DecalRoad" ); - addProtectedField( "breakAngle", TypeF32, Offset( mBreakAngle, DecalRoad ), &DecalRoad::ptSetBreakAngle, &defaultProtectedGetFn, + addProtectedFieldV( "breakAngle", TypeF32, Offset( mBreakAngle, DecalRoad ), &DecalRoad::ptSetBreakAngle, &defaultProtectedGetFn, &CommonValidators::PosDegreeRange, "Angle in degrees - DecalRoad will subdivided the spline if its curve is greater than this threshold." ); addField( "renderPriority", TypeS32, Offset( mRenderPriority, DecalRoad ), diff --git a/Engine/source/environment/editors/guiMeshRoadEditorCtrl.cpp b/Engine/source/environment/editors/guiMeshRoadEditorCtrl.cpp index 16e6bcd8c..d6195cabc 100644 --- a/Engine/source/environment/editors/guiMeshRoadEditorCtrl.cpp +++ b/Engine/source/environment/editors/guiMeshRoadEditorCtrl.cpp @@ -215,8 +215,8 @@ bool GuiMeshRoadEditorCtrl::onAdd() void GuiMeshRoadEditorCtrl::initPersistFields() { docsURL; - addField( "DefaultWidth", TypeF32, Offset( mDefaultWidth, GuiMeshRoadEditorCtrl ) ); - addField( "DefaultDepth", TypeF32, Offset( mDefaultDepth, GuiMeshRoadEditorCtrl ) ); + addFieldV( "DefaultWidth", TypeRangedF32, Offset( mDefaultWidth, GuiMeshRoadEditorCtrl ), &CommonValidators::PositiveFloat); + addFieldV( "DefaultDepth", TypeRangedF32, Offset( mDefaultDepth, GuiMeshRoadEditorCtrl ), &CommonValidators::PositiveFloat); addField( "DefaultNormal", TypePoint3F,Offset( mDefaultNormal, GuiMeshRoadEditorCtrl ) ); addField( "HoverSplineColor", TypeColorI, Offset( mHoverSplineColor, GuiMeshRoadEditorCtrl ) ); addField( "SelectedSplineColor", TypeColorI, Offset( mSelectedSplineColor, GuiMeshRoadEditorCtrl ) ); diff --git a/Engine/source/environment/editors/guiRiverEditorCtrl.cpp b/Engine/source/environment/editors/guiRiverEditorCtrl.cpp index 8dc21ef1b..f1d2a75c4 100644 --- a/Engine/source/environment/editors/guiRiverEditorCtrl.cpp +++ b/Engine/source/environment/editors/guiRiverEditorCtrl.cpp @@ -169,8 +169,8 @@ bool GuiRiverEditorCtrl::onAdd() void GuiRiverEditorCtrl::initPersistFields() { docsURL; - addField( "DefaultWidth", TypeF32, Offset( mDefaultWidth, GuiRiverEditorCtrl ) ); - addField( "DefaultDepth", TypeF32, Offset( mDefaultDepth, GuiRiverEditorCtrl ) ); + addFieldV( "DefaultWidth", TypeRangedF32, Offset( mDefaultWidth, GuiRiverEditorCtrl ), &CommonValidators::PositiveFloat); + addFieldV( "DefaultDepth", TypeRangedF32, Offset( mDefaultDepth, GuiRiverEditorCtrl ), &CommonValidators::PositiveFloat); addField( "DefaultNormal", TypePoint3F,Offset( mDefaultNormal, GuiRiverEditorCtrl ) ); addField( "HoverSplineColor", TypeColorI, Offset( mHoverSplineColor, GuiRiverEditorCtrl ) ); addField( "SelectedSplineColor", TypeColorI, Offset( mSelectedSplineColor, GuiRiverEditorCtrl ) ); diff --git a/Engine/source/environment/editors/guiRoadEditorCtrl.cpp b/Engine/source/environment/editors/guiRoadEditorCtrl.cpp index a644bc9d3..37ecb3f4d 100644 --- a/Engine/source/environment/editors/guiRoadEditorCtrl.cpp +++ b/Engine/source/environment/editors/guiRoadEditorCtrl.cpp @@ -159,7 +159,7 @@ bool GuiRoadEditorCtrl::onAdd() void GuiRoadEditorCtrl::initPersistFields() { docsURL; - addField( "DefaultWidth", TypeF32, Offset( mDefaultWidth, GuiRoadEditorCtrl ) ); + addFieldV( "DefaultWidth", TypeRangedF32, Offset( mDefaultWidth, GuiRoadEditorCtrl ), &CommonValidators::PositiveFloat); addField( "HoverSplineColor", TypeColorI, Offset( mHoverSplineColor, GuiRoadEditorCtrl ) ); addField( "SelectedSplineColor", TypeColorI, Offset( mSelectedSplineColor, GuiRoadEditorCtrl ) ); addField( "HoverNodeColor", TypeColorI, Offset( mHoverNodeColor, GuiRoadEditorCtrl ) ); diff --git a/Engine/source/environment/meshRoad.cpp b/Engine/source/environment/meshRoad.cpp index 39100e632..8dfdd67e9 100644 --- a/Engine/source/environment/meshRoad.cpp +++ b/Engine/source/environment/meshRoad.cpp @@ -933,6 +933,7 @@ MeshRoad::~MeshRoad() mConvexList = NULL; } +FRangeValidator mrTextureLengthV(0.1f, FLT_MAX); void MeshRoad::initPersistFields() { docsURL; @@ -942,13 +943,13 @@ void MeshRoad::initPersistFields() INITPERSISTFIELD_MATERIALASSET(BottomMaterial, MeshRoad, "Material for the bottom surface of the road."); INITPERSISTFIELD_MATERIALASSET(SideMaterial, MeshRoad, "Material for the side surface of the road."); - addField( "textureLength", TypeF32, Offset( mTextureLength, MeshRoad ), + addFieldV( "textureLength", TypeRangedF32, Offset( mTextureLength, MeshRoad ), &mrTextureLengthV, "The length in meters of textures mapped to the MeshRoad." ); - addField( "breakAngle", TypeF32, Offset( mBreakAngle, MeshRoad ), + addFieldV( "breakAngle", TypeRangedF32, Offset( mBreakAngle, MeshRoad ), &CommonValidators::PosDegreeRange, "Angle in degrees - MeshRoad will subdivide the spline if its curve is greater than this threshold." ); - addField( "widthSubdivisions", TypeS32, Offset( mWidthSubdivisions, MeshRoad ), + addFieldV( "widthSubdivisions", TypeRangedS32, Offset( mWidthSubdivisions, MeshRoad ), &CommonValidators::PositiveInt, "Subdivide segments widthwise this many times when generating vertices." ); endGroup( "MeshRoad" ); diff --git a/Engine/source/environment/river.cpp b/Engine/source/environment/river.cpp index 98088f737..13e8088e8 100644 --- a/Engine/source/environment/river.cpp +++ b/Engine/source/environment/river.cpp @@ -624,23 +624,26 @@ River::~River() { } + +FRangeValidator riverSegRange(MIN_METERS_PER_SEGMENT, FLT_MAX); + void River::initPersistFields() { docsURL; addGroup( "River" ); - addField( "SegmentLength", TypeF32, Offset( mMetersPerSegment, River ), + addFieldV( "SegmentLength", TypeRangedF32, Offset( mMetersPerSegment, River ), &riverSegRange, "Divide the River lengthwise into segments of this length in meters. " "These geometric volumes are used for spacial queries like determining containment." ); - addField( "SubdivideLength", TypeF32, Offset( mMaxDivisionSize, River ), + addFieldV( "SubdivideLength", TypeRangedF32, Offset( mMaxDivisionSize, River ), &CommonValidators::PositiveFloat, "For purposes of generating the renderable geometry River segments are further subdivided " "such that no quad is of greater width or length than this distance in meters." ); - addField( "FlowMagnitude", TypeF32, Offset( mFlowMagnitude, River ), + addFieldV( "FlowMagnitude", TypeRangedF32, Offset( mFlowMagnitude, River ), &CommonValidators::PositiveFloat, "Magnitude of the force vector applied to dynamic objects within the River." ); - addField( "LowLODDistance", TypeF32, Offset( mLodDistance, River ), + addFieldV( "LowLODDistance", TypeRangedF32, Offset( mLodDistance, River ), &CommonValidators::PositiveFloat, "Segments of the river at this distance in meters or greater will " "render as a single unsubdivided without undulation effects." ); diff --git a/Engine/source/environment/scatterSky.cpp b/Engine/source/environment/scatterSky.cpp index 0d7bb727b..a42560e33 100644 --- a/Engine/source/environment/scatterSky.cpp +++ b/Engine/source/environment/scatterSky.cpp @@ -42,6 +42,7 @@ #include "materials/sceneData.h" #include "environment/timeOfDay.h" #include "materials/materialFeatureTypes.h" +#include "console/typeValidators.h" ConsoleDocClass( ScatterSky, @@ -324,19 +325,19 @@ void ScatterSky::initPersistFields() addGroup( "ScatterSky", "Only azimuth and elevation are networked fields. To trigger a full update of all other fields use the applyChanges ConsoleMethod." ); - addField( "skyBrightness", TypeF32, Offset( mSkyBrightness, ScatterSky ), + addFieldV( "skyBrightness", TypeRangedF32, Offset( mSkyBrightness, ScatterSky ), &CommonValidators::PositiveFloat, "Global brightness and intensity applied to the sky and objects in the level." ); - addField( "sunSize", TypeF32, Offset( mSunSize, ScatterSky ), + addFieldV( "sunSize", TypeRangedF32, Offset( mSunSize, ScatterSky ), &CommonValidators::PositiveFloat, "Affects the size of the sun's disk." ); - addField( "colorizeAmount", TypeF32, Offset( mColorizeAmt, ScatterSky ), + addFieldV( "colorizeAmount", TypeRangedF32, Offset( mColorizeAmt, ScatterSky ), &CommonValidators::PositiveFloat, "Controls how much the alpha component of colorize brigthens the sky. Setting to 0 returns default behavior." ); addField( "colorize", TypeColorF, Offset( mColorize, ScatterSky ), "Tints the sky the color specified, the alpha controls the brigthness. The brightness is multipled by the value of colorizeAmt." ); - addField( "rayleighScattering", TypeF32, Offset( mRayleighScattering, ScatterSky ), + addFieldV( "rayleighScattering", TypeRangedF32, Offset( mRayleighScattering, ScatterSky ), &CommonValidators::PositiveFloat, "Controls how blue the atmosphere is during the day." ); addField( "sunScale", TypeColorF, Offset( mSunScale, ScatterSky ), @@ -350,26 +351,26 @@ void ScatterSky::initPersistFields() "property, so you should not use LevelInfo.fogColor if the level contains " "a ScatterSky object." ); - addField( "exposure", TypeF32, Offset( mExposure, ScatterSky ), + addFieldV( "exposure", TypeRangedF32, Offset( mExposure, ScatterSky ), &CommonValidators::PositiveFloat, "Controls the contrast of the sky and sun during daytime." ); - addField( "zOffset", TypeF32, Offset( mZOffset, ScatterSky ), + addFieldV( "zOffset", TypeRangedF32, Offset( mZOffset, ScatterSky ), &CommonValidators::F32Range, "Offsets the scatterSky to avoid canvas rendering. Use 5000 or greater for the initial adjustment" ); endGroup( "ScatterSky" ); addGroup( "Orbit" ); - addProtectedField( "azimuth", TypeF32, Offset( mSunAzimuth, ScatterSky ), &ScatterSky::ptSetAzimuth, &defaultProtectedGetFn, + addProtectedFieldV( "azimuth", TypeRangedF32, Offset( mSunAzimuth, ScatterSky ), &ScatterSky::ptSetAzimuth, &defaultProtectedGetFn, &CommonValidators::PosDegreeRange, "The horizontal angle of the sun measured clockwise from the positive Y world axis. This field is networked." ); - addProtectedField( "elevation", TypeF32, Offset( mSunElevation, ScatterSky ), &ScatterSky::ptSetElevation, &defaultProtectedGetFn, + addProtectedFieldV( "elevation", TypeRangedF32, Offset( mSunElevation, ScatterSky ), &ScatterSky::ptSetElevation, &defaultProtectedGetFn, &CommonValidators::DegreeRange, "The elevation angle of the sun above or below the horizon. This field is networked." ); - addField( "moonAzimuth", TypeF32, Offset( mMoonAzimuth, ScatterSky ), + addFieldV( "moonAzimuth", TypeRangedF32, Offset( mMoonAzimuth, ScatterSky ), &CommonValidators::PosDegreeRange, "The horizontal angle of the moon measured clockwise from the positive Y world axis. This is not animated by time or networked." ); - addField( "moonElevation", TypeF32, Offset( mMoonElevation, ScatterSky ), + addFieldV( "moonElevation", TypeRangedF32, Offset( mMoonElevation, ScatterSky ), &CommonValidators::DegreeRange, "The elevation angle of the moon above or below the horizon. This is not animated by time or networked." ); endGroup( "Orbit" ); @@ -382,11 +383,11 @@ void ScatterSky::initPersistFields() addField( "castShadows", TypeBool, Offset( mCastShadows, ScatterSky ), "Enables/disables shadows cast by objects due to ScatterSky light." ); - + /* addField("staticRefreshFreq", TypeS32, Offset(mStaticRefreshFreq, ScatterSky), "static shadow refresh rate (milliseconds)"); addField("dynamicRefreshFreq", TypeS32, Offset(mDynamicRefreshFreq, ScatterSky), "dynamic shadow refresh rate (milliseconds)"); - - addField( "brightness", TypeF32, Offset( mBrightness, ScatterSky ), + */ + addFieldV( "brightness", TypeRangedF32, Offset( mBrightness, ScatterSky ), &CommonValidators::PositiveFloat, "The brightness of the ScatterSky's light object." ); endGroup( "Lighting" ); @@ -396,7 +397,7 @@ void ScatterSky::initPersistFields() addField( "flareType", TYPEID< LightFlareData >(), Offset( mFlareData, ScatterSky ), "Datablock for the flare produced by the ScatterSky." ); - addField( "flareScale", TypeF32, Offset( mFlareScale, ScatterSky ), + addFieldV( "flareScale", TypeRangedF32, Offset( mFlareScale, ScatterSky ), &CommonValidators::PositiveFloat, "Changes the size and intensity of the flare." ); endGroup( "Misc" ); @@ -414,7 +415,7 @@ void ScatterSky::initPersistFields() INITPERSISTFIELD_MATERIALASSET(MoonMat, ScatterSky, "Material for the moon sprite."); - addField( "moonScale", TypeF32, Offset( mMoonScale, ScatterSky ), + addFieldV( "moonScale", TypeRangedF32, Offset( mMoonScale, ScatterSky ), &CommonValidators::PositiveFloat, "Controls size the moon sprite renders, specified as a fractional amount of the screen height." ); addField( "moonLightColor", TypeColorF, Offset( mMoonTint, ScatterSky ), diff --git a/Engine/source/environment/skyBox.cpp b/Engine/source/environment/skyBox.cpp index 16ad8d166..8d3a66c56 100644 --- a/Engine/source/environment/skyBox.cpp +++ b/Engine/source/environment/skyBox.cpp @@ -122,7 +122,7 @@ void SkyBox::initPersistFields() addField( "drawBottom", TypeBool, Offset( mDrawBottom, SkyBox ), "If false the bottom of the skybox is not rendered." ); - addField( "fogBandHeight", TypeF32, Offset( mFogBandHeight, SkyBox ), + addFieldV( "fogBandHeight", TypeRangedF32, Offset( mFogBandHeight, SkyBox ), &CommonValidators::NormalizedFloat, "The height (0-1) of the fog band from the horizon to the top of the SkyBox." ); endGroup( "Sky Box" ); diff --git a/Engine/source/environment/skySphere.cpp b/Engine/source/environment/skySphere.cpp index 7f8cf6618..d2d484ce7 100644 --- a/Engine/source/environment/skySphere.cpp +++ b/Engine/source/environment/skySphere.cpp @@ -118,7 +118,7 @@ void SkySphere::initPersistFields() INITPERSISTFIELD_MATERIALASSET(Material, SkySphere, "The name of a cubemap material for the sky box."); - addField("fogBandHeight", TypeF32, Offset(mFogBandHeight, SkySphere), + addFieldV("fogBandHeight", TypeRangedF32, Offset(mFogBandHeight, SkySphere), &CommonValidators::NormalizedFloat, "The height (0-1) of the fog band from the horizon to the top of the SkySphere."); endGroup("Sky Sphere"); diff --git a/Engine/source/environment/sun.cpp b/Engine/source/environment/sun.cpp index 615337a1f..1a9407be5 100644 --- a/Engine/source/environment/sun.cpp +++ b/Engine/source/environment/sun.cpp @@ -145,10 +145,10 @@ void Sun::initPersistFields() docsURL; addGroup( "Orbit" ); - addField( "azimuth", TypeF32, Offset( mSunAzimuth, Sun ), + addFieldV( "azimuth", TypeRangedF32, Offset( mSunAzimuth, Sun ), &CommonValidators::PosDegreeRange, "The horizontal angle of the sun measured clockwise from the positive Y world axis." ); - addField( "elevation", TypeF32, Offset( mSunElevation, Sun ), + addFieldV( "elevation", TypeRangedF32, Offset( mSunElevation, Sun ), &CommonValidators::DegreeRange, "The elevation angle of the sun above or below the horizon." ); endGroup( "Orbit" ); @@ -165,7 +165,7 @@ void Sun::initPersistFields() addField( "ambient", TypeColorF, Offset( mLightAmbient, Sun ), "Color shading applied to surfaces not " "in direct contact with light source, such as in the shadows or interiors."); - addField( "brightness", TypeF32, Offset( mBrightness, Sun ), + addFieldV( "brightness", TypeRangedF32, Offset( mBrightness, Sun ), &CommonValidators::PositiveFloat, "Adjust the Sun's global contrast/intensity"); addField( "castShadows", TypeBool, Offset( mCastShadows, Sun ), @@ -183,7 +183,7 @@ void Sun::initPersistFields() INITPERSISTFIELD_MATERIALASSET(CoronaMaterial, Sun, "Material for the corona sprite."); - addField( "coronaScale", TypeF32, Offset( mCoronaScale, Sun ), + addFieldV( "coronaScale", TypeRangedF32, Offset( mCoronaScale, Sun ), &CommonValidators::PositiveFloat, "Controls size the corona sprite renders, specified as a fractional amount of the screen height." ); addField( "coronaTint", TypeColorF, Offset( mCoronaTint, Sun ), @@ -200,7 +200,7 @@ void Sun::initPersistFields() addField( "flareType", TYPEID< LightFlareData >(), Offset( mFlareData, Sun ), "Datablock for the flare produced by the Sun" ); - addField( "flareScale", TypeF32, Offset( mFlareScale, Sun ), + addFieldV( "flareScale", TypeRangedF32, Offset( mFlareScale, Sun ), &CommonValidators::PositiveFloat, "Changes the size and intensity of the flare." ); endGroup( "Misc" ); diff --git a/Engine/source/environment/timeOfDay.cpp b/Engine/source/environment/timeOfDay.cpp index c943a4000..a01f8d837 100644 --- a/Engine/source/environment/timeOfDay.cpp +++ b/Engine/source/environment/timeOfDay.cpp @@ -28,6 +28,7 @@ #include "T3D/gameBase/gameConnection.h" #include "environment/sun.h" #include "console/engineAPI.h" +#include "console/typeValidators.h" TimeOfDayUpdateSignal TimeOfDay::smTimeOfDayUpdateSignal; @@ -127,24 +128,24 @@ void TimeOfDay::initPersistFields() docsURL; addGroup( "TimeOfDay" ); - addField( "axisTilt", TypeF32, Offset( mAxisTilt, TimeOfDay ), + addFieldV( "axisTilt", TypeRangedF32, Offset( mAxisTilt, TimeOfDay ), &CommonValidators::DegreeRange, "The angle in degrees between global equator and tropic." ); - addProtectedField( "dayLength", TypeF32, Offset( mDayLen, TimeOfDay ), &setDayLength, &defaultProtectedGetFn, + addProtectedFieldV( "dayLength", TypeRangedF32, Offset( mDayLen, TimeOfDay ), &setDayLength, &defaultProtectedGetFn, &CommonValidators::PositiveFloat, "The length of a virtual day in real world seconds." ); - addField( "startTime", TypeF32, Offset( mStartTimeOfDay, TimeOfDay ), + addFieldV( "startTime", TypeRangedF32, Offset( mStartTimeOfDay, TimeOfDay ), &CommonValidators::NormalizedFloat, "" ); - addProtectedField( "time", TypeF32, Offset( mTimeOfDay, TimeOfDay ), &setTimeOfDay, &defaultProtectedGetFn, "Current time of day." ); + addProtectedFieldV( "time", TypeRangedF32, Offset( mTimeOfDay, TimeOfDay ), &setTimeOfDay, &defaultProtectedGetFn, &CommonValidators::NormalizedFloat, "Current time of day." ); addProtectedField( "play", TypeBool, Offset( mPlay, TimeOfDay ), &setPlay, &defaultProtectedGetFn, "True when the TimeOfDay object is operating." ); - addField( "azimuthOverride", TypeF32, Offset( mAzimuthOverride, TimeOfDay ), "" ); + addFieldV( "azimuthOverride", TypeRangedF32, Offset( mAzimuthOverride, TimeOfDay ), &CommonValidators::PosDegreeRange, "" ); - addField( "dayScale", TypeF32, Offset( mDayScale, TimeOfDay ), "Scalar applied to time that elapses while the sun is up." ); + addFieldV( "dayScale", TypeRangedF32, Offset( mDayScale, TimeOfDay ), &CommonValidators::PositiveFloat, "Scalar applied to time that elapses while the sun is up." ); - addField( "nightScale", TypeF32, Offset( mNightScale, TimeOfDay ), "Scalar applied to time that elapses while the sun is down." ); + addFieldV( "nightScale", TypeRangedF32, Offset( mNightScale, TimeOfDay ), &CommonValidators::PositiveFloat, "Scalar applied to time that elapses while the sun is down." ); endGroup( "TimeOfDay" ); diff --git a/Engine/source/environment/waterBlock.cpp b/Engine/source/environment/waterBlock.cpp index 9b8c3ecf2..40e261fe6 100644 --- a/Engine/source/environment/waterBlock.cpp +++ b/Engine/source/environment/waterBlock.cpp @@ -41,6 +41,7 @@ #include "ts/tsShapeInstance.h" #include "postFx/postEffect.h" #include "math/util/matrixSet.h" +#include "console/typeValidators.h" IMPLEMENT_CO_NETOBJECT_V1(WaterBlock); @@ -529,11 +530,12 @@ void WaterBlock::initPersistFields() { docsURL; addGroup( "WaterBlock" ); - addProtectedField( "gridElementSize", TypeF32, Offset( mGridElementSize, WaterBlock ), - &setGridSizeProperty, &defaultProtectedGetFn, "Spacing between vertices in the WaterBlock mesh" ); - addProtectedField( "gridSize", TypeF32, Offset( mGridElementSize, WaterBlock ), - &setGridSizeProperty, &defaultProtectedGetFn, "Duplicate of gridElementSize for backwards compatility" ); - endGroup( "WaterBlock" ); + + addProtectedFieldV("gridSize", TypeRangedF32, Offset(mGridElementSize, WaterBlock), &setGridSizeProperty, &defaultProtectedGetFn, &CommonValidators::PositiveNonZeroFloat, + "Spacing between vertices in the WaterBlock mesh"); + + addProtectedFieldV("gridElementSize", TypeRangedF32, Offset(mGridElementSize, WaterBlock), &setGridSizeProperty, &defaultProtectedGetFn, &CommonValidators::PositiveNonZeroFloat, + "Duplicate of gridElementSize for backwards compatility"); Parent::initPersistFields(); } diff --git a/Engine/source/environment/waterObject.cpp b/Engine/source/environment/waterObject.cpp index c2074446d..f4dbb2af6 100644 --- a/Engine/source/environment/waterObject.cpp +++ b/Engine/source/environment/waterObject.cpp @@ -44,7 +44,7 @@ #include "sfx/sfxAmbience.h" #include "T3D/sfx/sfx3DWorld.h" #include "sfx/sfxTypes.h" - +#include "console/typeValidators.h" GFXImplementVertexFormat( GFXWaterVertex ) { @@ -272,32 +272,32 @@ WaterObject::~WaterObject() dFree_aligned(mMatrixSet); } - +FRangeValidator densityRange(0.0f,1000.0f); void WaterObject::initPersistFields() { docsURL; addGroup( "WaterObject" ); - addProtectedField( "density", TypeF32, Offset( mDensity, WaterObject ), &WaterObject::_checkDensity, &defaultProtectedGetFn, "Affects buoyancy of an object, thus affecting the Z velocity of a player (jumping, falling, etc."); - addField( "viscosity", TypeF32, Offset( mViscosity, WaterObject ), "Affects drag force applied to an object submerged in this container." ); + addProtectedFieldV( "density", TypeRangedF32, Offset( mDensity, WaterObject ), &WaterObject::_checkDensity, &defaultProtectedGetFn, &densityRange, "Affects buoyancy of an object, thus affecting the Z velocity of a player (jumping, falling, etc."); + addFieldV( "viscosity", TypeRangedF32, Offset( mViscosity, WaterObject ), &CommonValidators::PositiveFloat, "Affects drag force applied to an object submerged in this container." ); addField( "liquidType", TypeRealString, Offset( mLiquidType, WaterObject ), "Liquid type of WaterBlock, such as water, ocean, lava" " Currently only Water is defined and used."); addField( "baseColor", TypeColorI, Offset( mWaterFogData.color, WaterObject ), "Changes color of water fog." ); - addField( "fresnelBias", TypeF32, Offset( mFresnelBias, WaterObject ), "Extent of fresnel affecting reflection fogging." ); - addField( "fresnelPower", TypeF32, Offset( mFresnelPower, WaterObject ), "Measures intensity of affect on reflection based on fogging." ); - addField( "specularPower", TypeF32, Offset( mSpecularPower, WaterObject ), "Power used for specularity on the water surface ( sun only )." ); + addFieldV( "fresnelBias", TypeRangedF32, Offset( mFresnelBias, WaterObject ), &CommonValidators::PositiveFloat, "Extent of fresnel affecting reflection fogging." ); + addFieldV( "fresnelPower", TypeRangedF32, Offset( mFresnelPower, WaterObject ), &CommonValidators::PositiveFloat, "Measures intensity of affect on reflection based on fogging." ); + addFieldV( "specularPower", TypeRangedF32, Offset( mSpecularPower, WaterObject ), &CommonValidators::PositiveFloat, "Power used for specularity on the water surface ( sun only )." ); addField( "specularColor", TypeColorF, Offset( mSpecularColor, WaterObject ), "Color used for specularity on the water surface ( sun only )." ); addField( "emissive", TypeBool, Offset( mEmissive, WaterObject ), "When true the water colors don't react to changes to environment lighting." ); addArray( "Waves (vertex undulation)", MAX_WAVES ); addField( "waveDir", TypePoint2F, Offset( mWaveDir, WaterObject ), MAX_WAVES, "Direction waves flow toward shores." ); - addField( "waveSpeed", TypeF32, Offset( mWaveSpeed, WaterObject ), MAX_WAVES, "Speed of water undulation." ); - addField( "waveMagnitude", TypeF32, Offset( mWaveMagnitude, WaterObject ), MAX_WAVES, "Height of water undulation." ); + addFieldV( "waveSpeed", TypeRangedF32, Offset( mWaveSpeed, WaterObject ), &CommonValidators::PositiveFloat, MAX_WAVES, "Speed of water undulation." ); + addFieldV( "waveMagnitude", TypeRangedF32, Offset( mWaveMagnitude, WaterObject ), &CommonValidators::PositiveFloat, MAX_WAVES, "Height of water undulation." ); endArray( "Waves (vertex undulation)" ); - addField( "overallWaveMagnitude", TypeF32, Offset( mOverallWaveMagnitude, WaterObject ), "Master variable affecting entire body" + addFieldV( "overallWaveMagnitude", TypeRangedF32, Offset( mOverallWaveMagnitude, WaterObject ), &CommonValidators::PositiveFloat, "Master variable affecting entire body" " of water's undulation" ); INITPERSISTFIELD_IMAGEASSET(RippleTex, WaterObject, "Normal map used to simulate small surface ripples"); @@ -305,31 +305,31 @@ void WaterObject::initPersistFields() addArray( "Ripples (texture animation)", MAX_WAVES ); addField( "rippleDir", TypePoint2F, Offset( mRippleDir, WaterObject ), MAX_WAVES, "Modifies the direction of ripples on the surface." ); - addField( "rippleSpeed", TypeF32, Offset( mRippleSpeed, WaterObject ), MAX_WAVES, "Modifies speed of surface ripples."); + addFieldV( "rippleSpeed", TypeRangedF32, Offset( mRippleSpeed, WaterObject ), &CommonValidators::PositiveFloat, MAX_WAVES, "Modifies speed of surface ripples."); addField( "rippleTexScale", TypePoint2F, Offset( mRippleTexScale, WaterObject ), MAX_WAVES, "Intensifies the affect of the normal map " "applied to the surface."); - addField( "rippleMagnitude", TypeF32, Offset( mRippleMagnitude, WaterObject ), MAX_WAVES, "Intensifies the vertext modification of the surface." ); + addFieldV( "rippleMagnitude", TypeRangedF32, Offset( mRippleMagnitude, WaterObject ), &CommonValidators::PositiveFloat, MAX_WAVES, "Intensifies the vertext modification of the surface." ); endArray( "Ripples (texture animation)" ); - addField( "overallRippleMagnitude", TypeF32, Offset( mOverallRippleMagnitude, WaterObject ), "Master variable affecting entire surface"); + addFieldV( "overallRippleMagnitude", TypeRangedF32, Offset( mOverallRippleMagnitude, WaterObject ), &CommonValidators::PositiveFloat, "Master variable affecting entire surface"); INITPERSISTFIELD_IMAGEASSET(FoamTex, WaterObject, "Diffuse texture for foam in shallow water (advanced lighting only)"); addArray( "Foam", MAX_FOAM ); addField( "foamDir", TypePoint2F, Offset( mFoamDir, WaterObject ), MAX_FOAM, "" ); - addField( "foamSpeed", TypeF32, Offset( mFoamSpeed, WaterObject ), MAX_FOAM, ""); + addFieldV( "foamSpeed", TypeRangedF32, Offset( mFoamSpeed, WaterObject ), &CommonValidators::PositiveFloat, MAX_FOAM, ""); addField( "foamTexScale", TypePoint2F, Offset( mFoamTexScale, WaterObject ), MAX_FOAM, "" "applied to the surface."); - addField( "foamOpacity", TypeF32, Offset( mFoamOpacity, WaterObject ), MAX_FOAM, "" ); + addFieldV( "foamOpacity", TypeRangedF32, Offset( mFoamOpacity, WaterObject ), &CommonValidators::PositiveFloat, MAX_FOAM, "" ); endArray( "Foam" ); - addField( "overallFoamOpacity", TypeF32, Offset( mOverallFoamOpacity, WaterObject ), "" ); - addField( "foamMaxDepth", TypeF32, Offset( mFoamMaxDepth, WaterObject ), "" ); - addField( "foamAmbientLerp", TypeF32, Offset( mFoamAmbientLerp, WaterObject ), "" ); - addField( "foamRippleInfluence", TypeF32, Offset( mFoamRippleInfluence, WaterObject ), "" ); + addFieldV( "overallFoamOpacity", TypeRangedF32, Offset( mOverallFoamOpacity, WaterObject ), &CommonValidators::PositiveFloat, "" ); + addFieldV( "foamMaxDepth", TypeRangedF32, Offset( mFoamMaxDepth, WaterObject ), &CommonValidators::PositiveFloat, "" ); + addFieldV( "foamAmbientLerp", TypeRangedF32, Offset( mFoamAmbientLerp, WaterObject ), &CommonValidators::NormalizedFloat, "" ); + addFieldV( "foamRippleInfluence", TypeRangedF32, Offset( mFoamRippleInfluence, WaterObject ), &CommonValidators::PositiveFloat, "" ); endGroup( "WaterObject" ); @@ -342,25 +342,25 @@ void WaterObject::initPersistFields() &defaultProtectedGetFn, "Enables dynamic reflection rendering." ); - addField( "reflectivity", TypeF32, Offset( mReflectivity, WaterObject ), "Overall scalar to the reflectivity of the water surface." ); - addField( "reflectPriority", TypeF32, Offset( mReflectorDesc.priority, WaterObject ), "Affects the sort order of reflected objects." ); - addField( "reflectMaxRateMs", TypeS32, Offset( mReflectorDesc.maxRateMs, WaterObject ), "Affects the sort time of reflected objects." ); + addFieldV( "reflectivity", TypeRangedF32, Offset( mReflectivity, WaterObject ), &CommonValidators::PositiveFloat, "Overall scalar to the reflectivity of the water surface." ); + addFieldV( "reflectPriority", TypeRangedF32, Offset( mReflectorDesc.priority, WaterObject ), &CommonValidators::PositiveFloat, "Affects the sort order of reflected objects." ); + addFieldV( "reflectMaxRateMs", TypeRangedS32, Offset( mReflectorDesc.maxRateMs, WaterObject ), &CommonValidators::PositiveInt, "Affects the sort time of reflected objects." ); //addField( "reflectMaxDist", TypeF32, Offset( mReflectMaxDist, WaterObject ), "vert distance at which only cubemap color is used" ); //addField( "reflectMinDist", TypeF32, Offset( mReflectMinDist, WaterObject ), "vert distance at which only reflection color is used" ); - addField( "reflectDetailAdjust", TypeF32, Offset( mReflectorDesc.detailAdjust, WaterObject ), "scale up or down the detail level for objects rendered in a reflection" ); + addFieldV( "reflectDetailAdjust", TypeRangedF32, Offset( mReflectorDesc.detailAdjust, WaterObject ), &CommonValidators::PositiveFloat, "scale up or down the detail level for objects rendered in a reflection" ); addField( "reflectNormalUp", TypeBool, Offset( mReflectNormalUp, WaterObject ), "always use z up as the reflection normal" ); addField( "useOcclusionQuery", TypeBool, Offset( mReflectorDesc.useOcclusionQuery, WaterObject ), "turn off reflection rendering when occluded (delayed)." ); - addField( "reflectTexSize", TypeS32, Offset( mReflectorDesc.texSize, WaterObject ), "The texture size used for reflections (square)" ); + addFieldV( "reflectTexSize", TypeRangedS32, Offset( mReflectorDesc.texSize, WaterObject ), &CommonValidators::PositiveInt, "The texture size used for reflections (square)" ); endGroup( "Reflect" ); addGroup( "Underwater Fogging" ); - addField( "waterFogDensity", TypeF32, Offset( mWaterFogData.density, WaterObject ), "Intensity of underwater fogging." ); - addField( "waterFogDensityOffset", TypeF32, Offset( mWaterFogData.densityOffset, WaterObject ), "Delta, or limit, applied to waterFogDensity." ); - addField( "wetDepth", TypeF32, Offset( mWaterFogData.wetDepth, WaterObject ), "The depth in world units at which full darkening will be received," + addFieldV( "waterFogDensity", TypeRangedF32, Offset( mWaterFogData.density, WaterObject ), &CommonValidators::PositiveFloat, "Intensity of underwater fogging." ); + addFieldV( "waterFogDensityOffset", TypeRangedF32, Offset( mWaterFogData.densityOffset, WaterObject ), &CommonValidators::PositiveFloat, "Delta, or limit, applied to waterFogDensity." ); + addFieldV( "wetDepth", TypeRangedF32, Offset( mWaterFogData.wetDepth, WaterObject ), &CommonValidators::PositiveFloat, "The depth in world units at which full darkening will be received," " giving a wet look to objects underwater." ); - addField( "wetDarkening", TypeF32, Offset( mWaterFogData.wetDarkening, WaterObject ), "The refract color intensity scaled at wetDepth." ); + addFieldV( "wetDarkening", TypeRangedF32, Offset( mWaterFogData.wetDarkening, WaterObject ), &CommonValidators::PositiveFloat, "The refract color intensity scaled at wetDepth." ); endGroup( "Underwater Fogging" ); @@ -368,24 +368,24 @@ void WaterObject::initPersistFields() INITPERSISTFIELD_IMAGEASSET(DepthGradientTex, WaterObject, "1D texture defining the base water color by depth"); - addField( "depthGradientMax", TypeF32, Offset( mDepthGradientMax, WaterObject ), "Depth in world units, the max range of the color gradient texture." ); + addFieldV( "depthGradientMax", TypeRangedF32, Offset( mDepthGradientMax, WaterObject ), &CommonValidators::PositiveFloat, "Depth in world units, the max range of the color gradient texture." ); endGroup( "Misc" ); addGroup( "Distortion" ); - addField( "distortStartDist", TypeF32, Offset( mDistortStartDist, WaterObject ), "Determines start of distortion effect where water" + addFieldV( "distortStartDist", TypeRangedF32, Offset( mDistortStartDist, WaterObject ), &CommonValidators::PositiveFloat, "Determines start of distortion effect where water" " surface intersects the camera near plane."); - addField( "distortEndDist", TypeF32, Offset( mDistortEndDist, WaterObject ), "Max distance that distortion algorithm is performed. " + addFieldV( "distortEndDist", TypeRangedF32, Offset( mDistortEndDist, WaterObject ), &CommonValidators::PositiveFloat, "Max distance that distortion algorithm is performed. " "The lower, the more distorted the effect."); - addField( "distortFullDepth", TypeF32, Offset( mDistortFullDepth, WaterObject ), "Determines the scaling down of distortion " + addFieldV( "distortFullDepth", TypeRangedF32, Offset( mDistortFullDepth, WaterObject ), &CommonValidators::PositiveFloat, "Determines the scaling down of distortion " "in shallow water."); endGroup( "Distortion" ); addGroup( "Basic Lighting" ); - addField( "clarity", TypeF32, Offset( mClarity, WaterObject ), "Relative opacity or transparency of the water surface." ); + addFieldV( "clarity", TypeRangedF32, Offset( mClarity, WaterObject ), &CommonValidators::PositiveFloat, "Relative opacity or transparency of the water surface." ); addField( "underwaterColor", TypeColorI, Offset( mUnderwaterColor, WaterObject ), "Changes the color shading of objects beneath" " the water surface."); @@ -473,13 +473,13 @@ U32 WaterObject::packUpdate( NetConnection * conn, U32 mask, BitStream *stream ) if ( stream->writeFlag( mFullReflect ) ) { stream->write( mReflectorDesc.priority ); - stream->writeInt( mReflectorDesc.maxRateMs, 32 ); + stream->write( mReflectorDesc.maxRateMs ); //stream->write( mReflectMaxDist ); //stream->write( mReflectMinDist ); stream->write( mReflectorDesc.detailAdjust ); stream->writeFlag( mReflectNormalUp ); stream->writeFlag( mReflectorDesc.useOcclusionQuery ); - stream->writeInt( mReflectorDesc.texSize, 32 ); + stream->write( mReflectorDesc.texSize ); } stream->write( mReflectivity ); @@ -575,13 +575,13 @@ void WaterObject::unpackUpdate( NetConnection * conn, BitStream *stream ) { mFullReflect = true; stream->read( &mReflectorDesc.priority ); - mReflectorDesc.maxRateMs = stream->readInt( 32 ); + stream->read(&mReflectorDesc.maxRateMs); //stream->read( &mReflectMaxDist ); //stream->read( &mReflectMinDist ); stream->read( &mReflectorDesc.detailAdjust ); mReflectNormalUp = stream->readFlag(); mReflectorDesc.useOcclusionQuery = stream->readFlag(); - mReflectorDesc.texSize = stream->readInt( 32 ); + stream->read(&mReflectorDesc.texSize); if ( isProperlyAdded() && !mPlaneReflector.isEnabled() && smEnableTrueReflections ) mPlaneReflector.registerReflector( this, &mReflectorDesc ); diff --git a/Engine/source/environment/waterPlane.cpp b/Engine/source/environment/waterPlane.cpp index 83faed217..1354e00e6 100644 --- a/Engine/source/environment/waterPlane.cpp +++ b/Engine/source/environment/waterPlane.cpp @@ -43,6 +43,7 @@ #include "T3D/gameFunctions.h" #include "postFx/postEffect.h" #include "math/util/matrixSet.h" +#include "console/typeValidators.h" extern ColorI gCanvasClearColor; @@ -121,10 +122,10 @@ void WaterPlane::initPersistFields() docsURL; addGroup( "WaterPlane" ); - addProtectedField( "gridSize", TypeS32, Offset( mGridSize, WaterPlane ), &protectedSetGridSize, &defaultProtectedGetFn, + addProtectedFieldV( "gridSize", TypeRangedF32, Offset( mGridSize, WaterPlane ), &protectedSetGridSize, &defaultProtectedGetFn, &CommonValidators::PositiveNonZeroFloat, "Spacing between vertices in the WaterBlock mesh" ); - addProtectedField( "gridElementSize", TypeF32, Offset( mGridElementSize, WaterPlane ), &protectedSetGridElementSize, &defaultProtectedGetFn, + addProtectedFieldV( "gridElementSize", TypeRangedF32, Offset( mGridElementSize, WaterPlane ), &protectedSetGridElementSize, &defaultProtectedGetFn, &CommonValidators::PositiveNonZeroFloat, "Duplicate of gridElementSize for backwards compatility"); endGroup( "WaterPlane" ); diff --git a/Engine/source/forest/editor/forestBrushElement.cpp b/Engine/source/forest/editor/forestBrushElement.cpp index 33a0a7b81..a34090e61 100644 --- a/Engine/source/forest/editor/forestBrushElement.cpp +++ b/Engine/source/forest/editor/forestBrushElement.cpp @@ -67,43 +67,43 @@ void ForestBrushElement::initPersistFields() addField( "forestItemData", TYPEID< ForestItemData >(), Offset( mData, ForestBrushElement ), "The type of ForestItem this element holds placement parameters for." ); - addField( "probability", TypeF32, Offset( mProbability, ForestBrushElement ), + addFieldV( "probability", TypeRangedF32, Offset( mProbability, ForestBrushElement ), &CommonValidators::PositiveFloat, "The probability that this element will be created during an editor brush stroke " "is the sum of all element probabilities in the brush divided by the probability " "of this element." ); - addField( "rotationRange", TypeF32, Offset( mRotationRange, ForestBrushElement ), + addFieldV( "rotationRange", TypeRangedF32, Offset( mRotationRange, ForestBrushElement ), &CommonValidators::PosDegreeRange, "The max rotation in degrees that items will be placed." ); - addField( "scaleMin", TypeF32, Offset( mScaleMin, ForestBrushElement ), + addFieldV( "scaleMin", TypeRangedF32, Offset( mScaleMin, ForestBrushElement ), &CommonValidators::PositiveFloat, "The minimum random size for each item." ); - addField( "scaleMax", TypeF32, Offset( mScaleMax, ForestBrushElement ), + addFieldV( "scaleMax", TypeRangedF32, Offset( mScaleMax, ForestBrushElement ), &CommonValidators::PositiveFloat, "The maximum random size of each item." ); - addField( "scaleExponent", TypeF32, Offset( mScaleExponent, ForestBrushElement ), + addFieldV( "scaleExponent", TypeRangedF32, Offset( mScaleExponent, ForestBrushElement ), &CommonValidators::PositiveFloat, "An exponent used to bias between the minimum and maximum random sizes." ); - addField( "sinkMin", TypeF32, Offset( mSinkMin, ForestBrushElement ), + addFieldV( "sinkMin", TypeRangedF32, Offset( mSinkMin, ForestBrushElement ), &CommonValidators::PositiveFloat, "Min variation in the sink radius." ); - addField( "sinkMax", TypeF32, Offset( mSinkMax, ForestBrushElement ), + addFieldV( "sinkMax", TypeRangedF32, Offset( mSinkMax, ForestBrushElement ), &CommonValidators::PositiveFloat, "Max variation in the sink radius." ); - addField( "sinkRadius", TypeF32, Offset( mSinkRadius, ForestBrushElement ), + addFieldV( "sinkRadius", TypeRangedF32, Offset( mSinkRadius, ForestBrushElement ), &CommonValidators::PositiveFloat, "This is the radius used to calculate how much to sink the trunk at " "its base and is used to sink the tree into the ground when its on a slope." ); - addField( "slopeMin", TypeF32, Offset( mSlopeMin, ForestBrushElement ), + addFieldV( "slopeMin", TypeRangedF32, Offset( mSlopeMin, ForestBrushElement ), &CommonValidators::PosDegreeRangeQuarter, "The min surface slope in degrees this item will be placed on." ); - addField( "slopeMax", TypeF32, Offset( mSlopeMax, ForestBrushElement ), + addFieldV( "slopeMax", TypeRangedF32, Offset( mSlopeMax, ForestBrushElement ), &CommonValidators::PosDegreeRangeQuarter, "The max surface slope in degrees this item will be placed on." ); - addField( "elevationMin", TypeF32, Offset( mElevationMin, ForestBrushElement ), + addFieldV( "elevationMin", TypeRangedF32, Offset( mElevationMin, ForestBrushElement ), &CommonValidators::F32Range, "The min world space elevation this item will be placed." ); - addField( "elevationMax", TypeF32, Offset( mElevationMax, ForestBrushElement ), + addFieldV( "elevationMax", TypeRangedF32, Offset( mElevationMax, ForestBrushElement ), &CommonValidators::F32Range, "The max world space elevation this item will be placed." ); endGroup( "ForestBrushElement" ); diff --git a/Engine/source/forest/editor/forestBrushTool.cpp b/Engine/source/forest/editor/forestBrushTool.cpp index ad8dc50cc..6e557f3cc 100644 --- a/Engine/source/forest/editor/forestBrushTool.cpp +++ b/Engine/source/forest/editor/forestBrushTool.cpp @@ -40,6 +40,7 @@ #include "math/mRandomDeck.h" #include "math/mRandomSet.h" #include "scene/sceneContainer.h" +#include "console/typeValidators.h" bool ForestBrushTool::protectedSetSize( void *object, const char *index, const char *data ) @@ -104,6 +105,7 @@ ConsoleDocClass( ForestBrushTool, "@internal" ); +FRangeValidator fBrushRange(0.0f, 150.0f); void ForestBrushTool::initPersistFields() { docsURL; @@ -111,14 +113,14 @@ void ForestBrushTool::initPersistFields() addField( "mode", TYPEID< BrushMode >(), Offset( mMode, ForestBrushTool) ); - addProtectedField( "size", TypeF32, Offset( mSize, ForestBrushTool ), - &protectedSetSize, &defaultProtectedGetFn, "Brush Size" ); + addProtectedFieldV( "size", TypeRangedF32, Offset( mSize, ForestBrushTool ), + &protectedSetSize, &defaultProtectedGetFn, &fBrushRange, "Brush Size" ); - addProtectedField( "pressure", TypeF32, Offset( mPressure, ForestBrushTool ), - &protectedSetPressure, &defaultProtectedGetFn, "Brush Pressure" ); + addProtectedFieldV( "pressure", TypeRangedF32, Offset( mPressure, ForestBrushTool ), + &protectedSetPressure, &defaultProtectedGetFn, &CommonValidators::NormalizedFloat, "Brush Pressure" ); - addProtectedField( "hardness", TypeF32, Offset( mHardness, ForestBrushTool ), - &protectedSetHardness, &defaultProtectedGetFn, "Brush Hardness" ); + addProtectedFieldV( "hardness", TypeRangedF32, Offset( mHardness, ForestBrushTool ), + &protectedSetHardness, &defaultProtectedGetFn, &CommonValidators::NormalizedFloat, "Brush Hardness" ); endGroup( "ForestBrushTool" ); diff --git a/Engine/source/forest/forest.cpp b/Engine/source/forest/forest.cpp index 6be22be8c..9f80c829e 100644 --- a/Engine/source/forest/forest.cpp +++ b/Engine/source/forest/forest.cpp @@ -108,7 +108,7 @@ void Forest::initPersistFields() addGroup( "Lod" ); - addField( "lodReflectScalar", TypeF32, Offset( mReflectionLodScalar, Forest ), + addFieldV( "lodReflectScalar", TypeRangedF32, Offset( mReflectionLodScalar, Forest ), &CommonValidators::PositiveFloat, "Scalar applied to the farclip distance when Forest renders into a reflection." ); endGroup( "Lod" ); diff --git a/Engine/source/forest/forestItem.cpp b/Engine/source/forest/forestItem.cpp index 1032eaf9d..239919a91 100644 --- a/Engine/source/forest/forestItem.cpp +++ b/Engine/source/forest/forestItem.cpp @@ -70,40 +70,40 @@ void ForestItemData::initPersistFields() addGroup("Physics"); addField( "collidable", TypeBool, Offset( mCollidable, ForestItemData ), "Can other objects or spacial queries hit items of this type." ); - addField( "radius", TypeF32, Offset( mRadius, ForestItemData ), + addFieldV( "radius", TypeRangedF32, Offset( mRadius, ForestItemData ), &CommonValidators::PositiveFloat, "Radius used during placement to ensure items are not crowded." ); endGroup("Physics"); addGroup( "Wind" ); - addField( "mass", TypeF32, Offset( mMass, ForestItemData ), + addFieldV( "mass", TypeRangedF32, Offset( mMass, ForestItemData ), &CommonValidators::PositiveFloat, "Mass used in calculating spring forces on the trunk. Generally how " "springy a plant is." ); - addField( "rigidity", TypeF32, Offset( mRigidity, ForestItemData ), + addFieldV( "rigidity", TypeRangedF32, Offset( mRigidity, ForestItemData ), &CommonValidators::PositiveFloat, "Rigidity used in calculating spring forces on the trunk. How much the plant resists the wind force" ); - addField( "tightnessCoefficient", TypeF32, Offset( mTightnessCoefficient, ForestItemData ), + addFieldV( "tightnessCoefficient", TypeRangedF32, Offset( mTightnessCoefficient, ForestItemData ), &CommonValidators::PositiveFloat, "Coefficient used in calculating spring forces on the trunk. " "How much the plant resists bending." ); - addField( "dampingCoefficient", TypeF32, Offset( mDampingCoefficient, ForestItemData ), + addFieldV( "dampingCoefficient", TypeRangedF32, Offset( mDampingCoefficient, ForestItemData ), &CommonValidators::PositiveFloat, "Coefficient used in calculating spring forces on the trunk. " "Causes oscillation and forces to decay faster over time." ); - addField( "windScale", TypeF32, Offset( mWindScale, ForestItemData ), + addFieldV( "windScale", TypeRangedF32, Offset( mWindScale, ForestItemData ), &CommonValidators::PositiveFloat, "Overall scale to the effect of wind." ); - addField( "trunkBendScale", TypeF32, Offset( mTrunkBendScale, ForestItemData ), + addFieldV( "trunkBendScale", TypeRangedF32, Offset( mTrunkBendScale, ForestItemData ), &CommonValidators::PositiveFloat, "Overall bend amount of the tree trunk by wind and impacts." ); - addField( "branchAmp", TypeF32, Offset( mWindBranchAmp, ForestItemData ), + addFieldV( "branchAmp", TypeRangedF32, Offset( mWindBranchAmp, ForestItemData ), &CommonValidators::PositiveFloat, "Amplitude of the effect on larger branches." ); - addField( "detailAmp", TypeF32, Offset( mWindDetailAmp, ForestItemData ), + addFieldV( "detailAmp", TypeRangedF32, Offset( mWindDetailAmp, ForestItemData ), &CommonValidators::PositiveFloat, "Amplitude of the winds effect on leafs/fronds." ); - addField( "detailFreq", TypeF32, Offset( mWindDetailFreq, ForestItemData ), + addFieldV( "detailFreq", TypeRangedF32, Offset( mWindDetailFreq, ForestItemData ), &CommonValidators::PositiveFloat, "Frequency (speed) of the effect on leafs/fronds." ); endGroup( "Wind" ); diff --git a/Engine/source/forest/forestWindEmitter.cpp b/Engine/source/forest/forestWindEmitter.cpp index a9f4d5840..be3fe3a92 100644 --- a/Engine/source/forest/forestWindEmitter.cpp +++ b/Engine/source/forest/forestWindEmitter.cpp @@ -245,15 +245,15 @@ void ForestWindEmitter::initPersistFields() addGroup( "ForestWind" ); addField( "windEnabled", TypeBool, Offset( mEnabled, ForestWindEmitter ), "Determines if the emitter will be counted in wind calculations." ); addField( "radialEmitter", TypeBool, Offset( mRadialEmitter, ForestWindEmitter ), "Determines if the emitter is a global direction or local radial emitter." ); - addField( "strength", TypeF32, Offset( mWindStrength, ForestWindEmitter ), "The strength of the wind force." ); - addField( "radius", TypeF32, Offset( mWindRadius, ForestWindEmitter ), "The radius of the emitter for local radial emitters." ); - addField( "gustStrength", TypeF32, Offset( mWindGustStrength, ForestWindEmitter ), "The maximum strength of a gust." ); - addField( "gustFrequency", TypeF32, Offset( mWindGustFrequency, ForestWindEmitter ), "The frequency of gusting in seconds." ); - addField( "gustYawAngle", TypeF32, Offset( mWindGustYawAngle, ForestWindEmitter ), "The amount of degrees the wind direction can drift (both positive and negative)." ); - addField( "gustYawFrequency", TypeF32, Offset( mWindGustYawFrequency, ForestWindEmitter ), "The frequency of wind yaw drift, in seconds." ); - addField( "gustWobbleStrength", TypeF32, Offset( mWindGustWobbleStrength, ForestWindEmitter ), "The amount of random wobble added to gust and turbulence vectors." ); - addField( "turbulenceStrength", TypeF32, Offset( mWindTurbulenceStrength, ForestWindEmitter ), "The strength of gust turbulence." ); - addField( "turbulenceFrequency", TypeF32, Offset( mWindTurbulenceFrequency, ForestWindEmitter ), "The frequency of gust turbulence, in seconds." ); + addFieldV( "strength", TypeRangedF32, Offset( mWindStrength, ForestWindEmitter ), &CommonValidators::PositiveFloat, "The strength of the wind force." ); + addFieldV( "radius", TypeRangedF32, Offset( mWindRadius, ForestWindEmitter ), &CommonValidators::PositiveFloat, "The radius of the emitter for local radial emitters." ); + addFieldV( "gustStrength", TypeRangedF32, Offset( mWindGustStrength, ForestWindEmitter ), &CommonValidators::PositiveFloat, "The maximum strength of a gust." ); + addFieldV( "gustFrequency", TypeRangedF32, Offset( mWindGustFrequency, ForestWindEmitter ), &CommonValidators::PositiveFloat, "The frequency of gusting in seconds." ); + addFieldV( "gustYawAngle", TypeRangedF32, Offset( mWindGustYawAngle, ForestWindEmitter ), &CommonValidators::PosDegreeRange, "The amount of degrees the wind direction can drift (both positive and negative)." ); + addFieldV( "gustYawFrequency", TypeRangedF32, Offset( mWindGustYawFrequency, ForestWindEmitter ), &CommonValidators::PositiveFloat, "The frequency of wind yaw drift, in seconds." ); + addFieldV( "gustWobbleStrength", TypeRangedF32, Offset( mWindGustWobbleStrength, ForestWindEmitter ), &CommonValidators::PositiveFloat, "The amount of random wobble added to gust and turbulence vectors." ); + addFieldV( "turbulenceStrength", TypeRangedF32, Offset( mWindTurbulenceStrength, ForestWindEmitter ), &CommonValidators::PositiveFloat, "The strength of gust turbulence." ); + addFieldV( "turbulenceFrequency", TypeRangedF32, Offset( mWindTurbulenceFrequency, ForestWindEmitter ), &CommonValidators::PositiveFloat, "The frequency of gust turbulence, in seconds." ); addField( "hasMount", TypeBool, Offset( mHasMount, ForestWindEmitter ), "Determines if the emitter is mounted to another object." ); endGroup( "ForestWind" ); } diff --git a/Engine/source/gui/3d/guiTSControl.cpp b/Engine/source/gui/3d/guiTSControl.cpp index 0a01a1d25..9a7df0c9a 100644 --- a/Engine/source/gui/3d/guiTSControl.cpp +++ b/Engine/source/gui/3d/guiTSControl.cpp @@ -175,16 +175,16 @@ void GuiTSCtrl::initPersistFields() docsURL; addGroup( "Camera" ); - addField("cameraZRot", TypeF32, Offset(mCameraZRot, GuiTSCtrl), + addFieldV("cameraZRot", TypeRangedF32, Offset(mCameraZRot, GuiTSCtrl), &CommonValidators::DegreeRange, "Z rotation angle of camera." ); - addField("forceFOV", TypeF32, Offset(mForceFOV, GuiTSCtrl), + addFieldV("forceFOV", TypeRangedF32, Offset(mForceFOV, GuiTSCtrl), &CommonValidators::PosDegreeRange, "The vertical field of view in degrees or zero to use the normal camera FOV." ); endGroup( "Camera" ); addGroup( "Rendering" ); - addField( "reflectPriority", TypeF32, Offset( mReflectPriority, GuiTSCtrl ), + addFieldV( "reflectPriority", TypeRangedF32, Offset( mReflectPriority, GuiTSCtrl ), &CommonValidators::PositiveFloat, "The share of the per-frame reflection update work this control's rendering should run.\n" "The reflect update priorities of all visible GuiTSCtrls are added together and each control is assigned " "a share of the per-frame reflection update time according to its percentage of the total priority value." ); diff --git a/Engine/source/gui/buttons/guiIconButtonCtrl.cpp b/Engine/source/gui/buttons/guiIconButtonCtrl.cpp index b9288ec7e..b05fd6e0b 100644 --- a/Engine/source/gui/buttons/guiIconButtonCtrl.cpp +++ b/Engine/source/gui/buttons/guiIconButtonCtrl.cpp @@ -135,9 +135,9 @@ void GuiIconButtonCtrl::initPersistFields() addField( "makeIconSquare", TypeBool, Offset( mMakeIconSquare, GuiIconButtonCtrl ),"If true, will make sure the icon is square.\n"); addField( "textLocation", TYPEID< TextLocation >(), Offset( mTextLocation, GuiIconButtonCtrl ),"Where to place the text on the control.\n" "Options are 0 (None), 1 (Bottom), 2 (Right), 3 (Top), 4 (Left), 5 (Center).\n"); - addField( "textMargin", TypeS32, Offset( mTextMargin, GuiIconButtonCtrl ),"Margin between the icon and the text.\n"); + addFieldV( "textMargin", TypeRangedS32, Offset( mTextMargin, GuiIconButtonCtrl ),&CommonValidators::PositiveInt,"Margin between the icon and the text.\n"); addField( "autoSize", TypeBool, Offset( mAutoSize, GuiIconButtonCtrl ),"If true, the text and icon will be automatically sized to the size of the control.\n"); - addField( "bitmapMargin", TypeS32, Offset( mBitmapMargin, GuiIconButtonCtrl), "Margin between the icon and the border.\n"); + addFieldV( "bitmapMargin", TypeRangedS32, Offset( mBitmapMargin, GuiIconButtonCtrl), &CommonValidators::PositiveInt, "Margin between the icon and the border.\n"); Parent::initPersistFields(); } diff --git a/Engine/source/gui/containers/guiAutoScrollCtrl.cpp b/Engine/source/gui/containers/guiAutoScrollCtrl.cpp index e657a6b5f..24f2cbc36 100644 --- a/Engine/source/gui/containers/guiAutoScrollCtrl.cpp +++ b/Engine/source/gui/containers/guiAutoScrollCtrl.cpp @@ -112,14 +112,14 @@ void GuiAutoScrollCtrl::initPersistFields() addField( "scrollDirection", TYPEID< Direction >(), Offset( mDirection, GuiAutoScrollCtrl ), "Direction in which the child control is moved." ); - addField( "startDelay", TypeF32, Offset( mStartDelay, GuiAutoScrollCtrl ), + addFieldV( "startDelay", TypeRangedF32, Offset( mStartDelay, GuiAutoScrollCtrl ), &CommonValidators::PositiveFloat, "Seconds to wait before starting to scroll." ); - addField( "resetDelay", TypeF32, Offset( mResetDelay, GuiAutoScrollCtrl ), + addFieldV( "resetDelay", TypeRangedF32, Offset( mResetDelay, GuiAutoScrollCtrl ), &CommonValidators::PositiveFloat, "Seconds to wait after scrolling completes before resetting and starting over.\n\n" "@note Only takes effect if #isLooping is true." ); - addField( "childBorder", TypeS32, Offset( mChildBorder, GuiAutoScrollCtrl ), + addFieldV( "childBorder", TypeRangedS32, Offset( mChildBorder, GuiAutoScrollCtrl ), &CommonValidators::PositiveInt, "Padding to put around child control (in pixels)." ); - addField( "scrollSpeed", TypeF32, Offset( mScrollSpeed, GuiAutoScrollCtrl ), + addFieldV( "scrollSpeed", TypeRangedF32, Offset( mScrollSpeed, GuiAutoScrollCtrl ), &CommonValidators::PositiveFloat, "Scrolling speed in pixels per second." ); addField( "isLooping", TypeBool, Offset( mIsLooping, GuiAutoScrollCtrl ), "If true, the scrolling will reset to the beginning once completing a cycle." ); diff --git a/Engine/source/gui/containers/guiCtrlArrayCtrl.cpp b/Engine/source/gui/containers/guiCtrlArrayCtrl.cpp index ab81a9d2f..70791ad54 100644 --- a/Engine/source/gui/containers/guiCtrlArrayCtrl.cpp +++ b/Engine/source/gui/containers/guiCtrlArrayCtrl.cpp @@ -56,15 +56,15 @@ void GuiControlArrayControl::initPersistFields() docsURL; addGroup( "Array" ); - addField( "colCount", TypeS32, Offset(mCols, GuiControlArrayControl), + addFieldV( "colCount", TypeRangedS32, Offset(mCols, GuiControlArrayControl), &CommonValidators::PositiveInt, "Number of colums in the array." ); addField( "colSizes", TypeS32Vector, Offset(mColumnSizes, GuiControlArrayControl), "Size of each individual column." ); - addField( "rowSize", TypeS32, Offset(mRowSize, GuiControlArrayControl), + addFieldV( "rowSize", TypeRangedS32, Offset(mRowSize, GuiControlArrayControl), &CommonValidators::PositiveInt, "Heigth of a row in the array." ); - addField( "rowSpacing", TypeS32, Offset(mRowSpacing, GuiControlArrayControl), + addFieldV( "rowSpacing", TypeRangedS32, Offset(mRowSpacing, GuiControlArrayControl), &CommonValidators::PositiveInt, "Padding to put between rows." ); - addField( "colSpacing", TypeS32, Offset(mColSpacing, GuiControlArrayControl), + addFieldV( "colSpacing", TypeRangedS32, Offset(mColSpacing, GuiControlArrayControl), &CommonValidators::PositiveInt, "Padding to put between columns." ); endGroup( "Array" ); diff --git a/Engine/source/gui/containers/guiDragAndDropCtrl.cpp b/Engine/source/gui/containers/guiDragAndDropCtrl.cpp index 7503da072..a854d3070 100644 --- a/Engine/source/gui/containers/guiDragAndDropCtrl.cpp +++ b/Engine/source/gui/containers/guiDragAndDropCtrl.cpp @@ -215,6 +215,9 @@ void GuiDragAndDropControl::onMouseDragged( const GuiEvent& event ) // Allow the control under the drag to react to a potential drop GuiControl* enterTarget = findDragTarget( event.mousePoint, "onControlDragEnter" ); + if(enterTarget != nullptr) + Con::printf("GuiDragAndDropControl::onMouseDragged() - enterTarget: %d", enterTarget->getId()); + if( mLastTarget != enterTarget ) { if( mLastTarget ) diff --git a/Engine/source/gui/containers/guiDynamicCtrlArrayCtrl.cpp b/Engine/source/gui/containers/guiDynamicCtrlArrayCtrl.cpp index a9765bb4a..61ddefb10 100644 --- a/Engine/source/gui/containers/guiDynamicCtrlArrayCtrl.cpp +++ b/Engine/source/gui/containers/guiDynamicCtrlArrayCtrl.cpp @@ -98,28 +98,28 @@ ConsoleDocClass( GuiDynamicCtrlArrayControl, void GuiDynamicCtrlArrayControl::initPersistFields() { docsURL; - addField( "colCount", TypeS32, Offset( mCols, GuiDynamicCtrlArrayControl ), + addFieldV( "colCount", TypeRangedS32, Offset( mCols, GuiDynamicCtrlArrayControl ), &CommonValidators::PositiveInt, "Number of columns the child controls have been arranged into. This " "value is calculated automatically when children are added, removed or " "resized; writing it directly has no effect." ); - addField( "colSize", TypeS32, Offset( mColSize, GuiDynamicCtrlArrayControl ), + addFieldV( "colSize", TypeRangedS32, Offset( mColSize, GuiDynamicCtrlArrayControl ), &CommonValidators::PositiveInt, "Width of each column. If autoCellSize is set, this will be " "calculated automatically from the widest child control" ); - addField( "rowCount", TypeS32, Offset( mRows, GuiDynamicCtrlArrayControl ), + addFieldV( "rowCount", TypeRangedS32, Offset( mRows, GuiDynamicCtrlArrayControl ), &CommonValidators::PositiveInt, "Number of rows the child controls have been arranged into. This value " "is calculated automatically when children are added, removed or resized; " "writing it directly has no effect." ); - addField( "rowSize", TypeS32, Offset( mRowSize, GuiDynamicCtrlArrayControl ), + addFieldV( "rowSize", TypeRangedS32, Offset( mRowSize, GuiDynamicCtrlArrayControl ), &CommonValidators::PositiveInt, "Height of each row. If autoCellSize is set, this will be " "calculated automatically from the tallest child control" ); - addField( "rowSpacing", TypeS32, Offset( mRowSpacing, GuiDynamicCtrlArrayControl ), + addFieldV( "rowSpacing", TypeRangedS32, Offset( mRowSpacing, GuiDynamicCtrlArrayControl ), &CommonValidators::PositiveInt, "Spacing between rows" ); - addField( "colSpacing", TypeS32, Offset( mColSpacing, GuiDynamicCtrlArrayControl ), + addFieldV( "colSpacing", TypeRangedS32, Offset( mColSpacing, GuiDynamicCtrlArrayControl ), &CommonValidators::PositiveInt, "Spacing between columns" ); addField( "frozen", TypeBool, Offset( mFrozen, GuiDynamicCtrlArrayControl ), diff --git a/Engine/source/gui/containers/guiFrameCtrl.cpp b/Engine/source/gui/containers/guiFrameCtrl.cpp index ea18b1a4e..9f4d2809d 100644 --- a/Engine/source/gui/containers/guiFrameCtrl.cpp +++ b/Engine/source/gui/containers/guiFrameCtrl.cpp @@ -92,7 +92,7 @@ void GuiFrameSetCtrl::initPersistFields() addField( "rows", TypeS32Vector, Offset(mRowOffsets, GuiFrameSetCtrl), "A vector of row offsets (determines the height of each row)." ); - addField( "borderWidth", TypeS32, Offset(mFramesetDetails.mBorderWidth, GuiFrameSetCtrl), + addFieldV( "borderWidth", TypeRangedS32, Offset(mFramesetDetails.mBorderWidth, GuiFrameSetCtrl), &CommonValidators::PositiveInt, "Width of interior borders between cells in pixels." ); addField( "borderColor", TypeColorI, Offset(mFramesetDetails.mBorderColor, GuiFrameSetCtrl), @@ -111,7 +111,7 @@ void GuiFrameSetCtrl::initPersistFields() "If true, row and column offsets are automatically scaled to match the " "new extents when the control is resized." ); - addField( "fudgeFactor", TypeS32, Offset(mFudgeFactor, GuiFrameSetCtrl), + addFieldV( "fudgeFactor", TypeRangedS32, Offset(mFudgeFactor, GuiFrameSetCtrl), &CommonValidators::PositiveInt, "Offset for row and column dividers in pixels" ); Parent::initPersistFields(); diff --git a/Engine/source/gui/containers/guiRolloutCtrl.cpp b/Engine/source/gui/containers/guiRolloutCtrl.cpp index 1df533d68..eb8c91776 100644 --- a/Engine/source/gui/containers/guiRolloutCtrl.cpp +++ b/Engine/source/gui/containers/guiRolloutCtrl.cpp @@ -99,7 +99,7 @@ void GuiRolloutCtrl::initPersistFields() "Text label to display on the rollout header." ); addField( "margin", TypeRectI, Offset( mMargin, GuiRolloutCtrl ), "Margin to put around child control." ); - addField( "defaultHeight", TypeS32, Offset( mDefaultHeight, GuiRolloutCtrl ), + addFieldV( "defaultHeight", TypeRangedS32, Offset( mDefaultHeight, GuiRolloutCtrl ), &CommonValidators::PositiveInt, "Default height of the client area. This is used when no child control has been added to the rollout." ); addProtectedField( "expanded", TypeBool, Offset( mIsExpanded, GuiRolloutCtrl), &setExpanded, &defaultProtectedGetFn, "The current rollout expansion state." ); diff --git a/Engine/source/gui/containers/guiScrollCtrl.cpp b/Engine/source/gui/containers/guiScrollCtrl.cpp index c9f6d384f..47bf838cf 100644 --- a/Engine/source/gui/containers/guiScrollCtrl.cpp +++ b/Engine/source/gui/containers/guiScrollCtrl.cpp @@ -111,7 +111,7 @@ void GuiScrollCtrl::initPersistFields() addField( "constantThumbHeight", TypeBool, Offset(mUseConstantHeightThumb, GuiScrollCtrl)); addField( "childMargin", TypePoint2I, Offset(mChildMargin, GuiScrollCtrl), "Padding region to put around child contents." ); - addField( "mouseWheelScrollSpeed", TypeS32, Offset(mScrollAnimSpeed, GuiScrollCtrl), + addFieldV( "mouseWheelScrollSpeed", TypeRangedS32, Offset(mScrollAnimSpeed, GuiScrollCtrl), &CommonValidators::PositiveInt, "Pixels/Tick - if not positive then mousewheel scrolling occurs instantly (like other scrolling)."); endGroup( "Scrolling" ); diff --git a/Engine/source/gui/containers/guiSplitContainer.cpp b/Engine/source/gui/containers/guiSplitContainer.cpp index ff7f609c0..05b78ce74 100644 --- a/Engine/source/gui/containers/guiSplitContainer.cpp +++ b/Engine/source/gui/containers/guiSplitContainer.cpp @@ -118,14 +118,14 @@ void GuiSplitContainer::initPersistFields() addField( "orientation", TYPEID< Orientation >(), Offset( mOrientation, GuiSplitContainer), "Whether to split between top and bottom (horizontal) or between left and right (vertical)." ); - addField( "splitterSize", TypeS32, Offset( mSplitterSize, GuiSplitContainer), + addFieldV( "splitterSize", TypeRangedS32, Offset( mSplitterSize, GuiSplitContainer), &CommonValidators::PositiveInt, "Width of the splitter bar between the two sides. Default is 2." ); addField( "splitPoint", TypePoint2I, Offset( mSplitPoint, GuiSplitContainer), "Point on control through which the splitter goes.\n\n" "Changed relatively if size of control changes." ); addField( "fixedPanel", TYPEID< FixedPanel >(), Offset( mFixedPanel, GuiSplitContainer), "Which (if any) side of the splitter to keep at a fixed size." ); - addField( "fixedSize", TypeS32, Offset( mFixedPanelSize, GuiSplitContainer), + addFieldV( "fixedSize", TypeRangedS32, Offset( mFixedPanelSize, GuiSplitContainer), &CommonValidators::PositiveInt, "Width of the fixed panel specified by #fixedPanel (if any)." ); endGroup( "Splitter" ); diff --git a/Engine/source/gui/containers/guiSplitContainer.h b/Engine/source/gui/containers/guiSplitContainer.h index 3ac1c108e..a2babb2ae 100644 --- a/Engine/source/gui/containers/guiSplitContainer.h +++ b/Engine/source/gui/containers/guiSplitContainer.h @@ -110,4 +110,4 @@ DefineEnumType( GuiSplitFixedPanel ); /// @} -#endif // _GUI_SPLTCONTAINER_H_ \ No newline at end of file +#endif // _GUI_SPLTCONTAINER_H_ diff --git a/Engine/source/gui/containers/guiStackCtrl.cpp b/Engine/source/gui/containers/guiStackCtrl.cpp index e0ef13297..25deb84ff 100644 --- a/Engine/source/gui/containers/guiStackCtrl.cpp +++ b/Engine/source/gui/containers/guiStackCtrl.cpp @@ -110,7 +110,7 @@ void GuiStackControl::initPersistFields() "Controls the type of vertical stacking to use (Top to Bottom or " "Bottom to Top)" ); - addField( "padding", TypeS32, Offset(mPadding, GuiStackControl), + addFieldV( "padding", TypeRangedS32, Offset(mPadding, GuiStackControl), &CommonValidators::PositiveInt, "Distance (in pixels) between stacked child controls." ); addField( "dynamicSize", TypeBool, Offset(mDynamicSize, GuiStackControl), diff --git a/Engine/source/gui/containers/guiTabBookCtrl.cpp b/Engine/source/gui/containers/guiTabBookCtrl.cpp index a9810654e..68a69ac58 100644 --- a/Engine/source/gui/containers/guiTabBookCtrl.cpp +++ b/Engine/source/gui/containers/guiTabBookCtrl.cpp @@ -27,6 +27,7 @@ #include "gui/controls/guiPopUpCtrl.h" #include "gui/core/guiDefaultControlRender.h" #include "gfx/gfxDrawUtil.h" +#include "console/typeValidators.h" IMPLEMENT_CONOBJECT( GuiTabBookCtrl ); @@ -107,19 +108,19 @@ void GuiTabBookCtrl::initPersistFields() addField( "tabPosition", TYPEID< TabPosition >(), Offset( mTabPosition, GuiTabBookCtrl ), "Where to place the tab page headers." ); - addField( "tabMargin", TypeS32, Offset( mTabMargin, GuiTabBookCtrl ), + addFieldV( "tabMargin", TypeRangedS32, Offset( mTabMargin, GuiTabBookCtrl ), &CommonValidators::PositiveInt, "Spacing to put between individual tab page headers." ); - addField( "minTabWidth", TypeS32, Offset( mMinTabWidth, GuiTabBookCtrl ), + addFieldV( "minTabWidth", TypeRangedS32, Offset( mMinTabWidth, GuiTabBookCtrl ), &CommonValidators::PositiveInt, "Minimum width allocated to a tab page header." ); - addField( "tabHeight", TypeS32, Offset( mTabHeight, GuiTabBookCtrl ), + addFieldV( "tabHeight", TypeRangedS32, Offset( mTabHeight, GuiTabBookCtrl ), &CommonValidators::PositiveInt, "Height of tab page headers." ); addField( "allowReorder", TypeBool, Offset( mAllowReorder, GuiTabBookCtrl ), "Whether reordering tabs with the mouse is allowed." ); - addField( "defaultPage", TypeS32, Offset( mDefaultPageNum, GuiTabBookCtrl ), + addFieldV( "defaultPage", TypeRangedS32, Offset( mDefaultPageNum, GuiTabBookCtrl ), &CommonValidators::NegDefaultInt, "Index of page to select on first onWake() call (-1 to disable)." ); - addProtectedField( "selectedPage", TypeS32, Offset( mSelectedPageNum, GuiTabBookCtrl ), - &_setSelectedPage, &defaultProtectedGetFn, + addProtectedFieldV( "selectedPage", TypeRangedS32, Offset( mSelectedPageNum, GuiTabBookCtrl ), + &_setSelectedPage, &defaultProtectedGetFn, &CommonValidators::PositiveInt, "Index of currently selected page." ); addField( "frontTabPadding", TypeS32, Offset( mFrontTabPadding, GuiTabBookCtrl ), @@ -320,6 +321,15 @@ bool GuiTabBookCtrl::resize(const Point2I &newPosition, const Point2I &newExtent bool result = Parent::resize( newPosition, newExtent ); calculatePageTabs(); + + for (S32 i = 0; i < mPages.size(); i++) + { + const TabHeaderInfo& info = mPages[i]; + GuiTabPageCtrl* page = info.Page; + + if(page->getFitBook()) + fitPage(page); + } return result; } @@ -430,6 +440,18 @@ void GuiTabBookCtrl::onMouseMove(const GuiEvent &event) void GuiTabBookCtrl::onMouseLeave( const GuiEvent &event ) { Parent::onMouseLeave( event ); + + if(mDraggingTab) + { + //we dragged the tab out, so do something about that + GuiTabPageCtrl* selectedPage = NULL; + if (mSelectedPageNum != -1) + selectedPage = mPages[mSelectedPageNum].Page; + + mDraggingTab = false; + + Con::executef(this, "onTabDraggedOut", selectedPage->getIdString()); + } mHoverTab = NULL; } diff --git a/Engine/source/gui/containers/guiWindowCtrl.cpp b/Engine/source/gui/containers/guiWindowCtrl.cpp index bda7b0bfc..68f04c708 100644 --- a/Engine/source/gui/containers/guiWindowCtrl.cpp +++ b/Engine/source/gui/containers/guiWindowCtrl.cpp @@ -143,7 +143,7 @@ void GuiWindowCtrl::initPersistFields() "Whether the window can be resized horizontally." ); addField( "resizeHeight", TypeBool, Offset( mResizeHeight, GuiWindowCtrl ), "Whether the window can be resized vertically." ); - addField("resizeMargin", TypeF32, Offset(mResizeMargin, GuiWindowCtrl), + addFieldV("resizeMargin", TypeRangedF32, Offset(mResizeMargin, GuiWindowCtrl), &CommonValidators::PositiveFloat, "Margin along the window edge to allow grabbing."); addField( "canMove", TypeBool, Offset( mCanMove, GuiWindowCtrl ), "Whether the window can be moved by dragging its titlebar." ); diff --git a/Engine/source/gui/controls/guiAnimBitmapCtrl.cpp b/Engine/source/gui/controls/guiAnimBitmapCtrl.cpp index a098518e2..e9d6d148b 100644 --- a/Engine/source/gui/controls/guiAnimBitmapCtrl.cpp +++ b/Engine/source/gui/controls/guiAnimBitmapCtrl.cpp @@ -28,6 +28,7 @@ #include "console/engineAPI.h" #include "gfx/gfxDevice.h" #include "gfx/gfxDrawUtil.h" +#include "console/typeValidators.h" @@ -89,7 +90,7 @@ void guiAnimBitmapCtrl::initPersistFields() addField("reverse", TypeBool, Offset(mReverse, guiAnimBitmapCtrl), "play reversed?"); addField("fps", TypeS32, Offset(mFramesPerSec, guiAnimBitmapCtrl), "Frame Rate"); - addProtectedField("curFrame", TypeS32, Offset(mCurFrameIndex, guiAnimBitmapCtrl), &ptSetFrame, &defaultProtectedGetFn, "Index of currently Displaying Frame "); + addProtectedFieldV("curFrame", TypeRangedS32, Offset(mCurFrameIndex, guiAnimBitmapCtrl), &ptSetFrame, &defaultProtectedGetFn, &CommonValidators::S32Range, "Index of currently Displaying Frame "); Parent::initPersistFields(); removeField("wrap"); @@ -126,16 +127,21 @@ bool guiAnimBitmapCtrl::ptSetFrame(void *object, const char *index, const char * S32 val = dAtoi(data); - if (val < 0) + if ((val < 0) || (val >pData->mNumFrames)) { - pData->mCurFrameIndex = pData->mNumFrames; + if (pData->mLoop) + { + int len = pData->mNumFrames; + val = (val >= 0 ? val % len : -val % len ? len - (-val % len) : 0); + } + else + { + if (val < 0) val = 0; + if (val >pData->mNumFrames) val = pData->mNumFrames; + } + pData->mCurFrameIndex = val; return false; } - else if (val > pData->mNumFrames) - { - pData->mCurFrameIndex = 0; - return false; - }; pData->mCurFrameIndex = val; return true; diff --git a/Engine/source/gui/controls/guiBitmapBarCtrl.cpp b/Engine/source/gui/controls/guiBitmapBarCtrl.cpp index d1f17d2d0..1ee2d1a32 100644 --- a/Engine/source/gui/controls/guiBitmapBarCtrl.cpp +++ b/Engine/source/gui/controls/guiBitmapBarCtrl.cpp @@ -44,7 +44,7 @@ GuiBitmapBarCtrl::GuiBitmapBarCtrl(void) void GuiBitmapBarCtrl::initPersistFields() { docsURL; - addField("percent", TypeF32, Offset(mPercent, GuiBitmapBarCtrl), + addFieldV("percent", TypeRangedF32, Offset(mPercent, GuiBitmapBarCtrl), &CommonValidators::NormalizedFloat, "% shown"); addField("vertical", TypeBool, Offset(mVertical, GuiBitmapBarCtrl), "If true, the bitmap is clipped vertically."); diff --git a/Engine/source/gui/controls/guiBitmapCtrl.cpp b/Engine/source/gui/controls/guiBitmapCtrl.cpp index 783942d08..04f17e16b 100644 --- a/Engine/source/gui/controls/guiBitmapCtrl.cpp +++ b/Engine/source/gui/controls/guiBitmapCtrl.cpp @@ -88,7 +88,7 @@ void GuiBitmapCtrl::initPersistFields() addField( "wrap", TypeBool, Offset( mWrap, GuiBitmapCtrl ), "If true, the bitmap is tiled inside the control rather than stretched to fit." ); - addField("angle", TypeF32, Offset(mAngle, GuiBitmapCtrl), "rotation"); + addFieldV("angle", TypeRangedF32, Offset(mAngle, GuiBitmapCtrl), &CommonValidators::DegreeRange, "rotation"); endGroup( "Bitmap" ); diff --git a/Engine/source/gui/controls/guiColorPicker.cpp b/Engine/source/gui/controls/guiColorPicker.cpp index 4ec8bdafb..aa22978bc 100644 --- a/Engine/source/gui/controls/guiColorPicker.cpp +++ b/Engine/source/gui/controls/guiColorPicker.cpp @@ -29,6 +29,26 @@ #include "gui/controls/guiColorPicker.h" #include "gfx/primBuilder.h" #include "gfx/gfxDrawUtil.h" +#include "console/typeValidators.h" + +/// @name Common colors we use +/// @{ +LinearColorF colorWhite(1.,1.,1.); +LinearColorF colorWhiteBlend(1.,1.,1.,.75); +LinearColorF colorBlack(.0,.0,.0); +LinearColorF colorAlpha(0.0f, 0.0f, 0.0f, 0.0f); +LinearColorF colorAlphaW(1.0f, 1.0f, 1.0f, 0.0f); + +ColorI GuiColorPickerCtrl::mColorRange[7] = { + ColorI(255,0,0), // Red + ColorI(255,0,255), // Pink + ColorI(0,0,255), // Blue + ColorI(0,255,255), // Light blue + ColorI(0,255,0), // Green + ColorI(255,255,0), // Yellow + ColorI(255,0,0), // Red +}; +/// @} #include "postFx/postEffectManager.h" #include "gfx/screenshot.h" @@ -91,7 +111,9 @@ void GuiColorPickerCtrl::initPersistFields() { docsURL; addGroup("ColorPicker"); - addField("selectorGap", TypeS32, Offset(mSelectorGap, GuiColorPickerCtrl)); + addField("baseColor", TypeColorF, Offset(mBaseColor, GuiColorPickerCtrl)); + addField("pickColor", TypeColorF, Offset(mPickColor, GuiColorPickerCtrl)); + addFieldV("selectorGap", TypeRangedS32, Offset(mSelectorGap, GuiColorPickerCtrl),&CommonValidators::NaturalNumber); addField("displayMode", TYPEID< PickMode >(), Offset(mDisplayMode, GuiColorPickerCtrl) ); addField("selectorMode", TYPEID< SelectorMode >(), Offset(mSelectorMode, GuiColorPickerCtrl) ); addField("actionOnMove", TypeBool,Offset(mActionOnMove, GuiColorPickerCtrl)); diff --git a/Engine/source/gui/controls/guiGameListMenuCtrl.cpp b/Engine/source/gui/controls/guiGameListMenuCtrl.cpp index 4637a2285..1c71b17ac 100644 --- a/Engine/source/gui/controls/guiGameListMenuCtrl.cpp +++ b/Engine/source/gui/controls/guiGameListMenuCtrl.cpp @@ -29,6 +29,7 @@ #include "gui/containers/guiScrollCtrl.h" #include "sim/actionMap.h" #include "core/strings/stringUnit.h" +#include "console/typeValidators.h" //----------------------------------------------------------------------------- // GuiGameListMenuCtrl @@ -1878,10 +1879,10 @@ void GuiGameListMenuProfile::initPersistFields() addField( "rowSize", TypePoint2I, Offset(mRowSize, GuiGameListMenuProfile), "The base size (\"width height\") of a row" ); - addField("columnSplit", TypeS32, Offset(mColumnSplit, GuiGameListMenuProfile), + addFieldV("columnSplit", TypeRangedS32, Offset(mColumnSplit, GuiGameListMenuProfile), &CommonValidators::PositiveInt, "Padding between the leftmost edge of the control, and the row's left arrow."); - addField("rightPad", TypeS32, Offset(mRightPad, GuiGameListMenuProfile), + addFieldV("rightPad", TypeRangedS32, Offset(mRightPad, GuiGameListMenuProfile), &CommonValidators::PositiveInt, "Padding between the rightmost edge of the control and the row's right arrow."); Parent::initPersistFields(); diff --git a/Engine/source/gui/controls/guiGameListOptionsCtrl.cpp b/Engine/source/gui/controls/guiGameListOptionsCtrl.cpp index f4d40ebe6..52d5bd006 100644 --- a/Engine/source/gui/controls/guiGameListOptionsCtrl.cpp +++ b/Engine/source/gui/controls/guiGameListOptionsCtrl.cpp @@ -544,10 +544,10 @@ ConsoleDocClass( GuiGameListOptionsProfile, void GuiGameListOptionsProfile::initPersistFields() { docsURL; - addField( "columnSplit", TypeS32, Offset(mColumnSplit, GuiGameListOptionsProfile), + addFieldV( "columnSplit", TypeRangedS32, Offset(mColumnSplit, GuiGameListOptionsProfile), &CommonValidators::PositiveInt, "Padding between the leftmost edge of the control, and the row's left arrow." ); - addField( "rightPad", TypeS32, Offset(mRightPad, GuiGameListOptionsProfile), + addFieldV( "rightPad", TypeRangedS32, Offset(mRightPad, GuiGameListOptionsProfile), &CommonValidators::PositiveInt, "Padding between the rightmost edge of the control and the row's right arrow." ); Parent::initPersistFields(); diff --git a/Engine/source/gui/controls/guiGameSettingsCtrl.cpp b/Engine/source/gui/controls/guiGameSettingsCtrl.cpp index fff03c24b..0ee7cb91f 100644 --- a/Engine/source/gui/controls/guiGameSettingsCtrl.cpp +++ b/Engine/source/gui/controls/guiGameSettingsCtrl.cpp @@ -29,6 +29,7 @@ #include "gui/containers/guiScrollCtrl.h" #include "core/strings/stringUnit.h" #include "gui/core/guiDefaultControlRender.h" +#include "console/typeValidators.h" //----------------------------------------------------------------------------- // GuiGameSettingsCtrl @@ -844,13 +845,13 @@ void GuiGameSettingsCtrl::initPersistFields() INITPERSISTFIELD_IMAGEASSET(PreviousBitmap, GuiGameSettingsCtrl, "Bitmap used for the previous button when in list mode."); INITPERSISTFIELD_IMAGEASSET(NextBitmap, GuiGameSettingsCtrl, "Bitmap used for the next button when in list mode."); - addField("arrowSize", TypeS32, Offset(mArrowSize, GuiGameSettingsCtrl), + addFieldV("arrowSize", TypeRangedS32, Offset(mArrowSize, GuiGameSettingsCtrl), &CommonValidators::PositiveInt, "Size of the arrow buttons' extents"); - addField("columnSplit", TypeS32, Offset(mColumnSplit, GuiGameSettingsCtrl), + addFieldV("columnSplit", TypeRangedS32, Offset(mColumnSplit, GuiGameSettingsCtrl), &CommonValidators::NaturalNumber, "Position of the split between the leftside label and the rightside setting parts"); - addField("rightPad", TypeS32, Offset(mRightPad, GuiGameSettingsCtrl), + addFieldV("rightPad", TypeRangedS32, Offset(mRightPad, GuiGameSettingsCtrl), &CommonValidators::NaturalNumber, "Padding between the rightmost edge of the control and right arrow."); addField("callbackOnA", TypeString, Offset(mCallbackOnA, GuiGameSettingsCtrl), diff --git a/Engine/source/gui/controls/guiMLTextCtrl.cpp b/Engine/source/gui/controls/guiMLTextCtrl.cpp index 34e5e4100..5e2f12469 100644 --- a/Engine/source/gui/controls/guiMLTextCtrl.cpp +++ b/Engine/source/gui/controls/guiMLTextCtrl.cpp @@ -32,6 +32,7 @@ #include "sfx/sfxTrack.h" #include "sfx/sfxTypes.h" #include "console/engineAPI.h" +#include "console/typeValidators.h" IMPLEMENT_CONOBJECT( GuiMLTextCtrl ); @@ -301,18 +302,18 @@ void GuiMLTextCtrl::initPersistFields() docsURL; addGroup( "Text" ); - addField("lineSpacing", TypeS32, Offset(mLineSpacingPixels, GuiMLTextCtrl), "The number of blank pixels to place between each line.\n"); + addFieldV("lineSpacing", TypeRangedS32, Offset(mLineSpacingPixels, GuiMLTextCtrl), &CommonValidators::PositiveInt, "The number of blank pixels to place between each line.\n"); addField("allowColorChars", TypeBool, Offset(mAllowColorChars, GuiMLTextCtrl), "If true, the control will allow characters to have unique colors."); - addField("maxChars", TypeS32, Offset(mMaxBufferSize, GuiMLTextCtrl), "Maximum number of characters that the control will display."); + addFieldV("maxChars", TypeRangedS32, Offset(mMaxBufferSize, GuiMLTextCtrl), &CommonValidators::NegDefaultInt, "Maximum number of characters that the control will display."); INITPERSISTFIELD_SOUNDASSET(DeniedSound, GuiMLTextCtrl, "If the text will not fit in the control, the deniedSound is played."); addField("text", TypeCaseString, Offset( mInitialText, GuiMLTextCtrl ), "Text to display in this control."); addField("useURLMouseCursor", TypeBool, Offset(mUseURLMouseCursor, GuiMLTextCtrl), "If true, the mouse cursor will turn into a hand cursor while over a link in the text.\n" "This is dependant on the markup language used by the GuiMLTextCtrl\n"); addField("useTypeOverTime", TypeBool, Offset(mUseTypeOverTime, GuiMLTextCtrl), ""); - addField("typeOverTimeSpeedMS", TypeF32, Offset(mTypeOverTimeSpeedMS, GuiMLTextCtrl), ""); + addFieldV("typeOverTimeSpeedMS", TypeRangedF32, Offset(mTypeOverTimeSpeedMS, GuiMLTextCtrl), &CommonValidators::PositiveFloat, ""); addField("typeoutSound", TypeSFXTrackName, Offset(mTypeoutSound, GuiMLTextCtrl), "Played when the text is being typed out"); - addField("typeoutSoundRate", TypeS32, Offset(mTypeoutSoundRate, GuiMLTextCtrl), "Dictates how many characters must be typed out before the sound is played again. -1 for the sound to only play once at the start."); + addFieldV("typeoutSoundRate", TypeRangedS32, Offset(mTypeoutSoundRate, GuiMLTextCtrl), &CommonValidators::NegDefaultInt, "Dictates how many characters must be typed out before the sound is played again. -1 for the sound to only play once at the start."); endGroup( "Text" ); diff --git a/Engine/source/gui/controls/guiPopUpCtrl.cpp b/Engine/source/gui/controls/guiPopUpCtrl.cpp index ad4fafe4e..fb325dd4e 100644 --- a/Engine/source/gui/controls/guiPopUpCtrl.cpp +++ b/Engine/source/gui/controls/guiPopUpCtrl.cpp @@ -298,7 +298,7 @@ GuiPopUpMenuCtrl::~GuiPopUpMenuCtrl() void GuiPopUpMenuCtrl::initPersistFields(void) { docsURL; - addField("maxPopupHeight", TypeS32, Offset(mMaxPopupHeight, GuiPopUpMenuCtrl)); + addFieldV("maxPopupHeight", TypeRangedS32, Offset(mMaxPopupHeight, GuiPopUpMenuCtrl), &CommonValidators::PositiveInt); addField("sbUsesNAColor", TypeBool, Offset(mRenderScrollInNA, GuiPopUpMenuCtrl)); addField("reverseTextList", TypeBool, Offset(mReverseTextList, GuiPopUpMenuCtrl)); diff --git a/Engine/source/gui/controls/guiPopUpCtrlEx.cpp b/Engine/source/gui/controls/guiPopUpCtrlEx.cpp index 45183285d..1005780b5 100644 --- a/Engine/source/gui/controls/guiPopUpCtrlEx.cpp +++ b/Engine/source/gui/controls/guiPopUpCtrlEx.cpp @@ -28,6 +28,7 @@ #include "gfx/primBuilder.h" #include "gfx/gfxDrawUtil.h" #include "console/engineAPI.h" +#include "console/typeValidators.h" ConsoleDocClass( GuiPopUpMenuCtrlEx, "@brief A control that allows to select a value from a drop-down list.\n\n" @@ -352,7 +353,7 @@ GuiPopUpMenuCtrlEx::~GuiPopUpMenuCtrlEx() void GuiPopUpMenuCtrlEx::initPersistFields(void) { docsURL; - addField("maxPopupHeight", TypeS32, Offset(mMaxPopupHeight, GuiPopUpMenuCtrlEx), "Length of menu when it extends"); + addFieldV("maxPopupHeight", TypeRangedS32, Offset(mMaxPopupHeight, GuiPopUpMenuCtrlEx), &CommonValidators::PositiveInt, "Length of menu when it extends"); addField("sbUsesNAColor", TypeBool, Offset(mRenderScrollInNA, GuiPopUpMenuCtrlEx), "Deprecated" "@internal"); addField("reverseTextList", TypeBool, Offset(mReverseTextList, GuiPopUpMenuCtrlEx), "Reverses text list if popup extends up, instead of down"); @@ -1236,7 +1237,7 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect) { localStart.x = getWidth() - txt_w - 12; } - } + } else { localStart.x = mProfile->mTextOffset.x; // Use mProfile->mTextOffset as a controlable margin for the control's text. diff --git a/Engine/source/gui/controls/guiTextCtrl.cpp b/Engine/source/gui/controls/guiTextCtrl.cpp index 00b2bac2c..dbbdf25bc 100644 --- a/Engine/source/gui/controls/guiTextCtrl.cpp +++ b/Engine/source/gui/controls/guiTextCtrl.cpp @@ -96,7 +96,7 @@ void GuiTextCtrl::initPersistFields() addField( "textID", TypeString, Offset( mInitialTextID, GuiTextCtrl ), "Maps the text of this control to a variable used in localization, rather than raw text."); - addField( "maxLength", TypeS32, Offset( mMaxStrLen, GuiTextCtrl ), + addFieldV( "maxLength", TypeRangedS32, Offset( mMaxStrLen, GuiTextCtrl ), &CommonValidators::PositiveInt, "Defines the maximum length of the text. The default is 1024." ); Parent::initPersistFields(); diff --git a/Engine/source/gui/controls/guiTextEditCtrl.cpp b/Engine/source/gui/controls/guiTextEditCtrl.cpp index ea30740b5..ce5afc4a8 100644 --- a/Engine/source/gui/controls/guiTextEditCtrl.cpp +++ b/Engine/source/gui/controls/guiTextEditCtrl.cpp @@ -36,6 +36,7 @@ #include "sfx/sfxSystem.h" #include "core/strings/unicode.h" #include "console/engineAPI.h" +#include "console/typeValidators.h" IMPLEMENT_CONOBJECT(GuiTextEditCtrl); @@ -177,7 +178,7 @@ void GuiTextEditCtrl::initPersistFields() addField("validate", TypeRealString,Offset(mValidateCommand, GuiTextEditCtrl), "Script command to be called when the first validater is lost.\n"); addField("escapeCommand", TypeRealString,Offset(mEscapeCommand, GuiTextEditCtrl), "Script command to be called when the Escape key is pressed.\n"); - addField("historySize", TypeS32, Offset(mHistorySize, GuiTextEditCtrl), "How large of a history buffer to maintain.\n"); + addFieldV("historySize", TypeRangedS32, Offset(mHistorySize, GuiTextEditCtrl), &CommonValidators::PositiveInt, "How large of a history buffer to maintain.\n"); addField("tabComplete", TypeBool, Offset(mTabComplete, GuiTextEditCtrl), "If true, when the 'tab' key is pressed, it will act as if the Enter key was pressed on the control.\n"); addField("deniedSound", TypeSFXTrackName, Offset(mDeniedSound, GuiTextEditCtrl), "If the attempted text cannot be entered, this sound effect will be played.\n"); addField("sinkAllKeyEvents", TypeBool, Offset(mSinkAllKeyEvents, GuiTextEditCtrl), "If true, every key event will act as if the Enter key was pressed.\n"); diff --git a/Engine/source/gui/controls/guiTextEditSliderCtrl.cpp b/Engine/source/gui/controls/guiTextEditSliderCtrl.cpp index a22327b8c..a41f67804 100644 --- a/Engine/source/gui/controls/guiTextEditSliderCtrl.cpp +++ b/Engine/source/gui/controls/guiTextEditSliderCtrl.cpp @@ -341,6 +341,8 @@ void GuiTextEditSliderCtrl::onRender(Point2I offset, const RectI &updateRect) mIncCounter = (mIncCounter > 0.0f) ? mIncCounter-1 : mIncCounter+1; checkRange(); setValue(); + execConsoleCallback(); + execAltConsoleCallback(); mCursorPos = 0; } } diff --git a/Engine/source/gui/controls/guiTextListCtrl.cpp b/Engine/source/gui/controls/guiTextListCtrl.cpp index 174687f79..0507d4cfc 100644 --- a/Engine/source/gui/controls/guiTextListCtrl.cpp +++ b/Engine/source/gui/controls/guiTextListCtrl.cpp @@ -29,6 +29,7 @@ #include "gui/core/guiDefaultControlRender.h" #include "gfx/gfxDrawUtil.h" #include "console/engineAPI.h" +#include "console/typeValidators.h" IMPLEMENT_CONOBJECT(GuiTextListCtrl); @@ -134,7 +135,7 @@ void GuiTextListCtrl::initPersistFields() addField("columns", TypeS32Vector, Offset(mColumnOffsets, GuiTextListCtrl), "A vector of column offsets. The number of values determines the number of columns in the table.\n" ); addField("fitParentWidth", TypeBool, Offset(mFitParentWidth, GuiTextListCtrl), "If true, the width of this control will match the width of its parent.\n"); addField("clipColumnText", TypeBool, Offset(mClipColumnText, GuiTextListCtrl), "If true, text exceeding a column's given width will get clipped.\n" ); - addField("rowHeightPadding", TypeS32, Offset(mRowHeightPadding, GuiTextListCtrl), "Sets how much padding to add to the row heights on top of the font height"); + addFieldV("rowHeightPadding", TypeRangedS32, Offset(mRowHeightPadding, GuiTextListCtrl), &CommonValidators::PositiveInt, "Sets how much padding to add to the row heights on top of the font height"); Parent::initPersistFields(); } diff --git a/Engine/source/gui/controls/guiTreeViewCtrl.cpp b/Engine/source/gui/controls/guiTreeViewCtrl.cpp index e1589aed5..2e6a1e8b8 100644 --- a/Engine/source/gui/controls/guiTreeViewCtrl.cpp +++ b/Engine/source/gui/controls/guiTreeViewCtrl.cpp @@ -883,10 +883,10 @@ void GuiTreeViewCtrl::initPersistFields() docsURL; addGroup( "TreeView" ); - addField( "tabSize", TypeS32, Offset(mTabSize, GuiTreeViewCtrl)); + addFieldV( "tabSize", TypeRangedS32, Offset(mTabSize, GuiTreeViewCtrl), &CommonValidators::PositiveInt); addField( "textOffset", TypeS32, Offset(mTextOffset, GuiTreeViewCtrl)); addField( "fullRowSelect", TypeBool, Offset(mFullRowSelect, GuiTreeViewCtrl)); - addField( "itemHeight", TypeS32, Offset(mItemHeight, GuiTreeViewCtrl)); + addFieldV( "itemHeight", TypeRangedS32, Offset(mItemHeight, GuiTreeViewCtrl), &CommonValidators::PositiveInt); addField( "destroyTreeOnSleep", TypeBool, Offset(mDestroyOnSleep, GuiTreeViewCtrl), "If true, the entire tree item hierarchy is deleted when the control goes to sleep." ); addField( "mouseDragging", TypeBool, Offset(mSupportMouseDragging, GuiTreeViewCtrl)); diff --git a/Engine/source/gui/core/guiControl.cpp b/Engine/source/gui/core/guiControl.cpp index 005274ab5..5cd499c29 100644 --- a/Engine/source/gui/core/guiControl.cpp +++ b/Engine/source/gui/core/guiControl.cpp @@ -39,6 +39,7 @@ #include "gui/core/guiDefaultControlRender.h" #include "gui/editor/guiEditCtrl.h" #include "gfx/gfxDrawUtil.h" +#include "console/typeValidators.h" //#define DEBUG_SPEW @@ -306,7 +307,7 @@ void GuiControl::initPersistFields() "Control profile to use when rendering tooltips for this control." ); addField("tooltip", TypeRealString, Offset(mTooltip, GuiControl), "String to show in tooltip for this control." ); - addField("hovertime", TypeS32, Offset(mTipHoverTime, GuiControl), + addFieldV("hovertime", TypeRangedS32, Offset(mTipHoverTime, GuiControl), &CommonValidators::PositiveInt, "Time for mouse to hover over control until tooltip is shown (in milliseconds)." ); endGroup( "ToolTip" ); diff --git a/Engine/source/gui/core/guiTypes.cpp b/Engine/source/gui/core/guiTypes.cpp index 528ea5425..f8a6c544a 100644 --- a/Engine/source/gui/core/guiTypes.cpp +++ b/Engine/source/gui/core/guiTypes.cpp @@ -34,6 +34,7 @@ #include "sfx/sfxTrack.h" #include "sfx/sfxTypes.h" #include "console/engineAPI.h" +#include "console/typeValidators.h" //#define DEBUG_SPEW @@ -370,9 +371,9 @@ void GuiControlProfile::initPersistFields() addField("fillColorNA", TypeColorI, Offset(mFillColorNA, GuiControlProfile)); addField("fillColorERR", TypeColorI, Offset(mFillColorERR, GuiControlProfile)); addField("fillColorSEL", TypeColorI, Offset(mFillColorSEL, GuiControlProfile)); - addField("border", TypeS32, Offset(mBorder, GuiControlProfile), + addFieldV("border", TypeRangedS32, Offset(mBorder, GuiControlProfile), &CommonValidators::PositiveInt, "Border type (0=no border)." ); - addField("borderThickness",TypeS32, Offset(mBorderThickness, GuiControlProfile), + addFieldV("borderThickness", TypeRangedS32, Offset(mBorderThickness, GuiControlProfile), &CommonValidators::PositiveInt, "Thickness of border in pixels." ); addField("borderColor", TypeColorI, Offset(mBorderColor, GuiControlProfile), "Color to draw border with." ); @@ -394,7 +395,7 @@ void GuiControlProfile::initPersistFields() addField("fontType", TypeString, Offset(mFontType, GuiControlProfile), "Name of font family and typeface (e.g. \"Arial Bold\")." ); - addField("fontSize", TypeS32, Offset(mFontSize, GuiControlProfile), + addFieldV("fontSize", TypeRangedS32, Offset(mFontSize, GuiControlProfile), &CommonValidators::PositiveInt, "Font size in points." ); addField("fontCharset", TYPEID< FontCharset >(), Offset(mFontCharset, GuiControlProfile) ); addField("fontColors", TypeColorI, Offset(mFontColors, GuiControlProfile), ColorMax, diff --git a/Engine/source/gui/editor/guiEaseViewCtrl.cpp b/Engine/source/gui/editor/guiEaseViewCtrl.cpp index c78d92266..a47bf99dd 100644 --- a/Engine/source/gui/editor/guiEaseViewCtrl.cpp +++ b/Engine/source/gui/editor/guiEaseViewCtrl.cpp @@ -54,7 +54,7 @@ void GuiEaseViewCtrl::initPersistFields() addField("ease", TypeEaseF, Offset( mEase, GuiEaseViewCtrl ) ); addField("easeColor", TypeColorF, Offset( mEaseColor, GuiEaseViewCtrl ) ); - addField("easeWidth", TypeF32, Offset(mEaseWidth, GuiEaseViewCtrl ) ); + addFieldV("easeWidth", TypeRangedF32, Offset(mEaseWidth, GuiEaseViewCtrl ), &CommonValidators::PositiveNonZeroFloat); addField("axisColor", TypeColorF, Offset( mAxisColor, GuiEaseViewCtrl ) ); } diff --git a/Engine/source/gui/editor/guiEditCtrl.cpp b/Engine/source/gui/editor/guiEditCtrl.cpp index c30dab15d..ba2b985ab 100644 --- a/Engine/source/gui/editor/guiEditCtrl.cpp +++ b/Engine/source/gui/editor/guiEditCtrl.cpp @@ -152,7 +152,7 @@ void GuiEditCtrl::initPersistFields() "If true, selection edges will snap into alignment when moved or resized." ); addField( "snapToCenters", TypeBool, Offset( mSnapToCenters, GuiEditCtrl ), "If true, selection centers will snap into alignment when moved or resized." ); - addField( "snapSensitivity", TypeS32, Offset( mSnapSensitivity, GuiEditCtrl ), + addFieldV( "snapSensitivity", TypeRangedS32, Offset( mSnapSensitivity, GuiEditCtrl ), &CommonValidators::PositiveInt, "Distance in pixels that edge and center snapping will work across." ); endGroup( "Snapping" ); diff --git a/Engine/source/gui/editor/guiFilterCtrl.cpp b/Engine/source/gui/editor/guiFilterCtrl.cpp index d331efbf0..a352e66ba 100644 --- a/Engine/source/gui/editor/guiFilterCtrl.cpp +++ b/Engine/source/gui/editor/guiFilterCtrl.cpp @@ -29,6 +29,7 @@ #include "guiFilterCtrl.h" #include "math/mMath.h" #include "gfx/gfxDrawUtil.h" +#include "console/typeValidators.h" IMPLEMENT_CONOBJECT(GuiFilterCtrl); @@ -51,7 +52,7 @@ GuiFilterCtrl::GuiFilterCtrl() void GuiFilterCtrl::initPersistFields() { docsURL; - addField("controlPoints", TypeS32, Offset(mControlPointRequest, GuiFilterCtrl), + addFieldV("controlPoints", TypeRangedS32, Offset(mControlPointRequest, GuiFilterCtrl), &CommonValidators::NaturalNumber, "Total number of control points in the spline curve." ); addField("filter", TypeF32Vector, Offset(mFilter, GuiFilterCtrl), "Vector of control points." ); diff --git a/Engine/source/gui/editor/guiGraphCtrl.cpp b/Engine/source/gui/editor/guiGraphCtrl.cpp index 551b737c9..89113c8d1 100644 --- a/Engine/source/gui/editor/guiGraphCtrl.cpp +++ b/Engine/source/gui/editor/guiGraphCtrl.cpp @@ -105,7 +105,7 @@ void GuiGraphCtrl::initPersistFields() docsURL; addGroup( "Graph" ); - addField( "centerY", TypeF32, Offset( mCenterY, GuiGraphCtrl ), + addFieldV( "centerY", TypeRangedF32, Offset( mCenterY, GuiGraphCtrl ), &CommonValidators::NormalizedFloat, "Ratio of where to place the center coordinate of the graph on the Y axis. 0.5=middle height of control.\n\n" "This allows to account for graphs that have only positive or only negative data points, for example." ); @@ -119,7 +119,7 @@ void GuiGraphCtrl::initPersistFields() "Name of the variable to automatically plot on the curves. If empty, auto-plotting " "is disabled for the respective curve." ); - addField( "plotInterval", TypeS32, Offset( mAutoPlotDelay, GuiGraphCtrl ), MaxPlots, + addFieldV( "plotInterval", TypeRangedS32, Offset( mAutoPlotDelay, GuiGraphCtrl ), &CommonValidators::PositiveInt, MaxPlots, "Interval between auto-plots of #plotVariable for the respective curve (in milliseconds)." ); endGroup( "Graph" ); diff --git a/Engine/source/gui/editor/guiMenuBar.cpp b/Engine/source/gui/editor/guiMenuBar.cpp index bfef0f04d..b33079799 100644 --- a/Engine/source/gui/editor/guiMenuBar.cpp +++ b/Engine/source/gui/editor/guiMenuBar.cpp @@ -34,6 +34,7 @@ #include "gfx/primBuilder.h" #include "console/engineAPI.h" #include "gui/editor/guiPopupMenuCtrl.h" +#include "console/typeValidators.h" // menu bar: // basic idea - fixed height control bar at the top of a window, placed and sized in gui editor @@ -188,9 +189,9 @@ void GuiMenuBar::onRemove() void GuiMenuBar::initPersistFields() { docsURL; - addField("padding", TypeS32, Offset( mPadding, GuiMenuBar ),"Extra padding to add to the bounds of the control.\n"); + addFieldV("padding", TypeRangedS32, Offset( mPadding, GuiMenuBar ), &CommonValidators::PositiveInt,"Extra padding to add to the bounds of the control.\n"); - addField("menubarHeight", TypeS32, Offset(mMenubarHeight, GuiMenuBar), "Sets the height of the menubar when attached to the canvas.\n"); + addFieldV("menubarHeight", TypeRangedS32, Offset(mMenubarHeight, GuiMenuBar), &CommonValidators::PositiveInt, "Sets the height of the menubar when attached to the canvas.\n"); Parent::initPersistFields(); } diff --git a/Engine/source/gui/editor/guiRectHandles.cpp b/Engine/source/gui/editor/guiRectHandles.cpp index 52a303673..f2435a842 100644 --- a/Engine/source/gui/editor/guiRectHandles.cpp +++ b/Engine/source/gui/editor/guiRectHandles.cpp @@ -25,6 +25,7 @@ #include "console/engineAPI.h" #include "gfx/gfxDevice.h" #include "gfx/gfxDrawUtil.h" +#include "console/typeValidators.h" #include "gui/editor/guiRectHandles.h" @@ -55,7 +56,7 @@ void GuiRectHandles::initPersistFields() { docsURL; addField("handleRect", TypeRectF, Offset(mHandleRect, GuiRectHandles), "RectF of handle's box." ); - addField("handleSize", TypeS32, Offset(mHandleSize, GuiRectHandles), "Size of handles in pixels." ); + addFieldV("handleSize", TypeRangedS32, Offset(mHandleSize, GuiRectHandles), &CommonValidators::NaturalNumber, "Size of handles in pixels." ); addField("useCustomColor", TypeBool, Offset(mUseCustomColor, GuiRectHandles), "Use given custom color for handles." ); addField("handleColor", TypeColorI, Offset(mHandleColor, GuiRectHandles), "Use given custom color for handles." ); diff --git a/Engine/source/gui/editor/guiSeparatorCtrl.cpp b/Engine/source/gui/editor/guiSeparatorCtrl.cpp index bb6b6c903..5ab04b112 100644 --- a/Engine/source/gui/editor/guiSeparatorCtrl.cpp +++ b/Engine/source/gui/editor/guiSeparatorCtrl.cpp @@ -29,6 +29,7 @@ #include "console/consoleTypes.h" #include "gui/core/guiCanvas.h" #include "gui/core/guiDefaultControlRender.h" +#include "console/typeValidators.h" IMPLEMENT_CONOBJECT(GuiSeparatorCtrl); @@ -77,9 +78,9 @@ void GuiSeparatorCtrl::initPersistFields() "Optional text label to display." ); addField("type", TYPEID< separatorTypeOptions >(), Offset(mSeparatorType, GuiSeparatorCtrl), "Orientation of separator." ); - addField("borderMargin", TypeS32, Offset(mMargin, GuiSeparatorCtrl)); + addFieldV("borderMargin", TypeRangedS32, Offset(mMargin, GuiSeparatorCtrl), &CommonValidators::PositiveInt); addField("invisible", TypeBool, Offset(mInvisible, GuiSeparatorCtrl));// Nonsense. Should use GuiControl's visibility. - addField("leftMargin", TypeS32, Offset(mTextLeftMargin, GuiSeparatorCtrl), + addFieldV("leftMargin", TypeRangedS32, Offset(mTextLeftMargin, GuiSeparatorCtrl), &CommonValidators::PositiveInt, "Left margin of text label." ); Parent::initPersistFields(); diff --git a/Engine/source/gui/editor/guiShapeEdPreview.cpp b/Engine/source/gui/editor/guiShapeEdPreview.cpp index e19138004..1724db214 100644 --- a/Engine/source/gui/editor/guiShapeEdPreview.cpp +++ b/Engine/source/gui/editor/guiShapeEdPreview.cpp @@ -174,7 +174,7 @@ void GuiShapeEdPreview::initPersistFields() addGroup( "Detail Stats" ); addField( "fixedDetail", TypeBool, Offset( mFixedDetail, GuiShapeEdPreview ), "If false, the current detail is selected based on camera distance" ); - addField( "orbitDist", TypeF32, Offset( mOrbitDist, GuiShapeEdPreview ), + addFieldV( "orbitDist", TypeRangedF32, Offset( mOrbitDist, GuiShapeEdPreview ), &CommonValidators::PositiveFloat, "The current distance from the camera to the model" ); addProtectedField( "currentDL", TypeS32, Offset( mCurrentDL, GuiShapeEdPreview ), &setFieldCurrentDL, &defaultProtectedGetFn, "The current detail level" ); diff --git a/Engine/source/gui/game/guiFadeinBitmapCtrl.cpp b/Engine/source/gui/game/guiFadeinBitmapCtrl.cpp index f2820ae2c..2a2f2eebf 100644 --- a/Engine/source/gui/game/guiFadeinBitmapCtrl.cpp +++ b/Engine/source/gui/game/guiFadeinBitmapCtrl.cpp @@ -92,11 +92,11 @@ void GuiFadeinBitmapCtrl::initPersistFields() addField( "fadeColor", TypeColorF, Offset( mFadeColor, GuiFadeinBitmapCtrl ), "Color to fade in from and fade out to." ); - addField( "fadeInTime", TypeS32, Offset( mFadeInTime, GuiFadeinBitmapCtrl ), + addFieldV( "fadeInTime", TypeRangedS32, Offset( mFadeInTime, GuiFadeinBitmapCtrl ), &CommonValidators::PositiveInt, "Milliseconds for the bitmap to fade in." ); - addField( "waitTime", TypeS32, Offset( mWaitTime, GuiFadeinBitmapCtrl ), + addFieldV( "waitTime", TypeRangedS32, Offset( mWaitTime, GuiFadeinBitmapCtrl ), &CommonValidators::PositiveInt, "Milliseconds to wait after fading in before fading out the bitmap." ); - addField( "fadeOutTime", TypeS32, Offset( mFadeOutTime, GuiFadeinBitmapCtrl ), + addFieldV( "fadeOutTime", TypeRangedS32, Offset( mFadeOutTime, GuiFadeinBitmapCtrl ), &CommonValidators::PositiveInt, "Milliseconds for the bitmap to fade out." ); addField( "fadeInEase", TypeEaseF, Offset( mFadeInEase, GuiFadeinBitmapCtrl ), "Easing curve for fade-in." ); diff --git a/Engine/source/gui/game/guiIdleCamFadeBitmapCtrl.cpp b/Engine/source/gui/game/guiIdleCamFadeBitmapCtrl.cpp index 55a0891d6..b2fcbb16e 100644 --- a/Engine/source/gui/game/guiIdleCamFadeBitmapCtrl.cpp +++ b/Engine/source/gui/game/guiIdleCamFadeBitmapCtrl.cpp @@ -22,6 +22,7 @@ #include "platform/platform.h" #include "gui/controls/guiBitmapCtrl.h" +#include "console/typeValidators.h" #include "console/console.h" #include "console/consoleTypes.h" @@ -161,8 +162,8 @@ public: static void initPersistFields() { - addField("fadeinTime", TypeS32, Offset(fadeinTime, GuiIdleCamFadeBitmapCtrl)); - addField("fadeoutTime", TypeS32, Offset(fadeoutTime, GuiIdleCamFadeBitmapCtrl)); + addFieldV("fadeinTime", TypeRangedS32, Offset(fadeinTime, GuiIdleCamFadeBitmapCtrl), &CommonValidators::PositiveInt); + addFieldV("fadeoutTime", TypeRangedS32, Offset(fadeoutTime, GuiIdleCamFadeBitmapCtrl), &CommonValidators::PositiveInt); addField("done", TypeBool, Offset(done, GuiIdleCamFadeBitmapCtrl)); Parent::initPersistFields(); } diff --git a/Engine/source/gui/game/guiMessageVectorCtrl.cpp b/Engine/source/gui/game/guiMessageVectorCtrl.cpp index 313b7a265..77474b027 100644 --- a/Engine/source/gui/game/guiMessageVectorCtrl.cpp +++ b/Engine/source/gui/game/guiMessageVectorCtrl.cpp @@ -22,6 +22,7 @@ #include "platform/platform.h" #include "gui/game/guiMessageVectorCtrl.h" +#include "console/typeValidators.h" #include "gui/utility/messageVector.h" #include "console/consoleTypes.h" @@ -193,11 +194,11 @@ GuiMessageVectorCtrl::~GuiMessageVectorCtrl() void GuiMessageVectorCtrl::initPersistFields() { docsURL; - addField("lineSpacing", TypeS32, Offset(mLineSpacingPixels, GuiMessageVectorCtrl)); - addField("lineContinuedIndex", TypeS32, Offset(mLineContinuationIndent, GuiMessageVectorCtrl)); + addFieldV("lineSpacing", TypeRangedS32, Offset(mLineSpacingPixels, GuiMessageVectorCtrl), &CommonValidators::PositiveInt); + addFieldV("lineContinuedIndex", TypeRangedS32, Offset(mLineContinuationIndent, GuiMessageVectorCtrl), &CommonValidators::PositiveInt); addField("allowedMatches", TypeString, Offset(mAllowedMatches, GuiMessageVectorCtrl), 16); addField("matchColor", TypeColorI, Offset(mSpecialColor, GuiMessageVectorCtrl)); - addField("maxColorIndex", TypeS32, Offset(mMaxColorIndex, GuiMessageVectorCtrl)); + addFieldV("maxColorIndex", TypeRangedS32, Offset(mMaxColorIndex, GuiMessageVectorCtrl), &CommonValidators::S32_8BitCap); Parent::initPersistFields(); } diff --git a/Engine/source/gui/shaderEditor/guiShaderEditor.cpp b/Engine/source/gui/shaderEditor/guiShaderEditor.cpp index 7d0415296..ef4c48aee 100644 --- a/Engine/source/gui/shaderEditor/guiShaderEditor.cpp +++ b/Engine/source/gui/shaderEditor/guiShaderEditor.cpp @@ -88,7 +88,7 @@ void GuiShaderEditor::initPersistFields() { docsURL; addGroup("Node Settings"); - addFieldV("nodeSize", TypeS32, Offset(mNodeSize, GuiShaderEditor),&nodeSizeRange, + addFieldV("nodeSize", TypeRangedS32, Offset(mNodeSize, GuiShaderEditor),&nodeSizeRange, "Size of nodes."); endGroup("Node Settings"); diff --git a/Engine/source/gui/shiny/guiAudioCtrl.cpp b/Engine/source/gui/shiny/guiAudioCtrl.cpp index 498b08db2..c40f8042c 100644 --- a/Engine/source/gui/shiny/guiAudioCtrl.cpp +++ b/Engine/source/gui/shiny/guiAudioCtrl.cpp @@ -26,6 +26,7 @@ #include "sfx/sfxTrack.h" #include "sfx/sfxSource.h" #include "sfx/sfxTypes.h" +#include "console/typeValidators.h" #define TickMs 32 @@ -116,7 +117,7 @@ void GuiAudioCtrl::initPersistFields() { addGroup("Sounds"); INITPERSISTFIELD_SOUNDASSET(Sound, GuiAudioCtrl, "Looping SoundAsset to play while GuiAudioCtrl is active."); - addField("tickPeriodMS", TypeS32, Offset(mTickPeriodMS, GuiAudioCtrl), + addFieldV("tickPeriodMS", TypeRangedS32, Offset(mTickPeriodMS, GuiAudioCtrl), &CommonValidators::MSTickRange, "@brief Time in milliseconds between calls to onTick().\n\n" "@see onTickTrigger()\n"); addField("playIf", TypeCommand, Offset(mPlayIf, GuiAudioCtrl), "evaluation condition to trip playback (true/false)"); @@ -127,19 +128,19 @@ void GuiAudioCtrl::initPersistFields() "The SFXSource to which to assign the sound of this emitter as a child.\n" "@note This field is ignored if #useTrackDescriptionOnly is true.\n\n" "@see SFXDescription::sourceGroup"); - addField("volume", TypeF32, Offset(mVolume, GuiAudioCtrl), + addFieldV("volume", TypeRangedF32, Offset(mVolume, GuiAudioCtrl), &CommonValidators::PositiveFloat, "Volume level to apply to the sound.\n" "@note This field is ignored if #useTrackDescriptionOnly is true.\n\n" "@see SFXDescription::volume"); - addField("pitch", TypeF32, Offset(mPitch, GuiAudioCtrl), + addFieldV("pitch", TypeRangedF32, Offset(mPitch, GuiAudioCtrl), &CommonValidators::PositiveFloat, "Pitch shift to apply to the sound. Default is 1 = play at normal speed.\n" "@note This field is ignored if #useTrackDescriptionOnly is true.\n\n" "@see SFXDescription::pitch"); - addField("fadeInTime", TypeF32, Offset(mFadeInTime, GuiAudioCtrl), + addFieldV("fadeInTime", TypeRangedF32, Offset(mFadeInTime, GuiAudioCtrl), &CommonValidators::PositiveFloat, "Number of seconds to gradually fade in volume from zero when playback starts.\n" "@note This field is ignored if #useTrackDescriptionOnly is true.\n\n" "@see SFXDescription::fadeInTime"); - addField("fadeOutTime", TypeF32, Offset(mFadeOutTime, GuiAudioCtrl), + addFieldV("fadeOutTime", TypeRangedF32, Offset(mFadeOutTime, GuiAudioCtrl), &CommonValidators::PositiveFloat, "Number of seconds to gradually fade out volume down to zero when playback is stopped or paused.\n" "@note This field is ignored if #useTrackDescriptionOnly is true.\n\n" "@see SFXDescription::fadeOutTime"); diff --git a/Engine/source/gui/worldEditor/editTSCtrl.cpp b/Engine/source/gui/worldEditor/editTSCtrl.cpp index 4a219691c..d3c0fc5ef 100644 --- a/Engine/source/gui/worldEditor/editTSCtrl.cpp +++ b/Engine/source/gui/worldEditor/editTSCtrl.cpp @@ -37,6 +37,7 @@ #include "scene/sceneManager.h" #include "scene/sceneRenderState.h" #include "renderInstance/renderBinManager.h" +#include "console/typeValidators.h" #include "T3D/Scene.h" @@ -238,7 +239,7 @@ void EditTSCtrl::initPersistFields() addField("renderMissionArea", TypeBool, Offset(mRenderMissionArea, EditTSCtrl)); addField("missionAreaFillColor", TypeColorI, Offset(mMissionAreaFillColor, EditTSCtrl)); addField("missionAreaFrameColor", TypeColorI, Offset(mMissionAreaFrameColor, EditTSCtrl)); - addField("missionAreaHeightAdjust", TypeF32, Offset(mMissionAreaHeightAdjust, EditTSCtrl), + addFieldV("missionAreaHeightAdjust", TypeRangedF32, Offset(mMissionAreaHeightAdjust, EditTSCtrl), &CommonValidators::PositiveFloat, "How high above and below the terrain to render the mission area bounds." ); endGroup("Mission Area"); @@ -246,8 +247,8 @@ void EditTSCtrl::initPersistFields() addGroup("BorderMovement"); addField("allowBorderMove", TypeBool, Offset(mAllowBorderMove, EditTSCtrl)); - addField("borderMovePixelSize", TypeS32, Offset(mMouseMoveBorder, EditTSCtrl)); - addField("borderMoveSpeed", TypeF32, Offset(mMouseMoveSpeed, EditTSCtrl)); + addFieldV("borderMovePixelSize", TypeRangedS32, Offset(mMouseMoveBorder, EditTSCtrl), &CommonValidators::PositiveInt); + addFieldV("borderMoveSpeed", TypeRangedF32, Offset(mMouseMoveSpeed, EditTSCtrl), &CommonValidators::PositiveFloat); endGroup("BorderMovement"); @@ -255,9 +256,9 @@ void EditTSCtrl::initPersistFields() addField("consoleFrameColor", TypeColorI, Offset(mConsoleFrameColor, EditTSCtrl)); addField("consoleFillColor", TypeColorI, Offset(mConsoleFillColor, EditTSCtrl)); - addField("consoleSphereLevel", TypeS32, Offset(mConsoleSphereLevel, EditTSCtrl)); - addField("consoleCircleSegments", TypeS32, Offset(mConsoleCircleSegments, EditTSCtrl)); - addField("consoleLineWidth", TypeS32, Offset(mConsoleLineWidth, EditTSCtrl)); + addFieldV("consoleSphereLevel", TypeRangedS32, Offset(mConsoleSphereLevel, EditTSCtrl), &CommonValidators::NaturalNumber); + addFieldV("consoleCircleSegments", TypeRangedS32, Offset(mConsoleCircleSegments, EditTSCtrl), &CommonValidators::NaturalNumber); + addFieldV("consoleLineWidth", TypeRangedS32, Offset(mConsoleLineWidth, EditTSCtrl), &CommonValidators::NaturalNumber); addField("gizmoProfile", TYPEID< GizmoProfile >(), Offset(mGizmoProfile, EditTSCtrl)); endGroup("Misc"); diff --git a/Engine/source/materials/customMaterialDefinition.cpp b/Engine/source/materials/customMaterialDefinition.cpp index f66273c41..c819e95d3 100644 --- a/Engine/source/materials/customMaterialDefinition.cpp +++ b/Engine/source/materials/customMaterialDefinition.cpp @@ -82,7 +82,7 @@ CustomMaterial::CustomMaterial() void CustomMaterial::initPersistFields() { docsURL; - addField("version", TypeF32, Offset(mVersion, CustomMaterial), + addFieldV("version", TypeRangedF32, Offset(mVersion, CustomMaterial), &CommonValidators::PositiveFloat, "@brief Specifies pixel shader version for hardware.\n\n" "Valid pixel shader versions include 2.0, 3.0, etc. " "@note All features aren't compatible with all pixel shader versions."); diff --git a/Engine/source/materials/materialDefinition.cpp b/Engine/source/materials/materialDefinition.cpp index 70a3eabe6..076f39cd6 100644 --- a/Engine/source/materials/materialDefinition.cpp +++ b/Engine/source/materials/materialDefinition.cpp @@ -38,6 +38,7 @@ #include "T3D/accumulationVolume.h" #include "gui/controls/guiTreeViewCtrl.h" #include +#include "console/typeValidators.h" IMPLEMENT_CONOBJECT(Material); @@ -239,6 +240,11 @@ Material::Material() mReverbSoundOcclusion = 1.0; } +IRangeValidator bmpChanRange(0, 3); +FRangeValidator glowMulRange(0.0f, 20.0f); +FRangeValidator parallaxScaleRange(0.0f, 4.0f); +FRangeValidator scrollSpeedRange(0.0f, 10.0f); +FRangeValidator waveFreqRange(0.0f, 10.0f); void Material::onImageAssetChanged() { flush(); @@ -265,32 +271,31 @@ void Material::initPersistFields() endGroup("Basic Texture Maps"); addGroup("Light Influence Maps"); - addField("roughness", TypeF32, Offset(mRoughness, Material), MAX_STAGES, - "The degree of roughness when not using a ORMConfigMap."); - - addField("metalness", TypeF32, Offset(mMetalness, Material), MAX_STAGES, - "The degree of Metalness when not using a ORMConfigMap."); - - addField("invertRoughness", TypeBool, Offset(mInvertRoughness, Material), MAX_STAGES, - "Treat Roughness as Roughness"); - - addField("AOChan", TypeF32, Offset(mAOChan, Material), MAX_STAGES, - "The input channel AO maps use."); - addField("roughnessChan", TypeF32, Offset(mRoughnessChan, Material), MAX_STAGES, - "The input channel roughness maps use."); - addField("metalChan", TypeF32, Offset(mMetalChan, Material), MAX_STAGES, - "The input channel metalness maps use."); INITPERSISTFIELD_IMAGEASSET_ARRAY(ORMConfigMap, MAX_STAGES, Material, "AO|Roughness|metalness map"); addField("isSRGb", TypeBool, Offset(mIsSRGb, Material), MAX_STAGES, "Substance Designer Workaround."); + addField("invertRoughness", TypeBool, Offset(mInvertRoughness, Material), MAX_STAGES, + "Treat Roughness as Roughness"); INITPERSISTFIELD_IMAGEASSET_ARRAY(AOMap, MAX_STAGES, Material, "AOMap"); + addFieldV("AOChan", TypeRangedS32, Offset(mAOChan, Material), &bmpChanRange, MAX_STAGES, + "The input channel AO maps use."); + INITPERSISTFIELD_IMAGEASSET_ARRAY(RoughMap, MAX_STAGES, Material, "RoughMap (also needs MetalMap)"); + addFieldV("roughness", TypeRangedF32, Offset(mRoughness, Material), &CommonValidators::F32_8BitPercent,MAX_STAGES, + "The degree of roughness when not using a ORMConfigMap."); + addFieldV("roughnessChan", TypeRangedS32, Offset(mRoughnessChan, Material), &bmpChanRange, MAX_STAGES, + "The input channel roughness maps use."); + INITPERSISTFIELD_IMAGEASSET_ARRAY(MetalMap, MAX_STAGES, Material, "MetalMap (also needs RoughMap)"); + addFieldV("metalness", TypeRangedF32, Offset(mMetalness, Material), &CommonValidators::F32_8BitPercent, MAX_STAGES, + "The degree of Metalness when not using a ORMConfigMap."); + addFieldV("metalChan", TypeRangedS32, Offset(mMetalChan, Material), &bmpChanRange, MAX_STAGES, + "The input channel metalness maps use."); INITPERSISTFIELD_IMAGEASSET_ARRAY(GlowMap, MAX_STAGES, Material, "GlowMap (needs Albedo)"); - addField("glowMul", TypeF32, Offset(mGlowMul, Material), MAX_STAGES, + addFieldV("glowMul", TypeRangedF32, Offset(mGlowMul, Material),&glowMulRange, MAX_STAGES, "glow mask multiplier"); endGroup("Light Influence Maps"); @@ -300,7 +305,7 @@ void Material::initPersistFields() "The scale factor for the detail map."); INITPERSISTFIELD_IMAGEASSET_ARRAY(DetailNormalMap, MAX_STAGES, Material, "DetailNormalMap"); - addField("detailNormalMapStrength", TypeF32, Offset(mDetailNormalMapStrength, Material), MAX_STAGES, + addFieldV("detailNormalMapStrength", TypeRangedF32, Offset(mDetailNormalMapStrength, Material), &CommonValidators::PositiveFloat, MAX_STAGES, "Used to scale the strength of the detail normal map when blended with the base normal map."); INITPERSISTFIELD_IMAGEASSET_ARRAY(OverlayMap, MAX_STAGES, Material, "Overlay"); @@ -312,19 +317,19 @@ void Material::initPersistFields() addProtectedField("accuEnabled", TYPEID< bool >(), Offset(mAccuEnabled, Material), &_setAccuEnabled, &defaultProtectedGetFn, MAX_STAGES, "Accumulation texture."); - addField("accuScale", TypeF32, Offset(mAccuScale, Material), MAX_STAGES, + addFieldV("accuScale", TypeRangedF32, Offset(mAccuScale, Material), &CommonValidators::PositiveFloat, MAX_STAGES, "The scale that is applied to the accu map texture. You can use this to fit the texture to smaller or larger objects."); - addField("accuDirection", TypeF32, Offset(mAccuDirection, Material), MAX_STAGES, + addFieldV("accuDirection", TypeRangedF32, Offset(mAccuDirection, Material), &CommonValidators::DirFloat, MAX_STAGES, "The direction of the accumulation. Chose whether you want the accu map to go from top to bottom (ie. snow) or upwards (ie. mold)."); - addField("accuStrength", TypeF32, Offset(mAccuStrength, Material), MAX_STAGES, + addFieldV("accuStrength", TypeRangedF32, Offset(mAccuStrength, Material), &CommonValidators::NormalizedFloat, MAX_STAGES, "The strength of the accu map. This changes the transparency of the accu map texture. Make it subtle or add more contrast."); - addField("accuCoverage", TypeF32, Offset(mAccuCoverage, Material), MAX_STAGES, + addFieldV("accuCoverage", TypeRangedF32, Offset(mAccuCoverage, Material), &CommonValidators::NormalizedFloat, MAX_STAGES, "The coverage ratio of the accu map texture. Use this to make the entire shape pick up some of the accu map texture or none at all."); - addField("accuSpecular", TypeF32, Offset(mAccuSpecular, Material), MAX_STAGES, + addFieldV("accuSpecular", TypeRangedF32, Offset(mAccuSpecular, Material), &CommonValidators::NormalizedFloat, MAX_STAGES, "Changes specularity to this value where the accumulated material is present."); endGroup("Accumulation Properties"); @@ -335,7 +340,7 @@ void Material::initPersistFields() "Enables emissive lighting for the material."); addField("glow", TypeBool, Offset(mGlow, Material), MAX_STAGES, "Enables rendering as glowing."); - addField("parallaxScale", TypeF32, Offset(mParallaxScale, Material), MAX_STAGES, + addFieldV("parallaxScale", TypeRangedF32, Offset(mParallaxScale, Material),¶llaxScaleRange, MAX_STAGES, "Enables parallax mapping and defines the scale factor for the parallax effect. Typically " "this value is less than 0.4 else the effect breaks down."); @@ -346,7 +351,7 @@ void Material::initPersistFields() "If true the vertex color is used for lighting."); addField("vertColor", TypeBool, Offset(mVertColor, Material), MAX_STAGES, "If enabled, vertex colors are premultiplied with diffuse colors."); - + /* presently unsupported directly. advice would be to use a glowmap+glowmul to fine tune backscatter effects addField("subSurface", TypeBool, Offset(mSubSurface, Material), MAX_STAGES, "Enables the subsurface scattering approximation."); addField("minnaertConstant", TypeF32, Offset(mMinnaertConstant, Material), MAX_STAGES, @@ -355,6 +360,7 @@ void Material::initPersistFields() "The color used for the subsurface scattering approximation."); addField("subSurfaceRolloff", TypeF32, Offset(mSubSurfaceRolloff, Material), MAX_STAGES, "The 0 to 1 rolloff factor used in the subsurface scattering approximation."); + */ endGroup("Lighting Properties"); addGroup("Animation Properties"); @@ -364,10 +370,10 @@ void Material::initPersistFields() addField("scrollDir", TypePoint2F, Offset(mScrollDir, Material), MAX_STAGES, "The scroll direction in UV space when scroll animation is enabled."); - addField("scrollSpeed", TypeF32, Offset(mScrollSpeed, Material), MAX_STAGES, + addFieldV("scrollSpeed", TypeRangedF32, Offset(mScrollSpeed, Material), &scrollSpeedRange, MAX_STAGES, "The speed to scroll the texture in UVs per second when scroll animation is enabled."); - addField("rotSpeed", TypeF32, Offset(mRotSpeed, Material), MAX_STAGES, + addFieldV("rotSpeed", TypeRangedF32, Offset(mRotSpeed, Material), &CommonValidators::DegreeRange, MAX_STAGES, "The speed to rotate the texture in degrees per second when rotation animation is enabled."); addField("rotPivotOffset", TypePoint2F, Offset(mRotPivotOffset, Material), MAX_STAGES, @@ -376,10 +382,10 @@ void Material::initPersistFields() addField("waveType", TYPEID< WaveType >(), Offset(mWaveType, Material), MAX_STAGES, "The type of wave animation to perform when wave animation is enabled."); - addField("waveFreq", TypeF32, Offset(mWaveFreq, Material), MAX_STAGES, + addFieldV("waveFreq", TypeRangedF32, Offset(mWaveFreq, Material),&waveFreqRange, MAX_STAGES, "The wave frequency when wave animation is enabled."); - addField("waveAmp", TypeF32, Offset(mWaveAmp, Material), MAX_STAGES, + addFieldV("waveAmp", TypeRangedF32, Offset(mWaveAmp, Material), &CommonValidators::NormalizedFloat, MAX_STAGES, "The wave amplitude when wave animation is enabled."); addField("sequenceFramePerSec", TypeF32, Offset(mSeqFramePerSec, Material), MAX_STAGES, @@ -393,7 +399,7 @@ void Material::initPersistFields() "@internal"); addField("cellLayout", TypePoint2I, Offset(mCellLayout, Material), MAX_STAGES, "@internal"); - addField("cellSize", TypeS32, Offset(mCellSize, Material), MAX_STAGES, + addFieldV("cellSize", TypeRangedS32, Offset(mCellSize, Material), &CommonValidators::PositiveInt, MAX_STAGES, "@internal"); addField("bumpAtlas", TypeBool, Offset(mNormalMapAtlas, Material), MAX_STAGES, "@internal"); @@ -423,7 +429,7 @@ void Material::initPersistFields() addField("alphaTest", TypeBool, Offset(mAlphaTest, Material), "Enables alpha test when rendering the material.\n@see alphaRef\n"); - addField("alphaRef", TypeS32, Offset(mAlphaRef, Material), + addFieldV("alphaRef", TypeRangedS32, Offset(mAlphaRef, Material), &CommonValidators::S32_8BitCap, "The alpha reference value for alpha testing. Must be between 0 to 255.\n@see alphaTest\n"); addField("cubemap", TypeRealString, Offset(mCubemapName, Material), @@ -498,10 +504,10 @@ void Material::initPersistFields() endGroup("Behavioral (All Layers)"); // For backwards compatibility. - // - // They point at the new 'map' fields, but reads always return - // an empty string and writes only apply if the value is not empty. - // + // + // They point at the new 'map' fields, but reads always return + // an empty string and writes only apply if the value is not empty. + // addProtectedField("baseTex", TypeImageFilename, Offset(mDiffuseMapName, Material), defaultProtectedSetNotEmptyFn, emptyStringProtectedGetFn, MAX_STAGES, "For backwards compatibility.\n@see diffuseMap\n", AbstractClassRep::FIELD_HideInInspectors); diff --git a/Engine/source/materials/materialDefinition.h b/Engine/source/materials/materialDefinition.h index f8939af22..815c77b90 100644 --- a/Engine/source/materials/materialDefinition.h +++ b/Engine/source/materials/materialDefinition.h @@ -235,17 +235,17 @@ public: bool mIsSRGb[MAX_STAGES]; DECLARE_IMAGEASSET_ARRAY(Material, AOMap, MAX_STAGES, onImageAssetChanged); DECLARE_IMAGEASSET_ARRAY_SETGET(Material, AOMap); - F32 mAOChan[MAX_STAGES]; + S32 mAOChan[MAX_STAGES]; DECLARE_IMAGEASSET_ARRAY(Material, RoughMap, MAX_STAGES, onImageAssetChanged); DECLARE_IMAGEASSET_ARRAY_SETGET(Material, RoughMap); bool mInvertRoughness[MAX_STAGES]; - F32 mRoughnessChan[MAX_STAGES]; + S32 mRoughnessChan[MAX_STAGES]; DECLARE_IMAGEASSET_ARRAY(Material, MetalMap, MAX_STAGES, onImageAssetChanged); DECLARE_IMAGEASSET_ARRAY_SETGET(Material, MetalMap); - F32 mMetalChan[MAX_STAGES]; + S32 mMetalChan[MAX_STAGES]; DECLARE_IMAGEASSET_ARRAY(Material, GlowMap, MAX_STAGES, onImageAssetChanged); DECLARE_IMAGEASSET_ARRAY_SETGET(Material, GlowMap); diff --git a/Engine/source/materials/shaderData.cpp b/Engine/source/materials/shaderData.cpp index 34eab775d..85b6d1446 100644 --- a/Engine/source/materials/shaderData.cpp +++ b/Engine/source/materials/shaderData.cpp @@ -28,6 +28,7 @@ #include "core/strings/stringUnit.h" #include "lighting/lightManager.h" #include "console/engineAPI.h" +#include "console/typeValidators.h" using namespace Torque; @@ -115,7 +116,7 @@ void ShaderData::initPersistFields() "@brief If true, the maximum pixel shader version offered by the graphics card will be used.\n\n" "Otherwise, the script-defined pixel shader version will be used.\n\n"); - addField("pixVersion", TypeF32, Offset(mPixVersion, ShaderData), + addFieldV("pixVersion", TypeRangedF32, Offset(mPixVersion, ShaderData), &CommonValidators::PositiveFloat, "@brief Indicates target level the shader should be compiled.\n\n" "Valid numbers at the time of this writing are 1.1, 1.4, 2.0, and 3.0. " "The shader will not run properly if the hardware does not support the " diff --git a/Engine/source/navigation/coverPoint.cpp b/Engine/source/navigation/coverPoint.cpp index 1fc2d16e7..29eda49af 100644 --- a/Engine/source/navigation/coverPoint.cpp +++ b/Engine/source/navigation/coverPoint.cpp @@ -77,7 +77,7 @@ void CoverPoint::initPersistFields() addField("size", TYPEID(), Offset(mSize, CoverPoint), "The size of this cover point."); - addField("quality", TypeF32, Offset(mQuality, CoverPoint), + addFieldV("quality", TypeRangedF32, Offset(mQuality, CoverPoint), &CommonValidators::NormalizedFloat, "Reliability of this point as solid cover. (0...1)"); addField("peekLeft", TypeBool, Offset(mPeekLeft, CoverPoint), diff --git a/Engine/source/navigation/navMesh.cpp b/Engine/source/navigation/navMesh.cpp index 2a49dabcc..253ee7922 100644 --- a/Engine/source/navigation/navMesh.cpp +++ b/Engine/source/navigation/navMesh.cpp @@ -229,6 +229,11 @@ bool NavMesh::setProtectedDetailSampleDist(void *obj, const char *index, const c F32 dist = dAtof(data); if(dist == 0.0f || dist >= 0.9f) return true; + if (dist > 0.0f && dist < 0.9f) + { + NavMesh* ptr = static_cast(obj); + ptr->mDetailSampleDist = 0.9f; + } Con::errorf("NavMesh::detailSampleDist must be 0 or greater than 0.9!"); return false; } @@ -253,10 +258,6 @@ bool NavMesh::setProtectedAlwaysRender(void *obj, const char *index, const char } FRangeValidator ValidCellSize(0.01f, 10.0f); -FRangeValidator ValidSlopeAngle(0.0f, 89.9f); -IRangeValidator PositiveInt(0, S32_MAX); -IRangeValidator NaturalNumber(1, S32_MAX); -FRangeValidator CornerAngle(0.0f, 90.0f); void NavMesh::initPersistFields() { @@ -269,20 +270,20 @@ void NavMesh::initPersistFields() addField("waterMethod", TYPEID(), Offset(mWaterMethod, NavMesh), "The method to use to handle water surfaces."); - addFieldV("cellSize", TypeF32, Offset(mCellSize, NavMesh), &ValidCellSize, + addFieldV("cellSize", TypeRangedF32, Offset(mCellSize, NavMesh), &ValidCellSize, "Length/width of a voxel."); - addFieldV("cellHeight", TypeF32, Offset(mCellHeight, NavMesh), &ValidCellSize, + addFieldV("cellHeight", TypeRangedF32, Offset(mCellHeight, NavMesh), &ValidCellSize, "Height of a voxel."); - addFieldV("tileSize", TypeF32, Offset(mTileSize, NavMesh), &CommonValidators::PositiveNonZeroFloat, + addFieldV("tileSize", TypeRangedF32, Offset(mTileSize, NavMesh), &CommonValidators::PositiveNonZeroFloat, "The horizontal size of tiles."); - addFieldV("actorHeight", TypeF32, Offset(mWalkableHeight, NavMesh), &CommonValidators::PositiveFloat, + addFieldV("actorHeight", TypeRangedF32, Offset(mWalkableHeight, NavMesh), &CommonValidators::PositiveFloat, "Height of an actor."); - addFieldV("actorClimb", TypeF32, Offset(mWalkableClimb, NavMesh), &CommonValidators::PositiveFloat, + addFieldV("actorClimb", TypeRangedF32, Offset(mWalkableClimb, NavMesh), &CommonValidators::PositiveFloat, "Maximum climbing height of an actor."); - addFieldV("actorRadius", TypeF32, Offset(mWalkableRadius, NavMesh), &CommonValidators::PositiveFloat, + addFieldV("actorRadius", TypeRangedF32, Offset(mWalkableRadius, NavMesh), &CommonValidators::PositiveFloat, "Radius of an actor."); - addFieldV("walkableSlope", TypeF32, Offset(mWalkableSlope, NavMesh), &ValidSlopeAngle, + addFieldV("walkableSlope", TypeRangedF32, Offset(mWalkableSlope, NavMesh), &CommonValidators::ValidSlopeAngle, "Maximum walkable slope in degrees."); addField("smallCharacters", TypeBool, Offset(mSmallCharacters, NavMesh), @@ -304,9 +305,9 @@ void NavMesh::initPersistFields() addField("innerCover", TypeBool, Offset(mInnerCover, NavMesh), "Add cover points everywhere, not just on corners?"); - addField("coverDist", TypeF32, Offset(mCoverDist, NavMesh), + addFieldV("coverDist", TypeRangedF32, Offset(mCoverDist, NavMesh), &CommonValidators::PositiveFloat, "Distance from the edge of the NavMesh to search for cover."); - addField("peekDist", TypeF32, Offset(mPeekDist, NavMesh), + addFieldV("peekDist", TypeRangedF32, Offset(mPeekDist, NavMesh), &CommonValidators::PositiveFloat, "Distance to the side of each cover point that peeking happens."); endGroup("NavMesh Annotations"); @@ -321,22 +322,22 @@ void NavMesh::initPersistFields() addGroup("NavMesh Advanced Options"); - addFieldV("borderSize", TypeS32, Offset(mBorderSize, NavMesh), &PositiveInt, + addFieldV("borderSize", TypeRangedS32, Offset(mBorderSize, NavMesh), &CommonValidators::PositiveInt, "Size of the non-walkable border around the navigation mesh (in voxels)."); - addProtectedField("detailSampleDist", TypeF32, Offset(mDetailSampleDist, NavMesh), - &setProtectedDetailSampleDist, &defaultProtectedGetFn, + addProtectedFieldV("detailSampleDist", TypeRangedF32, Offset(mDetailSampleDist, NavMesh), + &setProtectedDetailSampleDist, &defaultProtectedGetFn, &CommonValidators::PositiveFloat, "Sets the sampling distance to use when generating the detail mesh."); - addFieldV("detailSampleError", TypeF32, Offset(mDetailSampleMaxError, NavMesh), &CommonValidators::PositiveFloat, + addFieldV("detailSampleError", TypeRangedF32, Offset(mDetailSampleMaxError, NavMesh), &CommonValidators::PositiveFloat, "The maximum distance the detail mesh surface should deviate from heightfield data."); - addFieldV("maxEdgeLen", TypeS32, Offset(mDetailSampleDist, NavMesh), &PositiveInt, + addFieldV("maxEdgeLen", TypeRangedS32, Offset(mDetailSampleDist, NavMesh), &CommonValidators::PositiveInt, "The maximum allowed length for contour edges along the border of the mesh."); - addFieldV("simplificationError", TypeF32, Offset(mMaxSimplificationError, NavMesh), &CommonValidators::PositiveFloat, + addFieldV("simplificationError", TypeRangedF32, Offset(mMaxSimplificationError, NavMesh), &CommonValidators::PositiveFloat, "The maximum distance a simplfied contour's border edges should deviate from the original raw contour."); - addFieldV("minRegionArea", TypeS32, Offset(mMinRegionArea, NavMesh), &PositiveInt, + addFieldV("minRegionArea", TypeRangedS32, Offset(mMinRegionArea, NavMesh), &CommonValidators::PositiveInt, "The minimum number of cells allowed to form isolated island areas."); - addFieldV("mergeRegionArea", TypeS32, Offset(mMergeRegionArea, NavMesh), &PositiveInt, + addFieldV("mergeRegionArea", TypeRangedS32, Offset(mMergeRegionArea, NavMesh), &CommonValidators::PositiveInt, "Any regions with a span count smaller than this value will, if possible, be merged with larger regions."); - addFieldV("maxPolysPerTile", TypeS32, Offset(mMaxPolysPerTile, NavMesh), &NaturalNumber, + addFieldV("maxPolysPerTile", TypeRangedS32, Offset(mMaxPolysPerTile, NavMesh), &CommonValidators::NaturalNumber, "The maximum number of polygons allowed in a tile."); endGroup("NavMesh Advanced Options"); diff --git a/Engine/source/navigation/navPath.cpp b/Engine/source/navigation/navPath.cpp index 4d41fedb7..50d25408b 100644 --- a/Engine/source/navigation/navPath.cpp +++ b/Engine/source/navigation/navPath.cpp @@ -209,7 +209,7 @@ void NavPath::initPersistFields() "Does this path loop?"); addField("isSliced", TypeBool, Offset(mIsSliced, NavPath), "Plan this path over multiple updates instead of all at once."); - addFieldV("maxIterations", TypeS32, Offset(mMaxIterations, NavPath), &ValidIterations, + addFieldV("maxIterations", TypeRangedS32, Offset(mMaxIterations, NavPath), &ValidIterations, "Maximum iterations of path planning this path does per tick."); addProtectedField("autoUpdate", TypeBool, Offset(mAutoUpdate, NavPath), &setProtectedAutoUpdate, &defaultProtectedGetFn, diff --git a/Engine/source/postFx/postEffect.cpp b/Engine/source/postFx/postEffect.cpp index c1ebaee52..826219c0d 100644 --- a/Engine/source/postFx/postEffect.cpp +++ b/Engine/source/postFx/postEffect.cpp @@ -568,7 +568,7 @@ void PostEffect::initPersistFields() addField( "renderBin", TypeRealString, Offset( mRenderBin, PostEffect ), "Name of a renderBin, used if renderTime is PFXBeforeBin or PFXAfterBin." ); - addField( "renderPriority", TypeF32, Offset( mRenderPriority, PostEffect ), + addFieldV( "renderPriority", TypeRangedF32, Offset( mRenderPriority, PostEffect ), &CommonValidators::PositiveFloat, "PostEffects are processed in DESCENDING order of renderPriority if more than one has the same renderBin/Time." ); addField( "allowReflectPass", TypeBool, Offset( mAllowReflectPass, PostEffect ), diff --git a/Engine/source/renderInstance/renderBinManager.cpp b/Engine/source/renderInstance/renderBinManager.cpp index dc57687cd..d37ba6b9c 100644 --- a/Engine/source/renderInstance/renderBinManager.cpp +++ b/Engine/source/renderInstance/renderBinManager.cpp @@ -56,10 +56,10 @@ void RenderBinManager::initPersistFields() addField( "binType", TypeRealString, Offset(mRenderInstType.mName, RenderBinManager), "Sets the render bin type which limits what render instances are added to this bin." ); - addField("renderOrder", TypeF32, Offset(mRenderOrder, RenderBinManager), + addFieldV("renderOrder", TypeRangedF32, Offset(mRenderOrder, RenderBinManager), &CommonValidators::PositiveFloat, "Defines the order for rendering in relation to other bins." ); - addField("processAddOrder", TypeF32, Offset(mProcessAddOrder, RenderBinManager), + addFieldV("processAddOrder", TypeRangedF32, Offset(mProcessAddOrder, RenderBinManager), &CommonValidators::PositiveFloat, "Defines the order for adding instances in relation to other bins." ); addField( "basicOnly", TypeBool, Offset(mBasicOnly, RenderBinManager), diff --git a/Engine/source/scene/reflector.cpp b/Engine/source/scene/reflector.cpp index 06c01222c..ba05abf3c 100644 --- a/Engine/source/scene/reflector.cpp +++ b/Engine/source/scene/reflector.cpp @@ -98,28 +98,28 @@ void ReflectorDesc::initPersistFields() docsURL; addGroup( "ReflectorDesc" ); - addField( "texSize", TypeS32, Offset( texSize, ReflectorDesc ), + addFieldV( "texSize", TypeRangedS32, Offset( texSize, ReflectorDesc ), &CommonValidators::PositiveInt, "Size in pixels of the (square) reflection texture. For a cubemap " "this value is interpreted as size of each face." ); - addField( "nearDist", TypeF32, Offset( nearDist, ReflectorDesc ), + addFieldV( "nearDist", TypeRangedF32, Offset( nearDist, ReflectorDesc ), &CommonValidators::PositiveFloat, "Near plane distance to use when rendering this reflection. Adjust " "this to limit self-occlusion artifacts." ); - addField( "farDist", TypeF32, Offset( farDist, ReflectorDesc ), + addFieldV( "farDist", TypeRangedF32, Offset( farDist, ReflectorDesc ), &CommonValidators::PositiveFloat, "Far plane distance to use when rendering reflections." ); - addField( "objectTypeMask", TypeS32, Offset( objectTypeMask, ReflectorDesc ), + addField( "objectTypeMask", TypeGameTypeMasksType, Offset( objectTypeMask, ReflectorDesc ), "Object types which render into this reflection." ); - addField( "detailAdjust", TypeF32, Offset( detailAdjust, ReflectorDesc ), + addFieldV( "detailAdjust", TypeRangedF32, Offset( detailAdjust, ReflectorDesc ), &CommonValidators::PositiveFloat, "Scale applied to lod calculation of objects rendering into " "this reflection ( modulates $pref::TS::detailAdjust )." ); - addField( "priority", TypeF32, Offset( priority, ReflectorDesc ), + addFieldV( "priority", TypeRangedF32, Offset( priority, ReflectorDesc ), &CommonValidators::PositiveFloat, "Priority for updating this reflection, relative to others." ); - addField( "maxRateMs", TypeS32, Offset( maxRateMs, ReflectorDesc ), + addFieldV( "maxRateMs", TypeRangedS32, Offset( maxRateMs, ReflectorDesc ), &CommonValidators::PositiveInt, "If less than maxRateMs has elapsed since this relfection was last " "updated, then do not update it again. This 'skip' can be disabled by " "setting maxRateMs to zero." ); diff --git a/Engine/source/scene/sceneObject.cpp b/Engine/source/scene/sceneObject.cpp index 7ed86de9c..fb093cc57 100644 --- a/Engine/source/scene/sceneObject.cpp +++ b/Engine/source/scene/sceneObject.cpp @@ -639,7 +639,7 @@ void SceneObject::setHidden( bool hidden ) } //----------------------------------------------------------------------------- - +IRangeValidator soMountRange(-1, SceneObject::NumMountPoints); void SceneObject::initPersistFields() { docsURL; @@ -685,7 +685,7 @@ void SceneObject::initPersistFields() "@brief PersistentID of object we are mounted to.\n\n" "Unlike the SimObjectID that is determined at run time, the PersistentID of an object is saved with the level/mission and " "may be used to form a link between objects." ); - addField( "mountNode", TypeS32, Offset( mMount.node, SceneObject ), "Node we are mounted to." ); + addFieldV( "mountNode", TypeRangedS32, Offset( mMount.node, SceneObject ),&soMountRange, "Node we are mounted to." ); addField( "mountPos", TypeMatrixPosition, Offset( mMount.xfm, SceneObject ), "Position we are mounted at ( object space of our mount object )." ); addField( "mountRot", TypeMatrixRotation, Offset( mMount.xfm, SceneObject ), "Rotation we are mounted at ( object space of our mount object )." ); diff --git a/Engine/source/scene/simPath.cpp b/Engine/source/scene/simPath.cpp index 1e12a5adf..8ced80bc8 100644 --- a/Engine/source/scene/simPath.cpp +++ b/Engine/source/scene/simPath.cpp @@ -31,6 +31,7 @@ #include "scene/pathManager.h" #include "scene/sceneRenderState.h" #include "math/mathIO.h" +#include "console/typeValidators.h" #include "core/stream/bitStream.h" #include "renderInstance/renderPassManager.h" #include "console/engineAPI.h" @@ -174,13 +175,13 @@ void Path::initPersistFields() { docsURL; addField("isLooping", TypeBool, Offset(mIsLooping, Path), "If this is true, the loop is closed, otherwise it is open.\n"); - addField("Speed", TypeF32, Offset(mPathSpeed, Path), "Speed.\n"); + addFieldV("Speed", TypeRangedF32, Offset(mPathSpeed, Path), &CommonValidators::PositiveFloat, "Speed.\n"); addProtectedField("mPathShape", TYPEID< PathShapeData >(), Offset(mDataBlock, Path), &setDataBlockProperty, &defaultProtectedGetFn, "@brief Spawned PathShape.\n\n"); - addField("spawnCount", TypeS32, Offset(mSpawnCount, Path), "Spawn Count.\n"); - addField("minDelay", TypeS32, Offset(mMinDelay, Path), "Spawn Delay (min).\n"); - addField("maxDelay", TypeS32, Offset(mMaxDelay, Path), "Spawn Delay (max).\n"); + addFieldV("spawnCount", TypeRangedS32, Offset(mSpawnCount, Path), &CommonValidators::PositiveInt, "Spawn Count.\n"); + addFieldV("minDelay", TypeRangedS32, Offset(mMinDelay, Path), &CommonValidators::PositiveInt, "Spawn Delay (min).\n"); + addFieldV("maxDelay", TypeRangedS32, Offset(mMaxDelay, Path), &CommonValidators::PositiveInt, "Spawn Delay (max).\n"); Parent::initPersistFields(); // @@ -467,10 +468,10 @@ void Marker::initPersistFields() { docsURL; addGroup( "Misc" ); - addField("seqNum", TypeS32, Offset(mSeqNum, Marker), "Marker position in sequence of markers on this path.\n"); + addFieldV("seqNum", TypeRangedS32, Offset(mSeqNum, Marker), &CommonValidators::PositiveInt, "Marker position in sequence of markers on this path.\n"); addField("hitCommand", TypeCommand, Offset(mHitCommand, Marker), "The command to execute when a path follower reaches this marker."); addField("type", TYPEID< KnotType >(), Offset(mKnotType, Marker), "Type of this marker/knot. A \"normal\" knot will have a smooth camera translation/rotation effect.\n\"Position Only\" will do the same for translations, leaving rotation un-touched.\nLastly, a \"Kink\" means the rotation will take effect immediately for an abrupt rotation change.\n"); - addField("msToNext", TypeS32, Offset(mMSToNext, Marker), "Milliseconds to next marker in sequence.\n"); + addFieldV("msToNext", TypeRangedS32, Offset(mMSToNext, Marker), &CommonValidators::NaturalNumber, "Milliseconds to next marker in sequence.\n"); addField("smoothingType", TYPEID< SmoothingType >(), Offset(mSmoothingType, Marker), "Path smoothing at this marker/knot. \"Linear\" means no smoothing, while \"Spline\" means to smooth.\n"); endGroup("Misc"); diff --git a/Engine/source/scene/zones/sceneSimpleZone.cpp b/Engine/source/scene/zones/sceneSimpleZone.cpp index 4fd14470d..5ab896031 100644 --- a/Engine/source/scene/zones/sceneSimpleZone.cpp +++ b/Engine/source/scene/zones/sceneSimpleZone.cpp @@ -105,10 +105,10 @@ U32 SceneSimpleZone::packUpdate( NetConnection* connection, U32 mask, BitStream* if( stream->writeFlag( mask & AmbientMask ) ) { stream->writeFlag( mUseAmbientLightColor ); - stream->writeFloat( mAmbientLightColor.red, 7 ); - stream->writeFloat( mAmbientLightColor.green, 7 ); - stream->writeFloat( mAmbientLightColor.blue, 7 ); - stream->writeFloat( mAmbientLightColor.alpha, 7 ); + stream->writeFloat( mAmbientLightColor.red, 8 ); + stream->writeFloat( mAmbientLightColor.green, 8 ); + stream->writeFloat( mAmbientLightColor.blue, 8 ); + stream->writeFloat( mAmbientLightColor.alpha, 8 ); } return retMask; @@ -123,10 +123,10 @@ void SceneSimpleZone::unpackUpdate( NetConnection* connection, BitStream* stream if( stream->readFlag() ) // AmbientMask { mUseAmbientLightColor = stream->readFlag(); - mAmbientLightColor.red = stream->readFloat( 7 ); - mAmbientLightColor.green = stream->readFloat( 7 ); - mAmbientLightColor.blue = stream->readFloat( 7 ); - mAmbientLightColor.alpha = stream->readFloat( 7 ); + mAmbientLightColor.red = stream->readFloat( 8 ); + mAmbientLightColor.green = stream->readFloat( 8 ); + mAmbientLightColor.blue = stream->readFloat( 8 ); + mAmbientLightColor.alpha = stream->readFloat( 8 ); } } diff --git a/Engine/source/sfx/sfxAmbience.cpp b/Engine/source/sfx/sfxAmbience.cpp index 0ef3ed0ad..285ffc03a 100644 --- a/Engine/source/sfx/sfxAmbience.cpp +++ b/Engine/source/sfx/sfxAmbience.cpp @@ -103,12 +103,12 @@ void SFXAmbience::initPersistFields() "@ref SFX_reverb" ); INITPERSISTFIELD_SOUNDASSET(SoundTrack, SFXAmbience, "Sound track to play in the ambience zone." ); - addField( "rolloffFactor", TypeF32, Offset( mRolloffFactor, SFXAmbience ), + addFieldV( "rolloffFactor", TypeRangedF32, Offset( mRolloffFactor, SFXAmbience ), &CommonValidators::PositiveFloat, "The rolloff factor to apply to distance-based volume attenuation in this space.\n" "Defaults to 1.0.\n\n" "@note This applies to the logarithmic distance model only.\n\n" "@ref SFXSource_volume" ); - addField( "dopplerFactor", TypeF32, Offset( mDopplerFactor, SFXAmbience ), + addFieldV( "dopplerFactor", TypeRangedF32, Offset( mDopplerFactor, SFXAmbience ), &CommonValidators::PositiveFloat, "The factor to apply to the doppler affect in this space.\n" "Defaults to 0.5.\n\n" "@ref SFXSource_doppler" ); diff --git a/Engine/source/sfx/sfxDescription.cpp b/Engine/source/sfx/sfxDescription.cpp index 97a873288..5a1eb0430 100644 --- a/Engine/source/sfx/sfxDescription.cpp +++ b/Engine/source/sfx/sfxDescription.cpp @@ -39,6 +39,7 @@ #include "math/mathTypes.h" #include "console/simBase.h" #include "console/engineAPI.h" +#include "console/typeValidators.h" IMPLEMENT_CO_DATABLOCK_V1( SFXDescription ); @@ -225,13 +226,13 @@ void SFXDescription::initPersistFields() "For example, one use of groups is to segregate sounds so that volume levels of different sound " "groups such as interface audio and game audio can be controlled independently.\n\n" "@ref SFXSource_hierarchies" ); - addField( "volume", TypeF32, Offset( mVolume, SFXDescription ), + addFieldV( "volume", TypeRangedF32, Offset( mVolume, SFXDescription ), &CommonValidators::PositiveFloat, "Base volume level for the sound.\n\n" "This will be the starting point for volume attenuation on the sound. The final effective volume of " "a sound will be dependent on a number of parameters.\n\n" "Must be between 0 (mute) and 1 (full volume). Default is 1.\n\n" "@ref SFXSource_volume" ); - addField( "pitch", TypeF32, Offset( mPitch, SFXDescription ), + addFieldV( "pitch", TypeRangedF32, Offset( mPitch, SFXDescription ), &CommonValidators::PositiveFloat, "Pitch shift to apply to playback.\n\n" "The pitch assigned to a sound determines the speed at which it is played back. A pitch shift of 1 plays the " "sound at its default speed. A greater shift factor speeds up playback and a smaller shift factor slows it down.\n\n" @@ -239,7 +240,7 @@ void SFXDescription::initPersistFields() addField( "isLooping", TypeBool, Offset( mIsLooping, SFXDescription ), "If true, the sound will be played in an endless loop.\n\n" "Default is false." ); - addField( "priority", TypeF32, Offset( mPriority, SFXDescription ), + addFieldV( "priority", TypeRangedF32, Offset( mPriority, SFXDescription ), &CommonValidators::PositiveFloat, "Priority level for virtualization of sounds (1 = base level).\n" "When there are more concurrently active sounds than supported by the audio mixer, some of the sounds " "need to be culled. Which sounds are culled first depends primarily on total audibility of individual sounds. " @@ -260,11 +261,11 @@ void SFXDescription::initPersistFields() addGroup( "Fading" ); - addField( "fadeInTime", TypeF32, Offset( mFadeInTime, SFXDescription ), + addFieldV( "fadeInTime", TypeRangedF32, Offset( mFadeInTime, SFXDescription ), &CommonValidators::PositiveFloat, "Number of seconds to gradually fade in volume from zero when playback starts.\n" "Must be >= 0.\n\n" "@ref SFXSource_fades" ); - addField( "fadeOutTime", TypeF32, Offset( mFadeOutTime, SFXDescription ), + addFieldV( "fadeOutTime", TypeRangedF32, Offset( mFadeOutTime, SFXDescription ), &CommonValidators::PositiveFloat, "Number of seconds to gradually fade out volume down to zero when playback is stopped or paused.\n" "Must be >=0.\n\n" "@ref SFXSource_fades" ); @@ -300,7 +301,7 @@ void SFXDescription::initPersistFields() "determines up front which is the case for a given sound.\n\n" "@ref SFX_3d\n" "@ref SFXSource_volume" ); - addField( "referenceDistance", TypeF32, Offset( mMinDistance, SFXDescription ), + addFieldV( "referenceDistance", TypeRangedF32, Offset( mMinDistance, SFXDescription ), &CommonValidators::PositiveFloat, "Distance at which volume attenuation begins.\n" "Up to this distance, the sound retains its base volume.\n\n" "In the linear distance model, the volume will linearly from this distance onwards up to maxDistance where it " @@ -313,7 +314,7 @@ void SFXDescription::initPersistFields() "@see LevelInfo::soundDistanceModel\n\n" "@ref SFX_3d\n" "@ref SFXSource_volume" ); - addField( "maxDistance", TypeF32, Offset( mMaxDistance, SFXDescription ), + addFieldV( "maxDistance", TypeRangedF32, Offset( mMaxDistance, SFXDescription ), &CommonValidators::PositiveFloat, "The distance at which attenuation stops.\n" "In the linear distance model, the attenuated volume will be zero at this distance.\n\n" "In the logarithmic model, attenuation will simply stop at this distance and the sound will keep its attenuated " @@ -333,14 +334,14 @@ void SFXDescription::initPersistFields() "y += rand( - scatterDistance[ 1 ], scatterDistance[ 1 ] );\n" "z += rand( - scatterDistance[ 2 ], scatterDistance[ 2 ] );\n" "@endverbatim\n" ); - addField( "coneInsideAngle", TypeS32, Offset( mConeInsideAngle, SFXDescription ), + addFieldV( "coneInsideAngle", TypeRangedS32, Offset( mConeInsideAngle, SFXDescription ), &CommonValidators::S32_PosDegreeRange, "Inner sound cone angle in degrees.\n" "This value determines the angle of the inner volume cone that protrudes out in the direction " "of a sound. Within this cone, the sound source retains full volume that is unaffected by sound cone " "settings (though still affected by distance attenuation.)\n\n" "Valid values are from 0 to 360. Must be less than coneOutsideAngle. Default is 360. Only for 3D sounds.\n\n" "@ref SFXSource_cones" ); - addField( "coneOutsideAngle", TypeS32, Offset( mConeOutsideAngle, SFXDescription ), + addFieldV( "coneOutsideAngle", TypeRangedS32, Offset( mConeOutsideAngle, SFXDescription ), &CommonValidators::S32_PosDegreeRange, "Outer sound cone angle in degrees.\n" "This value determines the angle of the outer volume cone that protrudes out in the direction of a sound " "and surrounds the inner volume cone. Within this cone, volume will linearly interpolate from the outer cone " @@ -348,14 +349,14 @@ void SFXDescription::initPersistFields() "up/down to the full base volume.\n\n" "Valid values are from 0 to 360. Must be >= coneInsideAngle. Default is 360. Only for 3D sounds.\n\n" "@ref SFXSource_cones" ); - addField( "coneOutsideVolume", TypeF32, Offset( mConeOutsideVolume, SFXDescription ), + addFieldV( "coneOutsideVolume", TypeRangedF32, Offset( mConeOutsideVolume, SFXDescription ), &CommonValidators::NormalizedFloat, "Determines the volume scale factor applied the a source's base volume level outside of the outer cone.\n" "In the outer cone, starting from outside the inner cone, the scale factor smoothly interpolates from 1.0 (within the inner cone) " "to this value. At the moment, the allowed range is 0.0 (silence) to 1.0 (no attenuation) as amplification is only supported on " "XAudio2 but not on the other devices.\n\n" "Only for 3D sound.\n\n" "@ref SFXSource_cones" ); - addField( "rolloffFactor", TypeF32, Offset( mRolloffFactor, SFXDescription ), + addFieldV( "rolloffFactor", TypeRangedF32, Offset( mRolloffFactor, SFXDescription ), &CommonValidators::NegDefaultF32, "Scale factor to apply to logarithmic distance attenuation curve. If -1, the global rolloff setting is used.\n\n" "@note Per-sound rolloff is only supported on OpenAL at the moment. With other divices, the global rolloff setting " "is used for all sounds.\n" @@ -368,7 +369,7 @@ void SFXDescription::initPersistFields() addField( "isStreaming", TypeBool, Offset( mIsStreaming, SFXDescription ), "If true, incrementally stream sounds; otherwise sounds are loaded in full.\n\n" "@ref SFX_streaming" ); - addField( "streamPacketSize", TypeS32, Offset( mStreamPacketSize, SFXDescription ), + addFieldV( "streamPacketSize", TypeRangedS32, Offset( mStreamPacketSize, SFXDescription ), &CommonValidators::S32_8BitCap, "Number of seconds of sample data per single streaming packet.\n" "This field allows to fine-tune streaming for individual sounds. The streaming system " "processes streamed sounds in batches called packets. Each packet will contain a set amount " @@ -376,7 +377,7 @@ void SFXDescription::initPersistFields() "packet contains, the more work is done per packet.\n\n" "@note This field only takes effect when Torque's own sound system performs the streaming. " "@ref SFX_streaming" ); - addField( "streamReadAhead", TypeS32, Offset( mStreamReadAhead, SFXDescription ), + addFieldV( "streamReadAhead", TypeRangedS32, Offset( mStreamReadAhead, SFXDescription ), &CommonValidators::S32_8BitCap, "Number of sample packets to read and buffer in advance.\n" "This field determines the number of packets that the streaming system will try to keep buffered " "in advance. As such it determines the number of packets that can be consumed by the sound " @@ -395,47 +396,47 @@ void SFXDescription::initPersistFields() "a custom reverb setup can be defined using the \"Reverb\" properties that will then be assigned " "to sounds playing with the description.\n\n" "@ref SFX_reverb"); - addField("reverbDensity", TypeF32, Offset(mReverb.flDensity, SFXDescription), + addFieldV("reverbDensity", TypeRangedF32, Offset(mReverb.flDensity, SFXDescription), &CommonValidators::PositiveFloat, "Density of reverb environment."); - addField("reverbDiffusion", TypeF32, Offset(mReverb.flDiffusion, SFXDescription), + addFieldV("reverbDiffusion", TypeRangedF32, Offset(mReverb.flDiffusion, SFXDescription), &CommonValidators::PositiveFloat, "Environment diffusion."); - addField("reverbGain", TypeF32, Offset(mReverb.flGain, SFXDescription), + addFieldV("reverbGain", TypeRangedF32, Offset(mReverb.flGain, SFXDescription), &CommonValidators::PositiveFloat, "Reverb Gain Level."); - addField("reverbGainHF", TypeF32, Offset(mReverb.flGainHF, SFXDescription), + addFieldV("reverbGainHF", TypeRangedF32, Offset(mReverb.flGainHF, SFXDescription), &CommonValidators::PositiveFloat, "Reverb Gain to high frequencies"); - addField("reverbGainLF", TypeF32, Offset(mReverb.flGainLF, SFXDescription), + addFieldV("reverbGainLF", TypeRangedF32, Offset(mReverb.flGainLF, SFXDescription), &CommonValidators::PositiveFloat, "Reverb Gain to high frequencies"); - addField("reverbDecayTime", TypeF32, Offset(mReverb.flDecayTime, SFXDescription), + addFieldV("reverbDecayTime", TypeRangedF32, Offset(mReverb.flDecayTime, SFXDescription), &CommonValidators::PositiveFloat, "Decay time for the reverb."); - addField("reverbDecayHFRatio", TypeF32, Offset(mReverb.flDecayHFRatio, SFXDescription), + addFieldV("reverbDecayHFRatio", TypeRangedF32, Offset(mReverb.flDecayHFRatio, SFXDescription), &CommonValidators::PositiveFloat, "High frequency decay time ratio."); - addField("reverbDecayLFRatio", TypeF32, Offset(mReverb.flDecayLFRatio, SFXDescription), + addFieldV("reverbDecayLFRatio", TypeRangedF32, Offset(mReverb.flDecayLFRatio, SFXDescription), &CommonValidators::PositiveFloat, "High frequency decay time ratio."); - addField("reflectionsGain", TypeF32, Offset(mReverb.flReflectionsGain, SFXDescription), + addFieldV("reflectionsGain", TypeRangedF32, Offset(mReverb.flReflectionsGain, SFXDescription), &CommonValidators::PositiveFloat, "Reflection Gain."); - addField("reflectionDelay", TypeF32, Offset(mReverb.flReflectionsDelay, SFXDescription), + addFieldV("reflectionDelay", TypeRangedF32, Offset(mReverb.flReflectionsDelay, SFXDescription), &CommonValidators::PositiveFloat, "How long to delay reflections."); - addField("lateReverbGain", TypeF32, Offset(mReverb.flLateReverbGain, SFXDescription), + addFieldV("lateReverbGain", TypeRangedF32, Offset(mReverb.flLateReverbGain, SFXDescription), &CommonValidators::PositiveFloat, "Late reverb gain amount."); - addField("lateReverbDelay", TypeF32, Offset(mReverb.flLateReverbDelay, SFXDescription), + addFieldV("lateReverbDelay", TypeRangedF32, Offset(mReverb.flLateReverbDelay, SFXDescription), &CommonValidators::PositiveFloat, "Late reverb delay time."); - addField("reverbEchoTime", TypeF32, Offset(mReverb.flEchoTime, SFXDescription), + addFieldV("reverbEchoTime", TypeRangedF32, Offset(mReverb.flEchoTime, SFXDescription), &CommonValidators::PositiveFloat, "Reverb echo time."); - addField("reverbEchoDepth", TypeF32, Offset(mReverb.flEchoDepth, SFXDescription), + addFieldV("reverbEchoDepth", TypeRangedF32, Offset(mReverb.flEchoDepth, SFXDescription), &CommonValidators::PositiveFloat, "Reverb echo depth."); - addField("reverbModTime", TypeF32, Offset(mReverb.flModulationTime, SFXDescription), + addFieldV("reverbModTime", TypeRangedF32, Offset(mReverb.flModulationTime, SFXDescription), &CommonValidators::PositiveFloat, "Reverb Modulation time."); - addField("reverbModDepth", TypeF32, Offset(mReverb.flModulationDepth, SFXDescription), + addFieldV("reverbModDepth", TypeRangedF32, Offset(mReverb.flModulationDepth, SFXDescription), &CommonValidators::PositiveFloat, "Reverb Modulation Depth."); - addField("airAbsorbtionGainHF", TypeF32, Offset(mReverb.flAirAbsorptionGainHF, SFXDescription), + addFieldV("airAbsorbtionGainHF", TypeRangedF32, Offset(mReverb.flAirAbsorptionGainHF, SFXDescription), &CommonValidators::PositiveFloat, "High Frequency air absorbtion"); - addField("reverbHFRef", TypeF32, Offset(mReverb.flHFReference, SFXDescription), + addFieldV("reverbHFRef", TypeRangedF32, Offset(mReverb.flHFReference, SFXDescription), &CommonValidators::PositiveFloat, "Reverb High Frequency Reference."); - addField("reverbLFRef", TypeF32, Offset(mReverb.flLFReference, SFXDescription), + addFieldV("reverbLFRef", TypeRangedF32, Offset(mReverb.flLFReference, SFXDescription), &CommonValidators::PositiveFloat, "Reverb Low Frequency Reference."); - addField("roomRolloffFactor", TypeF32, Offset(mReverb.flRoomRolloffFactor, SFXDescription), + addFieldV("roomRolloffFactor", TypeRangedF32, Offset(mReverb.flRoomRolloffFactor, SFXDescription), &CommonValidators::PositiveFloat, "Rolloff factor for reverb."); - addField("decayHFLimit", TypeS32, Offset(mReverb.iDecayHFLimit, SFXDescription), + addFieldV("decayHFLimit", TypeRangedS32, Offset(mReverb.iDecayHFLimit, SFXDescription), &CommonValidators::PositiveInt, "High Frequency decay limit."); endGroup("Reverb"); diff --git a/Engine/source/sfx/sfxEnvironment.cpp b/Engine/source/sfx/sfxEnvironment.cpp index a63ef5266..c5ba6aab9 100644 --- a/Engine/source/sfx/sfxEnvironment.cpp +++ b/Engine/source/sfx/sfxEnvironment.cpp @@ -24,6 +24,7 @@ #include "sim/netConnection.h" #include "core/stream/bitStream.h" #include "core/module.h" +#include "console/typeValidators.h" IMPLEMENT_CO_DATABLOCK_V1( SFXEnvironment ); @@ -145,51 +146,51 @@ void SFXEnvironment::initPersistFields() docsURL; addGroup( "Reverb" ); - addField("reverbDensity", TypeF32, Offset(mReverb.flDensity, SFXEnvironment), + addFieldV("reverbDensity", TypeRangedF32, Offset(mReverb.flDensity, SFXEnvironment), &CommonValidators::PositiveFloat, "Density of reverb environment."); - addField("reverbDiffusion", TypeF32, Offset(mReverb.flDiffusion, SFXEnvironment), + addFieldV("reverbDiffusion", TypeRangedF32, Offset(mReverb.flDiffusion, SFXEnvironment), &CommonValidators::PositiveFloat, "Environment diffusion."); - addField("reverbGain", TypeF32, Offset(mReverb.flGain, SFXEnvironment), + addFieldV("reverbGain", TypeRangedF32, Offset(mReverb.flGain, SFXEnvironment), &CommonValidators::PositiveFloat, "Reverb Gain Level."); - addField("reverbGainHF", TypeF32, Offset(mReverb.flGainHF, SFXEnvironment), + addFieldV("reverbGainHF", TypeRangedF32, Offset(mReverb.flGainHF, SFXEnvironment), &CommonValidators::PositiveFloat, "Reverb Gain to high frequencies"); - addField("reverbGainLF", TypeF32, Offset(mReverb.flGainLF, SFXEnvironment), + addFieldV("reverbGainLF", TypeRangedF32, Offset(mReverb.flGainLF, SFXEnvironment), &CommonValidators::PositiveFloat, "Reverb Gain to high frequencies"); - addField("reverbDecayTime", TypeF32, Offset(mReverb.flDecayTime, SFXEnvironment), + addFieldV("reverbDecayTime", TypeRangedF32, Offset(mReverb.flDecayTime, SFXEnvironment), &CommonValidators::PositiveFloat, "Decay time for the reverb."); - addField("reverbDecayHFRatio", TypeF32, Offset(mReverb.flDecayHFRatio, SFXEnvironment), + addFieldV("reverbDecayHFRatio", TypeRangedF32, Offset(mReverb.flDecayHFRatio, SFXEnvironment), &CommonValidators::PositiveFloat, "High frequency decay time ratio."); - addField("reverbDecayLFRatio", TypeF32, Offset(mReverb.flDecayLFRatio, SFXEnvironment), + addFieldV("reverbDecayLFRatio", TypeRangedF32, Offset(mReverb.flDecayLFRatio, SFXEnvironment), &CommonValidators::PositiveFloat, "High frequency decay time ratio."); - addField("reflectionsGain", TypeF32, Offset(mReverb.flReflectionsGain, SFXEnvironment), + addFieldV("reflectionsGain", TypeRangedF32, Offset(mReverb.flReflectionsGain, SFXEnvironment), &CommonValidators::PositiveFloat, "Reflection Gain."); - addField("reflectionDelay", TypeF32, Offset(mReverb.flReflectionsDelay, SFXEnvironment), + addFieldV("reflectionDelay", TypeRangedF32, Offset(mReverb.flReflectionsDelay, SFXEnvironment), &CommonValidators::PositiveFloat, "How long to delay reflections."); - addField("reflectionsPan", TypeF32, Offset(mReverb.flReflectionsPan, SFXEnvironment), 3, + addFieldV("reflectionsPan", TypeRangedF32, Offset(mReverb.flReflectionsPan, SFXEnvironment), &CommonValidators::F32Range, 3, "Reflection reverberation panning vector."); - addField("lateReverbGain", TypeF32, Offset(mReverb.flLateReverbGain, SFXEnvironment), + addFieldV("lateReverbGain", TypeRangedF32, Offset(mReverb.flLateReverbGain, SFXEnvironment), &CommonValidators::PositiveFloat, "Late reverb gain amount."); - addField("lateReverbDelay", TypeF32, Offset(mReverb.flLateReverbDelay, SFXEnvironment), + addFieldV("lateReverbDelay", TypeRangedF32, Offset(mReverb.flLateReverbDelay, SFXEnvironment), &CommonValidators::PositiveFloat, "Late reverb delay time."); - addField("lateReverbPan", TypeF32, Offset(mReverb.flLateReverbPan, SFXEnvironment), 3, + addFieldV("lateReverbPan", TypeRangedF32, Offset(mReverb.flLateReverbPan, SFXEnvironment), &CommonValidators::F32Range, 3, "Late reverberation panning vector."); - addField("reverbEchoTime", TypeF32, Offset(mReverb.flEchoTime, SFXEnvironment), + addFieldV("reverbEchoTime", TypeRangedF32, Offset(mReverb.flEchoTime, SFXEnvironment), &CommonValidators::PositiveFloat, "Reverb echo time."); - addField("reverbEchoDepth", TypeF32, Offset(mReverb.flEchoDepth, SFXEnvironment), + addFieldV("reverbEchoDepth", TypeRangedF32, Offset(mReverb.flEchoDepth, SFXEnvironment), &CommonValidators::PositiveFloat, "Reverb echo depth."); - addField("reverbModTime", TypeF32, Offset(mReverb.flModulationTime, SFXEnvironment), + addFieldV("reverbModTime", TypeRangedF32, Offset(mReverb.flModulationTime, SFXEnvironment), &CommonValidators::PositiveFloat, "Reverb Modulation time."); - addField("reverbModDepth", TypeF32, Offset(mReverb.flModulationDepth, SFXEnvironment), + addFieldV("reverbModDepth", TypeRangedF32, Offset(mReverb.flModulationDepth, SFXEnvironment), &CommonValidators::PositiveFloat, "Reverb Modulation time."); - addField("airAbsorbtionGainHF", TypeF32, Offset(mReverb.flAirAbsorptionGainHF, SFXEnvironment), + addFieldV("airAbsorbtionGainHF", TypeRangedF32, Offset(mReverb.flAirAbsorptionGainHF, SFXEnvironment), &CommonValidators::PositiveFloat, "High Frequency air absorbtion"); - addField("reverbHFRef", TypeF32, Offset(mReverb.flHFReference, SFXEnvironment), + addFieldV("reverbHFRef", TypeRangedF32, Offset(mReverb.flHFReference, SFXEnvironment), &CommonValidators::PositiveFloat, "Reverb High Frequency Reference."); - addField("reverbLFRef", TypeF32, Offset(mReverb.flLFReference, SFXEnvironment), + addFieldV("reverbLFRef", TypeRangedF32, Offset(mReverb.flLFReference, SFXEnvironment), &CommonValidators::PositiveFloat, "Reverb Low Frequency Reference."); - addField("roomRolloffFactor", TypeF32, Offset(mReverb.flRoomRolloffFactor, SFXEnvironment), + addFieldV("roomRolloffFactor", TypeRangedF32, Offset(mReverb.flRoomRolloffFactor, SFXEnvironment), &CommonValidators::PositiveFloat, "Rolloff factor for reverb."); - addField("decayHFLimit", TypeS32, Offset(mReverb.iDecayHFLimit, SFXEnvironment), + addFieldV("decayHFLimit", TypeRangedS32, Offset(mReverb.iDecayHFLimit, SFXEnvironment), &CommonValidators::PositiveInt, "High Frequency decay limit."); endGroup("Reverb"); diff --git a/Engine/source/sfx/sfxPlayList.cpp b/Engine/source/sfx/sfxPlayList.cpp index b763e4a14..6d81ed4cc 100644 --- a/Engine/source/sfx/sfxPlayList.cpp +++ b/Engine/source/sfx/sfxPlayList.cpp @@ -27,6 +27,7 @@ #include "core/stream/bitStream.h" #include "math/mRandom.h" #include "math/mathTypes.h" +#include "console/typeValidators.h" IMPLEMENT_CO_DATABLOCK_V1( SFXPlayList ); @@ -212,7 +213,7 @@ ImplementEnumType( SFXPlayListStateMode, "playing sources attached to the slot." }, EndImplementEnumType; - +IRangeValidator playlistSlotRange(0, SFXPlayList::SFXPlaylistSettings::NUM_SLOTS); //----------------------------------------------------------------------------- SFXPlayList::SFXPlayList() @@ -239,7 +240,7 @@ SFXPlayList::~SFXPlayList() } //----------------------------------------------------------------------------- - +IRangeValidator playlistSlotCount(1, SFXPlayList::NUM_SLOTS); void SFXPlayList::initPersistFields() { docsURL; @@ -256,9 +257,9 @@ void SFXPlayList::initPersistFields() "The loop mode determines whether the list will loop over a single slot or loop over " "all the entire list of slots being played.\n\n" "@see SFXDescription::isLooping" ); - addField( "numSlotsToPlay", TypeS32, Offset( mNumSlotsToPlay, SFXPlayList ), + addFieldV( "numSlotsToPlay", TypeRangedS32, Offset( mNumSlotsToPlay, SFXPlayList ), &playlistSlotCount, "Number of slots to play.\n" - "Up to a maximum of 16, this field determines the number of slots that are taken from the " + "Up to a maximum of 12, this field determines the number of slots that are taken from the " "list for playback. Only slots that have a valid #track assigned will be considered for " "this." ); @@ -280,55 +281,55 @@ void SFXPlayList::initPersistFields() "Behavior when moving out of this slot.\n" "After the #detailTimeOut has expired (if any), this slot determines what the controller " "will do before moving on to the next slot." ); - addField( "delayTimeIn", TypeF32, Offset( mSlots.mDelayTimeIn.mValue, SFXPlayList ), NUM_SLOTS, + addFieldV( "delayTimeIn", TypeRangedF32, Offset( mSlots.mDelayTimeIn.mValue, SFXPlayList ), &CommonValidators::PositiveFloat, NUM_SLOTS, "Seconds to wait after moving into slot before #transitionIn." ); addField( "delayTimeInVariance", TypePoint2F, Offset( mSlots.mDelayTimeIn.mVariance, SFXPlayList ), NUM_SLOTS, "Bounds on randomization of #delayTimeIn.\n\n" "@ref SFXPlayList_randomization\n" ); - addField( "delayTimeOut", TypeF32, Offset( mSlots.mDelayTimeOut.mValue, SFXPlayList ), NUM_SLOTS, + addFieldV( "delayTimeOut", TypeRangedF32, Offset( mSlots.mDelayTimeOut.mValue, SFXPlayList ), &CommonValidators::PositiveFloat, NUM_SLOTS, "Seconds to wait before moving out of slot after #transitionOut." ); addField( "delayTimeOutVariance", TypePoint2F, Offset( mSlots.mDelayTimeOut.mVariance, SFXPlayList ), NUM_SLOTS, "Bounds on randomization of #delayTimeOut.\n\n" "@ref SFXPlayList_randomization\n" ); - addField( "fadeTimeIn", TypeF32, Offset( mSlots.mFadeTimeIn.mValue, SFXPlayList ), NUM_SLOTS, + addFieldV( "fadeTimeIn", TypeRangedF32, Offset( mSlots.mFadeTimeIn.mValue, SFXPlayList ), &CommonValidators::PositiveFloat, NUM_SLOTS, "Seconds to fade sound in (-1 to use the track's own fadeInTime.)\n" "@see SFXDescription::fadeTimeIn" ); addField( "fadeTimeInVariance", TypePoint2F, Offset( mSlots.mFadeTimeIn.mVariance, SFXPlayList ), NUM_SLOTS, "Bounds on randomization of #fadeInTime.\n\n" "@ref SFXPlayList_randomization\n" ); - addField( "fadeTimeOut", TypeF32, Offset( mSlots.mFadeTimeOut.mValue, SFXPlayList ), NUM_SLOTS, + addFieldV( "fadeTimeOut", TypeRangedF32, Offset( mSlots.mFadeTimeOut.mValue, SFXPlayList ), &CommonValidators::PositiveFloat, NUM_SLOTS, "Seconds to fade sound out (-1 to use the track's own fadeOutTime.)\n" "@see SFXDescription::fadeTimeOut" ); addField( "fadeTimeOutVariance", TypePoint2F, Offset( mSlots.mFadeTimeOut.mVariance, SFXPlayList ), NUM_SLOTS, "Bounds on randomization of #fadeOutTime\n\n" "@ref SFXPlayList_randomization\n" ); - addField( "referenceDistance", TypeF32, Offset( mSlots.mMinDistance.mValue, SFXPlayList ), NUM_SLOTS, + addFieldV( "referenceDistance", TypeRangedF32, Offset( mSlots.mMinDistance.mValue, SFXPlayList ), &CommonValidators::PositiveFloat, NUM_SLOTS, "@c referenceDistance to set for 3D sounds in this slot (<1 to use @c referenceDistance of track's own description).\n" "@see SFXDescription::referenceDistance" ); addField( "referenceDistanceVariance", TypePoint2F, Offset( mSlots.mMinDistance.mVariance, SFXPlayList ), NUM_SLOTS, "Bounds on randomization of #referenceDistance.\n\n" "@ref SFXPlayList_randomization\n" ); - addField( "maxDistance", TypeF32, Offset( mSlots.mMaxDistance.mValue, SFXPlayList ), NUM_SLOTS, + addFieldV( "maxDistance", TypeRangedF32, Offset( mSlots.mMaxDistance.mValue, SFXPlayList ), &CommonValidators::PositiveFloat, NUM_SLOTS, "@c maxDistance to apply to 3D sounds in this slot (<1 to use @c maxDistance of track's own description).\n" "@see SFXDescription::maxDistance" ); addField( "maxDistanceVariance", TypePoint2F, Offset( mSlots.mMaxDistance.mVariance, SFXPlayList ), NUM_SLOTS, "Bounds on randomization of #maxDistance.\n\n" "@ref SFXPlayList_randomization\n" ); - addField( "volumeScale", TypeF32, Offset( mSlots.mVolumeScale.mValue, SFXPlayList ), NUM_SLOTS, + addFieldV( "volumeScale", TypeRangedF32, Offset( mSlots.mVolumeScale.mValue, SFXPlayList ), &CommonValidators::PositiveFloat, NUM_SLOTS, "Scale factor to apply to volume of sounds played on this list slot.\n" "This value will scale the actual volume level set on the track assigned to the slot, i.e. a value of 0.5 will " "cause the track to play at half-volume." ); addField( "volumeScaleVariance", TypePoint2F, Offset( mSlots.mVolumeScale.mVariance, SFXPlayList ), NUM_SLOTS, "Bounds on randomization of #volumeScale.\n\n" "@ref SFXPlayList_randomization\n" ); - addField( "pitchScale", TypeF32, Offset( mSlots.mPitchScale.mValue, SFXPlayList ), NUM_SLOTS, + addFieldV( "pitchScale", TypeRangedF32, Offset( mSlots.mPitchScale.mValue, SFXPlayList ), &CommonValidators::PositiveFloat, NUM_SLOTS, "Scale factor to apply to pitch of sounds played on this list slot.\n" "This value will scale the actual pitch set on the track assigned to the slot, i.e. a value of 0.5 will " "cause the track to play at half its assigned speed." ); addField( "pitchScaleVariance", TypePoint2F, Offset( mSlots.mPitchScale.mVariance, SFXPlayList ), NUM_SLOTS, "Bounds on randomization of #pitchScale.\n\n" "@ref SFXPlayList_randomization\n" ); - addField( "repeatCount", TypeS32, Offset( mSlots.mRepeatCount, SFXPlayList ), NUM_SLOTS, + addFieldV( "repeatCount", TypeRangedS32, Offset( mSlots.mRepeatCount, SFXPlayList ), &CommonValidators::PositiveInt, NUM_SLOTS, "Number of times to loop this slot." ); addField( "state", TypeSFXStateName, Offset( mSlots.mState, SFXPlayList ), NUM_SLOTS, "State that must be active for this slot to play.\n\n" diff --git a/Engine/source/sfx/sfxPlayList.h b/Engine/source/sfx/sfxPlayList.h index fde096659..60f0e3ac2 100644 --- a/Engine/source/sfx/sfxPlayList.h +++ b/Engine/source/sfx/sfxPlayList.h @@ -30,6 +30,10 @@ #include "sfx/sfxTrack.h" #endif +#ifndef _TYPEVALIDATORS_H_ +#include "console/typeValidators.h" +#endif + class SFXState; class SFXDescription; @@ -361,4 +365,5 @@ DefineEnumType( SFXPlayListStateMode ); DefineEnumType( SFXPlayListRandomMode ); DefineEnumType( SFXPlayListReplayMode ); +extern IRangeValidator playlistSlotRange; #endif // _SFXPLAYLIST_H_ diff --git a/Engine/source/terrain/terrData.cpp b/Engine/source/terrain/terrData.cpp index 8ee2bc504..a1259ea89 100644 --- a/Engine/source/terrain/terrData.cpp +++ b/Engine/source/terrain/terrData.cpp @@ -1373,7 +1373,7 @@ U32 TerrainBlock::packUpdate(NetConnection* con, U32 mask, BitStream *stream) if ( stream->writeFlag( mask & MiscMask ) ) stream->write( mScreenError ); - stream->writeInt(mBaseTexFormat, 32); + stream->writeInt(mBaseTexFormat, 3); stream->writeFlag(mUpdateBasetex); stream->writeFlag(mIgnoreZodiacs); @@ -1445,7 +1445,7 @@ void TerrainBlock::unpackUpdate(NetConnection* con, BitStream *stream) if ( stream->readFlag() ) // MiscMask stream->read( &mScreenError ); - mBaseTexFormat = (BaseTexFormat)stream->readInt(32); + mBaseTexFormat = (BaseTexFormat)stream->readInt(3); mUpdateBasetex = stream->readFlag(); mIgnoreZodiacs = stream->readFlag(); diff --git a/Engine/source/terrain/terrMaterial.cpp b/Engine/source/terrain/terrMaterial.cpp index 8c13861b4..85d3f4812 100644 --- a/Engine/source/terrain/terrMaterial.cpp +++ b/Engine/source/terrain/terrMaterial.cpp @@ -98,38 +98,38 @@ void TerrainMaterial::initPersistFields() { docsURL; INITPERSISTFIELD_IMAGEASSET(DiffuseMap, TerrainMaterial,"Base Albedo stretched over the whole map"); - addField( "diffuseSize", TypeF32, Offset( mDiffuseSize, TerrainMaterial ), "Used to scale the diffuse map to the material square" ); + addFieldV( "diffuseSize", TypeRangedF32, Offset( mDiffuseSize, TerrainMaterial ), &CommonValidators::PositiveFloat, "Used to scale the diffuse map to the material square" ); INITPERSISTFIELD_IMAGEASSET(NormalMap, TerrainMaterial,"NormalMap"); - addField( "parallaxScale", TypeF32, Offset( mParallaxScale, TerrainMaterial ), "Used to scale the height from the normal map to give some self " + addFieldV( "parallaxScale", TypeRangedF32, Offset( mParallaxScale, TerrainMaterial ), &CommonValidators::PositiveFloat, "Used to scale the height from the normal map to give some self " "occlusion effect (aka parallax) to the terrain material" ); - addField("blendHeightBase", TypeF32, Offset(mBlendDepth, TerrainMaterial), "A fixed value to add while blending using heightmap-based blending." + addFieldV("blendHeightBase", TypeRangedF32, Offset(mBlendDepth, TerrainMaterial), &CommonValidators::PositiveFloat, "A fixed value to add while blending using heightmap-based blending." "Higher numbers = larger blend radius."); - addField("blendHeightContrast", TypeF32, Offset(mBlendContrast, TerrainMaterial), "A fixed value to add while blending using heightmap-based blending." + addFieldV("blendHeightContrast", TypeRangedF32, Offset(mBlendContrast, TerrainMaterial), &CommonValidators::PositiveFloat, "A fixed value to add while blending using heightmap-based blending." "Higher numbers = larger blend radius."); - addFieldV("blendHeightHardness", TypeF32, Offset(mBlendHardness, TerrainMaterial), &hardnessValidator, "How sharply this layer blends with other textures." + addFieldV("blendHeightHardness", TypeRangedF32, Offset(mBlendHardness, TerrainMaterial), &hardnessValidator, "How sharply this layer blends with other textures." "0->1, soft->hard."); INITPERSISTFIELD_IMAGEASSET(DetailMap, TerrainMaterial, "Raises and lowers the RGB result of the Base Albedo up close."); - addField( "detailSize", TypeF32, Offset( mDetailSize, TerrainMaterial ), "Used to scale the detail map to the material square" ); - addField( "detailStrength", TypeF32, Offset( mDetailStrength, TerrainMaterial ), "Exponentially sharpens or lightens the detail map rendering on the material" ); - addField( "detailDistance", TypeF32, Offset( mDetailDistance, TerrainMaterial ), "Changes how far camera can see the detail map rendering on the material" ); - + addFieldV( "detailSize", TypeRangedF32, Offset( mDetailSize, TerrainMaterial ), &CommonValidators::PositiveFloat, "Used to scale the detail map to the material square" ); + addFieldV( "detailStrength", TypeRangedF32, Offset( mDetailStrength, TerrainMaterial ), &CommonValidators::PositiveFloat, "Exponentially sharpens or lightens the detail map rendering on the material" ); + addFieldV( "detailDistance", TypeRangedF32, Offset( mDetailDistance, TerrainMaterial ), &CommonValidators::PositiveFloat, "Changes how far camera can see the detail map rendering on the material" ); + /* addField( "useSideProjection", TypeBool, Offset( mSideProjection, TerrainMaterial ),"Makes that terrain material project along the sides of steep " "slopes instead of projected downwards"); - + */ INITPERSISTFIELD_IMAGEASSET(ORMConfigMap, TerrainMaterial, "AO|Roughness|metalness map (uses DetailMap UV Coords)"); addField("isSRGB", TypeBool, Offset(mIsSRGB, TerrainMaterial), "Is the PBR Config map's image in sRGB format?"); addField("invertRoughness", TypeBool, Offset(mInvertRoughness, TerrainMaterial), "Should the roughness channel of the PBR Config map be inverted?"); //Macro maps additions INITPERSISTFIELD_IMAGEASSET(MacroMap, TerrainMaterial, "Raises and lowers the RGB result of the Base Albedo at a distance."); - addField( "macroSize", TypeF32, Offset( mMacroSize, TerrainMaterial ), "Used to scale the Macro map to the material square" ); - addField( "macroStrength", TypeF32, Offset( mMacroStrength, TerrainMaterial ), "Exponentially sharpens or lightens the Macro map rendering on the material" ); - addField( "macroDistance", TypeF32, Offset( mMacroDistance, TerrainMaterial ), "Changes how far camera can see the Macro map rendering on the material" ); + addFieldV( "macroSize", TypeRangedF32, Offset( mMacroSize, TerrainMaterial ), &CommonValidators::PositiveFloat, "Used to scale the Macro map to the material square" ); + addFieldV( "macroStrength", TypeRangedF32, Offset( mMacroStrength, TerrainMaterial ), &CommonValidators::PositiveFloat, "Exponentially sharpens or lightens the Macro map rendering on the material" ); + addFieldV( "macroDistance", TypeRangedF32, Offset( mMacroDistance, TerrainMaterial ), &CommonValidators::PositiveFloat, "Changes how far camera can see the Macro map rendering on the material" ); Parent::initPersistFields();