Python equivalent to opinputpath

   4725   8   0
User Avatar
Member
2036 posts
Joined: Sept. 2015
Offline
Hello,

I've just started going over Jeffs' recent pyro webinar tut.

And as usual I try to look for ways to do equivalent expressions in python when I see an HScript expression being used.

Python in Houdini is my weak spot as I still have difficultly in utilizing the docs hou references in utilizing python in new ways.

In the tut Jeff is using the expression
`opinputpath("../", 0)`
in a SOP Path parameter field of a gasresizefluiddynamic node.

Oddly enough when I switch the node preference to Python from Hscript, the expression still works as is.

But this is an exercise to learn a bit about Python.

It seems hou.parent() maybe with the combination of input() somehow could accomplish the same thing.

But after searching through docs and the net I haven't been able to figure this one out.

Help is appreciated - thanks
User Avatar
Member
387 posts
Joined: Nov. 2008
Offline
opinputpath(“../”, 0)
hou.pwd().parent().inputs()[0].path()

opinputpath(“.”, 0)
hou.pwd().inputs()[0].path()
User Avatar
Member
2036 posts
Joined: Sept. 2015
Offline
Thanks very much for this pezetko.

I like that you also give an example for the argument of “.”

This helps me go through the docs again as I saw reference to the equivalent of that also.

path() is a new one I didn't think/come across as well.

Thanks again.
User Avatar
Member
14 posts
Joined: Oct. 2015
Offline
pezetko
opinputpath(“../”, 0)
hou.pwd().parent().inputs()[0].path()

opinputpath(“.”, 0)
hou.pwd().inputs()[0].path()

Hi,

I am not sure how to get similar result with path provided for example

`opinputpath("/obj/geo/Wood/dopimport2", 0)`

I see the first option with ‘parent’ is relevant to my situation but I did not find how I should stick my path

I will be so glad for help, thank you
Edited by Bartolomeooo - Feb. 4, 2018 06:13:33
User Avatar
Member
387 posts
Joined: Nov. 2008
Offline
pwd()
is this node

You can replace it with:
node('/obj/geo/Wood/dopimport2')
User Avatar
Member
14 posts
Joined: Oct. 2015
Offline
pezetko
pwd()
is this node

You can replace it with:
node('/obj/geo/Wood/dopimport2')

Thank you for replay

so the right code looks like this?

hou.node('/obj/geo/Wood/dopimport2').parent().inputs()[0].path()

I tried different options but seems I do something wrong or I miss understand.

I would like to set soppath for ‘hero object’ which is in AutoDopNetwork Node and apply a correct path
User Avatar
Member
7741 posts
Joined: Sept. 2011
Offline
Which node's inputs are you trying to get, ‘/obj/geo/Wood/dopimport2’ or ‘/obj/geo/Wood’?

Adding .parent() to the end will give you the parent's inputs, which in this case is the node called ‘Wood.’

Omit ‘parent()’ if you actually want the dopimport node's inputs.
User Avatar
Member
14 posts
Joined: Oct. 2015
Offline
jsmack
Which node's inputs are you trying to get, ‘/obj/geo/Wood/dopimport2’ or ‘/obj/geo/Wood’?

Adding .parent() to the end will give you the parent's inputs, which in this case is the node called ‘Wood.’

Omit ‘parent()’ if you actually want the dopimport node's inputs.


I am trying to get ‘/obj/geo/Wood/dopimport2’ as input in soppath ‘rbd hero obj’ in AutoDopNetwork to achieve that result

`opinputpath("/obj/geo/Wood/dopimport2", 0)`

The ‘Wood’ node is a ‘Subnetwork’ which contain other ‘dopimport’ nodes. I would like to specify that this need to be as soppath for my ‘rbd hero obj’
User Avatar
Member
14 posts
Joined: Oct. 2015
Offline
I still didn't find solution for my problem,

one more time

I have two nodes

/obj/geo/Wood/dopimport2

/obj/AutoDopNetwork/rbdobject
(this hero object)

I would like to add this
/obj/geo/Wood/dopimport2
into soppath of my rbdobject which is
/obj/AutoDopNetwork/rbdobject/soppath
and achieve the final results as
`opinputpath("/obj/geo/Wood/dopimport2", 0)`
.

Anyone know how to do it? I am stuck with this a bit

Thank you
  • Quick Links