Select by color - select instances - how to ?

   3187   10   2
User Avatar
Member
68 posts
Joined: 9月 2014
Online
hi
just starting in USD

I import a CAD File in 3dsmax and export as USD
(its a big File with thausands of Objekts - no Hirarchy or Groups)

there are a lot of Instances - I want to select the instances to give them the same material
- whats the best way to do this ?

and a lot of similar Objects have the same display Color
- is there a way to select by display Color ?
User Avatar
Member
43 posts
Joined: 9月 2018
Offline
I'm learning USD and Solaris myself so I don't know a solution like that but wouldn't it make sense to prep the asset first in SOPs where you can definitely select geometry by Cd then make groups and then bring the asset into Solaris?
User Avatar
Member
68 posts
Joined: 9月 2014
Online
thanks for the reply

- found a %instace Pattern to select Instances in Solaris
(it selects all instances but without the instance itself)

so - if there is a way to select all instancec with the instance itself - please let me know
User Avatar
スタッフ
4435 posts
Joined: 7月 2005
Offline
`selects all instances but without the instance itself` - this sentence is confusing me... Using USD terminology, did you mean `selects all instances but without the prototype`?

If so, I think there is more to USD instancing than you might realize... Because the "prototype" primitive isn't a "real" primitive. Even if /foo is an instanceable reference of /bar, that does not make /bar the "prototype". However, if you know that this is the structure of all your instances, and you want a pattern that finds both /foo and /bar, you can use the `%referencedby` auto-collection to find all prims referenced by your instances (something like `%instance + %referencedby(%instance)`.
User Avatar
Member
68 posts
Joined: 9月 2014
Online
thanks for the feedback - but I cant get it to work

here is a little Testscene to look at

Image Not Found



- how to find all the Instances from SCR_000 (+ the reference SCR011)



and I still looking for a method to select by display color - any Info about this ?

Attachments:
vat-mitte-instance-rename.usd (1.5 MB)
Solaris.instance-missing.JPG (548.2 KB)

User Avatar
スタッフ
4435 posts
Joined: 7月 2005
Offline
That's basically because you're bringing in the file as a reference rather than as a sublayer. The basic issue is that primitives defined inside a reference cannot "see" outside the reference. Which means that SCR_011 that you see in your composed scene graph isn't actually the prim being referenced by SCR_010. Look at the metadata on SCR_010, and you'll see it is referencing /World/SCR_011. A prim which doesn't even exist in the composed scene. But even if you reference your file to /World, and /World/SCR_011 does exist in the composed scene, that's not the /World/SCR_011 being referenced by SCR_010. Try changing the color on SCR_011, and SCR_010 will not be affected.

Bring in your file as a sublayer, and everything I've said above changes. The pattern works, SCR_011 _is_ the prim being referenced by SCR_010, and changing SCR_011 changes all the other SCR_* prims.

This is deeper USD composition logic than you were probably expecting here, but I've made a hip file to at least demonstrate the end results... I hope it helps.

Attachments:
referencing.hip (75.5 KB)

User Avatar
Member
68 posts
Joined: 9月 2014
Online
thanks for the detailed explanation - but thats way over my USD knowledge

wehn i bring in the file as sublayer i can get all the references with:

%instance:/World/SCR_010
%referencedby:/World/SCR_010

thank you for this

- any tipps on how to select by display color
(Iwant to assign a material based on display color)
User Avatar
スタッフ
356 posts
Joined: 2月 2008
Offline
You can use VEX for the selection, so in the primpattern parm, use
{ vector(usd_primvarelement(0, s@primpath, "displayColor", 0)).x > 0.9999 &&  vector(usd_primvarelement(0, s@primpath, "displayColor", 0)).y < 0.0001 && vector(usd_primvarelement(0, s@primpath, "displayColor", 0)).z < 0.0001 }
to select all the red prims.

This expression might get long though as you need to compensate for float precision.
Edited by npetit - 2022年11月5日 18:28:42

Attachments:
SelectByDisplayColor.hip (98.7 KB)

User Avatar
Member
68 posts
Joined: 9月 2014
Online
thanks alot for the feedback and the .hip file - very usefull

- so there is no easy method to pick the color in viewport to get all primitives with the same color
User Avatar
Member
7733 posts
Joined: 9月 2011
Offline
w_maro
- so there is no easy method to pick the color in viewport to get all primitives with the same color

Picking 'the same color' isn't a well defined concept. What makes something the same color? Converting the rgb values to a string representing the 'name' of the color? An identical tuple of floats?
User Avatar
Member
68 posts
Joined: 9月 2014
Online
OK - but it would be very user friendly

imagine you can pick a primitive in the viewport
right mouse
- select all instances
- select by size
- select by color
...

to create a collection for example
  • Quick Links