How to retrieve correct UV coordinates

Hi @mamarchenko ,

it took a while for me to get back to this issue.

After some further investigation I realized that it is actually already possible to retrieve the OCS mapping.

The OCS mapping is actually just a planar mapping on mapping channel 100000 (one hundred thousand). The following Python code shows you how to query objects for the OCS mapping:

import scriptcontext as sc

for ob in sc.doc.Objects:
    tm = ob.GetTextureMapping(100000) # OCS mapping is always on this channel)
    if tm:
        print "object", ob.Id, "has OCS mapping:"
        print "\t", tm.MappingType
        res = tm.TryGetMappingPlane() # the mapping is based on a plane
        if res[0]:
            plane = res[1]
            print "\t", plane
    else:
        print "object", ob.Id, "has no OCS mapping"
1 Like