<?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[Programmatically created Redshift Lights in an Object Plugin converts lights into Null-Objekts without an function after making Objekt-Plugin editable]]></title><description><![CDATA[<p dir="auto">Sorry first, I am not sure if this is the right place to post this. The Redshift forum was apparently not the right place. <img src="http://developers.maxon.net/forum/assets/plugins/nodebb-plugin-emoji/emoji/android/1f644.png?v=0b8ddba251d" class="not-responsive emoji emoji-android emoji--face_with_rolling_eyes" style="height:23px;width:auto;vertical-align:middle" title=":face_with_rolling_eyes:" alt="🙄" /></p>
<p dir="auto">I don't know if this behavior is intentional or unavoidable, but there is a problem with Redshift lights in my opinion.</p>
<p dir="auto"><strong>Situation:</strong><br />
When you create a Redshift light and press 'C', it converts it into a standard Cinema 4D light—or, if generated programmatically, into a useless Null object.<br />
It is programmatically impossible to generate a light (e.g., within an object plugin). When the object plugin is made "Editable"—for instance, to get the geometry—all Redshift lights are converted into Null objects and lose their functionality. Unlike the standard behavior, they aren't even converted into Cinema 4D lights.</p>
<p dir="auto"><strong>Steps:</strong></p>
<ul>
<li>The plugin loads a virtual scene containing prepared scene elements and lights.</li>
<li>It returns in a container all the needed elements</li>
<li>When the plugin is made "Editable" to recieve the geometry, all Redshift lights are converted into Null objects.<br />
<img src="http://developers.maxon.net/forum/assets/plugins/nodebb-plugin-emoji/emoji/android/27a1.png?v=0b8ddba251d" class="not-responsive emoji emoji-android emoji--arrow_right" style="height:23px;width:auto;vertical-align:middle" title="➡" alt="➡" />️ result: Light functionality is lost.</li>
</ul>
<p dir="auto"><strong>Visual Examples:</strong><br />
Plugin creates a building for night view:</p>
<ul>
<li>
<p dir="auto">as long as the plugin is running lights are working<br />
<img src="/forum/assets/uploads/files/1783069757999-bug_redshift.jpg" alt="bug_redshift.jpg" class=" img-fluid img-markdown" /></p>
</li>
<li>
<p dir="auto">a light in code looks like this in a virtual temp_doc:<br />
<img src="/forum/assets/uploads/files/1783069836089-bug_redshift_light_in_code.jpg" alt="bug_redshift_light_in_code.jpg" class=" img-fluid img-markdown" /></p>
</li>
<li>
<p dir="auto">after converting the plugin into geometry (c to make it editable) it converts the lights into this:<br />
<img src="/forum/assets/uploads/files/1783069854495-bug_redshift_light_afterconversion.jpg" alt="bug_redshift_light_afterconversion.jpg" class=" img-fluid img-markdown" /></p>
</li>
</ul>
<p dir="auto"><strong>Plugin Example:</strong><br />
Here is a trivial plugin example which basically loads a scene and returns an element with a light.<br />
The scene structure of the document looks like that. The plugin returns the base element<br />
<img src="/forum/assets/uploads/files/1783069929584-bug_house_stucture.jpg" alt="bug_house_stucture.jpg" class=" img-fluid img-markdown" /></p>
<p dir="auto">After making the plugin editabel the light_flurescent is converted into a null object, and not even a Cinema 4D light remains.<br />
Ideally, of course, the Redshift light would be fully preserved. That makes sense if you want to render with Redshift.</p>
<p dir="auto">It uses a temporary Plugin ID<br />
<a href="https://drive.google.com/file/d/1jAVsPXx2AeSA2-TDF6yJNcQeyIRfClfi/view?usp=sharing" target="_blank" rel="noopener noreferrer nofollow ugc">Download Plugin</a></p>
<p dir="auto">I don't need to explain the code in detail here; an element is simply returned in the GetVirtualObjects method:</p>
<pre><code>    def GetVirtualObjects(self, op: BaseObject, hh: object) -&gt; Optional[BaseObject]:

        cdirty = False
        for child in op.GetChildren():

            cdirty = child.CheckCache(hh) or child.IsDirty(c4d.DIRTYFLAGS_DATA)
            if cdirty:

                break

        dirty = op.CheckCache(hh) or op.IsDirty(c4d.DIRTYFLAGS_DATA | c4d.DIRTYFLAGS_ALL) or cdirty
        if not dirty:
            return op.GetCache(hh)


        if self._temp_doc:
            container = c4d.BaseObject(c4d.Onull)

            base: c4d.BaseObject = self._temp_doc.GetFirstObject().GetDown().GetClone()
            base.InsertUnder(container)

            return container
        else:
            return None
</code></pre>
<p dir="auto">Cheers<br />
T.B.</p>
]]></description><link>http://developers.maxon.net/forum/topic/16428/programmatically-created-redshift-lights-in-an-object-plugin-converts-lights-into-null-objekts-without-an-function-after-making-objekt-plugin-editable</link><generator>RSS for Node</generator><lastBuildDate>Fri, 03 Jul 2026 19:20:26 GMT</lastBuildDate><atom:link href="http://developers.maxon.net/forum/topic/16428.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 03 Jul 2026 09:05:04 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Programmatically created Redshift Lights in an Object Plugin converts lights into Null-Objekts without an function after making Objekt-Plugin editable on Fri, 03 Jul 2026 16:18:55 GMT]]></title><description><![CDATA[<p dir="auto">Hey <a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/thomasb">@<bdi>ThomasB</bdi></a>,</p>
<p dir="auto">I do not think that this is an API issue. I do not meant with that that I will not help you, as this still happens in the context of a plugin, I say this simply to classify the issue.</p>
<p dir="auto">When I try to manually open your <code>build_1.c4d</code> file, it loads in 2026.2.0 but when I then press C on that light in question, I get exactly the output you report. And I cannot really explain why as this is just a normal rectangle shape area light (well, I sort of can, see below <img src="http://developers.maxon.net/forum/assets/plugins/nodebb-plugin-emoji/emoji/android/1f604.png?v=0b8ddba251d" class="not-responsive emoji emoji-android emoji--smile" style="height:23px;width:auto;vertical-align:middle" title=":D" alt="😄" /> ).</p>
<p dir="auto"><img src="/forum/assets/uploads/files/1783093717769-26b330be-2ffb-4079-94bd-e35821b41c29-image.png" alt="26b330be-2ffb-4079-94bd-e35821b41c29-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">The plot however thickens when I try to open the file with 2026.3.1:</p>
<p dir="auto"><img src="/forum/assets/uploads/files/1783093803547-3f42e837-826c-4145-87ae-9436d31c51f2-image.png" alt="3f42e837-826c-4145-87ae-9436d31c51f2-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">This file seems to be somehow corrupted. After some poking around I manged to create this <a href="/forum/assets/uploads/files/1783094395015-build_2.c4d">build_2.c4d</a>  which loads in 2026.3. But the light still did not work correctly. I then created a new RS light instance and copied over the whole data container via <code>Get/SetData</code>, which again resulted in a broken light. Only when I manually recreated the light by manually copying values, I ended up with a valid light. Which then also revealed that this light should have a much different light representation in the VP.</p>
<p dir="auto">Your light:</p>
<p dir="auto"><img src="/forum/assets/uploads/files/1783094589563-8bb73cb1-8cf6-4851-9001-83dff031795e-image.png" alt="8bb73cb1-8cf6-4851-9001-83dff031795e-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">The manual copy:</p>
<p dir="auto"><img src="/forum/assets/uploads/files/1783094606869-31f028b3-6054-4078-b9c0-82f04b49b7a9-image.png" alt="31f028b3-6054-4078-b9c0-82f04b49b7a9-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">I.e., you seem to have there a fundamentally corrupted scene and especially light objects. The fact that I could reproduce this with a fresh light instance and a <code>Get/SetData</code> copy indicates this the data container of the light is corrupted. We could now start comparing the data containers of your light and the manually created one, to dive deeper, but I think I stop here for now. Did you programmatically modify this scene? Because your plugin only seems to load it. The question is now if you have more scenes like this. Otherwise I would just use my fixed scene (which also contains the fixed light) and move one.</p>
<p dir="auto">Cheers,<br />
Ferdinand</p>
<p dir="auto">PS: Okay, now I see it, the actual scene in much more complex.</p>
<p dir="auto">When you want to dig deeper yourself, a great tool to debug this would be <a href="https://developers.maxon.net/docs/py/2026_3_0/modules/mxutils/index.html#mxutils.GetContainerTreeString" target="_blank" rel="noopener noreferrer nofollow ugc">mxutils.GetContainerTreeString</a>. You can just dump both containers and then either visually compare them or use a diff tool. Or you use <a href="https://developers.maxon.net/docs/py/2026_3_0/modules/mxutils/index.html#mxutils.GetParameterTreeString" target="_blank" rel="noopener noreferrer nofollow ugc">mxutils.GetParameterTreeString</a> directly on the light objects.</p>
]]></description><link>http://developers.maxon.net/forum/post/77242</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/77242</guid><dc:creator><![CDATA[ferdinand]]></dc:creator><pubDate>Fri, 03 Jul 2026 16:18:55 GMT</pubDate></item><item><title><![CDATA[Reply to Programmatically created Redshift Lights in an Object Plugin converts lights into Null-Objekts without an function after making Objekt-Plugin editable on Fri, 03 Jul 2026 11:14:34 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/ferdinand">@<bdi>ferdinand</bdi></a></p>
<p dir="auto">Okay, thank you Ferdinand for your reply.<br />
Okay, that's strange—it works in your video.</p>
<p dir="auto">I don't think the issue lies with my code; it simply loads a Cinema 4D scene in which the objects are already prepared.</p>
<p dir="auto">But here is the unprotected plugin.<br />
As previously mentioned, this is just a simple, simplified plugin to demonstrate that the problem behaves exactly as described above when using "Make Editable."<br />
<a href="https://drive.google.com/file/d/1GXA1CBxbW1Mp_br2ToxiVeWLmSCqPiG1/view?usp=sharing" target="_blank" rel="noopener noreferrer nofollow ugc">Download unprotected plugin</a></p>
<p dir="auto">and the code if this helps out:</p>
<pre><code>from typing import Optional

import c4d
from c4d import plugins, bitmaps, BaseObject
import os


PLUGIN_ID = 1000200


def load_house():

    house_path = os.path.join(path, "res", "models", "build_1.c4d")
    doc = None
    if os.path.exists(house_path):
        doc = c4d.documents.LoadDocument(house_path, c4d.SCENEFILTER_OBJECTS | c4d.SCENEFILTER_MATERIALS)

    return doc




class RedshiftLightsTest(plugins.ObjectData):

    def __init__(self):
        self.SetOptimizeCache(True)

        self._temp_doc = load_house()

    def Init(self, op, isCloneInit):


        return True

    

    def GetVirtualObjects(self, op: BaseObject, hh: object) -&gt; Optional[BaseObject]:

        cdirty = False
        for child in op.GetChildren():

            cdirty = child.CheckCache(hh) or child.IsDirty(c4d.DIRTYFLAGS_DATA)
            if cdirty:

                break

        dirty = op.CheckCache(hh) or op.IsDirty(c4d.DIRTYFLAGS_DATA | c4d.DIRTYFLAGS_ALL) or cdirty
        if not dirty:
            return op.GetCache(hh)


        if self._temp_doc:
            container = c4d.BaseObject(c4d.Onull)

            base: c4d.BaseObject = self._temp_doc.GetFirstObject().GetDown().GetClone()
            base.InsertUnder(container)

            return container
        else:
            return None

    def GetDDescription(self, op, description, flags):
        if not description.LoadDescription(op.GetType()):

            return False

        single_id = description.GetSingleDescID()
        

        return False, (flags | c4d.DESCFLAGS_DESC_LOADED)            

   

    def GetDEnabling(self, op, did, t_data, flags, itemdesc):        

        return True


if __name__ == "__main__":
    path, file = os.path.split(__file__)
    file = "icon.tif"
    new_path = os.path.join(path, "res", file)
    bitmap = bitmaps.BaseBitmap()
    bitmap.InitWith(new_path)
    plugins.RegisterObjectPlugin(id=PLUGIN_ID, str="redshift_lights_test", g=RedshiftLightsTest, description="redshift_lights_test", icon=bitmap,
                                 info=c4d.OBJECT_GENERATOR)

</code></pre>
]]></description><link>http://developers.maxon.net/forum/post/77239</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/77239</guid><dc:creator><![CDATA[ThomasB]]></dc:creator><pubDate>Fri, 03 Jul 2026 11:14:34 GMT</pubDate></item><item><title><![CDATA[Reply to Programmatically created Redshift Lights in an Object Plugin converts lights into Null-Objekts without an function after making Objekt-Plugin editable on Fri, 03 Jul 2026 11:01:10 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/thomasb">@<bdi>ThomasB</bdi></a>,</p>
<p dir="auto">I am sorry that you had a bad experience in the RS forum. Can you show me the actual code where you add the RS light object in code? Because I see no <code>Orslight</code> in your snippet? Or when you load an asset, share that asset? When I do a quick test with a Python generator object, this works fine for me.</p>
<p dir="auto">Cheers,<br />
Ferdinand</p>
<p dir="auto">PS: The plugin link you shared only contains an encrypted plugin (<code>pypv</code>) which not only makes it harder for me to get to the source code, I also cannot run such plugin on company hardware before I  cracked it and can reasonably say that it does not contain dangerous code. Could you please share an unencrypted version?</p>
<p dir="auto"><video class="embed-video-local" controls src="/forum/assets/uploads/files/1783076048510-foo2.mp4">
</video></p>]]></description><link>http://developers.maxon.net/forum/post/77238</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/77238</guid><dc:creator><![CDATA[ferdinand]]></dc:creator><pubDate>Fri, 03 Jul 2026 11:01:10 GMT</pubDate></item></channel></rss>