Search and Replace
Search and Replace
Using a Python “wrapper” script you can catch the output of an executing application, which is very useful when you want to perform certain tasks depending on what is being printed to stdout by the application.
This is a simplified example of how I do it:
# Imports import os, sys, subprocess # Build command command = [ 'python', os.join.path('/path/to', 'scriptFile.py') ] # Execute command p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) # Read stdout and print each new line sys.stdout.flush() for line in iter(p.stdout.readline, b''): # Print line sys.stdout.flush() print(">>> " + line.rstrip()) # Look for the string 'Render done' in the stdout output if 'Render done' in line.rstrip(): # Write something to stdout sys.stdout.write('Nice job on completing the render, I am executing myFunction()\n' ) sys.stdout.flush() # Execute something myFunction()
Here’s an example of catching the output of a V-Ray for Maya render and outputting TR_PROGRESS nnn% to stdout whenever a percentage is being printed to stdout, which makes Pixar’s Tractor show a task progress in the task node tree.
# Imports import os, sys, subprocess, re # Build command command = ['python', os.join.path('/path/to', 'scriptFile.py'), '-r', 'vray'] # Execute command p = subprocess.Popen( command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) # Read stdout and print each new line sys.stdout.flush() for line in iter(p.stdout.readline, b''): sys.stdout.flush() print(">>> " + line.rstrip()) # Tractor Progress match = re.search('[\d]* %', line.rstrip() ) # Detect percentage without period if not match: match = re.search('[\d.\d]* %', line.rstrip() ) # Detect percentage with period if match: percent = match.group(0).replace('%','').replace(' ','') try: percent = float(percent) percent = int(percent) percent = str(percent) except: pass sys.stdout.write('TR_PROGRESS ' + str(percent) + '%\n' ) sys.stdout.flush()
Catching string from stdout with Python
Ever wanted to be able to run the same user interface in Maya, Nuke as well as completely standalone (with or without app-specific modifications) and on any platform, using PySide and/or PyQt?
– That’s exactly why I created a boilerplate Python script, which could serve as a good starting point for most PySide/PyQt projects to be used in the VFX pipeline.
As my experience is limited to some VFX applications, you are most welcome to fork or contribute to make it also run in other PyQt/PySide enabled applications.
QtTypeto either ‘PySide’ or ‘PyQt’
uiFileto point to your .ui file
import sys sys.path.append('c:/path/to/dir/containing/the/script') import boilerplate boilerplate.runMaya()
import sys sys.path.append('c:/path/to/dir/containing/the/script') import boilerplate boilerplate.runNuke()
More on usage and customization over at the GitHub project’s wiki.
A PySide/PyQt boilerplate for Maya, Nuke or standalone
Send MEL/Python code from Sublime Text to Maya
There are some official Autodesk instructions floating around on how to get PyQt4 support in of Maya 2014, but I found them a bit unclear and hard to follow. I also found an error (although minor)… so I’ve typed down my own little step-by-step reminder below, based off that.
PyQt4 in Maya 2014 on OS X
Here’s how to install Maya Bonus Tools 2014 in an arbitrary location. I’ve covered two different methods (which can actually be mixed, if you will). The simple method (#1) is probably the best bet for most people while the “thorough” method (#2) could be interesting for some other folks. Take your pick.
Maya Bonus Tools 2014: arbitrary installation
The Fujifilm X100S – compared to the X100
Having used the previous model, the X100, I will primarily focus on the differences between these two models (that really makes a difference to me, personally).
I have linked random shots of mine from flickr into this blog post along with some RAW file samples. I am writing this blog post using firmware 1.0 on the X100S.
Fujifilm UK has posted somewhat of an official list of the 68 improvements the X100S has over the X100 on Google+, but there seems to be some errors in it. And of course DPReview has also compiled their changelog … but if you are looking for the more hands-on experience related changes, read on…
X100S 23mm, f/5.6, 1/950, ISO 200. RAW file download.
For some reason manual focusing does not work at all when shooting with the advanced filters. If the camera is set to MF, it will still behave as if it was set to AF-S.
X100S 23mm, f/5.6, 1/100, ISO 3200. RAW file download.
X100S 23mm, f/4, 1/125, ISO 200. RAW file download.
To summarise the above, “Basic” seems to reflect whatever state the camera is in right now. This is all very, very confusing at first. At least that’s what I thought.
On top of that little source of possible confusion, the Q button menu’s “Basic” mode does not remember the Auto ISO setting when scrolling through C1/C2/C3/Basic while in the Q button menu. Instead it inherits values from custom profiles C1 or C3 (depending on which way you scroll through the three custom profiles). This, I would say has to be a clear-cut bug, and which I hope Fujifilm will address in an upcoming firmware update. Update April 22nd, 2014: This bug was fixed with firmware update 1.20.
The video capabilities of the X100S is a big step up from the X100, but it is nowhere near a professional tool for video production, and clearly never intended as such. I was hoping to be able to use the X100S for some personal video recording, but I’m not so sure.
I would recommend all JPEG shooters to start out by shooting F+RAW of RAW and try different JPEG developing settings with the built-in RAW converter. This is the only way you will be able to find those magic JPEG settings you are looking for as they are not at all the same as on the X100.
X100S 23mm, f/4, 1/60, ISO 6400. RAW file download.
Check out the photo below. Is that pretty darn good for being ISO 6400 or what? It’s actually usable where ISO 3200 on the X100 was completely unusable (in my humble opinion and for my purposes, that is).
X100S 23mm, f/5.6, 1/125, ISO 6400. RAW file download.
I managed to squeeze out 406 photos over several days during “normal travelling usage” (just two of them with flash) in F+RAW mode on one NP-95 battery. No video was shot on this charge.
When you see two (out of three) bars, change the battery, just like on the X100.
X100S 23mm, f/4, 1/550, ISO 200. RAW file download.
Update 8th April, 2014: Adobe today released Adobe Camera RAW 8.4 which includes huge improvements on color rendition in Lightroom 5.4 and Photoshop CC (version 14.2.1).
ACR 8.4 enables the best color rendition achievable in Lightroom by utilizing custom camera profiles (Provia, Astia Velvia, ProNeg, Monochrome etc). Definitively go check this out right now!
Update 16th June, 2013: I have made a custom camera profile for the X100S which addresses my complaints on X100S RAW file color rendition in Lightroom. Go here to check it out!
Update 18th April, 2013: Apple has released native X-Trans support and this is by far the best RAW conversion available for the X100S. If you are on a Mac, go get this right now. The problems described below are eliminated if you use this for RAW conversion. You may have to perform some defringing and look out for color noise, but that’s usually easy to eliminate.
Tip: You can install this update from Apple, then open the .RAF files directly in Preview.app and then save an 16-bit TIF file to use in Lightroom, Photoshop or other application of your choice.
Another alternative on OS X would be to check out Iridient Developer which produces excellent RAW conversion for the X100S.
The following is related to working with Lightroom 4.4 rather than the actual RAW files themselves, since Lightroom is just interpreting the RAW data this way…
Here’s a crazy idea. Since Fujifilm obviously are the only ones who really know how the .RAF RAW file should be converted into JPEG (see my JPEG notes), why don’t you (Fujifilm) enable 16-bit TIF export in the in-camera RAW converter? The reason for me saying this is not because I’m unhappy with the RAW files, it’s just that when I watch the JPEG and RAW side by side, the JPEGs just look so amazing. To me, it’s just sometimes virtually impossible to edit a RAW file to mimic local areas or features of a JPEG. But if bringing the JPEG into post production, I can’t utilize the full 14-bits of color depth.
X100S 23mm, f/5.6, 1/125, ISO 3200. RAW file download.
For the JPEG settings on the old X100 I used Astia with Auto ISO and I also used to set sharpness to its maximum. However, since the JPEG output of the X100S is quite different, my current X100S settings also differ, and now I primarily use JPEGs as a neutral reference when editing the RAW files. Update 8th April, 2014: With the release of Lightroom 5.4 I can now feel confident to shoot RAW only.
Usually, I have the camera set at C2 (see below) so I can quickly pick up the camera and shoot from the hip.
The rest of the values are all at their defaults.
The rest of the values are all at their defaults.
The rest of the values are all at their defaults.
Even though the X100S has many of the same quirks as the X100, listed over here (of which none are actual issues for me after the move to the X100S) …Ohhh yesss, without a doubt is it worth the upgrade.
I would say it’s the combo of all the speed-ups, a now working MF ring and usable higher ISO values which makes the biggest difference to me. It’s a completely different camera where the handling has improved immensely.
With the X100S, a totally normal scenario: grab the camera, power on instantly, hit Q, change to the appropriate custom profile with the appropriate ISO set, set f/11, look through OVF, tweak the AF point position, snap a shot in AF-S, check the preview, reset AF point position, reposition real close to subject (macro style), hit the MF switch (enabling the EVF and MF preview with peak focus assist) and go f/4, enable ND via Fn, acquire focus with AFL/AEL and tweak focus with MF ring with peak focus assist, mash shutter. All of this in about 10 seconds.
After returning from a vacation with almost a thousand shots, a total of three (that’s 3!) were out of focus. This may not have been the camera’s fault either. That would never have been the case with the X100, as I would have had a much larger miss rate due to the subject moving too fast. Got kids? – get the X100S.
Being able to shoot in lighting conditions where I’m used to just simply not even bother to shoot in is fantastic. A street at night was never going to look nice with the X100. Shooting in the dark? – embrace ISO 6400.
Image quality wise, the X100S is not lacking in any department compared with its predecessor – but I would encourage you to download a couple of the RAF files and judge for yourself regarding overall RAW handling and feel. The RAW files do feel a little different from the X100. I’d say they are “same but different”.
In short, if the X100S doesn’t receive the gold award over at DPReview, it has to be for some technical reason which I probably wouldn’t care about. Of course, this is a highly personal opinion, from having used the X100 for two years while being very happy with it, despite its shortcomings. This is the upgrade I have been waiting for. My hat off to Fujifilm.
Update July 30th, 2013: DPReview has finally released their X100S review – and gave it a 81% score along with the gold award.
Ah yes. It’s not a proper Fuji X camera release without a firmware wish list. ;-) I set up an X100S firmwire wish list poll. You get to cast 10 votes on feature requests and when posting a new request, you can preload it with 1, 2 or 3 of your votes.
Please remember that Fujifilm did not really add that much new features on the X100 via firmware updates. Instead, they tweaked existing functionality. Also, when you go back and look at what they actually fixed, that’s not much either. So, use your votes wisely.
Make sure to check out some of my previous X100 articles:
Recently we ended up with a Maya scene with locked, read-only, nodes which prohibited us from deleting them from the scene. This usually happens to nodes having been part of a locked reference which has been imported into the scene. In our case, we had no access to the original referenced file, so we had to unlock these nodes from being read-only.
For some reason it didn’t work to unlock them using the lockNode command from within Maya and I had to write a Python script which would read each line of the Maya ASCII file and strip out any lines containing “lockNode”.
This is the script, which I’ve saved as
unlock.py in the same directory as the scene file:
import re infile = open('original_file.ma', 'r') outfile = open('new_file.ma', 'w') for line in infile: lockNodeFound = False for word in re.findall(r"\w+", line): if (word == 'lockNode'): lockNodeFound = True if (lockNodeFound): #print 'Line removed: ' + line pass else: outfile.write(line)
Switch out the file name
"original_file.ma" to match the name of your file. Back up your original Maya scene file somewhere safe and run the script in a command line window (not inside of Maya) like this:
Although a new file is created, I take no responsibility for how you use this script, of course. You’re on your own :)
If you want visual feedback of what’s going on, just uncomment the line that says
#print 'Line removed: ' + line but this will make large scenes take significantly longer to process.
And, just in case, why not first try to see if you can unlock the nodes from within Maya with this simple script:
import maya.cmds as cmds unlockError = False nodes = cmds.ls() for node in nodes: lockStatus = cmds.lockNode( node, q=True ) for response in lockStatus: if response != False: try: cmds.lockNode( node, lock=False ) print 'Unlocked: ' + node except: print 'Error: Could not unlock ' + node
Fixing “Read-only” nodes in Maya
Transfer game save data between iOS devices