The problem I am trying to solve is I have a model I created in blender with several separate geometries, each with their own texture file.
From what I understand, you can create a mesh in PyCollada and get the texture coordinates like so:
from collada import Collada
mesh = Collada("my_model.dae")
geometries = [g for g in mesh.geometries] # gets a list of the geometries
tex_paths = [im.path for im in mesh.images] # gets a list of the texture paths
However, the problem I am running in to is the texture paths and the geometries do not share an index, and I can't seem to find an abstracted way to consistently map a geometry to its diffuse texture file. Any tips on this?
I figured it out, and this is how i did it:
rel_path = "../../../"
tex_paths = []
# iterate over geometries in the mesh
for geom in mesh.geometries:
abs_path = mesh.materials[geom.primitives[0].material].effect.params[0].image.path
tex_paths.append(rel_path + abs_path)
where rel_path is just the path relative to the python script where the model and textures exist.