@ferdinand Thank you for the swift response. I will try to elaborate on my question.
I am iterating over the entire scene to find tags matching a name and put them in a list:
maxon::BaseArray<BaseTag*> FindTagsContaining(BaseObject* topObject, maxon::String contains)
{
maxon::BaseArray<BaseTag*> foundTags;
BaseObject* child = topObject->GetDown();
if (child == nullptr)
return maxon::BaseArray<BaseTag*>();
while (child != nullptr) {
BaseTag* tag = child->GetTag(Ttexture);
if(tag != nullptr)
{
maxon::String tagName = tag->GetName();
if (tagName.Find(contains, 0)) {
(void)foundTags.Append(tag);
}
}
(void)foundTags.AppendAll(FindTagsContaining(child,contains));
child = child->GetNext();
}
return foundTags;
}
I found a weird thing that if I print GetTypeName() on the tag returned by GetTag(Ttexture) it returns Material, that was the reason for my thinking that the term Texture tag was removed.
However with this list I then create a material override take with each tags material overridden:
maxon::BaseArray<BaseTag*>::Iterator editTagIterator;
for (editTagIterator = editTags->Begin(); editTagIterator != editTags->End(); editTagIterator++)
{
DescID idMaterialAssignment = DescID(DescLevel(TEXTURETAG_MATERIAL));
take->FindOrAddOverrideParam(td, *editTagIterator, idMaterialAssignment, GeData(GetMaterial(*materialDescription)));
}
This is following the Python version (where it works) almost fully.
I have validated that the GetMaterial function returns a Material object and the function follows the example you posted in another of my threads:
BaseMaterial* GetMaterial(maxon::AssetDescription assetDescription) {
iferr_scope_handler
{
ApplicationOutput("Stopped LoadMaterial() execution with the error: @", err);
return nullptr;
};
BaseDocument* doc = GetActiveDocument();
maxon::String matName = assetDescription.GetMetaString(maxon::OBJECT::BASE::NAME, maxon::LanguageRef()) iferr_return;
BaseMaterial* material = doc->SearchMaterial(matName);
if (material == nullptr) {
maxon::Url url = assetDescription.GetUrl() iferr_return;
if (url.IsEmpty())
return nullptr;
maxon::String* error = {};
maxon::Bool didMerge = MergeDocument(doc, MaxonConvert(url), SCENEFILTER::MATERIALS, nullptr, error);
material = doc->SearchMaterial(matName);
}
return material;
}