Skip to content

Instantly share code, notes, and snippets.

Tim Crowson tcrowson

Block or report user

Report or block tcrowson

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tcrowson
tcrowson / GroupMeshesByModel.py
Created Nov 10, 2015
Softimage - For selected model nulls, finds renderable items and groups them according to their source models.
View GroupMeshesByModel.py
# Group Meshes By Model
# DESCRIPTION
# - Adds a new command, GroupMeshesByModel(), which can be called from a key assignment or shelf button.
# - For selected model nulls, finds renderable items and groups them according to their source models.
# - Groups the following: meshes, pointclouds, instances, and hair.
# INSTALLATION
# This is a self-installing plugin, so place it in your user scripts
# or similar folder in the workgroup of your choosing.
@tcrowson
tcrowson / ConvertToRedshiftProxy.py
Last active Oct 2, 2015
Softimage script for converting a selection to Redshift Proxy, and re-importing it into the scene with some customizations.
View ConvertToRedshiftProxy.py
# ConvertToRedshiftProxy
#
# - Adds a new command to the context menu for objects in the Scene Explorer: 'Convert to Redshift Proxy'
#
# FEATURES
# - Exports the selected items to a Redshift Proxy, then re-imports the result back into the scene.
# - Optionally maintains parenting, but only to the parent of the first selected item.
# - Appends a suffix (defaults to '_RSPROXY') to the name of the proxy mesh, to distinguish it from other polymeshes.
# - Locks the Construction stack on the proxy mesh to prevent it being frozen by accident.
# - Optionally lets you specify a display mesh for GL previewing.
@tcrowson
tcrowson / morphDuplicate.py
Last active Oct 1, 2015
Modo 901 command for duplicating the selected morph map
View morphDuplicate.py
# Command for duplicating the selected morph.
# Tim Crowson, June 2015
import lx
import lxu
import lxifc
import modo
@tcrowson
tcrowson / morphToMesh.py
Last active Apr 11, 2018
Modo 901 command for freezing a morph to a new mesh.
View morphToMesh.py
# Command for freezing a morph to a new mesh.
# 1. Select a morph map
# 2. run morph.freezeToMesh
# 3. A new mesh bearing the name of the morph map will be created, with the frozen morph shape in it.
import lx
import lxu
import lxifc
import modo
@tcrowson
tcrowson / modo_SaveIncremental.py
Last active Nov 13, 2018
Increment the version number of the current Modo scene, respecting existing digit padding.
View modo_SaveIncremental.py
#python
# tc_SaveIncremental.py
# Tim Crowson, 9/29/2014
# Saves a new version of your current scene. Requires the scene to have been saved previously.
# - Searches for an existing version that follows the pattern 'sceneName_vXXX.lxo'
# - Any number of digits can be used for the version number: the script will respect the existing number padding.
# - If no version is identified (e.g. "sceneName.lxo") the script will append '_v001' to end of the scene name.
# - You can configure the padding for this First Version by setting the FIRST_VERSION_PADDING variable
@tcrowson
tcrowson / pysideDialogExamples.py
Last active Oct 11, 2017
Examples of simple PySide dialogs
View pysideDialogExamples.py
from PySide.QtGui import *
# create a modal message box with a single 'Ok' button
box = QMessageBox()
box.setWindowTitle('Title')
box.setText('Text')
box.exec_()
# create a modal message box that offers some choices (Yes|No|Cancel)
@tcrowson
tcrowson / simpleModoMonitor.py
Last active Aug 29, 2015
Basic Modo Progress Bar
View simpleModoMonitor.py
import lx
import time
dialog_svc = lx.service.StdDialog()
mymonitor = lx.object.Monitor(dialog_svc.MonitorAllocate('Some task or other ...'))
mymonitor.Initialize(10)
for x in range(10):
mymonitor.Increment(1)
time.sleep(2)
@tcrowson
tcrowson / modo_getItemsOfType.py
Last active Aug 29, 2015
Function that returns all items in the scene of the specified type(s) as a list of Python objects.
View modo_getItemsOfType.py
# python
'''
This function searches the current Modo scene and returns all items of
the specified type as a list of Python objects.
The function takes one or more arguments as strings or integers, which are the types of items you're after.
To ensure forward compatibility we'll use the symbol for the item type we need.
To see the full list of item type symbols, visit the following URL:
@tcrowson
tcrowson / softimage_RunAnnotationAsPython.py
Last active Jan 2, 2016
For Softimage. A quick snippet for running the text in an Annotation property as Python code. This allows you to store Python code in an Annotation property, as part of a scene or model, and run in later. Running this will drop you into a pick session, asking you to choose an Annotation property. No special error handling for now, it's brute-for…
View softimage_RunAnnotationAsPython.py
# Puts the user into a pick-session, asking you to select an Annotation property
# whose text it will then run as Python code.
from win32com.client import constants
annotation = Application.PickElement(constants.siPropertyFilter,'Choose an Annotation Property','Choose an Annotation Property')[2]
exec annotation.Text.Value
@tcrowson
tcrowson / softimage_DisableViewportVertColor.py
Last active Jan 2, 2016
For Softimage. Set the 'Vertex Color' display option to 'Never Show' for all cameras and 3d viewports (lights excluded). This can be very useful when working with normal maps, due to the crazy performance hit from Tangent properties.
View softimage_DisableViewportVertColor.py
from win32com.client import constants
for camera in [cam for cam in Application.ActiveSceneRoot.FindChildren2("", constants.siCameraPrimType)]:
Application.SetValue("%s.camdisp.vcdisplay" %camera, 0)
for viewport in Application.Desktop.ActiveLayout.Views.Find("View Manager").Views:
Application.SetValue("Views.View%s.UserCamera.camdisp.vcdisplay" %viewport, 0)
Application.SetValue("Views.View%s.TopCamera.camdisp.vcdisplay" %viewport, 0)
Application.SetValue("Views.View%s.FrontCamera.camdisp.vcdisplay" %viewport, 0)
Application.SetValue("Views.View%s.RightCamera.camdisp.vcdisplay" %viewport, 0)
You can’t perform that action at this time.