mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-13 15:44:36 +00:00
BitfieldConsoleBaseType::setData definition
also, preserve saved out 0 and -1 numbers to resrver 'none' and 'all' ditch 'no' materialdefinition::animtype
This commit is contained in:
parent
64103a58aa
commit
0ac0ee88c2
3 changed files with 28 additions and 8 deletions
|
|
@ -223,6 +223,15 @@ class BitfieldConsoleBaseType : public ConsoleBaseType
|
||||||
const U32 numEnums = tbl->getNumValues();
|
const U32 numEnums = tbl->getNumValues();
|
||||||
bool first = true;
|
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++)
|
for (U32 i = 0; i < numEnums; i++)
|
||||||
{
|
{
|
||||||
if (dptrVal.test(BIT(i)))
|
if (dptrVal.test(BIT(i)))
|
||||||
|
|
@ -242,10 +251,25 @@ class BitfieldConsoleBaseType : public ConsoleBaseType
|
||||||
return Con::getReturnBuffer(returnBuffer);
|
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; \
|
if( argc != 1 ) return;
|
||||||
*((S32 *) dptr) = dAtoui(argv[0]); \
|
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;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,6 @@ ConsoleDocClass(Material,
|
||||||
ImplementBitfieldType(MaterialAnimType,
|
ImplementBitfieldType(MaterialAnimType,
|
||||||
"The type of animation effect to apply to this material.\n"
|
"The type of animation effect to apply to this material.\n"
|
||||||
"@ingroup GFX\n\n")
|
"@ingroup GFX\n\n")
|
||||||
{ Material::No, "$No", "No animations.\n"},
|
|
||||||
{ Material::Scroll, "$Scroll", "Scroll the material along the X/Y axis.\n"},
|
{ Material::Scroll, "$Scroll", "Scroll the material along the X/Y axis.\n"},
|
||||||
{ Material::Rotate, "$Rotate" , "Rotate the material around a point.\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::Wave, "$Wave" , "Warps the material with an animation using Sin, Triangle or Square mathematics.\n" },
|
||||||
|
|
@ -82,9 +81,7 @@ EndImplementBitfieldType;
|
||||||
ImplementEnumType(MaterialBlendOp,
|
ImplementEnumType(MaterialBlendOp,
|
||||||
"The type of graphical blending operation to apply to this material\n"
|
"The type of graphical blending operation to apply to this material\n"
|
||||||
"@ingroup GFX\n\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::Mul, "Mul", "Multiplicative blending." },
|
||||||
{ Material::PreMul, "PreMul", "Premultiplied alpha." },
|
{ Material::PreMul, "PreMul", "Premultiplied alpha." },
|
||||||
{ Material::Add, "Add", "Adds the color of the material to the frame buffer with full alpha for each pixel." },
|
{ Material::Add, "Add", "Adds the color of the material to the frame buffer with full alpha for each pixel." },
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,6 @@ public:
|
||||||
|
|
||||||
enum AnimType
|
enum AnimType
|
||||||
{
|
{
|
||||||
No = 0,
|
|
||||||
Scroll = BIT(0),
|
Scroll = BIT(0),
|
||||||
Rotate = BIT(1),
|
Rotate = BIT(1),
|
||||||
Wave = BIT(2),
|
Wave = BIT(2),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue