Redshift deleting using old information
-
Because data is coming from User Data, do I need additional info as per this post?
https://developers.maxon.net/forum/topic/5195 -
Hi,
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
node[(m, u)]
ornode[(s, u)]
to test for user data ids (probably the first one). User data DescIDs follow the formID_USERDATA, x
, so for example700, 1
for the first element. You have to poke around a little bit to find out what is what, but my guess would benode[(m, u)]
.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
PS: You also do not need the line
in_did = (in_port.GetMainID(), in_port.GetSubID())
, this is just some garbage I forgot to delete before I realised that I was going to need a dedicated function for thisCheers,
zipit -
The original code yields image 1:
m, u yields image 2:
s, u yields image 3:
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:
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? -
Hi,
I actually meant doing that inside the
get_port_descid
function. However, I just did it for you and found out that for user dataDescID
elements the port returns some gibberish form, s, u
like for example20000000 1000 -1
for a port for the first user data element for a null (we would at least expect700
and1
to pop up in there).The problem is that ports for user data elements and the
DescID
they are being build for always have been a bit weird (seeGvNode.AddPort
). To build a port for the first user data element of a node, we would initialise it with theDescID
(700, 5, 1)
(the weird part being the5
, which is the integer for the symbolDTYPE_SUBCONTAINER
). The other problem is that ports do not really expose the element they point at to the outside world.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
DescID
for ports pointing at user data elements.Cheers,
zipit -
Cool. I will try a different approach. Thanks for all your help on this, zipit.
-
I tried inputting the User Data directly into a RS port using Python and this 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]] 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
Now my code causes C4D to hang. Can you help?
-
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.
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.
My only question is what is the difference between Set Driven (Absolute) and Set Driven (Relative)? Does it make a difference? Thanks.
-
Hi,
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.
Cheers,
zipit -
@Swinn said in Redshift deleting using old information:
My only question is what is the difference between Set Driven (Absolute) and Set Driven (Relative)? Does it make a difference?
Both setups add a Range Mapper node. In case of 'Relative', this range mapper creates an offset. See the online help.
-
Thanks, PluginStudent!
-
hi,
your question is sometimes not obvious
Even with the scene it's a bit compicated.What i can say about your code is that you should be more defensive in your code. Always check the value before continue.
For example what if the object is not found ? You should continue to the next item or stop ?
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 ...
Cheers,
Manuel