@@ -363,6 +363,32 @@ Re running the import will result in this wizard:
363363
364364![ Import options] ( https://github.com/20tab/UnrealEnginePython/blob/master/tutorials/WritingAColladaFactoryWithPython_Assets/import_options.png )
365365
366+ Remember to change the FixMeshData function to honour the self.force_rotation value:
367+
368+ ``` python
369+ # this functions starts with an uppercase letter, so it will be visible to the UE system
370+ # not required obviously, but it will be a good example
371+ def FixMeshData (self ):
372+ # move from collada system (y on top) to ue4 one (z on top, forward decreases over viewer)
373+ for i in range (0 , len (self .vertices), 3 ):
374+ xv, yv, zv = self .vertices[i], self .vertices[i+ 1 ], self .vertices[i+ 2 ]
375+ # invert forward
376+ vec = FVector(zv * - 1 , xv, yv) * self .force_rotation
377+ self .vertices[i] = vec.x
378+ self .vertices[i+ 1 ] = vec.y
379+ self .vertices[i+ 2 ] = vec.z
380+ xn, yn, zn = self .normals[i], self .normals[i+ 1 ], self .normals[i+ 2 ]
381+ nor = FVector(zn * - 1 , xn, yn) * self .force_rotation
382+ # invert forward
383+ self .normals[i] = nor.x
384+ self .normals[i+ 1 ] = nor.y
385+ self .normals[i+ 2 ] = nor.z
386+
387+ # fix uvs from 0 on bottom to 0 on top
388+ for i, uv in enumerate (self .uvs):
389+ if i % 2 != 0 :
390+ self .uvs[i] = 1 - uv
391+ ```
366392
367393## Persistent importer options: more subclassing
368394
0 commit comments