<?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[UA is update too often]]></title><description><![CDATA[<p dir="auto">I have a User Area (UA) where I display thumbnails from image files.<br />
I scale the image files in DrawMsg().</p>
<pre><code>result, ismovie = self.bmp.InitWith(path)
width, height = self.bmp.GetSize()
self.DrawBitmap(self.bmp, x1, y1, 100, 100, 0, 0, width, height, c4d.BMP_NORMAL)
</code></pre>
<p dir="auto">This of course takes some time.</p>
<p dir="auto">I noticed that the UA (and thus the image files scaled) is often updated.<br />
For example, when I click in the UA or I move the slider of the UA.</p>
<p dir="auto">What can I do to make it more efficient?</p>
]]></description><link>http://developers.maxon.net/forum/topic/12230/ua-is-update-too-often</link><generator>RSS for Node</generator><lastBuildDate>Fri, 17 Jul 2026 09:05:50 GMT</lastBuildDate><atom:link href="http://developers.maxon.net/forum/topic/12230.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 01 Feb 2020 13:14:59 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to UA is update too often on Mon, 03 Feb 2020 16:31:41 GMT]]></title><description><![CDATA[<p dir="auto">Thanks for the answer.<br />
And yes, you are fully correct. Things should not be done in DrawMsg()</p>
]]></description><link>http://developers.maxon.net/forum/post/61356</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/61356</guid><dc:creator><![CDATA[pim]]></dc:creator><pubDate>Mon, 03 Feb 2020 16:31:41 GMT</pubDate></item><item><title><![CDATA[Reply to UA is update too often on Mon, 03 Feb 2020 11:09:03 GMT]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">as always, efficiency is the result of good software design. One way of speeding things up is to use <a href="https://en.wikipedia.org/wiki/Cache_(computing)" target="_blank" rel="noopener noreferrer nofollow ugc">caches</a>.</p>
<p dir="auto"><code>DrawMsg()</code> is called by Cinema whenever Cinema things something might have changed. I don't think you can do anything about that.</p>
<p dir="auto">You have to make sure that within DrawMsg() you only draw and do nothing else. Why are you loading the bitmap in the context of DrawMsg()? Why are you scaling the images in the context of DrawMsg()? Why not earlier?</p>
<p dir="auto">I guess at some point, your program knowns what images to display. At that point you could load all these (scaled) images into a cache. Then in DrawMsg(), you can simply access the data in that cache.</p>
<p dir="auto">Compare e.g. <a href="https://developers.maxon.net/docs/py/2023_2/modules/c4d/C4DAtom/GeListNode/BaseList2D/BaseShader/index.html?highlight=initrender#BaseShader.InitRender" target="_blank" rel="noopener noreferrer nofollow ugc">BaseShader.InitRender()</a> which is used to do all the heavy lifting, so that <a href="https://developers.maxon.net/docs/py/2023_2/modules/c4d/C4DAtom/GeListNode/BaseList2D/BaseShader/index.html?highlight=initrender#BaseShader.Sample" target="_blank" rel="noopener noreferrer nofollow ugc">BaseShader.Sample()</a> can be fast.</p>
<p dir="auto">Depending on the reason for the redraw, you could optimize further. E.g. you could use a <a href="https://developers.maxon.net/docs/py/2023_2/modules/c4d.bitmaps/GeClipMap/index.html?highlight=geclipmap" target="_blank" rel="noopener noreferrer nofollow ugc">GeClipMap</a> to draw whatever you want into a <a href="https://developers.maxon.net/docs/py/2023_2/modules/c4d.bitmaps/BaseBitmap/index.html?highlight=basebitmap" target="_blank" rel="noopener noreferrer nofollow ugc">BaseBitmap</a> and simply draw that BaseBitmap in the context of DrawMsg().</p>
<p dir="auto">Speed is the result of software design. Caches can help, but of course they increase code complexity and memory footprint.</p>
<p dir="auto">Best wishes,<br />
Sebastian</p>
]]></description><link>http://developers.maxon.net/forum/post/61350</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/61350</guid><dc:creator><![CDATA[s_bach]]></dc:creator><pubDate>Mon, 03 Feb 2020 11:09:03 GMT</pubDate></item></channel></rss>