getting transform from geom

hi evrybody,
I create a geom, and after transform it (translate or rotate)
if I want to export it to egg, I lose the information about the transformation (the vdata doesn’t apply these transformations on the vertices)…
Does anyone have an idea ?

perhaps nodepath.flattenStrong() ?

We need a bit more context. Are you working in a modeling package like Blender? Or are you creating dynamic geometry directly within Panda?

What, precisely, do you mean about losing the transform? Most modeling converters will convert any transforms on the nodes you create. These will not usually be directly applied to the vertices, unless you pick “freeze transforms” or “zero transforms” or “apply transforms” or whatever the equivalent is in your modeling package.



We’re creating procedural houses within panda.
We create the geometry of the house directly in Panda (using GeomTriangles) and then we add windows (which are egg models we load in Panda).

Then we wanna export the whole thing to an egg file. So we scan the nodepaths that contain the information.
We retrieve the vertices from the vertex datas and, when we write them, we see that the transformations are not taken in account.
For an example, the many windows we have loaded are all at the same place when we access to their vertices.
We tried the “apply_transforms” method but it didn’t change anything.




This will apply any transforms to the vertices.
But you might be going about it the wrong way. If your goal is to create egg files, why not create the EggVertexPools and EggPolygons directly, rather than first creating GeomVertexDatas? The egg structures have lots of interfaces for creating transforms and whatnot, and are pretty easy to use.

Of course, if you want the user to be able to manipulate the houses before you write them out, it makes sense to create GeomVertexDatas for them, so you can render them onscreen and give the user a chance to see what he’s getting before it becomes an egg file. But if this is the route that you choose, you might find it simpler to use model.writeBamFile(‘filename.bam’), which will write a bam file, and then use the command-line tool bam2egg, with a command like “bam2egg -o filename.egg filename.bam” to convert the bam file to egg format. This will preserve any transforms correctly, without having to first apply them to the vertices.



Indeed we want the user to be able to render the created house before saving it. So we use GeomVertexData.

We just tried the solution with the writeBamFile command and it’s wonderful! You saved our lives !! :slight_smile:

Thank you VERY much