From b77911bdcd4235436011eb1bc3791c79ae13e9a6 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sat, 4 May 2024 09:56:04 -0500 Subject: [PATCH 1/3] Exposes the SceneObjectTypeMasks as an enum type, allowing it to be utilized in inspectors. Updated Trigger triggeredBy field to utilize new enum type for editing Updated MaterialDefinition's animFlags field to utilize appropriate enum type for editing Fixed image reference in bitmask inspectorField type to use correct image asset name --- Engine/source/T3D/trigger.cpp | 3 +- Engine/source/console/simObject.cpp | 29 +++++++++++++++++++ Engine/source/console/simObject.h | 3 ++ .../source/gui/editor/guiInspectorTypes.cpp | 4 +-- .../source/materials/materialDefinition.cpp | 10 +++++-- 5 files changed, 43 insertions(+), 6 deletions(-) diff --git a/Engine/source/T3D/trigger.cpp b/Engine/source/T3D/trigger.cpp index 1fa807ce2..0320d6208 100644 --- a/Engine/source/T3D/trigger.cpp +++ b/Engine/source/T3D/trigger.cpp @@ -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, diff --git a/Engine/source/console/simObject.cpp b/Engine/source/console/simObject.cpp index 926827c86..6fe643ab3 100644 --- a/Engine/source/console/simObject.cpp +++ b/Engine/source/console/simObject.cpp @@ -44,6 +44,35 @@ #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::GameBaseObjectType, "GameBaseObjectType", "Any Gamebase-based Objects. Objects generally associated to gameplay functionality.\n" }, +{ SceneObjectTypes::ShapeBaseObjectType, "ShapeBaseObjectType", "Any Gamebase-based Objects. Objects generally associated to gameplay functionality.\n" }, +{ SceneObjectTypes::CameraObjectType, "CameraObjectType", "Camera Objects.\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::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::LightObjectType, "LightObjectType", "Lights.\n" }, +{ SceneObjectTypes::PathShapeObjectType, "PathShapeObjectType", "Path-following Objects.\n" }, +{ SceneObjectTypes::TurretObjectType, "TurretObjectType", "Turret Objects.\n" }, + +EndImplementBitfieldType; + IMPLEMENT_CONOBJECT( SimObject ); // See full description in the new CHM manual diff --git a/Engine/source/console/simObject.h b/Engine/source/console/simObject.h index 7588f0aec..563f86e12 100644 --- a/Engine/source/console/simObject.h +++ b/Engine/source/console/simObject.h @@ -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. /// diff --git a/Engine/source/gui/editor/guiInspectorTypes.cpp b/Engine/source/gui/editor/guiInspectorTypes.cpp index 39b59d1ea..89477418b 100644 --- a/Engine/source/gui/editor/guiInspectorTypes.cpp +++ b/Engine/source/gui/editor/guiInspectorTypes.cpp @@ -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" ); @@ -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(); diff --git a/Engine/source/materials/materialDefinition.cpp b/Engine/source/materials/materialDefinition.cpp index e496d3e61..056d6e001 100644 --- a/Engine/source/materials/materialDefinition.cpp +++ b/Engine/source/materials/materialDefinition.cpp @@ -77,7 +77,13 @@ ImplementBitfieldType(MaterialAnimType, { Material::Rotate, "Rotate" , "Rotate the material around a point.\n" }, { Material::Wave, "Wave" , "Warps the material with an animation using Sin, Triangle or Square mathematics.\n" }, { Material::Scale, "Scale", "Scales the material larger and smaller with a pulsing effect.\n" }, -{ Material::Sequence, "Sequence", "Enables the material to have multiple frames of animation in its imagemap.\n" } +{ Material::Sequence, "Sequence", "Enables the material to have multiple frames of animation in its imagemap.\n" }, +{ Material::Sequence, "SequenceA", "Enables the material to have multiple frames of animation in its imagemap.\n" }, +{ Material::Sequence, "SequenceB", "Enables the material to have multiple frames of animation in its imagemap.\n" }, +{ Material::Sequence, "SequenceC", "Enables the material to have multiple frames of animation in its imagemap.\n" }, +{ Material::Sequence, "SequenceD", "Enables the material to have multiple frames of animation in its imagemap.\n" }, +{ Material::Sequence, "SequenceE", "Enables the material to have multiple frames of animation in its imagemap.\n" }, +{ Material::Sequence, "SequenceF", "Enables the material to have multiple frames of animation in its imagemap.\n" } EndImplementBitfieldType; ImplementEnumType(MaterialBlendOp, @@ -357,7 +363,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, From da743d9dc48e81a9a8fbbd6558b86b3a8d700e23 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sat, 4 May 2024 10:19:12 -0500 Subject: [PATCH 2/3] Removed test enum values --- Engine/source/materials/materialDefinition.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/Engine/source/materials/materialDefinition.cpp b/Engine/source/materials/materialDefinition.cpp index 056d6e001..8c5201b47 100644 --- a/Engine/source/materials/materialDefinition.cpp +++ b/Engine/source/materials/materialDefinition.cpp @@ -77,13 +77,7 @@ ImplementBitfieldType(MaterialAnimType, { Material::Rotate, "Rotate" , "Rotate the material around a point.\n" }, { Material::Wave, "Wave" , "Warps the material with an animation using Sin, Triangle or Square mathematics.\n" }, { Material::Scale, "Scale", "Scales the material larger and smaller with a pulsing effect.\n" }, -{ Material::Sequence, "Sequence", "Enables the material to have multiple frames of animation in its imagemap.\n" }, -{ Material::Sequence, "SequenceA", "Enables the material to have multiple frames of animation in its imagemap.\n" }, -{ Material::Sequence, "SequenceB", "Enables the material to have multiple frames of animation in its imagemap.\n" }, -{ Material::Sequence, "SequenceC", "Enables the material to have multiple frames of animation in its imagemap.\n" }, -{ Material::Sequence, "SequenceD", "Enables the material to have multiple frames of animation in its imagemap.\n" }, -{ Material::Sequence, "SequenceE", "Enables the material to have multiple frames of animation in its imagemap.\n" }, -{ Material::Sequence, "SequenceF", "Enables the material to have multiple frames of animation in its imagemap.\n" } +{ Material::Sequence, "Sequence", "Enables the material to have multiple frames of animation in its imagemap.\n" } EndImplementBitfieldType; ImplementEnumType(MaterialBlendOp, From eaa09a6db701bc7d14a790c60051ed877efea7b0 Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Wed, 24 Jul 2024 20:43:36 -0500 Subject: [PATCH 3/3] corrections: fill in missing SceneObjectTypes enums. parity with simobject.cpp and objecttypes.h correct inspector display --- Engine/source/T3D/objectTypes.h | 7 ++++++- Engine/source/console/dynamicTypes.h | 4 ++-- Engine/source/console/simObject.cpp | 21 +++++++++++++++---- .../source/gui/editor/guiInspectorTypes.cpp | 2 +- 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/Engine/source/T3D/objectTypes.h b/Engine/source/T3D/objectTypes.h index 77741ab33..c6b05df74 100644 --- a/Engine/source/T3D/objectTypes.h +++ b/Engine/source/T3D/objectTypes.h @@ -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), /// @} }; diff --git a/Engine/source/console/dynamicTypes.h b/Engine/source/console/dynamicTypes.h index 416519f74..f805f12cb 100644 --- a/Engine/source/console/dynamicTypes.h +++ b/Engine/source/console/dynamicTypes.h @@ -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]); \ } }; diff --git a/Engine/source/console/simObject.cpp b/Engine/source/console/simObject.cpp index 6fe643ab3..7a9bb4404 100644 --- a/Engine/source/console/simObject.cpp +++ b/Engine/source/console/simObject.cpp @@ -53,11 +53,14 @@ ImplementBitfieldType(GameTypeMasksType, { SceneObjectTypes::WaterObjectType, "WaterObjectType", "Water Objects.\n" }, { SceneObjectTypes::TriggerObjectType, "TriggerObjectType", "Interactive Trigger Objects.\n" }, { SceneObjectTypes::MarkerObjectType, "MarkerObjectType", "Marker Objects, utilized primarily for tooling.\n" }, -{ SceneObjectTypes::GameBaseObjectType, "GameBaseObjectType", "Any Gamebase-based Objects. Objects generally associated to gameplay functionality.\n" }, -{ SceneObjectTypes::ShapeBaseObjectType, "ShapeBaseObjectType", "Any Gamebase-based Objects. Objects generally associated to gameplay functionality.\n" }, -{ SceneObjectTypes::CameraObjectType, "CameraObjectType", "Camera Objects.\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" }, @@ -67,9 +70,19 @@ ImplementBitfieldType(GameTypeMasksType, { 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::LightObjectType, "LightObjectType", "Lights.\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; diff --git a/Engine/source/gui/editor/guiInspectorTypes.cpp b/Engine/source/gui/editor/guiInspectorTypes.cpp index 89477418b..e12e61b97 100644 --- a/Engine/source/gui/editor/guiInspectorTypes.cpp +++ b/Engine/source/gui/editor/guiInspectorTypes.cpp @@ -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++ ) {