Access a Xpresso node via python tag? [SOLVED]

On 22/03/2016 at 02:09, xxxxxxxx wrote:

Hey Guys ^^

so, what I want to do is, to access the "Output Upper" of an RangeMapper via a Python Tag.
I want to use this like an multiplier with an Float Field from my User Data.
I have tried it like this:

import c4d
  
def main() :
    obj_ps = doc.SearchObject("Null")
    multi = obj_ps[c4d.ID_USERDATA,29] #This is the float field
    xpresso_tag = obj_ps.GetFirstTag()
    node_master = xpresso_tag.GetNodeMaster()
    node = node_master.AllocNode(c4d.ID_OPERATOR_RANGEMAPPER)
    node[c4d.GV_RANGEMAPPER_RANGE22] = multi

I tried it like this because I only have one Range Mapper in my Xpresso.
but this seems to be not working.
Well, it actually does nothing at all, but I don't get an error or something.
So yeah, is it actually possible, or am I just to stupid to get it right?

thanks in advance,

neon

On 22/03/2016 at 03:21, xxxxxxxx wrote:

Hello,

in your code your are not accessing an existing node. You are allocating a new node (AllocNode) and that node is not inserted into anything.

So if you are searching for a specific node you have to get the root node (GetRoot()) and search its child nodes for the node you want to edit.

  
node_master = xpresso_tag.GetNodeMaster()  
if node_master is None:  
  return  
  
root = node_master.GetRoot()  
if root is None:  
  return  
  
first = root.GetDown()  
if first is not None:  
  if first.GetOperatorID() == c4d.ID_OPERATOR_RANGEMAPPER:  
      first[c4d.GV_RANGEMAPPER_RANGE22] = 123  

Best wishes,
Sebastian

On 01/04/2016 at 09:20, xxxxxxxx wrote:

Hello Neon,

was your question answered?

Best wishes,
Sebastian

On 01/04/2016 at 10:37, xxxxxxxx wrote:

Hello Sebastian,

Yes it was!
I actually thought I have already written a reply to your answer, I am sorry.

greetings, 
neon