Python

Minor Pipeline Tools- Change background of all viewports

The most common email I get from people who have visited this blog is inquiries about the dark color of the background in the screenshots. No it’s not a custom UI, I just have a custom menu with a bunch of stuff including two ridiculously simple scripts… one which cycles the background color in all viewports and one which sets them to this dark grey.

Its Your Friend, Dark Grey

I chose this color for a couple of reasons.

  • With a darker color, particles are much more visible, meaning I can display them as single pixels.
  • The color is dark but just light enough to easily see black wireframes.
  • Have you ever opened Softimage in a dark room full of people using Maya and Nuke? It’s like switching on a searchlight. The light grey color scheme of the Softimage UI is waaaay to bright.

These two little scripts go a long way towards my personal enjoyment of the software. I won’t bother to display them in the post (wordpress kills the formatting), but here’s a file for each…

setAllBackgroundColorsDkGrey

cycleAllBackgroundColor

Since we’re on the topic… Softimage needs a new UI. It’s elegant and functional in many ways, but dated. The light grey is glaring, the huge arrow button looks absurd to new artists, (they’re right) and I have a strong suspicion that it’s a major factor which keeps new artists from Softimage. Just my $0.02.

Minor Pipeline Tools – Logging Distance

There is an awesome thread on the softimage list where the small pipeline enhancements softimage users tend to accumulate in their personal collections are being discussed. In it I vowed to share mine to the community as a whole over time on this blog. So here’s the first one… a little python script I keep in a custom menu, which writes a log (as an anotation in the explorer) of distances between objects.

File (<1kb): LogDistances.py

#—————————————-
# Log Distances between 2 objects
# 2011 A Moorer
#—————————————-
xsi = Application
xsiRoot = xsi.ActiveSceneRoot
lm = xsi.LogMessage
root = xsi.ActiveSceneRoot

def SelectionCheck():
sel = xsi.Selection
if sel.Count <= 1:
lm(“Select two objects.”,4)
return False
if sel.Count >= 3:
lm(“More than two objects selected.”,4)
return False

else:
lm(“\nLog Distance\n————————“,32)
return True

#————————
#Distance Between Centers

def ctr_dist( objA, objB ):
from math import sqrt,pow
# Thx to Alan F for this function

Ax, Ay, Az = objA.Kinematics.Global.Transform.GetTranslationValues2()
Bx, By, Bz = objB.Kinematics.Global.Transform.GetTranslationValues2()

return sqrt( pow(Ax-Bx,2) + pow(Ay-By,2) + pow(Az-Bz,2) )

#———————–

#Annotate Distance

def annotate( nDist ):
if xsi.ClassName(root.Properties[“MeasuredDistances”]):
prevText = xsi.getValue(str(root.Properties[“MeasuredDistances”])+”.text”)
lm(“Logging new distance measurement…\n”,32)
xsi.SetValue(str(root.Properties[“MeasuredDistances”])+”.text”, str(prevText)+nDist, “”)

else:
oSet = root.AddProperty(“Annotation”,0,”MeasuredDistances”)
lm(“Annotation Created.\n”,32)
xsi.SetValue(str(oSet)+”.text”, “Distance Measurement Log\r”+”\r ————————————-\n\r” + nDist, “”)

return

#———————–

#Log Distance

def LogDist():
try:
if SelectionCheck():
fromObj, toObj = xsi.Selection(0), xsi.Selection(1)

newDist = “\r\nDistance between <“+fromObj.FullName+”> to <“+toObj.FullName+”> is: ” +str( ctr_dist(fromObj, toObj))
lm(newDist+”\n\n————————\n”,32)
annotate(newDist)

except:
lm (“\n——-\nDistance Script Error.”,4)
return True

#—————————————-
#Call the function –
LogDist()

There you go… I hope it proves helpful to some of you. :)

I considered sharing my personal workgroup in it’s entirety, but there’s a lot of trash in there I wouldn’t want to burden people with, plus a considerable amount of stuff which Isn’t mine to share. So until I make a “clean” workgroup I’ll just have to post bits and pieces…