http://code.google.com/p/makehuman/issues/detail?id=23
However, there are three ways one could do that, and I'd like input on which to go for before submitting anything.
The first approach is adding this line in the top of __init__() in main.py
- Code: Select all
os.chdir(os.path[0])
Which is a quick and easy solution, but which changes the working directory. This might have unforeseen consequences if we ever want to use the makehuman binary for command line stuff like piping.
The second approach is to modify all data loading lines so that for example:
- Code: Select all
self.scene3d.selectedHuman.setTexture("data/textures/texture.tif")
becomes
- Code: Select all
self.scene3d.selectedHuman.setTexture(os.path[0] + "/data/textures/texture.tif")
Unfortunately, bug #23 is present in every single location where anything is loaded. It is everywhere simply assumed that working directory is the one containing the makehuman binary. Thus this'd lead to many, many code changes.
A third, slightly more beautiful approach would be to modify all file access methods in all classes so they properly take into account what the working directory is and compensate for it. Then the previous example would be:
- Code: Select all
self.scene3d.selectedHuman.setTexture("texture.tif")
.. and inside setTexture(), the file would be prepended with os.path[0] + "/data/textures/". This approach would require some planning and also probably many code changes. It might also lead to unforeseen consequences if one forgets to change stuff somewhere.
In any which way, I'm currently favoring the first approach since it'd be a minimal code intervention.
Comments?