Autodetect attribute class?

   3269   6   0
User Avatar
Member
38 posts
Joined: 2月 2014
Offline
Hi,

I'm building a super simple tool - a Color Map with pre-built attribute promotion, since I need uvs to be point, not vertex for it to work properly.

Is it possible to have Attribute Promote (or some custom made replacement) auto-detect what is the input uv's original class?

Also is it possible to have class auto-detection in other contexts - in a custom Bind VOP for instance?

If not, would you consider it something worth submitting an RFE for?

In XSI ICE general purpose nodes that worked with more than one kind of input could automatically recognize what kind of data was fed to them, and adapted accordingly. I see no advantage in identifying the kind of input by hand, other than it keeps you on your toes. Having the nodes recognize the data properly (by default, not instead of the manual solution) would help eliminate some human error.

Sorry if it is a noob question.

Cheers
Edited by - 2015年8月17日 17:10:06
User Avatar
スタッフ
2551 posts
Joined: 9月 2007
Offline
As this had nothing to do with tutorials, I've moved it to this forum instead.
Chris McSpurren
Senior Quality Assurance Specialist
SideFX
User Avatar
Member
38 posts
Joined: 2月 2014
Offline
chrism
As this had nothing to do with tutorials, I've moved it to this forum instead.

Thank you and sorry for posting in a wrong place.
User Avatar
Member
38 posts
Joined: 2月 2014
Offline
So I'm guessing I should make a Python SOP that does something like this:

Check what type the original uv attribute is (hou.attribType?) and output a value from 0 to 3 accordingly, so

if (uv is point) x=0
if (uv is vertex) x=1
if (uv is primitive) x=2
if (uv is global) x=3

Attrib Promote
Original class switch = x

Could you guide me in the right direction?
User Avatar
Member
8839 posts
Joined: 7月 2007
Offline
you can just use hscript functions like
haspointattrib()
hasprimattrib()
hasvertexattrib()
hasdetailattrib()

to test if such attrib exists and switch accordingly
so the expression in Original Class parameter of Attrib Promote will look like:
{
string geo = opinputpath(“.”,0);
string attrib = chs(“inname”);
return if(hasdetailattrib(geo, attrib), 0, if(hasprimattrib(geo, attrib), 1, if(haspointattrib(geo, attrib), 2, 3)));
}

or VEX has the same functions as well if you need to determine that in VEX/VOPs
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
38 posts
Joined: 2月 2014
Offline
Thank you very much Tomas! I will test it as soon as I can.
User Avatar
Member
38 posts
Joined: 2月 2014
Offline
Thanks! This works great in Attribute Promote, and I'm sure it will in other SOPs.

How could I do the same for Bind VOP to include all the possible input types?
Should I use dataType(self) or optionType(self)?

Is there a more generalized method to check for input type in the context of the node receiving the data?

Attachments:
Screen Shot 2015-08-20 at 15.28.31.png (28.7 KB)

  • Quick Links