Hi. I’m trying to do more in PyMEL and am looking into using path objects, but I’m unsure of how to work with it.
For instance, I want to get the sourceimages folder path to the current scene. I could do it with Python’s os module, but I would really like to learn how to do it in PyMEL if possible. I haven’t been able to find out just how, yet.
So basically I want this:
- get the project path to the current scene, this returns a python path.
- then from there, get the source images folder path
However I can’t seem to find what I need.
I have this:
scenePath = pm.system.sceneName()
and it returns a PyMEL path object to the scene file.
And I could use this and partition at “scenes/” getting scenePath and scenePath[-1], but then I lose the path object and am back to just going with os module =/
I found this:
and it does give me the project folder, but only if it has been set correctly.
It’s imperative that it relies on the scene file that is opened. I don’t want it to rely on the user to have to set the project directory, if possible.
I’m thinking I want something like:
TLDR: how can I get the file path of the currently opened scene file, in PyMEL without using Python’s os module?