<?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[How to know baking is end with BakeTextureTag?]]></title><description><![CDATA[<p dir="auto">Hello, I am a newbie in c4d python programming.<br />
And have tried to bake BakeTextureTag by script.</p>
<p dir="auto">Like below..</p>
<pre><code>if __name__ == '__main__':
    tags = doc.GetActiveTags()

    for i, tag in enumerate(tags):
        c4d.CallButton(tag, c4d.BAKETEXTURE_BAKE)

</code></pre>
<p dir="auto">The problem is how to know when the baking is done??</p>
<p dir="auto">I'd like to bake one by one. Because I baked several things at the same time, my computer goes down <img src="http://developers.maxon.net/forum/assets/plugins/nodebb-plugin-emoji/emoji/android/1f61e.png?v=0b8ddba251d" class="not-responsive emoji emoji-android emoji--disappointed" style="height:23px;width:auto;vertical-align:middle" title=":(" alt="😞" /></p>
<p dir="auto">I've seen some examples of threads. It's too hard, and it's just showing me the uvw tag bake not BakeTexture Tag.</p>
<p dir="auto">Please give me some advice.</p>
<p dir="auto">Thanks.</p>
]]></description><link>http://developers.maxon.net/forum/topic/13186/how-to-know-baking-is-end-with-baketexturetag</link><generator>RSS for Node</generator><lastBuildDate>Thu, 12 Nov 2026 08:06:08 GMT</lastBuildDate><atom:link href="http://developers.maxon.net/forum/topic/13186.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 16 Feb 2021 06:29:56 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to know baking is end with BakeTextureTag? on Thu, 24 Jun 2021 14:14:53 GMT]]></title><description><![CDATA[<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/velbie">@<bdi>velbie</bdi></a> with the latest update of Cinema 4D (<a href="https://www.maxon.net/fr/service-pack-update-24-111-for-cinema-4d/" target="_blank" rel="noopener noreferrer nofollow ugc">R24 SP1</a>), the BAKE_TEX_AO_VERTEXMAPS issue is fixed.</p>
<p dir="auto">Cheers,<br />
Maxime.</p>
]]></description><link>http://developers.maxon.net/forum/post/66992</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/66992</guid><dc:creator><![CDATA[m_adam]]></dc:creator><pubDate>Thu, 24 Jun 2021 14:14:53 GMT</pubDate></item><item><title><![CDATA[Reply to How to know baking is end with BakeTextureTag? on Mon, 22 Feb 2021 11:52:51 GMT]]></title><description><![CDATA[<p dir="auto">Hi Unfortunately I didn't found any workaround. I saw you deleted the topic but I restored it since there is still valuable information for the next readers, moreover, I will update the post once the bug will be fixed.</p>
<p dir="auto">Cheers,<br />
Maxime</p>
]]></description><link>http://developers.maxon.net/forum/post/65897</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/65897</guid><dc:creator><![CDATA[m_adam]]></dc:creator><pubDate>Mon, 22 Feb 2021 11:52:51 GMT</pubDate></item><item><title><![CDATA[Reply to How to know baking is end with BakeTextureTag? on Thu, 18 Feb 2021 16:18:43 GMT]]></title><description><![CDATA[<p dir="auto">Thank you for letting me know <a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/m_adam">@<bdi>m_adam</bdi></a></p>
]]></description><link>http://developers.maxon.net/forum/post/65861</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/65861</guid><dc:creator><![CDATA[velbie]]></dc:creator><pubDate>Thu, 18 Feb 2021 16:18:43 GMT</pubDate></item><item><title><![CDATA[Reply to How to know baking is end with BakeTextureTag? on Thu, 18 Feb 2021 13:56:51 GMT]]></title><description><![CDATA[<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/velbie">@<bdi>velbie</bdi></a> unfrotually this is not possible to do it due to a bug in the Python API. I've opened a new bug report.</p>
<p dir="auto">I will try to find a workaround within the next days (but I'm pretty doubtfully to come with a solution this week)<br />
Cheers,<br />
Maxime.</p>
]]></description><link>http://developers.maxon.net/forum/post/65860</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/65860</guid><dc:creator><![CDATA[m_adam]]></dc:creator><pubDate>Thu, 18 Feb 2021 13:56:51 GMT</pubDate></item><item><title><![CDATA[Reply to How to know baking is end with BakeTextureTag? on Fri, 19 Feb 2021 04:27:58 GMT]]></title><description><![CDATA[<p dir="auto">Thank you so much <a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/m_adam">@<bdi>m_adam</bdi></a> !<br />
I try to texture_baker example just now you mentioned! Adding some options with BaseContainer()</p>
<pre><code>        bakeData[c4d.BAKE_TEX_AMBIENT_OCCLUSION] = True
        bakeData[c4d.BAKE_TEX_AO_VERTEX_MAP] = True
</code></pre>
<p dir="auto">It's working but I want to make a vertex map tag into the selected object like the below image.</p>
<p dir="auto">It's automatically generated when I click the bake button in the Bake texture tag(blue) with my hand, but I don't know how to do it with python code.</p>
<p dir="auto">This is code that simplifies and adds options.<br />
Finally, I got the bitmap so Can I use a bitmap to make the Bake texture tag into the object?</p>
<pre><code>import c4d

class TextureBakerThread(c4d.threading.C4DThread):

    def __init__(self, doc, textags, texuvws, destuvws):
        self.doc = doc
        self.textags = textags
        self.texuvws = texuvws
        self.destuvws = destuvws

        self.bakeDoc = None
        self.bakeData = None
        self.bakeBmp = c4d.bitmaps.MultipassBitmap(512, 512, c4d.COLORMODE_RGB)
        self.bakeError = c4d.BAKE_TEX_ERR_NONE

    def Begin(self):

        # Defines baking setting
        bakeData = c4d.BaseContainer()
        bakeData[c4d.BAKE_TEX_WIDTH] = 512
        bakeData[c4d.BAKE_TEX_HEIGHT] = 512
        bakeData[c4d.BAKE_TEX_PIXELBORDER] = 1
        bakeData[c4d.BAKE_TEX_CONTINUE_UV] = False
        bakeData[c4d.BAKE_TEX_SUPERSAMPLING] = 0
        bakeData[c4d.BAKE_TEX_FILL_COLOR] = c4d.Vector(1)
        bakeData[c4d.BAKE_TEX_USE_BUMP] = False
        bakeData[c4d.BAKE_TEX_USE_CAMERA_VECTOR] = False
        bakeData[c4d.BAKE_TEX_AUTO_SIZE] = False
        bakeData[c4d.BAKE_TEX_NO_GI] = False
        bakeData[c4d.BAKE_TEX_GENERATE_UNDO] = False
        bakeData[c4d.BAKE_TEX_PREVIEW] = False
        bakeData[c4d.BAKE_TEX_COLOR] = True
        bakeData[c4d.BAKE_TEX_UV_LEFT] = 0.0
        bakeData[c4d.BAKE_TEX_UV_RIGHT] = 1.0
        bakeData[c4d.BAKE_TEX_UV_TOP] = 0.0
        bakeData[c4d.BAKE_TEX_UV_BOTTOM] = 1.0
        bakeData[c4d.BAKE_TEX_AMBIENT_OCCLUSION] = True # HERE I ADD
        bakeData[c4d.BAKE_TEX_AO_VERTEX_MAP] = True # HERE I ADD
        # bakeData[c4d.BAKE_TEX_OPTIMAL_MAPPING] = c4d.BAKE_TEX_OPTIMAL_MAPPING_CUBIC

        self.bakeData = bakeData

        # Initializes bake process
        bakeInfo = c4d.utils.InitBakeTexture(self.doc, self.textags, self.texuvws, self.destuvws, self.bakeData, self.Get())
        self.bakeDoc = bakeInfo[0]
        self.bakeError = bakeInfo[1]

        if self.bakeError != c4d.BAKE_TEX_ERR_NONE or self.bakeDoc is None:
            return False

        # Starts bake thread
        self.Start(c4d.THREADMODE_ASYNC, c4d.THREADPRIORITY_BELOW)
        return True

    def BakeTextureHook(self, info):
        # Texture Baker hook, currently not used
        # print info
        pass

    def Main(self):
        # Bake Texture Thread Main routine
        self.bakeError = c4d.utils.BakeTexture(self.bakeDoc, self.bakeData, self.bakeBmp, self.Get(), self.BakeTextureHook)


if __name__ == '__main__':
    obj = doc.GetActiveObject()
    uvwTag = obj.GetTag(c4d.Tuvw)
    tags = obj.GetTags()
    textags, texuvws, destuvws = [], [], []
    for tag in tags:
        if tag.CheckType(c4d.Ttexture):
            textags.append(tag)
            texuvws.append(uvwTag)
            destuvws.append(uvwTag)

    textureBakerThread = TextureBakerThread(doc, textags, texuvws, destuvws)
    print textureBakerThread
    print textureBakerThread.Begin()
    bmp = textureBakerThread.bakeBmp
    if bmp is None:
        raise RuntimeError("Failed to retrieve the baked bitmap.")

    # Displays the bitmap
    c4d.bitmaps.ShowBitmap(bmp)

    # Removes the reference to the C4D Thread, so the memory used is free
    textureBakerThread = None

</code></pre>
<p dir="auto">Thank you for your time <a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/m_adam">@<bdi>m_adam</bdi></a> !</p>
]]></description><link>http://developers.maxon.net/forum/post/65853</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/65853</guid><dc:creator><![CDATA[velbie]]></dc:creator><pubDate>Fri, 19 Feb 2021 04:27:58 GMT</pubDate></item><item><title><![CDATA[Reply to How to know baking is end with BakeTextureTag? on Wed, 17 Feb 2021 08:10:18 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/velbie">@<bdi>velbie</bdi></a> first of all welcome to the plugincafe community <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="🙂" /><br />
For your next topics and also this one please try to use our <a href="https://plugincafe.maxon.net/guidlines_cp#forum-question" target="_blank" rel="noopener noreferrer nofollow ugc">QA feature</a>.</p>
<p dir="auto">Regarding your issue, unfortunately, there is no way to catch the result or wait until the CallButton action ended.<br />
However the Python SDK offer the <a href="https://developers.maxon.net/docs/py/2023_2/modules/c4d.utils/index.html#c4d.utils.BakeTexture" target="_blank" rel="noopener noreferrer nofollow ugc">c4d.utils.BakeTexture</a> function which need to be initialized via <a href="https://developers.maxon.net/docs/py/2023_2/modules/c4d.utils/index.html#c4d.utils.InitBakeTexture" target="_blank" rel="noopener noreferrer nofollow ugc">c4d.utils.InitBakeTexture</a>.<br />
The <code>BakeTexture</code> function is an asynchronous function meaning when it returns, the baking process is done, moreover, both methods let you define baking setting.</p>
<p dir="auto">Finally, we have the <a href="https://github.com/PluginCafe/cinema4d_py_sdk_extended/blob/master/plugins/py-texture_baker_r18/py-texture_baker_r18.pyp#L53-L102" target="_blank" rel="noopener noreferrer nofollow ugc">texture_baker</a> example which uses the baking functions.</p>
<p dir="auto">Hope it answers your question, if not feel free to ask again.<br />
Cheers,<br />
Maxime.</p>
]]></description><link>http://developers.maxon.net/forum/post/65842</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/65842</guid><dc:creator><![CDATA[m_adam]]></dc:creator><pubDate>Wed, 17 Feb 2021 08:10:18 GMT</pubDate></item></channel></rss>