On 21/02/2018 at 00:48, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R18
Platform: Windows ;
Language(s) : C++ ;
---------
Hi all,
I'm currently developing a plugin for opening SMD files in Cinema 4D. The plugin allows the loading of either SMD or QC files, these are related files, a QC file can point to a number of SMD files, and an SMD can point to a QC (for texture lookup and other tasks).
The problem I've run into is I have an option in my Description Resource for using the QC file, if I load a QC file I want to set the Use QC option to enabled and lock it. My code will check if it is a QC file and then set a member bool m_qc_file to true if it is, however if the user then cancels the load dialog, and without restarting c4d tries to change the defaults via the preferences window they will find that the qc option is locked.
So, what I'm trying to do is change the enabling based on what window the user is currently in (how they accessed the description).
Bool SMDLoader::Init(GeListNode *node)
{
// Member variable declarations
m_qc_file = false;
return true;
}
Bool SMDLoader::Identify(BaseSceneLoader* node, const Filename& name, UChar* probe, Int32 size)
{
// unfortunately SMD/QC is an ascii format so we will just assume
// that the file-type is SMD/QC based on the extension alone.
if (name.GetSuffix().ToLower() == "qc")
{
m_qc_file = true;
return true;
}
return name.GetSuffix().ToLower() == "smd" ? true : false;
}
Bool SMDLoader::GetDEnabling(GeListNode *node, const DescID &id, const GeData &t_data, DESCFLAGS_ENABLE flags, const BaseContainer *itemdesc)
{
if (!node)
return false;
switch (id[0].id)
{
case SMD_IMPORT_QC:
{
if (m_qc_file)
return false;
else
return true;
}
}
// call parent
return SceneLoaderData::GetDEnabling(node, id, t_data, flags, itemdesc);
}
Thank-you for any and all help !