@zipit said in Python NODES - Shouldn't really they can change the scene?:
This statement is a bit nit-picky, but this is not really a relative path, but a url with a unusual scheme (the Maxon preset scheme that is). You can get the preset folders with c4d.storage.GeGetC4DPath() and the respective path symbols and then check with these and os.path.exists.
Thanks for mentioning that, and also telling the correct usage. I've beem havong a bad rime using
Edit: One thing though, this code kinda has it's own holes, because I encountered a problem once more. I think what
os.path.exists() looks up is the OS Absolute Path, which in this case, not very helpful because of two points:
preset:// followed by file name do not follow the OS path of the file, like
preset://thispreset.lib4d was the path, but
preset://browser/thispreset.lib4d is the one which it was looking for.
- The preset name on C4D do not follow the actual filename, for example, I have
ThisRig by Someone.lib4d for OS path, and c4d reads it on the program as
ThisRig v# - someone and have the path
preset://ThisRig v# - someone.lib4d insted of the one being looked up by
Results on a test run using your code:
preset://browser/default.lib4d prints out the full OS path
preset://testrig.lib4d prints False
preset://broswer/testrig.lib4d prints out the full OS path if file name was
preset://broswer/testrig.lib4d prints False if file name was
So far, I want to detect if this path exists on Cinema4D preset list, even if it doesn't exist in any of the directories being used by Cinema4D itself, as long as it's listed in the Preset list. This was due to the nature of some users just drags and drops a
.lib4d file from some folder.
However, I think using a combination of detecting if a Bitmap is valid by looking at the file resolution if it matches, since it also brings the correct and always updated
preset:// path (Update Textures are still a need since this isn't automatic when either Preset Folder name was changed, or it was moved to a new preset. I just thought of other ways to do that other than the Bitmap way.