mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-14 16:14:38 +00:00
from marauder: proper enumtable lookup
This commit is contained in:
parent
d8fcbb7863
commit
45bb368762
1 changed files with 14 additions and 6 deletions
|
|
@ -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
|
if (mask == 0 && mask != -1) //zero we need to double check. -1 we know is all on
|
||||||
{
|
{
|
||||||
BitSet32 bitMask;
|
BitSet32 bitMask;
|
||||||
const EnumTable* tbl = mInspector->getInspectObject(0)->getClassRep()->getEnumTable();
|
const EngineEnumTable* table = mField->table;
|
||||||
if (tbl)
|
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);
|
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)
|
if (inString.find(t[i].getName()) != String::NPos)
|
||||||
bitMask.set(BIT(i));
|
bitMask.set(t[i].getInt());
|
||||||
}
|
}
|
||||||
mask = bitMask.getMask();
|
mask = bitMask.getMask();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue