From 64103a58aa5121d30a92310615f7ddbc197bc732 Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Thu, 6 Mar 2025 19:04:22 -0600 Subject: [PATCH 1/5] enum value listing show the string value of masked enums in variable entries also sort the combo case of scrolling and rotating materials --- Engine/source/console/dynamicTypes.h | 31 +++- Engine/source/console/simObject.cpp | 64 +++---- .../source/materials/materialDefinition.cpp | 13 +- Engine/source/materials/materialDefinition.h | 11 +- .../materials/processedShaderMaterial.cpp | 159 ++++++++---------- 5 files changed, 141 insertions(+), 137 deletions(-) diff --git a/Engine/source/console/dynamicTypes.h b/Engine/source/console/dynamicTypes.h index f805f12cb..b635ab7ea 100644 --- a/Engine/source/console/dynamicTypes.h +++ b/Engine/source/console/dynamicTypes.h @@ -214,13 +214,34 @@ class BitfieldConsoleBaseType : public ConsoleBaseType public: - const char* getData( void* dptr, const EnumTable*, BitSet32 ) override + const char* getData(void* dptr, const EnumTable* tbl, BitSet32) override { - static const U32 bufSize = 256; - char* returnBuffer = Con::getReturnBuffer(bufSize); - dSprintf(returnBuffer, bufSize, "%i", *((S32 *) dptr) ); - return returnBuffer; + BitSet32 dptrVal = BitSet32(*(U32*)dptr); + String returnBuffer; + if (!tbl) tbl = getEnumTable(); + + const U32 numEnums = tbl->getNumValues(); + bool first = true; + + for (U32 i = 0; i < numEnums; i++) + { + if (dptrVal.test(BIT(i))) + { + if (first) + { + returnBuffer = String::ToString("%s",(*tbl)[i].getName()); + } + else + { + returnBuffer += String::ToString(" | %s", (*tbl)[i].getName()); + } + first = false; + } + } + + return Con::getReturnBuffer(returnBuffer); } + void setData( void* dptr, S32 argc, const char** argv, const EnumTable*, BitSet32 ) override { if( argc != 1 ) return; \ diff --git a/Engine/source/console/simObject.cpp b/Engine/source/console/simObject.cpp index b1863d5bd..e607fbcfa 100644 --- a/Engine/source/console/simObject.cpp +++ b/Engine/source/console/simObject.cpp @@ -47,42 +47,42 @@ 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" }, +{ SceneObjectTypes::StaticObjectType, "$TypeMasks::StaticObjectType", "Static Objects.\n" }, +{ SceneObjectTypes::EnvironmentObjectType, "$TypeMasks::EnvironmentObjectType" , "Objects considered part of the background or environment of a level.\n" }, +{ SceneObjectTypes::TerrainObjectType, "$TypeMasks::TerrainObjectType" , "Terrain Objects.\n" }, +{ SceneObjectTypes::WaterObjectType, "$TypeMasks::WaterObjectType", "Water Objects.\n" }, +{ SceneObjectTypes::TriggerObjectType, "$TypeMasks::TriggerObjectType", "Interactive Trigger Objects.\n" }, +{ SceneObjectTypes::MarkerObjectType, "$TypeMasks::MarkerObjectType", "Marker Objects, utilized primarily for tooling.\n" }, +{ SceneObjectTypes::LightObjectType, "$TypeMasks::LightObjectType", "Lights.\n" }, +{ SceneObjectTypes::ZoneObjectType, "$TypeMasks::ZoneObjectType", "zones.\n" }, +{ SceneObjectTypes::StaticShapeObjectType, "$TypeMasks::StaticShapeObjectType", "Static Shape Objects. Distinct from StaticObjectType in that Static Shapes have additional functionality and behaviors.\n" }, +{ SceneObjectTypes::DynamicShapeObjectType, "$TypeMasks::DynamicShapeObjectType", "Any sort of Dynamic Object.\n" }, +{ SceneObjectTypes::GameBaseObjectType, "$TypeMasks::GameBaseObjectType", "Any Gamebase-based Objects. Objects generally associated to gameplay functionality.\n" }, +{ SceneObjectTypes::GameBaseHiFiObjectType, "$TypeMasks::GameBaseHiFiObjectType", "Specialised Gamebase-based Objects. currently narrowly used. if at all.\n" }, +{ SceneObjectTypes::ShapeBaseObjectType, "$TypeMasks::ShapeBaseObjectType", "Any Gamebase-based Objects. Objects generally associated to gameplay functionality.\n" }, +{ SceneObjectTypes::CameraObjectType, "$TypeMasks::CameraObjectType", "Camera Objects.\n" }, +{ SceneObjectTypes::PlayerObjectType, "$TypeMasks::PlayerObjectType", "Player Objects.\n" }, +{ SceneObjectTypes::ItemObjectType, "$TypeMasks::ItemObjectType", "Item Objects.\n" }, +{ SceneObjectTypes::VehicleObjectType, "$TypeMasks::VehicleObjectType", "Any sort of Vehicle Object.\n" }, +{ SceneObjectTypes::VehicleBlockerObjectType, "$TypeMasks::VehicleBlockerObjectType", "\n" }, +{ SceneObjectTypes::ProjectileObjectType, "$TypeMasks::ProjectileObjectType", "Projectiles.\n" }, +{ SceneObjectTypes::ExplosionObjectType, "$TypeMasks::ExplosionObjectType", "Explosion and Effects.\n" }, +{ SceneObjectTypes::CorpseObjectType, "$TypeMasks::CorpseObjectType", "Corpses of controlled objects.\n" }, +{ SceneObjectTypes::DebrisObjectType, "$TypeMasks::DebrisObjectType", "Debris or debris-like things such as shell casings.\n" }, +{ SceneObjectTypes::PhysicalZoneObjectType, "$TypeMasks::PhysicalZoneObjectType", "Physical Zones. Distinct from triggers in that they have physics forces applications.\n" }, +{ SceneObjectTypes::EntityObjectType, "$TypeMasks::EntityObjectType", "A generic entity.\n" }, +{ SceneObjectTypes::InteriorLikeObjectType, "$TypeMasks::InteriorLikeObjectType", "InteriorLikeObjectType (deprecated).\n" }, +{ SceneObjectTypes::TerrainLikeObjectType, "$TypeMasks::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" }, +{ SceneObjectTypes::N_A_27, "$TypeMasks::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" }, +{ SceneObjectTypes::N_A_28, "$TypeMasks::N_A_28", "unused 28th bit.\n" }, +{ SceneObjectTypes::PathShapeObjectType, "$TypeMasks::PathShapeObjectType", "Path-following Objects.\n" }, +{ SceneObjectTypes::TurretObjectType, "$TypeMasks::TurretObjectType", "Turret Objects.\n" }, +{ SceneObjectTypes::N_A_31, "$TypeMasks::N_A_31", "unused 31st bit.\n" }, +{ SceneObjectTypes::N_A_32, "$TypeMasks::N_A_32", "unused 32nd bit.\n" }, EndImplementBitfieldType; diff --git a/Engine/source/materials/materialDefinition.cpp b/Engine/source/materials/materialDefinition.cpp index c9a09bd0d..d8619f04b 100644 --- a/Engine/source/materials/materialDefinition.cpp +++ b/Engine/source/materials/materialDefinition.cpp @@ -71,13 +71,12 @@ ConsoleDocClass(Material, ImplementBitfieldType(MaterialAnimType, "The type of animation effect to apply to this material.\n" "@ingroup GFX\n\n") -{ - Material::Scroll, "Scroll", "Scroll the material along the X/Y axis.\n" -}, -{ 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::No, "$No", "No animations.\n"}, +{ Material::Scroll, "$Scroll", "Scroll the material along the X/Y axis.\n"}, +{ 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" } EndImplementBitfieldType; ImplementEnumType(MaterialBlendOp, diff --git a/Engine/source/materials/materialDefinition.h b/Engine/source/materials/materialDefinition.h index e17bdd317..1fbf0e81c 100644 --- a/Engine/source/materials/materialDefinition.h +++ b/Engine/source/materials/materialDefinition.h @@ -115,11 +115,12 @@ public: enum AnimType { - Scroll = 1, - Rotate = 2, - Wave = 4, - Scale = 8, - Sequence = 16, + No = 0, + Scroll = BIT(0), + Rotate = BIT(1), + Wave = BIT(2), + Scale = BIT(3), + Sequence = BIT(4), }; enum WaveType diff --git a/Engine/source/materials/processedShaderMaterial.cpp b/Engine/source/materials/processedShaderMaterial.cpp index 521ec04c6..6747c3f85 100644 --- a/Engine/source/materials/processedShaderMaterial.cpp +++ b/Engine/source/materials/processedShaderMaterial.cpp @@ -914,98 +914,81 @@ void ProcessedShaderMaterial::_setTextureTransforms(const U32 pass) PROFILE_SCOPE( ProcessedShaderMaterial_SetTextureTransforms ); ShaderConstHandles* handles = _getShaderConstHandles(pass); - if (handles->mTexMatSC->isValid()) - { - MatrixF texMat( true ); + if (!handles->mTexMatSC->isValid()) + return; - mMaterial->updateTimeBasedParams(); - F32 waveOffset = _getWaveOffset( pass ); // offset is between 0.0 and 1.0 + MatrixF texMat(true); + mMaterial->updateTimeBasedParams(); + F32 waveOffset = _getWaveOffset(pass); // offset is between 0.0 and 1.0 - // handle scroll anim type - if( mMaterial->mAnimFlags[pass] & Material::Scroll ) - { - if( mMaterial->mAnimFlags[pass] & Material::Wave ) - { - Point3F scrollOffset; - scrollOffset.x = mMaterial->mScrollDir[pass].x * waveOffset; - scrollOffset.y = mMaterial->mScrollDir[pass].y * waveOffset; - scrollOffset.z = 1.0; + // --- Scroll Animation --- + if (mMaterial->mAnimFlags[pass] & Material::Scroll) + { + Point3F offset = (mMaterial->mAnimFlags[pass] & Material::Wave) + ? Point3F(mMaterial->mScrollDir[pass].x * waveOffset, + mMaterial->mScrollDir[pass].y * waveOffset, 0.0f) + : Point3F(mMaterial->mScrollOffset[pass].x, + mMaterial->mScrollOffset[pass].y, 0.0f); - texMat.setColumn( 3, scrollOffset ); - } - else - { - Point3F offset( mMaterial->mScrollOffset[pass].x, - mMaterial->mScrollOffset[pass].y, - 1.0 ); - - texMat.setColumn( 3, offset ); - } - - } - - // handle rotation - if( mMaterial->mAnimFlags[pass] & Material::Rotate ) - { - if( mMaterial->mAnimFlags[pass] & Material::Wave ) - { - F32 rotPos = waveOffset * M_2PI; - texMat.set( EulerF( 0.0, 0.0, rotPos ) ); - texMat.setColumn( 3, Point3F( 0.5, 0.5, 0.0 ) ); - - MatrixF test( true ); - test.setColumn( 3, Point3F( mMaterial->mRotPivotOffset[pass].x, - mMaterial->mRotPivotOffset[pass].y, - 0.0 ) ); - texMat.mul( test ); - } - else - { - texMat.set( EulerF( 0.0, 0.0, mMaterial->mRotPos[pass] ) ); - - texMat.setColumn( 3, Point3F( 0.5, 0.5, 0.0 ) ); - - MatrixF test( true ); - test.setColumn( 3, Point3F( mMaterial->mRotPivotOffset[pass].x, - mMaterial->mRotPivotOffset[pass].y, - 0.0 ) ); - texMat.mul( test ); - } - } - - // Handle scale + wave offset - if( mMaterial->mAnimFlags[pass] & Material::Scale && - mMaterial->mAnimFlags[pass] & Material::Wave ) - { - F32 wOffset = fabs( waveOffset ); - - texMat.setColumn( 3, Point3F( 0.5, 0.5, 0.0 ) ); - - MatrixF temp( true ); - temp.setRow( 0, Point3F( wOffset, 0.0, 0.0 ) ); - temp.setRow( 1, Point3F( 0.0, wOffset, 0.0 ) ); - temp.setRow( 2, Point3F( 0.0, 0.0, wOffset ) ); - temp.setColumn( 3, Point3F( -wOffset * 0.5, -wOffset * 0.5, 0.0 ) ); - texMat.mul( temp ); - } - - // handle sequence - if( mMaterial->mAnimFlags[pass] & Material::Sequence ) - { - U32 frameNum = (U32)(MATMGR->getTotalTime() * mMaterial->mSeqFramePerSec[pass]); - F32 offset = frameNum * mMaterial->mSeqSegSize[pass]; - - if ( mMaterial->mAnimFlags[pass] & Material::Scale ) - texMat.scale( Point3F( mMaterial->mSeqSegSize[pass], 1.0f, 1.0f ) ); - - Point3F texOffset = texMat.getPosition(); - texOffset.x += offset; - texMat.setPosition( texOffset ); - } - - GFXShaderConstBuffer* shaderConsts = _getShaderConstBuffer(pass); - shaderConsts->setSafe(handles->mTexMatSC, texMat); + MatrixF scrollMat(true); + scrollMat.setColumn(3, offset); + texMat.mul(scrollMat); } + + // --- Rotation Animation --- + if (mMaterial->mAnimFlags[pass] & Material::Rotate) + { + F32 rotationAngle = (mMaterial->mAnimFlags[pass] & Material::Wave) + ? waveOffset * M_2PI + : mMaterial->mRotPos[pass]; + + MatrixF rotationMat(EulerF(0.0f, 0.0f, rotationAngle)); + + Point3F pivotPoint( + mMaterial->mRotPivotOffset[pass].x, + mMaterial->mRotPivotOffset[pass].y, + 0.0f); + + MatrixF finalRotationMat(true); + finalRotationMat.setColumn(3, pivotPoint); + finalRotationMat.mul(rotationMat); + finalRotationMat.setColumn(3, -pivotPoint); + + // Apply final rotation matrix + texMat.mul(finalRotationMat); + } + + // --- Scale Animation --- + if ((mMaterial->mAnimFlags[pass] & Material::Scale) && (mMaterial->mAnimFlags[pass] & Material::Wave)) + { + F32 scaleFactor = mFabs(waveOffset); + + MatrixF scaleMat(true); + scaleMat.setRow(0, Point3F(scaleFactor, 0.0f, 0.0f)); + scaleMat.setRow(1, Point3F(0.0f, scaleFactor, 0.0f)); + scaleMat.setRow(2, Point3F(0.0f, 0.0f, scaleFactor)); + + // Apply final scale matrix + texMat.mul(scaleMat); + } + + // --- Sequence Animation --- + if (mMaterial->mAnimFlags[pass] & Material::Sequence) + { + U32 frameNum = static_cast(MATMGR->getTotalTime() * mMaterial->mSeqFramePerSec[pass]); + F32 offset = frameNum * mMaterial->mSeqSegSize[pass]; + + MatrixF sequenceMat(true); + sequenceMat.setColumn(3, Point3F(offset, 0.0f, 0.0f)); + + if (mMaterial->mAnimFlags[pass] & Material::Scale) + sequenceMat.scale(Point3F(mMaterial->mSeqSegSize[pass], 1.0f, 1.0f)); + + texMat.mul(sequenceMat); + } + + GFXShaderConstBuffer* shaderConsts = _getShaderConstBuffer(pass); + shaderConsts->setSafe(handles->mTexMatSC, texMat); } //-------------------------------------------------------------------------- From 0ac0ee88c2d3da36e53260e43665b0a8bcd06df4 Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Thu, 6 Mar 2025 20:55:40 -0600 Subject: [PATCH 2/5] BitfieldConsoleBaseType::setData definition also, preserve saved out 0 and -1 numbers to resrver 'none' and 'all' ditch 'no' materialdefinition::animtype --- Engine/source/console/dynamicTypes.h | 30 +++++++++++++++++-- .../source/materials/materialDefinition.cpp | 5 +--- Engine/source/materials/materialDefinition.h | 1 - 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/Engine/source/console/dynamicTypes.h b/Engine/source/console/dynamicTypes.h index b635ab7ea..7f0fdf4cc 100644 --- a/Engine/source/console/dynamicTypes.h +++ b/Engine/source/console/dynamicTypes.h @@ -223,6 +223,15 @@ class BitfieldConsoleBaseType : public ConsoleBaseType const U32 numEnums = tbl->getNumValues(); bool first = true; + if (dptrVal.testStrict(-1)) //test for all + { + return Con::getReturnBuffer("-1"); + } + else if (!dptrVal.test(-1)) //test for none + { + return Con::getReturnBuffer("0"); + } + for (U32 i = 0; i < numEnums; i++) { if (dptrVal.test(BIT(i))) @@ -242,10 +251,25 @@ class BitfieldConsoleBaseType : public ConsoleBaseType return Con::getReturnBuffer(returnBuffer); } - void setData( void* dptr, S32 argc, const char** argv, const EnumTable*, BitSet32 ) override + void setData( void* dptr, S32 argc, const char** argv, const EnumTable* tbl, BitSet32 ) override { - if( argc != 1 ) return; \ - *((S32 *) dptr) = dAtoui(argv[0]); \ + if( argc != 1 ) return; + S32 retVal = dAtoui(argv[0]); + if (retVal == 0 && retVal != -1) //zero we need to double check. -1 we know is all on + { + BitSet32 mask; + if (!tbl) tbl = getEnumTable(); + const U32 numEnums = tbl->getNumValues(); + String inString(argv[0]); + + for (U32 i = 0; i < numEnums; i++) + { + if (inString.find((*tbl)[i].getName()) != String::NPos) + mask.set(BIT(i)); + } + retVal = mask; + } + *((S32*)dptr) = retVal; } }; diff --git a/Engine/source/materials/materialDefinition.cpp b/Engine/source/materials/materialDefinition.cpp index d8619f04b..70a3eabe6 100644 --- a/Engine/source/materials/materialDefinition.cpp +++ b/Engine/source/materials/materialDefinition.cpp @@ -71,7 +71,6 @@ ConsoleDocClass(Material, ImplementBitfieldType(MaterialAnimType, "The type of animation effect to apply to this material.\n" "@ingroup GFX\n\n") -{ Material::No, "$No", "No animations.\n"}, { Material::Scroll, "$Scroll", "Scroll the material along the X/Y axis.\n"}, { 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" }, @@ -82,9 +81,7 @@ EndImplementBitfieldType; ImplementEnumType(MaterialBlendOp, "The type of graphical blending operation to apply to this material\n" "@ingroup GFX\n\n") -{ - Material::None, "None", "Disable blending for this material." -}, +{ Material::None, "None", "Disable blending for this material."}, { Material::Mul, "Mul", "Multiplicative blending." }, { Material::PreMul, "PreMul", "Premultiplied alpha." }, { Material::Add, "Add", "Adds the color of the material to the frame buffer with full alpha for each pixel." }, diff --git a/Engine/source/materials/materialDefinition.h b/Engine/source/materials/materialDefinition.h index 1fbf0e81c..f8939af22 100644 --- a/Engine/source/materials/materialDefinition.h +++ b/Engine/source/materials/materialDefinition.h @@ -115,7 +115,6 @@ public: enum AnimType { - No = 0, Scroll = BIT(0), Rotate = BIT(1), Wave = BIT(2), From 79782148ec8be52223f9844827b039786e016bd0 Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Thu, 6 Mar 2025 23:32:38 -0600 Subject: [PATCH 3/5] fix another potential crash with firstresponder code --- Engine/source/gui/editor/inspector/field.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/gui/editor/inspector/field.cpp b/Engine/source/gui/editor/inspector/field.cpp index a5dc77c03..9a5caeec0 100644 --- a/Engine/source/gui/editor/inspector/field.cpp +++ b/Engine/source/gui/editor/inspector/field.cpp @@ -233,7 +233,7 @@ void GuiInspectorField::setFirstResponder( GuiControl *firstResponder ) { Parent::setFirstResponder( firstResponder ); - if (( firstResponder == this || firstResponder == mEdit ) && firstResponder->isProperlyAdded()) + if (( firstResponder == this || firstResponder == mEdit ) && (firstResponder && firstResponder->isProperlyAdded())) { mInspector->setHighlightField( this ); } From d8fcbb78633fc2329c8f56a8c35aa6be59e39e26 Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Thu, 6 Mar 2025 23:37:37 -0600 Subject: [PATCH 4/5] work towards reflecting the typemask in the checkboxes in a combinatory manner again --- Engine/source/console/dynamicTypes.h | 2 +- Engine/source/gui/editor/guiInspectorTypes.cpp | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Engine/source/console/dynamicTypes.h b/Engine/source/console/dynamicTypes.h index 7f0fdf4cc..65476f00f 100644 --- a/Engine/source/console/dynamicTypes.h +++ b/Engine/source/console/dynamicTypes.h @@ -267,7 +267,7 @@ class BitfieldConsoleBaseType : public ConsoleBaseType if (inString.find((*tbl)[i].getName()) != String::NPos) mask.set(BIT(i)); } - retVal = mask; + retVal = mask.getMask(); } *((S32*)dptr) = retVal; } diff --git a/Engine/source/gui/editor/guiInspectorTypes.cpp b/Engine/source/gui/editor/guiInspectorTypes.cpp index e12e61b97..127ca86ce 100644 --- a/Engine/source/gui/editor/guiInspectorTypes.cpp +++ b/Engine/source/gui/editor/guiInspectorTypes.cpp @@ -1522,6 +1522,24 @@ void GuiInspectorTypeBitMask32::setValue( StringTableEntry value ) { U32 mask = dAtoui( value ); + if (mask == 0 && mask != -1) //zero we need to double check. -1 we know is all on + { + BitSet32 bitMask; + const EnumTable* tbl = mInspector->getInspectObject(0)->getClassRep()->getEnumTable(); + if (tbl) + { + const U32 numEnums = tbl->getNumValues(); + String inString(value); + + for (U32 i = 0; i < numEnums; i++) + { + if (inString.find((*tbl)[i].getName()) != String::NPos) + bitMask.set(BIT(i)); + } + mask = bitMask.getMask(); + } + } + for ( U32 i = 0; i < mArrayCtrl->size(); i++ ) { GuiCheckBoxCtrl *pCheckBox = dynamic_cast( mArrayCtrl->at(i) ); From 45bb3687622171a8f5a6872cdfa148ee667e0026 Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Fri, 7 Mar 2025 00:12:09 -0600 Subject: [PATCH 5/5] from marauder: proper enumtable lookup --- .../source/gui/editor/guiInspectorTypes.cpp | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/Engine/source/gui/editor/guiInspectorTypes.cpp b/Engine/source/gui/editor/guiInspectorTypes.cpp index 127ca86ce..6281d71d2 100644 --- a/Engine/source/gui/editor/guiInspectorTypes.cpp +++ b/Engine/source/gui/editor/guiInspectorTypes.cpp @@ -1525,16 +1525,24 @@ void GuiInspectorTypeBitMask32::setValue( StringTableEntry value ) if (mask == 0 && mask != -1) //zero we need to double check. -1 we know is all on { BitSet32 bitMask; - const EnumTable* tbl = mInspector->getInspectObject(0)->getClassRep()->getEnumTable(); - if (tbl) + const EngineEnumTable* table = mField->table; + if (!table) { - const U32 numEnums = tbl->getNumValues(); + ConsoleBaseType* type = ConsoleBaseType::getType(mField->type); + if (type && type->getEnumTable()) + table = type->getEnumTable(); + } + + if (table) + { + const EngineEnumTable& t = *table; + const U32 numEntries = t.getNumValues(); String inString(value); - for (U32 i = 0; i < numEnums; i++) + for (U32 i = 0; i < numEntries; i++) { - if (inString.find((*tbl)[i].getName()) != String::NPos) - bitMask.set(BIT(i)); + if (inString.find(t[i].getName()) != String::NPos) + bitMask.set(t[i].getInt()); } mask = bitMask.getMask(); }