Python - Allow Instance Proxies in Collection (CROWD)

   577   2   1
User Avatar
Member
33 posts
Joined: Dec. 2014
Offline
Hello,

I'm trying to create collections through the Python node to allow the assignment of shaders to crowd agents. I'm trying to basically do the same function as ticking the "Allow Instance Proxies in Collection" tickbox in the collection node but for the life of me I can't seem to be able to grab the instanced proxies through the agent definition shape library and add them to the collection to then have their material assigned through the assign material node.


To be honest this approach,might end up being unnecessary if I can assign the material bindings to each instanced agent through python?
Edited by JohnDoe777 - Oct. 28, 2023 12:25:42
User Avatar
Member
6 posts
Joined: Sept. 2021
Offline
JohnDoe777
Hello,

I'm trying to create collections through the Python node to allow the assignment of shaders to crowd agents. I'm trying to basically do the same function as ticking the "Allow Instance Proxies in Collection" tickbox in the collection node but for the life of me I can't seem to be able to grab the instanced proxies through the agent definition shape library and add them to the collection to then have their material assigned through the assign material node.


To be honest this approach,might end up being unnecessary if I can assign the material bindings to each instanced agent through python?

Ah yes. Been in that rabbit hole.
What you have to do is create collection for each shape in instance proxies, and assign materials via collections.
I have some duct tape python script for that. But didn't finish it, had to switch over to another project.

Can someone from SideFX confirm us that this is still the way to assign shaders to crowd agents?
Is there something in Houdini 20 coming in this regard?

It would be super nice if we could just sublayer lookdev usd over agentdefinition, but for some reason crowdimport flattens whole hierarchy of the agents, and also think instance proxies don't work in that way.
User Avatar
Member
33 posts
Joined: Dec. 2014
Offline
Ah yes. Been in that rabbit hole.
What you have to do is create collection for each shape in instance proxies, and assign materials via collections.
I have some duct tape python script for that. But didn't finish it, had to switch over to another project.


I ended up getting it to work with Python through the use of

ls = hou.LopSelectionRule()
ls.setTraversalDemands(hou.lopTraversalDemands.AllowInstanceProxies)

but it all felt quite inefficient route to go. Would be nice if they made it more straightforward.
  • Quick Links