Accessing mapping channels via RhinoCommon


Hi - as per the title - can this be done pls? And when accessing the UV from a Mesh.TextureCoordinates, how can the UV’s for mapping channels 2 onwards be obtained pls?



(Menno Deij - van Rijswijk) #2

Just an idea - check if the number of texture coordinates matches the number of vertices, or that multiple channels are encoded one-after-the-other in the list of texture coordinates.


Thanks for the suggestion. Unfortunately there are 4 UV’s in a test plane with only 1 mapping channel, and also only 4 UV’s in a test plane with 2 mapping channels (and the UV’s provided by Mesh.TextureCoordinates is for channel 1). So I cannot see how to get the UV’s for channel 2.



Do any McNeel techs know the answer to this pls?



(Nathan 'jesterKing' Letwory) #9

I’ll look into this tomorrow, but I’ll be able to give good info mostly about RhinoCommon as it currently exists in Rhino WIP. Will that be good, or do you need to know for v5?


Hi Nathan - that depends how long it will be until Rhino6 is released :slight_smile: But yes, would be good to know how to do this in Rhino5 too.



(Nathan 'jesterKing' Letwory) #11

You can call int[] RhinoObject.GetTextureChannels() to get the different mapping ids. Then for each id you can use TextureMapping RhinoObject.GetTextureMapping(int) to get the mapping for the specified channel with an id from the GetTextureChannels(). Then use Mesh.SetCachedTextureCoordinates(TextureMapping, ref Transform).

AFAICT it is pretty much the same in V6, although it is probably a good idea to look at the ChangeQueue there to build your engine integration on.

Does this give you enough information to continue your work?