Now that I've gotten to grips with making Python scripts that work, I'm paying more attention to readability and style. I've had the PEP 8 Style guide for Python Code recommended to me as a good standard to follow.
Here is a quick code snippet for calling a Python script from Substance Painter and parsing the results. The in/out is very simple, but serves as an example of using the alg.subprocess.check_output function to bridge the JS api and your own Python scripts. // This can be called from the QML UI, or elsewhere in the plugin code. function GetAllFilesInDirectory(root) { if (root == undefined) return; // I put my scripts in a relative path to keep my plugin tidy. var script_path = "Scripts/FileUtils.py"; // Gathering files var ret = "NOSTRING"; try { // The arguments are used as parameter inputs to the Python script. This requires some planning // and well communicated conventions, but works well enough. ret = alg.subprocess.check_output( [ pypath, // Absolute path to interpreter. script_path, // Relative path to the py script. "log_files_of_type", // sys.argv[1], in this case the python ...
Super quick check-in. Hello world! For the last year or so, I've been working with Echtra Inc. on a great project as a Tools Engineer/Technical Artist guy. The project is using the Unreal Engine, which I like more and more every day. On Windows, C++ plus Visual Studio Pro and Visual Assist is a great combo, and I happily churn through my daily tasks without fighting the tools too much. Not so on my Mac at home. Programming in Unity on a Mac is great! Mono Develop isn't amazing, but it isn't terrible. But Unreal on a Mac. I want it to be fun, I want it to be possible, but I just can't get myself to like, let alone enjoy, XCode. On that, for anyone thinking "well, you could just use blueprints..." etc, I feel it's too much of a shackle to not be able to just dive into the guts of it. C++ or bust. So anyway, I recently adopted PyCharm at work and really enjoyed using it for my Python tools. I noticed that JetBrains also made an IDE called CLion , and they ...
Now for something a little different! Google Spreadsheets! Here is a little script I cooked up today for changing a row color in Google Spreadsheet when you change the contents of a drop down menu. When you change the contents of a cell in the designated "status" column the entire row will change it's background color to match whatever rule you have defined in the switch statement. A useful addition to this would be the ability to automatically find the status column in whatever sheet you have open, but it was beyond the scope of what the script was meant for, so here is it in the raw! /** Google Sheets Script to modify a row's color based on the 'Status' entry. This script uses the onEdit() method, which is called every time a cell is edited. The statusColumn variable's cells are assumed to be a drop-down with the following options: Complete In Progress Not Started Revisions Req Blocked The script modifies a row's color based on the contents- leaving ...
Comments
Post a Comment