Get connected input node from Null in Python

   1895   2   1
User Avatar
Member
96 posts
Joined: Nov. 2017
Offline
Why does
parent = null.inputs()[0]

not work on a null object? Without the
[0]
I get the “parent”, but can't use its value to setFirstInput later on (error message).

With bone nodes it works flawlessly.

Cheers
Tom

P.S.: null = hou.node(“obj/GEO/childNull”)

P.P.S.: I need to unparent the null and parent it again after doing several transforms. Therefore I need to get the nodes name which is connected to its input.
Edited by Tom Mangold - Sept. 23, 2019 09:28:13
User Avatar
Member
106 posts
Joined: June 2011
Offline
Hi there,

What's not working for you ? Could you please post the error message you're getting ?

Isn't this what you're trying to do ?

null = hou.node(obj/GEO/childNull)
parent = null.inputs()[0]
# Unparenting
null.setFirstInput(None)

# Re-parenting
null.setFirstInput(parent)

-J
User Avatar
Member
1 posts
Joined: Aug. 2020
Offline
Python Null object is the singleton None. There’s no null value in Python; instead, there’s None. The equivalent of the null keyword in Python is None. Can you please elaborate on what you want to do with null and not none?
  • Quick Links