<?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[Redshift deleting using old information]]></title><description><![CDATA[<p dir="auto">Hi, I am deleting a User Data node from Redhshift using the code below:</p>
<pre><code># Remove Redshift UD node
    for item in spline_id:
        rs_mat = doc.SearchObject ("S" + str (item) + " Gas " + str (bake_name))
        rs_tag = rs_mat.GetTag(c4d.Ttexture)
        rs_mat = rs_tag.GetMaterial()
        outputNode = rs_mat[c4d.REDSHIFT_GRAPH_NODES]
        gvMaster = outputNode.GetNodeMaster()
        gvRoot = gvMaster.GetRoot()

        currentNode = gvRoot.GetDown()
        while currentNode is not None:
            if currentNode.GetName() == "Neon Redshift":
                currentNode.Remove()
                break

            currentNode = currentNode.GetNext()
</code></pre>
<p dir="auto">The code works perfectly but when the node is deleted, for some reason, the settings for the other nodes, particlularly colour, are not what was inputted by the User Data node. Can you help?</p>
]]></description><link>http://developers.maxon.net/forum/topic/12627/redshift-deleting-using-old-information</link><generator>RSS for Node</generator><lastBuildDate>Fri, 15 May 2026 13:56:56 GMT</lastBuildDate><atom:link href="http://developers.maxon.net/forum/topic/12627.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 30 May 2020 09:52:49 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Redshift deleting using old information on Tue, 02 Jun 2020 15:20:19 GMT]]></title><description><![CDATA[<p dir="auto">hi,</p>
<p dir="auto">your question is sometimes not obvious <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="😄" /><br />
Even with the scene it's a bit compicated.</p>
<p dir="auto">What i can say about your code is that you should be more defensive in your code. Always check the value before continue.</p>
<p dir="auto">For example what if the object is not found ? You should continue to the next item or stop ?</p>
<pre><code>for item in spline_UD:
        rs_mat = doc.SearchObject ("S" + str (item) + " Gas")
        if rs_mat is None:
            # Because we don't have object to continue, we iterate to the next item.
            continue
        ...
</code></pre>
<p dir="auto">Cheers,<br />
Manuel</p>
]]></description><link>http://developers.maxon.net/forum/post/63207</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/63207</guid><dc:creator><![CDATA[Manuel]]></dc:creator><pubDate>Tue, 02 Jun 2020 15:20:19 GMT</pubDate></item><item><title><![CDATA[Reply to Redshift deleting using old information on Mon, 01 Jun 2020 19:07:34 GMT]]></title><description><![CDATA[<p dir="auto">Thanks, PluginStudent! <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/63193</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/63193</guid><dc:creator><![CDATA[Swinn]]></dc:creator><pubDate>Mon, 01 Jun 2020 19:07:34 GMT</pubDate></item><item><title><![CDATA[Reply to Redshift deleting using old information on Mon, 01 Jun 2020 18:55:03 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/swinn">@<bdi>Swinn</bdi></a> said in <a href="https://developers.maxon.net/forum/post/63188" target="_blank" rel="noopener noreferrer nofollow ugc">Redshift deleting using old information</a>:</p>
<blockquote>
<p dir="auto">My only question is what is the difference between Set Driven (Absolute) and Set Driven (Relative)? Does it make a difference?</p>
</blockquote>
<p dir="auto">Both setups add a Range Mapper node. In case of 'Relative', this range mapper creates an offset. See <a href="https://help.maxon.net/us/index.html#5832" target="_blank" rel="noopener noreferrer nofollow ugc">the online help</a>.</p>
]]></description><link>http://developers.maxon.net/forum/post/63191</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/63191</guid><dc:creator><![CDATA[PluginStudent]]></dc:creator><pubDate>Mon, 01 Jun 2020 18:55:03 GMT</pubDate></item><item><title><![CDATA[Reply to Redshift deleting using old information on Mon, 01 Jun 2020 17:18:25 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">sorry, I did not see your replies. But I cannot help you as I do neither have access to Redshift nor am very fluent when it comes to Cinemas features.</p>
<p dir="auto">Cheers,<br />
zipit</p>
]]></description><link>http://developers.maxon.net/forum/post/63190</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/63190</guid><dc:creator><![CDATA[ferdinand]]></dc:creator><pubDate>Mon, 01 Jun 2020 17:18:25 GMT</pubDate></item><item><title><![CDATA[Reply to Redshift deleting using old information on Mon, 01 Jun 2020 08:39:32 GMT]]></title><description><![CDATA[<p dir="auto">I figured out a way to get this to work. They key is separating the User Data out of the RS XPresso node but still maintaining a connection to this node through a regular XPresso node. Cinema won't let me drag Redshift nodes from the RS XPresso window to the C4D XPresso window. Nor can I drag them from the AM.</p>
<p dir="auto">The solution is to delete the User Data from the RS XPresso window, paste it into a new C4D Xpresso window, then use Set Driven (Absolute) on the RS nodes I need what is essentially double access to. Cinema then automatically creates a new XPresso node, which I then cut the contents from and paste them into my UD Xpresso node.</p>
<p dir="auto">My only question is what is the difference between Set Driven (Absolute) and Set Driven (Relative)? Does it make a difference? Thanks.</p>
]]></description><link>http://developers.maxon.net/forum/post/63188</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/63188</guid><dc:creator><![CDATA[Swinn]]></dc:creator><pubDate>Mon, 01 Jun 2020 08:39:32 GMT</pubDate></item><item><title><![CDATA[Reply to Redshift deleting using old information on Sun, 31 May 2020 12:36:13 GMT]]></title><description><![CDATA[<p dir="auto">I tried inputting the User Data directly into a RS port using Python and this code:</p>
<pre><code>import c4d

def main():

    obj = op.GetObject()
    neon_col_INPUT = obj[c4d.ID_USERDATA,834]

    # List: Spline, Colour, Power, Gas, Blend.
    spline_UD = {1: 618}

    for item in spline_UD:
        rs_mat = doc.SearchObject ("S" + str (item) + " Gas")
        rs_tag = rs_mat.GetTag(c4d.Ttexture)
        rs_mat = rs_tag.GetMaterial()
        outputNode = rs_mat[c4d.REDSHIFT_GRAPH_NODES]
        gvMaster = outputNode.GetNodeMaster()
        gvRoot = gvMaster.GetRoot()

        colour = obj[c4d.ID_USERDATA,spline_UD[item&rsqb;&rsqb;
        print colour

        power = obj[c4d.ID_USERDATA,619]
        gas = obj[c4d.ID_USERDATA,65]
        blend = obj[c4d.ID_USERDATA,66]

        currentNode = gvRoot.GetDown()
        while currentNode is not None:
            if currentNode.GetName() == "RS Material":
                RSMaterial[c4d.REDSHIFT_SHADER_MATERIAL_EMISSION_COLOR] = colour
                break
</code></pre>
<p dir="auto">Now my code causes C4D to hang. Can you help?</p>
]]></description><link>http://developers.maxon.net/forum/post/63174</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/63174</guid><dc:creator><![CDATA[Swinn]]></dc:creator><pubDate>Sun, 31 May 2020 12:36:13 GMT</pubDate></item><item><title><![CDATA[Reply to Redshift deleting using old information on Sun, 31 May 2020 10:39:45 GMT]]></title><description><![CDATA[<p dir="auto">Cool. I will try a different approach. Thanks for all your help on this, zipit. <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/63171</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/63171</guid><dc:creator><![CDATA[Swinn]]></dc:creator><pubDate>Sun, 31 May 2020 10:39:45 GMT</pubDate></item><item><title><![CDATA[Reply to Redshift deleting using old information on Sun, 31 May 2020 10:36:28 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I actually meant doing that inside the <code>get_port_descid</code> function. However, I just did it for you and found out that for user data <code>DescID</code> elements the port returns some gibberish for <code>m, s, u</code> like for example <code>20000000 1000 -1</code> for a port for the first user data element for a null (we would at least expect <code>700</code> and <code>1</code> to pop up in there).</p>
<p dir="auto">The problem is that ports for user data elements and the <code>DescID</code> they are being build for always have been a bit weird (see <code>GvNode.AddPort</code>). To build a port for the first user data element of a  node, we would initialise it with the <code>DescID</code> <code>(700, 5, 1)</code> (the weird part being the <code>5</code>, which is the integer for the symbol <code>DTYPE_SUBCONTAINER</code>). The other problem is that ports do not really expose the element they point at to the outside world.</p>
<p dir="auto">I am afraid that you will have to wait for MAXON to shed some light on the topic, but I would not hold my breath for them coming up with a solution. It might very well be the case that you cannot infer the <code>DescID</code> for ports pointing at user data elements.</p>
<p dir="auto">Cheers,<br />
zipit</p>
]]></description><link>http://developers.maxon.net/forum/post/63170</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/63170</guid><dc:creator><![CDATA[ferdinand]]></dc:creator><pubDate>Sun, 31 May 2020 10:36:28 GMT</pubDate></item><item><title><![CDATA[Reply to Redshift deleting using old information on Sun, 31 May 2020 09:20:50 GMT]]></title><description><![CDATA[<p dir="auto">The original code yields image 1:<br />
<img src="https://developers.maxon.net/forum/assets/uploads/files/1590916562293-screen-shot-2020-05-31-at-5.13.22-am.png" alt="Screen Shot 2020-05-31 at 5.13.22 AM.png" class=" img-fluid img-markdown" /><br />
m, u yields image 2:<br />
<img src="https://developers.maxon.net/forum/assets/uploads/files/1590916595567-screen-shot-2020-05-31-at-5.14.23-am.png" alt="Screen Shot 2020-05-31 at 5.14.23 AM.png" class=" img-fluid img-markdown" /><br />
s, u yields image 3:<br />
<img src="https://developers.maxon.net/forum/assets/uploads/files/1590916623700-screen-shot-2020-05-31-at-5.15.05-am.png" alt="Screen Shot 2020-05-31 at 5.15.05 AM.png" class=" img-fluid img-markdown" /><br />
It doesn't look like any of the actual User Data Values (3 of which are colour) are coming through. Here are images of the node and the UD:<br />
<img src="https://developers.maxon.net/forum/assets/uploads/files/1590916756957-screen-shot-2020-05-31-at-5.18.21-am.png" alt="Screen Shot 2020-05-31 at 5.18.21 AM.png" class=" img-fluid img-markdown" /><br />
<img src="https://developers.maxon.net/forum/assets/uploads/files/1590916767429-screen-shot-2020-05-31-at-5.18.46-am.png" alt="Screen Shot 2020-05-31 at 5.18.46 AM.png" class=" img-fluid img-markdown" /><br />
Neither m,u or s,u causes the actual User Data to transfer to the nodes before the User Data node gets deleted. Is there something I am missing?</p>
]]></description><link>http://developers.maxon.net/forum/post/63169</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/63169</guid><dc:creator><![CDATA[Swinn]]></dc:creator><pubDate>Sun, 31 May 2020 09:20:50 GMT</pubDate></item><item><title><![CDATA[Reply to Redshift deleting using old information on Sun, 31 May 2020 08:37:34 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I did not really test the user data stuff, I just included it, since I knew you are going to need it. But looking at my code now, the user data stuff does not make much sense. It should probably be <code>node[(m, u)]</code> or <code>node[(s, u)]</code>to test for user data ids (probably the first one). User data DescIDs  follow the form <code>ID_USERDATA, x</code>, so for example <code>700, 1</code> for the first element. You have to poke around a little bit to find out what is what, but my guess would be <code>node[(m, u)]</code>.</p>
<p dir="auto">If you keep running into errors, you should try the description stuff I mentioned in the function docstring instead. The approach of the function is not the safest <img src="http://developers.maxon.net/forum/assets/plugins/nodebb-plugin-emoji/emoji/android/1f609.png?v=0b8ddba251d" class="not-responsive emoji emoji-android emoji--wink" style="height:23px;width:auto;vertical-align:middle" title=";)" alt="😉" /></p>
<p dir="auto">PS: You also do not need the line <code>in_did = (in_port.GetMainID(), in_port.GetSubID())</code>, this is just some garbage I forgot to delete before I realised that I was going to need a dedicated function for this <img src="http://developers.maxon.net/forum/assets/plugins/nodebb-plugin-emoji/emoji/android/1f609.png?v=0b8ddba251d" class="not-responsive emoji emoji-android emoji--wink" style="height:23px;width:auto;vertical-align:middle" title=";)" alt="😉" /></p>
<p dir="auto">Cheers,<br />
zipit</p>
]]></description><link>http://developers.maxon.net/forum/post/63166</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/63166</guid><dc:creator><![CDATA[ferdinand]]></dc:creator><pubDate>Sun, 31 May 2020 08:37:34 GMT</pubDate></item><item><title><![CDATA[Reply to Redshift deleting using old information on Sun, 31 May 2020 08:22:34 GMT]]></title><description><![CDATA[<p dir="auto">Because data is coming from User Data, do I need additional info as per this post?<br />
<a href="https://developers.maxon.net/forum/topic/5195" target="_blank" rel="noopener noreferrer nofollow ugc">https://developers.maxon.net/forum/topic/5195</a></p>
]]></description><link>http://developers.maxon.net/forum/post/63165</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/63165</guid><dc:creator><![CDATA[Swinn]]></dc:creator><pubDate>Sun, 31 May 2020 08:22:34 GMT</pubDate></item><item><title><![CDATA[Reply to Redshift deleting using old information on Sun, 31 May 2020 08:11:46 GMT]]></title><description><![CDATA[<p dir="auto">Hmmm. I tried to implement the code (fixed indent errors in the first def) and the print out looks like it is catching what it should but the User Data is not being copied over to the inputs before it gets deleted. Any idea what I am doing wrong?</p>
<pre><code class="language-#">    def get_port_descid(node, port):
        m, s, u = port.GetMainID(), port.GetSubID(), port.GetUserID()
        if u &gt; 0:
            try:
                node[(m, s, u)]
                return (m, s, u)
            except AttributeError as e:
                pass
            try:
                node[(m, s)]
                return (m, s)
            except AttributeError as e:
                pass
            try:
                node[s]
                return s
            except AttributeError as e:
                pass

        return None

    for item in spline_id:
        rs_mat = doc.SearchObject ("S" + str (item) + " Gas " + str (bake_name))
        rs_tag = rs_mat.GetTag(c4d.Ttexture)
        rs_mat = rs_tag.GetMaterial()
        outputNode = rs_mat[c4d.REDSHIFT_GRAPH_NODES]
        gvMaster = outputNode.GetNodeMaster()
        gvRoot = gvMaster.GetRoot()

        currentNode = gvRoot.GetDown()
        while currentNode is not None:
            if currentNode.GetName() == "Neon Redshift":
                for out_port in currentNode.GetOutPorts():

                    connected_ports = out_port.GetDestination()
                    out_port.Remove()

                    c4d.EventAdd()

                    out_did = get_port_descid(currentNode, out_port)
                    print out_did
                    if out_did is None:
                        continue

                    for in_port in connected_ports:
                        in_node = in_port.GetNode()
                        in_did = (in_port.GetMainID(), in_port.GetSubID())
                        in_did = get_port_descid(in_node, in_port)
                        if in_did is not None:
                            in_node[in_did] = currentNode[out_did]

                currentNode.Remove()
                break

            currentNode = currentNode.GetNext()
</code></pre>
]]></description><link>http://developers.maxon.net/forum/post/63164</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/63164</guid><dc:creator><![CDATA[Swinn]]></dc:creator><pubDate>Sun, 31 May 2020 08:11:46 GMT</pubDate></item><item><title><![CDATA[Reply to Redshift deleting using old information on Sat, 30 May 2020 19:12:02 GMT]]></title><description><![CDATA[<p dir="auto">Thanks, zipit, you are a Code God! Much appreciated. <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/63162</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/63162</guid><dc:creator><![CDATA[Swinn]]></dc:creator><pubDate>Sat, 30 May 2020 19:12:02 GMT</pubDate></item><item><title><![CDATA[Reply to Redshift deleting using old information on Sat, 30 May 2020 15:50:24 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">There are quite a few hoops to jump through, but this example should get you the idea.</p>
<pre><code>import c4d

def get_port_descid(node, port):
    """Returns the DescID for a ``GvPort``.

    If all our ports would be for static description elements, this would be
    easy. It would be just ``port.GetSubID()``. Unfortunately we are dealing
    with a lot of dynamic descriptions in the context of Xpresso, and at
    least I am not aware of any builtin methods that would return the 
    ``DescID`` of a ``GvPort`` in a more sane way.

    This solution is especially lazy, a solution less prone to errors
    would be to iterate over the description of the ``GvNode`` and see which
    combination of ``m, s, u`` is in there.

    Args:
        node (``c4d.modules.graphview.GvNode``): The node of the port.
        port (``c4d.modules.graphview.GvPort``): The port to get the DescID for.
    
    Returns:
        ``tuple[int]`` or ``None``: The resolved DescID.
    """
    # The fragments (DescLevels) of the DescID of the port. The problem is
    # that all methods always return an integer-
    m, s, u = port.GetMainID(), port.GetSubID(), port.GetUserID()

    # Now we are just trying to access the node and see if it raises an
    # (attribute) error. If so, we just try the next combination.

    # There are no user data DescLevels below 1.
    if u &gt; 0:
        try:
            node[(m, s, u)]
            # It is a user data DescID.
            return (m, s, u)
        except AttributeError as e:
            pass

    try:
        node[(m, s)]
        # It is a dynamic description DescID.
        return (m, s)
    except AttributeError as e:
        pass

    try:
        node[s]
        # It is a static description DescID.
        return s
    except AttributeError as e:
        pass

    return None

def main():
    """Entry point.
    """
    # This example is for a Xpresso GraphView instance, since I do not
    # have access to RedShift. I did use two constant nodes and a math 
    # node as an example scene.
    if not op or not op.GetTag(c4d.Texpresso):
        return 

    tag = op.GetTag(c4d.Texpresso)
    master = tag.GetNodeMaster()
    root = master.GetRoot()

    if not root:
        return

    nodes = root.GetChildren()
    if not nodes:
        return

    # I just took the first top-level node as the node to disconnect, 
    # which was one of the constant nodes connected to the math node.
    out_node = nodes[0]

    # Go over all output ports in our node to disconnect/remove.
    for out_port in out_node.GetOutPorts():
        # Get all input ports the current output port is connected to.
        connected_ports = out_port.GetDestination()
        # Severe all connections from our output port.  
        out_port.Remove()
        # Let Cinema catch up.
        c4d.EventAdd()
        # This one of the nastier parts. We will have to unwind the
        # DescID the output port has been build for. See the 
        # respective function for details.
        out_did = get_port_descid(out_node, out_port)
        # We couldn't resolve the DescID properly.
        if out_did is None:
            continue
        # Now we are just going over all input ports, get the DescID
        # they are pointing at and write the value from our output_node
        # to the input_node with these two DescIDs.
        for in_port in connected_ports:
            in_node = in_port.GetNode()
            in_did = (in_port.GetMainID(), in_port.GetSubID())
            in_did = get_port_descid(in_node, in_port)
            if in_did is not None:
                in_node[in_did] = out_node[out_did]

if __name__=='__main__':
    main()
</code></pre>
<p dir="auto">Cheers,<br />
zipit</p>
]]></description><link>http://developers.maxon.net/forum/post/63157</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/63157</guid><dc:creator><![CDATA[ferdinand]]></dc:creator><pubDate>Sat, 30 May 2020 15:50:24 GMT</pubDate></item><item><title><![CDATA[Reply to Redshift deleting using old information on Sat, 30 May 2020 14:08:30 GMT]]></title><description><![CDATA[<p dir="auto">Would it be possible for you to show me a few lines of code that demonstrate what you are talking about? Especially disconnecting the ports one at a time. Thanks.</p>
]]></description><link>http://developers.maxon.net/forum/post/63155</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/63155</guid><dc:creator><![CDATA[Swinn]]></dc:creator><pubDate>Sat, 30 May 2020 14:08:30 GMT</pubDate></item><item><title><![CDATA[Reply to Redshift deleting using old information on Sat, 30 May 2020 13:41:23 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I am not quite sure if I do understand your question correctly. From what I am understanding, you have the <code>graphview</code> nodes <code>A</code> and <code>B</code>, where the nodes are the relationship <code>A -&gt; B</code>, and you are deleting <code>A</code>, but would expect <code>B</code> to maintain its state after that?</p>
<p dir="auto">Cinema does not do that, probably for the reason that it would contradict the state machine nature of a node based interpreted language. Your only option to maintain the states of the input ports formerly driven by your user data node, would be to iterate over all output ports of that user data node and cache their current states, then iterate over all input ports each output port is being connected to, disconnect them one by one and write the cached state to the <code>BaseContainer</code> of the node that input port is attached to.</p>
<p dir="auto">Cheers<br />
zipit</p>
]]></description><link>http://developers.maxon.net/forum/post/63153</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/63153</guid><dc:creator><![CDATA[ferdinand]]></dc:creator><pubDate>Sat, 30 May 2020 13:41:23 GMT</pubDate></item></channel></rss>