mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-14 23:56:23 +00:00
Added ability to separate words by underscore in generated names
This commit is contained in:
@@ -130,6 +130,11 @@ void CPropertyNameGenerator::Generate(const SPropertyNameGenerationParameters& r
|
||||
for (; RecalcIndex < WordCache.size(); RecalcIndex++)
|
||||
{
|
||||
int Index = WordCache[RecalcIndex].WordIndex;
|
||||
|
||||
// Add an underscore if needed
|
||||
if (RecalcIndex > 0 && rkParams.UseUnderscores)
|
||||
LastValidHash.Hash("_");
|
||||
|
||||
LastValidHash.Hash( *mWords[Index].Word );
|
||||
WordCache[RecalcIndex].Hash = LastValidHash;
|
||||
}
|
||||
@@ -156,6 +161,12 @@ void CPropertyNameGenerator::Generate(const SPropertyNameGenerationParameters& r
|
||||
for (int WordIdx = 0; WordIdx < WordCache.size(); WordIdx++)
|
||||
{
|
||||
int Index = WordCache[WordIdx].WordIndex;
|
||||
|
||||
if (WordIdx > 0 && rkParams.UseUnderscores)
|
||||
{
|
||||
PropertyName.Name += "_";
|
||||
}
|
||||
|
||||
PropertyName.Name += mWords[Index].Word;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,9 @@ struct SPropertyNameGenerationParameters
|
||||
/** List of valid type suffixes */
|
||||
std::vector<TString> TypeNames;
|
||||
|
||||
/** Whether to separate words with underscores */
|
||||
bool UseUnderscores;
|
||||
|
||||
/** Whether to print the output from the generation process to the log */
|
||||
bool PrintToLog;
|
||||
};
|
||||
|
||||
@@ -311,7 +311,7 @@ const char* HashablePropTypeName(EPropertyType Prop)
|
||||
case eBoolProperty: return "bool";
|
||||
case eLongProperty: return "int";
|
||||
case eEnumProperty: return "enum";
|
||||
case eBitfieldProperty: return "bitfield";
|
||||
case eBitfieldProperty: return "Flags";
|
||||
case eFloatProperty: return "float";
|
||||
case eStringProperty: return "string";
|
||||
case eColorProperty: return "Color";
|
||||
|
||||
Reference in New Issue
Block a user