On 20/09/2013 at 01:38, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R13+
Platform: Windows ; Mac OSX ;
Language(s) : C++ ;
---------
This is a difficult one to work out. If the Interactive Render Region is active using the VrayBridge for rendering while using my tool (mouse click) to change the image used by the Shader attached to both the Vray Light tag and VrayBridge Environment, soon enough the VrayBridge crashes. My plugin does not crash but is definitely involved in VB's demise.
So far, I have tried StopExternalRenderer() along with StopAllThreads() but was not so sure these would be effective against the IRR (and they weren't). Here is the code where VB crashes (Access Violation) :
//------------------------------------------------------------------------
void LivePanel::UpdateHDRI_VRay(BaseDocument* pDoc, BaseObject* pObj, const Filename& fnProject)
//------------------------------------------------------------------------
{
#ifdef DEVELOPMENT
GePrint("UpdateHDRI_VRay");
#endif
// UPDATE 2013.09.09
// Implemented HDR file update of Vray Light tag
GeData data;
pObj->GetParameter(DescID(HDRLSOBJECT_LUMINANCE_OBJ), data, DESCFLAGS_GET_0);
pObj = static_cast<BaseObject*>(data.GetLink(pDoc));
if (!pObj)
return;
BaseTag* pVTag = pObj->GetTag(PLUGINID_VRAYLIGHTTAG);
if (!pVTag)
return;
pVTag->GetParameter(DescID(VRAYLIGHTTAG_AREA_DOME_TEX), data, DESCFLAGS_GET_0);
BaseShader* pShader = static_cast<BaseShader*>(data.GetLink(pDoc));
if (!pShader)
return;
StopAllThreads();
if (!StopExternalRenderer()) return;
pShader->SetParameter(DescID(BITMAPSHADER_FILENAME), GeData(fnProject), DESCFLAGS_SET_0);
pShader->Message(MSG_CHANGE);
// - VrayBridge should react automatically to shader changes (we hope!)
EventAdd();
}
As that last comment states, it indeed does. Either it works or it crashes. Anyway to suspend the IRR render while making these changes?
ETA: How would one go about checking if IRR is enabled so as to disable it using CallCommand()? Does CheckIsRunning(CHECKISRUNNING_EDITORRENDERING) consider the IRR?
Thanks!