Skip to content

Commit

Permalink
Tuning: added set_managedmaterials_options to .addonpart
Browse files Browse the repository at this point in the history
  • Loading branch information
ohlidalp committed Jan 10, 2024
1 parent a9addb3 commit 53712df
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
13 changes: 13 additions & 0 deletions source/main/resources/addonpart_fileformat/AddonPartFileFormat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ std::shared_ptr<Document::Module> AddonPartUtility::TransformToRigDefModule(Cach
// Process data in block
switch (block)
{
case Keyword::SET_MANAGEDMATERIALS_OPTIONS: this->ProcessSetManagedMaterialsOptions(); break;
case Keyword::MANAGEDMATERIALS: this->ProcessManagedMaterial(); break;
case Keyword::PROPS: this->ProcessProp(); break;
case Keyword::FLEXBODIES: this->ProcessFlexbody(); break;
Expand Down Expand Up @@ -195,9 +196,21 @@ void AddonPartUtility::ProcessManagedMaterial()
if (n > 3) def.specular_map = m_context->getTokString(3);
if (n > 4) def.damaged_diffuse_map = m_context->getTokString(4);

// Options:
def.options = m_managedmaterials_options;

m_module->managedmaterials.push_back(def);
}

void AddonPartUtility::ProcessSetManagedMaterialsOptions()
{
int n = m_context->countLineArgs();
if (n > 1)
{
m_managedmaterials_options.double_sided = m_context->getTokBool(1);
}
}

void AddonPartUtility::ProcessProp()
{
RigDef::Prop def;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class AddonPartUtility
private:
// Helpers of `TransformToRigDefModule()`, they expect `m_context` to be in position:
void ProcessManagedMaterial();
void ProcessSetManagedMaterialsOptions();
void ProcessProp();
void ProcessFlexbody();
void ProcessTweakWheel();
Expand All @@ -72,6 +73,7 @@ class AddonPartUtility
CacheEntryPtr m_addonpart_entry;
// TransformToRigDefModule() state:
std::shared_ptr<RigDef::Document::Module> m_module;
RigDef::ManagedMaterialsOptions m_managedmaterials_options;
// ResolveUnwantedAndTweakedElements() state:
TuneupDefPtr m_tuneup;
};
Expand Down

0 comments on commit 53712df

Please sign in to comment.