<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[GeDialog Failing To Open]]></title><description><![CDATA[<p dir="auto">Hello.</p>
<p dir="auto">I am encountering a problem when I insert my object plugin into a scene in R26, save the document and then reopen the file. When I click the button to open the GeDialog Cinema immediately crashes on me.</p>
<p dir="auto">I stripped down the code for my GeDialog to the bare minimum that was still similar to the examples in the sdk and the problem is still occurring.</p>
<pre><code>#include "c4d_general.h"
#include "c4d.h"
#include "c4d_symbols.h"
#include "main.h"

#define ID_RUNDIALOG 1059364
enum Controls
{
	idSendMessageLinkObject = 1000,
	idLinkedObject,
	idGatherChildren,

	idOverallScrollGroup = 2000,
	idGroupToFlush,
	idControls,

	idLaunchDialogWindow = 1500,
	idBasicControlGroup,
};

class ObjDialog : public GeDialog
{
public:
	ObjDialog() {}
	virtual ~ObjDialog() {}
	virtual Bool CreateLayout();
	virtual Bool InitValues();
	virtual void DestroyWindow();
	virtual Bool Command(Int32 id, const BaseContainer&amp; msg);
	virtual Int32 Message(const BaseContainer&amp; msg, BaseContainer&amp; result);
};


Bool ObjDialog::CreateLayout()
{
	Bool res = GeDialog::CreateLayout();

	SetTitle("Dialog Window"_s);

	ScrollGroupBegin(idOverallScrollGroup, BFH_SCALEFIT | BFV_SCALEFIT, SCROLLGROUP_VERT | SCROLLGROUP_HORIZ);
	{
		GroupBegin(idGroupToFlush, BFH_SCALEFIT | BFV_SCALEFIT, 1, 0, String(), 0);
		{
			GroupBegin(idControls, BFH_SCALEFIT | BFV_SCALEFIT, 5, 0, String(), 0);
			{
			}
			GroupEnd();
		}
		GroupEnd();
	}
	GroupEnd();

	return res;
}

Bool ObjDialog::InitValues()
{
	if (!GeDialog::InitValues())
		return false;
	return true;
}

void ObjDialog::DestroyWindow() {}

Bool ObjDialog::Command(Int32 id, const BaseContainer&amp; msg)
{
	return true;
}


Int32 ObjDialog::Message(const BaseContainer&amp; msg, BaseContainer&amp; result)
{
	return GeDialog::Message(msg, result);
}


class RunDialog : public ObjectData
{
public:
	virtual Bool Init(GeListNode* node);

	virtual BaseObject* GetVirtualObjects(BaseObject* op, HierarchyHelp* hh);
	virtual Bool Message(GeListNode* node, Int32 type, void* t_data);
	virtual Bool GetDDescription(GeListNode* node, Description* description, DESCFLAGS_DESC&amp; flags);

	static NodeData* Alloc() { return NewObjClear(RunDialog); }

	maxon::BaseArray&lt;BaseObject*&gt; objArrayToCheckForMatch;
private:
	ObjDialog dlg;
};


Bool RunDialog::GetDDescription(GeListNode *node, Description *description, DESCFLAGS_DESC &amp;flags)
{
	BaseContainer *dataInstance;
	const DescID *singleid;
	if (!description-&gt;LoadDescription(node-&gt;GetType()))
	{
	}

	dataInstance = ((BaseList2D*)node)-&gt;GetDataInstance(); // Get the container for the tag
	if (!dataInstance)
		return FALSE;
	singleid = description-&gt;GetSingleDescID();
	DescID cid;


	DescID DescHelperControlGroup = DescLevel(idBasicControlGroup, DTYPE_GROUP, 0);
	if (!singleid || DescHelperControlGroup.IsPartOf(*singleid, NULL))
	{
		BaseContainer bc;
		bc = GetCustomDataTypeDefault(DTYPE_GROUP);
		bc.SetString(DESC_NAME, "Run Dialog"_s);
		bc.SetInt32(DESC_COLUMNS, 1);
		bc.SetInt32(DESC_DEFAULT, 1);
		bc.SetBool(DESC_SCALEH, TRUE);

		if (!description-&gt;SetParameter(DescHelperControlGroup, bc, DescLevel(ID_RUNDIALOG)))
			return TRUE;
	}


	cid = DescLevel(idLaunchDialogWindow, DTYPE_BUTTON, 0);
	if (!singleid || cid.IsPartOf(*singleid, NULL))  //  important to check for speedup c4d!
	{
		BaseContainer bc;
		bc = GetCustomDataTypeDefault(DTYPE_BUTTON);
		bc.SetInt32(DESC_CUSTOMGUI, CUSTOMGUI_BUTTON);
		bc.SetString(DESC_NAME, "Open Dialog"_s);
		if (!description-&gt;SetParameter(cid, bc, DescHelperControlGroup))
			return TRUE;
	}




	flags |= DESCFLAGS_DESC::LOADED;

	return TRUE;
}

Bool RunDialog::Init(GeListNode* node)
{
	return true;
}


Bool RunDialog::Message(GeListNode* node, Int32 type, void* t_data)
{
	if (type == MSG_DESCRIPTION_COMMAND)
	{
		DescriptionCommand *dc = (DescriptionCommand*)t_data;
		if (!dc)
			return TRUE;
		Int32 ID = Int32(dc-&gt;_descId[0].id);
		BaseDocument* doc = node-&gt;GetDocument();
		if (!doc)
			return TRUE;

		switch (ID)
		{
			// Problem occurs here
			case idLaunchDialogWindow:
			{
				if (dlg.IsOpen() == false)
					dlg.Open(DLG_TYPE::ASYNC, ID_RUNDIALOG, -1, -1, 300, 200, 0, OPENDIALOGFLAGS::IGNORELAYOUT);
				break;
			}
		}
	}

	return true;
}

BaseObject* RunDialog::GetVirtualObjects(BaseObject* op, HierarchyHelp* hh)
{
	BaseObject *nullReturn = BaseObject::Alloc(Onull);

	return nullReturn;
}

Bool RegisterRunDialog()
{

	return RegisterObjectPlugin(ID_RUNDIALOG, "Run Dialog"_s, OBJECT_GENERATOR | OBJECT_INPUT, RunDialog::Alloc, "ORunDialog"_s, AutoBitmap("atom.tif"_s), 0);
}

</code></pre>
<p dir="auto">I've used this same code in R20 and R25 and haven't had a single issue with opening the GeDialog, I only started encountering the problem in R26.</p>
<p dir="auto">Looking at the examples in the sdk that deal with GeDialogs they are all opened via a CommandData plugin and the GeDialog manual specifically mentions that  GeDialog based windows are typically owned by a CommandData plugin.</p>
<p dir="auto">Is it now a requirement to use a CommandData plugin to open a GeDialog?</p>
<p dir="auto">Any help would be greatly appreciated.</p>
<p dir="auto">John Terenece</p>
]]></description><link>http://developers.maxon.net/forum/topic/14152/gedialog-failing-to-open</link><generator>RSS for Node</generator><lastBuildDate>Mon, 11 May 2026 18:21:16 GMT</lastBuildDate><atom:link href="http://developers.maxon.net/forum/topic/14152.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 19 Aug 2022 06:22:15 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to GeDialog Failing To Open on Fri, 26 Aug 2022 17:30:46 GMT]]></title><description><![CDATA[<p dir="auto">Thanks for the response.  This seems to have solved the problem.</p>
<p dir="auto">John Terenece</p>
]]></description><link>http://developers.maxon.net/forum/post/69692</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/69692</guid><dc:creator><![CDATA[JohnTerenece]]></dc:creator><pubDate>Fri, 26 Aug 2022 17:30:46 GMT</pubDate></item><item><title><![CDATA[Reply to GeDialog Failing To Open on Wed, 24 Aug 2022 13:38:34 GMT]]></title><description><![CDATA[<p dir="auto">The issue is happening because no dialog operation should be done from a thread. Loading the scene is now done asynchronously and the object creation is done in a thread. The GeDialog constructor will be called from a thread and fail.</p>
<p dir="auto">My suggestion is to replace the GeDialog variable by a pointer and be sure that the allocation and the deletion is done in the mainthread.</p>
<p dir="auto">Because the GeDialog was not initialised correctly, the CDIalog was not defined so the function <code>dlg.IsOpen()</code> was crashing.<br />
For extra check, you can check CDialog against nullptr like so</p>
<pre><code>CDialog* intern = dlg-&gt;Get();
</code></pre>
<p dir="auto">I also change the TRUE to true. TRUE should be avoided.</p>
<pre><code>#include "c4d_general.h"
#include "c4d.h"
#include "c4d_symbols.h"

#include "maxon/thread.h"

#define ID_RUNDIALOG 1059364
 

enum Controls
{
	idSendMessageLinkObject = 1000,
	idLinkedObject,
	idGatherChildren,

	idOverallScrollGroup = 2000,
	idGroupToFlush,
	idControls,

	idLaunchDialogWindow = 1500,
	idBasicControlGroup,
};

class ObjDialog : public GeDialog
{
public:
	virtual Bool CreateLayout();
	virtual Bool InitValues();
	virtual void DestroyWindow();
	virtual Bool Command(Int32 id, const BaseContainer&amp; msg);
	virtual Int32 Message(const BaseContainer&amp; msg, BaseContainer&amp; result);
};


Bool ObjDialog::CreateLayout()
{
	Bool res = GeDialog::CreateLayout();
	SetTitle("Dialog Window"_s);
	ScrollGroupBegin(idOverallScrollGroup, BFH_SCALEFIT | BFV_SCALEFIT, SCROLLGROUP_VERT | SCROLLGROUP_HORIZ);
	{
		GroupBegin(idGroupToFlush, BFH_SCALEFIT | BFV_SCALEFIT, 1, 0, String(), 0);
		{
			GroupBegin(idControls, BFH_SCALEFIT | BFV_SCALEFIT, 5, 0, String(), 0);
			{
			}
			GroupEnd();
		}
		GroupEnd();
	}
	GroupEnd();

	return res;
}

Bool ObjDialog::InitValues()
{
	if (!GeDialog::InitValues())
		return false;
	return true;
}

void ObjDialog::DestroyWindow() {}

Bool ObjDialog::Command(Int32 id, const BaseContainer&amp; msg)
{
	return true;
}


Int32 ObjDialog::Message(const BaseContainer&amp; msg, BaseContainer&amp; result)
{
	return GeDialog::Message(msg, result);
}




class RunDialog : public ObjectData
{
public:
	virtual Bool Init(GeListNode* node);

	virtual BaseObject* GetVirtualObjects(BaseObject* op, HierarchyHelp* hh);
	virtual Bool Message(GeListNode* node, Int32 type, void* t_data);
	virtual Bool GetDDescription(GeListNode* node, Description* description, DESCFLAGS_DESC&amp; flags);

	static NodeData* Alloc() { return NewObjClear(RunDialog); }

	maxon::BaseArray&lt;BaseObject*&gt; objArrayToCheckForMatch;

	void Free(GeListNode* node) override;
private:
	ObjDialog *dlg = nullptr;


};

Bool RunDialog::Init(GeListNode* node)
{
	if (dlg == nullptr)
	{
		maxon::ExecuteOnMainThread([this]() 
			{
				dlg = NewObjClear(ObjDialog);
			});
	}
	
	return true;
}

void RunDialog::Free(GeListNode* node) 
{
	if (dlg)
	{
		maxon::ExecuteOnMainThread([this]()
			{
				DeleteObj(dlg);
				dlg = nullptr;
			});
	}
}

Bool RunDialog::GetDDescription(GeListNode* node, Description* description, DESCFLAGS_DESC&amp; flags)
{
	BaseContainer* dataInstance;
	const DescID* singleid;
	if (!description-&gt;LoadDescription(node-&gt;GetType()))
	{
	}

	dataInstance = ((BaseList2D*)node)-&gt;GetDataInstance(); // Get the container for the tag
	if (!dataInstance)
		return FALSE;
	singleid = description-&gt;GetSingleDescID();
	DescID cid;


	DescID DescHelperControlGroup = DescLevel(idBasicControlGroup, DTYPE_GROUP, 0);
	if (!singleid || DescHelperControlGroup.IsPartOf(*singleid, NULL))
	{
		BaseContainer bc;
		bc = GetCustomDataTypeDefault(DTYPE_GROUP);
		bc.SetString(DESC_NAME, "Run Dialog"_s);
		bc.SetInt32(DESC_COLUMNS, 1);
		bc.SetInt32(DESC_DEFAULT, 1);
		bc.SetBool(DESC_SCALEH, true);

		if (!description-&gt;SetParameter(DescHelperControlGroup, bc, DescLevel(ID_RUNDIALOG)))
			return true;
	}


	cid = DescLevel(idLaunchDialogWindow, DTYPE_BUTTON, 0);
	if (!singleid || cid.IsPartOf(*singleid, NULL))  //  important to check for speedup c4d!
	{
		BaseContainer bc;
		bc = GetCustomDataTypeDefault(DTYPE_BUTTON);
		bc.SetInt32(DESC_CUSTOMGUI, CUSTOMGUI_BUTTON);
		bc.SetString(DESC_NAME, "Open Dialog"_s);
		if (!description-&gt;SetParameter(cid, bc, DescHelperControlGroup))
			return true;
	}




	flags |= DESCFLAGS_DESC::LOADED;

	return true;
}




Bool RunDialog::Message(GeListNode* node, Int32 type, void* t_data)
{
	if (type == MSG_DESCRIPTION_COMMAND)
	{
		DescriptionCommand* dc = (DescriptionCommand*)t_data;
		if (!dc)
			return true;
		Int32 ID = Int32(dc-&gt;_descId[0].id);
		BaseDocument* doc = node-&gt;GetDocument();
		if (!doc)
			return true;

		switch (ID)
		{
			// Problem occurs here
			case idLaunchDialogWindow:
			{
				if (dlg)
				{
					CDialog* intern = dlg-&gt;Get();
					if (intern)
					{
						if (dlg-&gt;IsOpen() == false)
							dlg-&gt;Open(DLG_TYPE::ASYNC, ID_RUNDIALOG, -1, -1, 300, 200, 0, OPENDIALOGFLAGS::IGNORELAYOUT);
					}
				}
				break;
			}
		}
	}

	return true;
}

BaseObject* RunDialog::GetVirtualObjects(BaseObject* op, HierarchyHelp* hh)
{
	BaseObject* nullReturn = BaseObject::Alloc(Onull);

	return nullReturn;
}
Bool RegisterRunDialog();
Bool RegisterRunDialog()
{

	return RegisterObjectPlugin(ID_RUNDIALOG, "Run Dialog"_s, OBJECT_GENERATOR | OBJECT_INPUT, RunDialog::Alloc, ""_s, AutoBitmap("atom.tif"_s), 0);
}
</code></pre>
<p dir="auto">Cheers,<br />
Manuel</p>
]]></description><link>http://developers.maxon.net/forum/post/69677</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/69677</guid><dc:creator><![CDATA[Manuel]]></dc:creator><pubDate>Wed, 24 Aug 2022 13:38:34 GMT</pubDate></item><item><title><![CDATA[Reply to GeDialog Failing To Open on Mon, 22 Aug 2022 14:40:40 GMT]]></title><description><![CDATA[<p dir="auto">hi, sorry i missed the fact it is mandatory to save the file and reopen it.</p>
<p dir="auto">I was able to reproduce the issue. I need to ask ours devs the best way to fix this.</p>
<p dir="auto">Cheers,<br />
Manuel</p>
]]></description><link>http://developers.maxon.net/forum/post/69669</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/69669</guid><dc:creator><![CDATA[Manuel]]></dc:creator><pubDate>Mon, 22 Aug 2022 14:40:40 GMT</pubDate></item><item><title><![CDATA[Reply to GeDialog Failing To Open on Fri, 19 Aug 2022 14:58:26 GMT]]></title><description><![CDATA[<p dir="auto">Release mode.</p>
]]></description><link>http://developers.maxon.net/forum/post/69662</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/69662</guid><dc:creator><![CDATA[JohnTerenece]]></dc:creator><pubDate>Fri, 19 Aug 2022 14:58:26 GMT</pubDate></item><item><title><![CDATA[Reply to GeDialog Failing To Open on Fri, 19 Aug 2022 14:49:10 GMT]]></title><description><![CDATA[<p dir="auto">hi,<br />
I am not able to reproduce the issue. Are you compiling in debug or release mode?</p>
<p dir="auto">Cheers<br />
Manuel</p>
]]></description><link>http://developers.maxon.net/forum/post/69661</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/69661</guid><dc:creator><![CDATA[Manuel]]></dc:creator><pubDate>Fri, 19 Aug 2022 14:49:10 GMT</pubDate></item></channel></rss>