Page 1 of 1

Geometry - UVSets problem

Posted: Thu Aug 12, 2021 9:07 am
by Mingfae Wong 20210811011621
Hi, does anyone know how to get the object's UVsets data in PyMaxwell4? I can only get the count of each object.

from pymaxwell4 import *

def test():
file = "C:/Users/twong/Desktop/test.mxs"
scene = Cmaxwell(mwcallback)
scene.readMXS(file)
it = CmaxwellObjectIterator()
obj = it.first(scene)
while not obj.isNull():
obj_Name = obj.getName()[0]
print('\nobj_Name:', obj_Name)
if obj.isInstance()[0] == 0: # 0=Object, 1=Instance.
obj_UVSets = obj.getChannelsUVWCount()
for u in range(obj_UVSets[0]):
obj_UVChannelId = obj.getUVWChannelId(u)
print('obj_UVChannelId:', obj_UVChannelId)
obj = it.next()

test()
Image

Re: Geometry - UVSets problem

Posted: Mon Aug 16, 2021 9:24 am
by luis.hijarrubia
From the documentation that comes with the installation (sdk/doc), there's a function:

byte getUVWChannelProperties (dword iChannel, byte &projType, bool &customProj, Cbase &projectorBase, real &startLatitude, real &endLatitude, real &startLongitude, real &endLongitude, real &startAngle, real &endAngle, bool &mirrorBackFaces) const

It should exist the same method on python.

Re: Geometry - UVSets problem

Posted: Tue Aug 17, 2021 8:26 am
by Mingfae Wong 20210811011621
I still can't get it, I tried "obj.getUVWChannelProperties(0)", it return error = Invalid object to get UVW channels properties.
Could you give me more hints?

Re: Geometry - UVSets problem

Posted: Tue Aug 17, 2021 10:30 am
by luis.hijarrubia
It seems that it only work with user defined data. Let me check this next week with the dev that made pymaxwell.

Re: Geometry - UVSets problem

Posted: Tue Aug 24, 2021 11:24 am
by Brany
CmaxwellObject.getUVWChannelProperties is meant for procedural geometry objects, which UVs were generated by CmaxwellObject.generateCustomUVW.

UV projection parameters used to generate UVs in Studio, in the way you show in the screenshot, are saved as "Maxwell Studio custom data" in the MXS, so they cannot be retrieved from the public SDK. It is opaque data that only Maxwell Studio knows how to handle.

Re: Geometry - UVSets problem

Posted: Wed Aug 25, 2021 9:58 am
by Mingfae Wong 20210811011621
I see, thank you for all of your help.