Replace one HDA with another

   1983   4   0
User Avatar
Member
128 posts
Joined: Feb. 2021
Offline
I am curious if you could with python swap an HDA to another HDA without having the HDA move or change location in the network.
This seems to be happening anyways under the hood, if the HDA versions have different save locations. Switching the version then completly loads another hda path. Now I just need to figure out how to do this on purpose. While saving it, this is straight forward, but how to go about it with just swapping to another?
Andreas Weidman
VFX Supervisor - Dupe VFX
www.dupevfx.com
User Avatar
Member
8026 posts
Joined: Sept. 2011
Offline
Are the hda's the same type name exactly, or different because of version/namespace? If identical then it should swap automatically when installing the new def if it's newer or if 'force_use_assets' is true on the hda.installFile command.

When the types differ, then swapping is less straightforward as a type change is involved. Every node in the scene would need to be found and type changed.
User Avatar
Member
128 posts
Joined: Feb. 2021
Offline
Thanks Jsmack. So the simplified idea is this:

- We’d have an editable template HDA with stuff and our own save/load/edit/revert buttons. (Template.1.0.hda)
- Artist does things in it. Presses our save button. It saves it out and installs it as myName.1.0.hda.
- The Template hda should then be replaced by the myName hda, for this instance of the node. And myName hda becomes available as a new digital asset. Very similar to how ”save as” works in the Digital Asset menu.

The first two things is not a problem. It’s the last point I’m trying to solve. Currently I’m doing some hacky stuff, getting template position and input/output, and manually deleting one, and moving the other to its place. But that might screw with anything referenceing that node.

If I can find a way to replicate HDA ”save as”. That would make my day.
Andreas Weidman
VFX Supervisor - Dupe VFX
www.dupevfx.com
User Avatar
Member
8026 posts
Joined: Sept. 2011
Offline
You should be able to use node.changeType() to go from the template type to the saved type.
User Avatar
Member
128 posts
Joined: Feb. 2021
Offline
jsmack
You should be able to use node.changeType() to go from the template type to the saved type.

Seems to work like a charm! Thank you very very much!
Andreas Weidman
VFX Supervisor - Dupe VFX
www.dupevfx.com
  • Quick Links