<?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[DrawObject()]]></title><description><![CDATA[<p dir="auto"><em>On 18/06/2018 at 04:11, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">User Information:<br />
Cinema 4D Version:    <br />
Platform:      <br />
Language(s) :</p>
<p dir="auto">---------<br />
Hi folks,</p>
<p dir="auto">I'm trying to draw a null object inside an ObjectData's Draw() method. I set the nulls position, but when it draws, the position is ignored and instead draws at world centre.</p>
<pre><code>// There's a few class-level variables here
// Null_Object is a class level BaseObject::Alloc(Onull)
  
DRAWRESULT Demo_Object::Draw(BaseObject *op,DRAWPASS drawpass,BaseDraw *bd,BaseDrawHelp *bh)
{
	if(drawpass == DRAWPASS_OBJECT)
	{
		Draw_Matrix = bh-&gt;GetMg();
		bd-&gt;SetMatrix_Matrix(nullptr,Draw_Matrix);
		Null_Object-&gt;SetAbsPos(Vector(0.0,100.0,-250.0));
		Null_Object-&gt;Message(MSG_UPDATE);
		Draw_Result = bd-&gt;DrawObject(bh,Null_Object,DRAWOBJECT_USE_OBJECT_COLOR,drawpass,nullptr,colour_vec);
		if(Draw_Result == DRAWRESULT_OK){GePrint("Point drawn..");} // prints
	}
	
	return SUPER::Draw(op,drawpass,bd,bh);
}
</code></pre>
<p dir="auto">I've stripped it to cut to the chase. What am I missing here?</p>
<p dir="auto">WP.</p>
]]></description><link>http://developers.maxon.net/forum/topic/10823/14271_drawobject</link><generator>RSS for Node</generator><lastBuildDate>Mon, 11 May 2026 17:46:20 GMT</lastBuildDate><atom:link href="http://developers.maxon.net/forum/topic/10823.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 01 Sep 2018 10:36:42 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to DrawObject() on Sat, 01 Sep 2018 10:36:59 GMT]]></title><description><![CDATA[<p dir="auto"><em>On 26/06/2018 at 03:47, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">Ah, you beaut! Thanks Yannick, that was it. Needed bh-&gt;SetMg()!</p>
<p dir="auto">Thanks for you help <img src="http://developers.maxon.net/forum/assets/plugins/nodebb-plugin-emoji/emoji/android/1f44d.png?v=0b8ddba251d" class="not-responsive emoji emoji-android emoji--+1" style="height:23px;width:auto;vertical-align:middle" title=":thumbsup:" alt="👍" /></p>
<p dir="auto">WP.</p>
]]></description><link>http://developers.maxon.net/forum/post/55085</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/55085</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:36:59 GMT</pubDate></item><item><title><![CDATA[Reply to DrawObject() on Sat, 01 Sep 2018 10:36:56 GMT]]></title><description><![CDATA[<p dir="auto"><em>On 25/06/2018 at 10:37, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">Hi,</p>
<p dir="auto">The behavior you describe makes sense, in DRAWPASS_OBJECT the BaseDraw drawings are done in the object's space.<br />
Instead of calling bd-&gt;SetMatrix_Matrix() try bh-&gt;SetMg().</p>
]]></description><link>http://developers.maxon.net/forum/post/55084</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/55084</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:36:56 GMT</pubDate></item><item><title><![CDATA[Reply to DrawObject() on Sat, 01 Sep 2018 10:36:54 GMT]]></title><description><![CDATA[<p dir="auto"><em>On 22/06/2018 at 03:28, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">Hi Yannick,</p>
<p dir="auto">thanks for MatrixMove(), didn't realise that was there!</p>
<p dir="auto">I'd been trying to set the matrix with other object matrices but nothing would change it. I shortened it to using the below:</p>
<pre><code>DRAWRESULT Demo_Object::Draw(BaseObject *op,DRAWPASS drawpass,BaseDraw *bd,BaseDrawHelp *bh)
{
	if(drawpass == DRAWPASS_OBJECT)
	{
		bd-&gt;SetMatrix_Matrix(nullptr,MatrixMove(Vector(0.0,100.0,-250.0)));
		Draw_Result = bd-&gt;DrawObject(bh,Null_Object,DRAWOBJECT_USE_OBJECT_COLOR,drawpass,nullptr,colour_vec);
		if(Draw_Result == DRAWRESULT_OK)
		{
			GePrint("Null drawn.."); // prints
		}
	}
	
	return SUPER::Draw(op,drawpass,bd,bh);
}
</code></pre>
<p dir="auto">but the object is still not drawn where I'd expect. In my initial post I said it was drawing it to world centre, but I've now realised it's drawn to my object's 0,0,0 position. So if I drag my object around the null follows it, does that indicate anything?</p>
<p dir="auto">WP.</p>
]]></description><link>http://developers.maxon.net/forum/post/55083</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/55083</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:36:54 GMT</pubDate></item><item><title><![CDATA[Reply to DrawObject() on Sat, 01 Sep 2018 10:36:51 GMT]]></title><description><![CDATA[<p dir="auto"><em>On 21/06/2018 at 07:03, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">Hi,</p>
<p dir="auto">Yes, if the object is not attached to a document then you can't rely on GetMg().<br />
You can use <a href="https://developers.maxon.net/docs/cpp/2023_2/group__c4d__tools__matrix.html#gaf3c9f1509f080ac8c129cfb9ae3e657b" target="_blank" rel="noopener noreferrer nofollow ugc">MatrixMove()</a> to obtain a transformation matrix from a position/translation vector.</p>
]]></description><link>http://developers.maxon.net/forum/post/55082</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/55082</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:36:51 GMT</pubDate></item><item><title><![CDATA[Reply to DrawObject() on Sat, 01 Sep 2018 10:36:48 GMT]]></title><description><![CDATA[<p dir="auto"><em>On 21/06/2018 at 03:53, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">Hi Yannick,</p>
<p dir="auto">thanks for your reply. For objects I have in memory (not attached to a document), does this mean I have to construct the matrix myself? I can't use GetMg()?</p>
<p dir="auto">WP.</p>
]]></description><link>http://developers.maxon.net/forum/post/55081</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/55081</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:36:48 GMT</pubDate></item><item><title><![CDATA[Reply to DrawObject() on Sat, 01 Sep 2018 10:36:45 GMT]]></title><description><![CDATA[<p dir="auto"><em>On 19/06/2018 at 02:08, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">Hi,</p>
<p dir="auto">BaseDraw::DrawObject() doesn't use the passed object transform. The matrix for the BaseDraw has to be set prior to perform any drawing operation.<br />
See <em>BaseView / BaseDraw Manual</em> in the C++ docs: <a href="https://developers.maxon.net/docs/cpp/2023_2/page_manual_basedraw.html#page_manual_basedraw_drawing_matrix" target="_blank" rel="noopener noreferrer nofollow ugc">Matrix </a>and <a href="https://developers.maxon.net/docs/cpp/2023_2/page_manual_basedraw.html#page_manual_basedraw_drawing_objects" target="_blank" rel="noopener noreferrer nofollow ugc">Objects</a>.</p>
]]></description><link>http://developers.maxon.net/forum/post/55080</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/55080</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:36:45 GMT</pubDate></item></channel></rss>