Jump to content

Is there a way to find the object associated with a DOP node in Python


magneto

Recommended Posts

Hi,

If you have a dopnet and a Gas Match Field DOP inside where the Reference Field is vel, how can you know where this vel is originating from?

I have a handle to the Gas Match Field node but I don't know how to find the vel field from that.

Should I use the simulation() from my Gas Match Field node? But that only returns the dopnet, and there could be many objects inside.

Thanks :)

Link to comment
Share on other sites

You'll want to find the DOP object your data is attached to and then look for the particular subdata on it. Once you have the subdata you can ask if for the creator.

For example, using a simple smoke setup I'm able to determine where the vel field was created:

>>> hou.node('/obj/dopnet1').simulation().findObject('smokeobject1').findSubData('vel')
<hou.DopData of type SIM_SopVectorField at smokeobject1/vel>
>>> hou.node('/obj/dopnet1').simulation().findObject('smokeobject1').findSubData('vel').creator()
<hou.DopNode of type sopvectorfield at /obj/dopnet1/smokeobject1/smokeconfigureobject2/velocity_data>

You can actually drag and drop DOP data from a Details view pane to a Python shell and it will give you the code necessary to access what you dropped. The first line above is an example of the output.

Link to comment
Share on other sites

Thanks Graham now it makes sense. Then there is no way for me to find the object the data is associated to from the Gas Match Field DOP?

If you look at the Gas Match Field DOP's Rank parameter, the last option is "Same as Reference". How does it know the type of the Reference Field? Can I just access the DOP object that's being used by a particular Gas Match Field DOP node?

Because there could be multiple objects in the simulation, in the same tree?

I don't really know :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...