zarti Posted May 11, 2011 Share Posted May 11, 2011 hi all , yesterday i was working with profiles of a window. i needed to Sweep and Skin them, while preserving the manually assigned group names to later apply materials . at the beginning, the ForEach SOP wasn't giving me the results with For's Each Group option . Each Attribute Value has always been 'kind with me' . =) after searching in forums i didn't found something or felt tired and .. i gave Python a try . here there are those lines pasted : # This code is called when instances of this SOP cook. geo = hou.pwd().geometry() # Add code to modify the contents of geo. groups = geo.primGroups() group_list = [] for group in groups : group_list.append( group.name() ) #print group_list mat_attrib = geo.addAttrib( hou.attribType.Prim, "group", "") for group_name in group_list: for primitive in geo.iterPrims(): if geo.findPrimGroup( group_name ).contains( primitive ): primitive.setAttribValue( mat_attrib, group_name ) create a new operator type > python type > geometry operator and paste this in the Code tab. the attribute name is 'hard coded' to "group", but you can easily create a string input parameter for it. ... and so , my manually named groups 'survived' passing through foreachs , sweeps and skins =) hope this wd help someone else in other cases too .. attached pics shows what i was doing ... Quote Link to comment Share on other sites More sharing options...
anim Posted May 11, 2011 Share Posted May 11, 2011 what about this? no Python needed sweep_keep_groups.hip Quote Link to comment Share on other sites More sharing options...
zarti Posted May 11, 2011 Author Share Posted May 11, 2011 what about this? no Python needed yes, it does the job too ( just tested in my hip ). thanks for sharing it ! Quote Link to comment Share on other sites More sharing options...
hopbin9 Posted May 11, 2011 Share Posted May 11, 2011 That looks cool. Nice rendering by the wall. Quote Link to comment Share on other sites More sharing options...
zarti Posted May 11, 2011 Author Share Posted May 11, 2011 That looks cool. Nice rendering by the wall. thanks ! beside the glass , all other shaders are colored irradiance vops , mixed with lambert ( 10-15% ), just to slightly catch the shadows of a single point light and 'naturally' shade the models . i'm doing few short animated illustrations . Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.