On 29/11/2016 at 03:37, xxxxxxxx wrote:
Hi Mustapha,
I'm sorry in so many ways...
First of all i'm sorry, for being triggered by the most obvious error in your script, that I didn't look into your actual problem. Terribly sorry!
The actual reason for your issue: You copy/move a UVW Tag from one object to another object with a different polygon count. Resulting in the UVW tag not being "in sync" with the host object, as the polygon count differs from the number of UV polygons in the tag.
Now, I'm sorry for the second time, because internally this is handled via a MSG_POLYGONS_CHANGED/VariableChanged (links into C++ docs), unfortunately this message is not correctly supported via Python, yet. I have put it on our list and hopefully we will be able to address this with one of our future updates.
Depending on your needs you can manually work around these limitations.
For example like so:
tagUVW = platonic.GetTag(c4d.Tuvw) # platonic is the source object in this example
cntPlatonic = platonic.GetPolygonCount()
cntSphere = sphere.GetPolygonCount() # sphere is the destination object in this example
tagDst = sphere.MakeVariableTag(c4d.Tuvw, cntSphere, None)
for idxPoly in range(0, cntSphere) :
uvwdict = tagUVW.GetSlow(idxPoly % cntPlatonic)
tagDst.SetSlow(idxPoly, uvwdict["a"], uvwdict["b"], uvwdict["c"], uvwdict["d"])
c4d.EventAdd()
Notes:
- The above example works only for copying the tag from a lower poly count object to a higher polygon count object. But you get the idea, I guess.
- Also repeating the coordinates for the additional polygons, might not be what you want. But at least it comes close to, what was shown in the screenshots.
And then the above example might look overly complicated with a CpySlow() function being available in the UVWTag class. Well, this is where I'm sorry for the third time. There's a bug in the index range checking of CpySlow(), so it can't be used in this case. This will be most likely addressed in one of the next service packs.
No, my back hurts from apologizing so much. But it was due.