Select by color - select instances - how to ?
3187 10 2- w_maro
- 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 ?
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 ?
- fusion9
- Member
- 43 posts
- Joined: 9月 2018
- Offline
- w_maro
- Member
- 68 posts
- Joined: 9月 2014
- Online
- mtucker
- スタッフ
- 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)`.
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)`.
- w_maro
- Member
- 68 posts
- Joined: 9月 2014
- Online
- mtucker
- スタッフ
- 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.
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.
- w_maro
- 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)
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)
- npetit
- スタッフ
- 356 posts
- Joined: 2月 2008
- Offline
You can use VEX for the selection, so in the primpattern parm, use to select all the red prims.
This expression might get long though as you need to compensate for float precision.
{ 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 }
This expression might get long though as you need to compensate for float precision.
Edited by npetit - 2022年11月5日 18:28:42
- w_maro
- Member
- 68 posts
- Joined: 9月 2014
- Online
- jsmack
- 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?
- w_maro
- Member
- 68 posts
- Joined: 9月 2014
- Online
-
- Quick Links