Hi,
I am trying to call the following code in 2023. From this page.
// Print all the NodeSpace ID from the selected material. In practice we should
// test if mat is a nullptr before proceeding.
BaseMaterial* mat = doc->GetActiveMaterial();
// The error handling needs to have an error context defined with either iferr_scope or iffer_handler.
const maxon::HashMap<maxon::Id, maxon::NimbusForwardRef> hashNimbusRefs = mat->GetAllNimbusRefs() iferr_return;
for (const auto& e : hashNimbusRefs)
{
const maxon::Id& key = e.GetKey();
const maxon::NimbusBaseRef nimbusRef = e.GetValue().GetBase();
ApplicationOutput("NodeSpace ID: @"_s, key);
}
I get the following errors in my code.
Error C2079 'nimbusRef' uses undefined class 'maxon::NimbusBaseRef'
Error C2027 use of undefined type 'maxon::NimbusBaseRef'
I have the nodes.framework and the graph framework installed (and actually use it in places as well). But looking through the maxon code I can't find where NimbusBaseRef is supposed to be defined.
I see the following in operatingsystem.h
class NimbusBaseRef;
using NimbusForwardRef = ForwardRefWithExtraBase<NimbusRef, NimbusBaseRef>;
Is there some other framework that I am supposed to use so that this code will compile?
I tend to find this a lot with the documentation, where it will have the code I need, but not tell me the header file to include, or the required framework to use it.
Thanks.
edited by @ferdinand:
@kbar wrote:
Actually looks like I don't have the graph.framework for this project. I will add that and see if it fixes the issue.
Unfortunately adding graph.framework did not fix the issue.
I case anyone is reading this I went back to using the following alternative, checking for an exact node space to see if it is what I am looking for, in this case redshift.
BaseMaterial *pMat = //the passed in material
Int32 matID = pMat->GetType();
Bool isRSNode = false;
// Documentation states this is always safe to cast
NodeMaterial* pNodeMat = static_cast<NodeMaterial*>(pMat);
if (matID == Mmaterial)
{
if (pNodeMat->HasSpace(maxon::Id("com.redshift3d.redshift4c4d.class.nodespace")))
isRSNode = true;
}