Merge pull request #1274 from Areloch/Enumnanigans

Various small tweaks to facilitate bitmask and enum editing in the inspector
This commit is contained in:
Areloch 2024-07-26 17:15:35 -05:00 committed by GitHub
commit c8cdc7647b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 58 additions and 9 deletions

View file

@ -160,8 +160,11 @@ enum SceneObjectTypes
InteriorLikeObjectType = BIT(24),
TerrainLikeObjectType = BIT(25),
#if defined(AFX_CAP_AFXMODEL_TYPE)
afxModelObjectType = BIT(26)
afxModelObjectType = BIT(26),
#else
N_A_27 = BIT(26),
#endif
N_A_28 = BIT(27),
// PATHSHAPE
PathShapeObjectType = BIT( 28 ),
@ -170,6 +173,8 @@ enum SceneObjectTypes
/// A turret object.
/// @see TurretShape
TurretObjectType = BIT(29),
N_A_31 = BIT(30),
N_A_32 = BIT(31),
/// @}
};

View file

@ -38,7 +38,6 @@
#include "T3D/physics/physicsBody.h"
#include "T3D/physics/physicsCollision.h"
bool Trigger::smRenderTriggers = false;
//-----------------------------------------------------------------------------
@ -381,7 +380,7 @@ void Trigger::initPersistFields()
addField("TripOnce", TypeBool, Offset(mTripOnce, Trigger),"Do we trigger callacks just the once?");
addField("TripCondition", TypeRealString, Offset(mTripCondition, Trigger),"evaluation condition to trip callbacks (true/false)");
addField("TrippedBy", TypeS32, Offset(mTrippedBy, Trigger), "typemask filter");
addField("TrippedBy", TypeGameTypeMasksType, Offset(mTrippedBy, Trigger), "typemask filter");
addProtectedField("enterCommand", TypeCommand, Offset(mEnterCommand, Trigger), &setEnterCmd, &defaultProtectedGetFn,
"The command to execute when an object enters this trigger. Object id stored in %%obj. Maximum 1023 characters." );
addProtectedField("leaveCommand", TypeCommand, Offset(mLeaveCommand, Trigger), &setLeaveCmd, &defaultProtectedGetFn,

View file

@ -218,13 +218,13 @@ class BitfieldConsoleBaseType : public ConsoleBaseType
{
static const U32 bufSize = 256;
char* returnBuffer = Con::getReturnBuffer(bufSize);
dSprintf(returnBuffer, bufSize, "0x%08x", *((S32 *) dptr) );
dSprintf(returnBuffer, bufSize, "%i", *((S32 *) dptr) );
return returnBuffer;
}
void setData( void* dptr, S32 argc, const char** argv, const EnumTable*, BitSet32 ) override
{
if( argc != 1 ) return; \
*((S32 *) dptr) = dAtoui(argv[0],0); \
*((S32 *) dptr) = dAtoui(argv[0]); \
}
};

View file

@ -44,6 +44,48 @@
#include "sim/netObject.h"
ImplementBitfieldType(GameTypeMasksType,
"The type of animation effect to apply to this material.\n"
"@ingroup GFX\n\n")
{ SceneObjectTypes::StaticObjectType, "StaticObjectType", "Static Objects.\n" },
{ SceneObjectTypes::EnvironmentObjectType, "EnvironmentObjectType" , "Objects considered part of the background or environment of a level.\n" },
{ SceneObjectTypes::TerrainObjectType, "TerrainObjectType" , "Terrain Objects.\n" },
{ SceneObjectTypes::WaterObjectType, "WaterObjectType", "Water Objects.\n" },
{ SceneObjectTypes::TriggerObjectType, "TriggerObjectType", "Interactive Trigger Objects.\n" },
{ SceneObjectTypes::MarkerObjectType, "MarkerObjectType", "Marker Objects, utilized primarily for tooling.\n" },
{ SceneObjectTypes::LightObjectType, "LightObjectType", "Lights.\n" },
{ SceneObjectTypes::ZoneObjectType, "ZoneObjectType", "zones.\n" },
{ SceneObjectTypes::StaticShapeObjectType, "StaticShapeObjectType", "Static Shape Objects. Distinct from StaticObjectType in that Static Shapes have additional functionality and behaviors.\n" },
{ SceneObjectTypes::DynamicShapeObjectType, "DynamicShapeObjectType", "Any sort of Dynamic Object.\n" },
{ SceneObjectTypes::GameBaseObjectType, "GameBaseObjectType", "Any Gamebase-based Objects. Objects generally associated to gameplay functionality.\n" },
{ SceneObjectTypes::GameBaseHiFiObjectType, "GameBaseHiFiObjectType", "Specialised Gamebase-based Objects. currently narrowly used. if at all.\n" },
{ SceneObjectTypes::ShapeBaseObjectType, "ShapeBaseObjectType", "Any Gamebase-based Objects. Objects generally associated to gameplay functionality.\n" },
{ SceneObjectTypes::CameraObjectType, "CameraObjectType", "Camera Objects.\n" },
{ SceneObjectTypes::PlayerObjectType, "PlayerObjectType", "Player Objects.\n" },
{ SceneObjectTypes::ItemObjectType, "ItemObjectType", "Item Objects.\n" },
{ SceneObjectTypes::VehicleObjectType, "VehicleObjectType", "Any sort of Vehicle Object.\n" },
{ SceneObjectTypes::VehicleBlockerObjectType, "VehicleBlockerObjectType", "\n" },
{ SceneObjectTypes::ProjectileObjectType, "ProjectileObjectType", "Projectiles.\n" },
{ SceneObjectTypes::ExplosionObjectType, "ExplosionObjectType", "Explosion and Effects.\n" },
{ SceneObjectTypes::CorpseObjectType, "CorpseObjectType", "Corpses of controlled objects.\n" },
{ SceneObjectTypes::DebrisObjectType, "DebrisObjectType", "Debris or debris-like things such as shell casings.\n" },
{ SceneObjectTypes::PhysicalZoneObjectType, "PhysicalZoneObjectType", "Physical Zones. Distinct from triggers in that they have physics forces applications.\n" },
{ SceneObjectTypes::EntityObjectType, "EntityObjectType", "A generic entity.\n" },
{ SceneObjectTypes::InteriorLikeObjectType, "InteriorLikeObjectType", "InteriorLikeObjectType (deprecated).\n" },
{ SceneObjectTypes::TerrainLikeObjectType, "TerrainLikeObjectType", "Pseudo-terrains, like groundplanes, or meshroads.\n" },
#if defined(AFX_CAP_AFXMODEL_TYPE)
{ SceneObjectTypes::afxModelObjectType, "afxModelObjectType", "afx-specific model typemask.\n" },
#else
{ SceneObjectTypes::N_A_27, "N_A_27", "unused 27th bit.\n" },
#endif
{ SceneObjectTypes::N_A_28, "N_A_28", "unused 28th bit.\n" },
{ SceneObjectTypes::PathShapeObjectType, "PathShapeObjectType", "Path-following Objects.\n" },
{ SceneObjectTypes::TurretObjectType, "TurretObjectType", "Turret Objects.\n" },
{ SceneObjectTypes::N_A_31, "N_A_31", "unused 31st bit.\n" },
{ SceneObjectTypes::N_A_32, "N_A_32", "unused 32nd bit.\n" },
EndImplementBitfieldType;
IMPLEMENT_CONOBJECT( SimObject );
// See full description in the new CHM manual

View file

@ -40,6 +40,7 @@
#ifndef _TAML_CALLBACKS_H_
#include "persistence/taml/tamlCallbacks.h"
#endif
#include "T3D/objectTypes.h"
class Stream;
class LightManager;
@ -1009,6 +1010,8 @@ public:
virtual void reloadReset() { }
};
typedef SceneObjectTypes GameTypeMasksType;
DefineBitfieldType(GameTypeMasksType);
/// Smart SimObject pointer.
///

View file

@ -1459,7 +1459,7 @@ void GuiInspectorTypeBitMask32::consoleInit()
Parent::consoleInit();
// Set this to be the inspector type for all bitfield console types.
for( ConsoleBaseType* type = ConsoleBaseType::getListHead(); type != NULL; type = type->getListNext() )
if( type->getTypeInfo() && type->getTypeInfo()->isBitfield() )
type->setInspectorFieldType( "GuiInspectorTypeBitMask32" );
@ -1520,7 +1520,7 @@ StringTableEntry GuiInspectorTypeBitMask32::getValue()
void GuiInspectorTypeBitMask32::setValue( StringTableEntry value )
{
U32 mask = dAtoui( value, 0 );
U32 mask = dAtoui( value );
for ( U32 i = 0; i < mArrayCtrl->size(); i++ )
{
@ -1583,7 +1583,7 @@ GuiControl* GuiInspectorTypeBitMask32Helper::constructEditControl()
mButton->setField( "Command", szBuffer );
mButton->setField( "buttonType", "ToggleButton" );
mButton->setDataField( StringTable->insert("Profile"), NULL, "GuiInspectorButtonProfile" );
mButton->setBitmap(StringTable->insert("ToolsModule:arrowBtn_image") );
mButton->setBitmap(StringTable->insert("ToolsModule:arrowBtn_n_image") );
mButton->setStateOn( true );
mButton->setExtent( 16, 16 );
mButton->registerObject();

View file

@ -357,7 +357,7 @@ void Material::initPersistFields()
endGroup("Lighting Properties");
addGroup("Animation Properties");
addField("animFlags", TYPEID< AnimType >(), Offset(mAnimFlags, Material), MAX_STAGES,
addField("animFlags", TypeMaterialAnimType, Offset(mAnimFlags, Material), MAX_STAGES,
"The types of animation to play on this material.");
addField("scrollDir", TypePoint2F, Offset(mScrollDir, Material), MAX_STAGES,