<?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[NewMem question]]></title><description><![CDATA[<p dir="auto">in my plugin i used the following code which doesn't work in r20</p>
<pre><code>Vector* vp1 = NewMem(Vector, 3);
Vector* vp2 = NewMem(Vector, 3);
Vector* vf = NewMem(Vector, 3);
</code></pre>
<p dir="auto">i get the error "Initialisierung": "maxon::ResultMemT&lt;T *&gt;" kann nicht in "Vector *" konvertiert werden</p>
<p dir="auto"><strong>edit</strong>: found out this</p>
<pre><code>Vector vp1[3] = { endpoint1 + dir * Vector(0, 0, -20) , endpoint1 + dir * Vector(0, 5, -5) , endpoint1 + dir * Vector(0, -5, -5) };
</code></pre>
<p dir="auto">but now i get new errors:</p>
<blockquote>
<p dir="auto">Fehler (aktiv)	E0135	"class "maxon::ArrayInterface<a target="_blank" rel="noopener noreferrer nofollow ugc">maxon::Generic</a>"" hat keinen Member ""Iterator"".	arkos	 C:\sdk\frameworks\core.framework\source\maxon\array.h	741</p>
</blockquote>
<blockquote>
<p dir="auto">Fehler (aktiv)	E0070	Ein unvollständiger Typ ist nicht zulässig.	arkos	C:\sdk\frameworks\core.framework\source\maxon\array.h	706</p>
</blockquote>
]]></description><link>http://developers.maxon.net/forum/topic/11098/newmem-question</link><generator>RSS for Node</generator><lastBuildDate>Sun, 15 Nov 2026 19:33:45 GMT</lastBuildDate><atom:link href="http://developers.maxon.net/forum/topic/11098.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 25 Oct 2018 18:18:54 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to NewMem question on Tue, 30 Oct 2018 07:01:25 GMT]]></title><description><![CDATA[<p dir="auto">thank you. i got this working. maybe there are even other places in my code where i can use this knowledge <img src="http://developers.maxon.net/forum/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=0b8ddba251d" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:23px;width:auto;vertical-align:middle" title=":)" alt="🙂" /></p>
]]></description><link>http://developers.maxon.net/forum/post/56227</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/56227</guid><dc:creator><![CDATA[ello]]></dc:creator><pubDate>Tue, 30 Oct 2018 07:01:25 GMT</pubDate></item><item><title><![CDATA[Reply to NewMem question on Mon, 29 Oct 2018 09:33:11 GMT]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">the best solution is probably to create the <code>BaseArray</code> in the caller and hand over a reference to that BaseArray. Your function can then safely fill the BaseArray:</p>
<pre><code>maxon::Result&lt;void&gt; GetVertexNormals(PolygonObject * const pObj, maxon::BaseArray&lt;Vector&gt;&amp; normals)
</code></pre>
<p dir="auto">If you encounter unexpected break points, please open a new thread to discuss this issue.</p>
<p dir="auto">best wishes,<br />
Sebastian</p>
]]></description><link>http://developers.maxon.net/forum/post/56200</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/56200</guid><dc:creator><![CDATA[s_bach]]></dc:creator><pubDate>Mon, 29 Oct 2018 09:33:11 GMT</pubDate></item><item><title><![CDATA[Reply to NewMem question on Fri, 26 Oct 2018 14:55:09 GMT]]></title><description><![CDATA[<p dir="auto">and btw, it seems to be a general problem with all parts of the plugin, cinema is not crashing with most of them, but the debugger halts everytime</p>
]]></description><link>http://developers.maxon.net/forum/post/56181</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/56181</guid><dc:creator><![CDATA[ello]]></dc:creator><pubDate>Fri, 26 Oct 2018 14:55:09 GMT</pubDate></item><item><title><![CDATA[Reply to NewMem question on Fri, 26 Oct 2018 12:00:08 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/s_bach">@<bdi>s_bach</bdi></a> thank you very much for pointing me to that. however, i tried adopting that to a function retrieveing the vertex normals and now i don't know how to properly return those normals.</p>
<pre><code>Vector *GetVertexNormals(PolygonObject *pObj)
{
	Int32 numVerts = pObj-&gt;GetPointCount();
	Int32 numPolys = pObj-&gt;GetPolygonCount();
	const Vector *pVerts = pObj-&gt;GetPointR();
	const CPolygon *pPolys = pObj-&gt;GetPolygonR();

	// initialize neighbor class... this is used to compute m_SrcvNorms
	Neighbor neighbor;
	if( !neighbor.Init(numVerts, pPolys, numPolys, NULL) )
		return NULL;

	//** those two lines worked in the old version **//
	//Vector *pNormals = (Vector *)NewMemClear(UChar,numVerts * sizeof(Vector));
	//if( !pNormals )     return NULL;

	//** these are my adoption to basearray **//
	maxon::BaseArray&lt;Vector&gt; pNormals;
	if(pNormals.GetCount()&lt;=0) return NULL;

	// Determine a Normal for each vertex of mesh
	Int32 i, j, faceCnt, *pFaces = NULL;
	Vector vNorm;
	for(i=0; i&lt;numVerts; i++)
	{
		vNorm = Vector();          // (re)intitialize 
		neighbor.GetPointPolys(i, &amp;pFaces, &amp;faceCnt);
		if( faceCnt )
		{
			for(j=0; j&lt;faceCnt; j++)
			{
				Vector n = CalcFaceNormal(pVerts, pPolys[pFaces[j&rsqb;&rsqb;);
				vNorm += !n;
			}
			vNorm /= faceCnt;          // average the normal(s)
			pNormals[i] = !vNorm;     // normalize and store
		}
		else
			pNormals[i] = Vector(0.0,1.0,0.0);     // default case = Up for any stray verts
	}
	return pNormals;
}
</code></pre>
]]></description><link>http://developers.maxon.net/forum/post/56177</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/56177</guid><dc:creator><![CDATA[ello]]></dc:creator><pubDate>Fri, 26 Oct 2018 12:00:08 GMT</pubDate></item><item><title><![CDATA[Reply to NewMem question on Fri, 26 Oct 2018 09:11:28 GMT]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">Cinema 40 R20 introduces a new, elaborate <a href="https://developers.maxon.net/docs/cpp/2023_2/page_maxonapi_error_overview.html" target="_blank" rel="noopener noreferrer nofollow ugc">error handling system</a>. A function can return now a dedicated result object that stores additional information if the operation was successful or not.</p>
<p dir="auto"><code>NewMem</code> does return such a result value. You find information on how to handle errors in the documentation: <a href="https://developers.maxon.net/docs/cpp/2023_2/page_maxonapi_error.html" target="_blank" rel="noopener noreferrer nofollow ugc">Error Handling</a>. See also <a href="https://developers.maxon.net/docs/cpp/2023_2/page_maxonapi_transition.html#page_maxonapi_transition_code_error" target="_blank" rel="noopener noreferrer nofollow ugc">Error System</a> in the <a href="https://developers.maxon.net/docs/cpp/2023_2/page_maxonapi_transition.html" target="_blank" rel="noopener noreferrer nofollow ugc">API Transition</a>.</p>
<p dir="auto">That being said, in most cases there should be no reason to allocate memory with <code>NewMem</code>. It is recommended to use arrays like <code>BaseArray</code> instead. Such an array provides save access to and management of the allocated data.</p>
<p dir="auto">See</p>
<ul>
<li><a href="https://developers.maxon.net/docs/cpp/2023_2/page_maxonapi_memory_allocation.html" target="_blank" rel="noopener noreferrer nofollow ugc">Memory Allocation</a></li>
<li><a href="https://developers.maxon.net/docs/cpp/2023_2/page_maxonapi_basearray.html" target="_blank" rel="noopener noreferrer nofollow ugc">BaseArray Manual</a></li>
</ul>
<p dir="auto">best wishes,<br />
Sebastian</p>
]]></description><link>http://developers.maxon.net/forum/post/56171</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/56171</guid><dc:creator><![CDATA[s_bach]]></dc:creator><pubDate>Fri, 26 Oct 2018 09:11:28 GMT</pubDate></item></channel></rss>