Python carriage returns, using /r/n

I’ve written a little shader-making script for Poser folk who want to go one step farther than the Poser-flavour of Cycles and render in the real thing. I’ve found that error-trapping and error-message-sharing leaves a bit to be desired: while I use the console extensively when I code and test, it’s not every end user’s natural inclination to go there if there’s issues.

So, I’ve invoked this feature. Not excessively elegant, but it works, sort-of. What I’m running into a problem with is a message of longer than a few words: I’d like the dialogue to stay at, say, 400px wide, and for the error text to occupy several lines. I tried doing this in the function that detects what the runtime error is:

if sMsg == “PATH”:
longMsg = "Missing path_list.csv. “+”
"
longMsg += "Copy this file to the folder “+”
"
longMsg += “containing your .blend and edit it.”

… which string is then sent to the dialogue, but python and blender sort-of spit the dummy, won’t display the text in multiple lines and it doesn’t work, end of the day. It does display the first part of the string, then some boxes (non-printing chars) and ellipses and then the end of the string.

Any ideas?

So that those kind enough to reply have more to work with than my terse note above, here is the script on GitHub:

https://github.com/robinboncoeur/FigureShaders

The issue is in the init.py file.

Thanks to any who reply.

Fixed with a dynamically-sized error message box. See above link for the solution: it’s in the init.py file.

Thank you, Robynsveil.

Your FigureShaders add-on looks great. I haven’t worked with CSV files yet, but you have thoroughly detailed what is needed for the Poser transfers.

I created my first CMD file export integrated into my remeshing tab for an external quad/tri remesher, and I like your error handling solution, so I might borrow it instead of just writing to console and info.

I loved reading your code… it was great code study. Keep up the great work!

Take care…
Ken

Thank your for your kind words, Ken. Your remesher sounds interesting: does it create like delaunay mesh? I’ve been looking for a decent triangulation solution - one that includes delaunay as an option - for simming cloth.

Significant challenges still loom for this script, for example, I’d like path selection done by a user navigating to the location of the image files and the script saving that location, as well as file:mat zone association also done in the script, which would eliminate typos and other editing problems of csv files.

So, still a bit to do.

The shader itself is okay - as in, it works - but there are infinitely more sophisticated skin shaders out there. Because the shader-creating is its own file, if someone wanted to replace the existing shader bit with their own, well, that’s why it’s open-source. :yes: