fill in the validated variables

This commit is contained in:
AzaezelX 2025-03-09 11:53:23 -05:00
parent fa760fa746
commit f633ef3a3d
184 changed files with 1359 additions and 1216 deletions

View file

@ -77,7 +77,7 @@ void CoverPoint::initPersistFields()
addField("size", TYPEID<CoverPointSize>(), 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),

View file

@ -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<NavMesh*>(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<NavMeshWaterMethod>(), 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");

View file

@ -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,