Timeline for Is it possible to get the path of a .blend file from within OSL?
Current License: CC BY-SA 4.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 20, 2021 at 17:55 | vote | accept | Michael Macha | ||
Mar 19, 2021 at 22:29 | answer | added | Rich Sedman | timeline score: 4 | |
Mar 19, 2021 at 22:10 | comment | added | Michael Macha | Thanks, but I'm using Linux Mint, so I wouldn't have been bothered by that. | |
Mar 19, 2021 at 22:09 | comment | added | Rich Sedman | Alright, so '//' and '///' have subtly different meanings... On Windows, '//' prefixes with the local path using the O/S file path delimiter (eg,'c:\users\rsedman\Desktop\' - ie, backslashes) and '///' does the same but forcing '/' as the path separator (eg, 'c:/users/rsedman/Desktop/...') | |
Mar 19, 2021 at 22:00 | comment | added | Rich Sedman | I've just re-tested this and I found I had to use '///' (instead of just '//') as a prefix or it didn't work!! Also, you're right - it's the Blender node that's doing the filename conversion on the string; I always thought it was the OSL side that was doing this.... this does mean that all strings are being interpreted this way! | |
Mar 19, 2021 at 21:42 | comment | added | Michael Macha | It seems I can use "//" in an input field to my OSL node, though! It simply doesn't work inside the script. This is very helpful. I can just make the file path a parameter on the shader. This way, it's handled by some other part of Blender. | |
Mar 19, 2021 at 20:12 | comment | added | Michael Macha | @RichSedman In the case of OSL-internal, it does not. I get an error-pink texture. | |
Mar 19, 2021 at 19:54 | comment | added | Rich Sedman | You can prefix the filename with ‘//‘ to indicate the directory of the current .blend file. Does that not work for your case? | |
Mar 19, 2021 at 19:19 | history | asked | Michael Macha | CC BY-SA 4.0 |