CG · Python · Softimage

Making your PPG pretty – Part 01

PPG’s provide GUI for users to interact with your plugins/tools/script. They are a mini-application, if you may. So why not make your mini-application look cool. Here is how you can make your PPG prettier.

Adding Images/Logos to your PPG

You can change this boring PPG,

scrNoLogo1

to this,

scrAllLogo1

 

Please note that you can add only .bmp formats. So how do we get the transparency with .bmp? hmmm, elementary my dear Watson. The trick is to use the background color of image file same as that of your PPG.

 

To do that open Softimage and take a capture the screen. In Photoshop or any other image-editing software bring in the capture and set the bg color to the Softimage application window color from the capture.

bgColorImage

Remember, the color varies from monitor to monitor and profile to profile. So to make sure this works on all the calibrations, use the same monitor and color profile from which you capture and make your logo.

 

Just clean your image off any background and use the background created from the capture.

imageClean1

Save your image as .bmp and you are done.

cleanedLogo.jpg

You can add company/studio logo to the PPG,  image files as bullets for parameters, signature etc., the possibilities are endless.

 

You can set images to your PPG  by using the c.siControlBitmap item type. All it needs is a path to a .bmp file. Here’s equivalent python code.

 

 

from win32com.client import constants as c

LOGO_PATH = r'---path to your .bmp file here---'

def defineProp(inProp):
 inProp.AddParameter3('logo', c.siString)
 inProp.AddParameter3('myParam', c.siDouble)
 inProp.AddParameter3('anotherParam', c.siBool)

 return prop

def definePropLayout(inProp):
 layout = inProp.PPGLayout
 logo = layout.AddItem('logo','',c.siControlBitmap)
 logo.SetAttribute(c.siUIFilePath,  LOGO_PATH)
 logo.SetAttribute(c.siUINoLabel, True)

 layout.AddSpacer(0, 20)

 layout.AddGroup('My Parameters')
 layout.AddSpacer(0, 10)
 layout.AddItem('myParam','A Parameter')
 layout.AddSpacer(0, 5)
 layout.AddItem('anotherParam','Another Parameter')
 layout.AddSpacer(0, 5)
 layout.EndGroup()
 layout.AddSpacer(0, 20)

 return prop

prop = XSIFactory.CreateObject('CustomProperty')
prop.Name = 'myProp'
prop = defineProp(prop)
prop = definePropLayout(prop)
Application.InspectObj(prop, '', 'MyProperty', c.siModal, False)
Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s