This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# loop through shader nodes in the scene, identify 'store_color_in_channel' nodes, | |
# and add them to the scene globals. Avoid duplicate channnels. | |
for x in Application.FindObjects("", "{6495C5C1-FD18-474E-9703-AEA66631F7A7}" ): | |
if str(x.ProgID) == "Softimage.sib_color_storeinchannel.1.0": | |
chanName = Application.GetValue(x.Channel) | |
addChan = Application.CreateRenderChannel("%s"%(chanName), "siRenderChannelColorType", "") | |
newChan = (addChan[-1]) | |
if newChan.isdigit(): | |
Application.RemoveRenderChannel(addChan) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Gathers all the polymeshes for selected models and places them in model-specific groups | |
# (i.e. one group for each model). | |
from win32com.client import constants | |
if len(Application.Selection) > 0: | |
selectedModels = [item for item in Application.Selection if item.Type == '#model'] | |
# Create the groups and populate them | |
for model in selectedModels: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import PySide | |
from PySide import QtGui | |
def clearQTreeWidget(tree): | |
iterator = QtGui.QTreeWidgetItemIterator(tree, QtGui.QTreeWidgetItemIterator.All) | |
while iterator.value(): | |
iterator.value().takeChildren() | |
iterator +=1 | |
i = tree.topLevelItemCount() | |
while i > -1: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PySide.QtGui import * | |
from PySide.QtCore import * | |
from PySide.QtUiTools import QUiLoader | |
uiFile = "path\to\my\UI\file.ui" | |
class UiLoader(QUiLoader): | |
''' | |
Convenience class for dynamically loading QtDesigner '.ui' files, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
OlderNewer