mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-16 16:37:02 +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";
|
||||
|
||||
@@ -100,6 +100,7 @@ void CGeneratePropertyNamesDialog::StartGeneration()
|
||||
Params.MaxWords = mpUI->NumWordsSpinBox->value();
|
||||
Params.Prefix = TO_TSTRING( mpUI->PrefixLineEdit->text() );
|
||||
Params.Suffix = TO_TSTRING( mpUI->SuffixLineEdit->text() );
|
||||
Params.UseUnderscores = mpUI->UseUnderscoresCheckBox->isChecked();
|
||||
Params.PrintToLog = mpUI->LogOutputCheckBox->isChecked();
|
||||
|
||||
// Run the task and configure ourselves so we can update correctly
|
||||
|
||||
@@ -68,6 +68,13 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="UseUnderscoresCheckBox">
|
||||
<property name="text">
|
||||
<string>Use underscores</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="LogOutputCheckBox">
|
||||
<property name="text">
|
||||
|
||||
Reference in New Issue
Block a user