Created
October 15, 2012 23:50
-
-
Save caron/3896418 to your computer and use it in GitHub Desktop.
working version of this code... http://www.softimageblog.com/archives/209
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
#imports | |
import win32com.client | |
from win32com.client import constants | |
from win32com.client import Dispatch | |
#globals | |
xsi = Dispatch( "XSI.Application" ).Application | |
xsiPrint = xsi.LogMessage | |
def setupDorito(): | |
if xsi.Selection < 1: | |
xsiPrint("Select an component!",constants.siError) | |
return False | |
root = xsi.ActiveSceneRoot | |
#create cluster constrained null, setup its look | |
clsCnsNull = root.AddNull("clsCnsNull") | |
clsCnsNull.primary_icon.value = 0 | |
clsCnsNull.size.value = 0.1 | |
clsCnsNull.shadow_icon.value = 7 | |
clsCnsNull.shadow_colour_custom.value = 1 | |
clsCnsNull.B.value = 1 | |
clsCnsNull.G.value = 0.5 | |
#make cluster from selection | |
subComponent = xsi.Selection(0).SubComponent | |
cnsCls = subComponent.CreateCluster("cnsCls") | |
#constrain object to cluster | |
cns = Dispatch(clsCnsNull.Kinematics.AddConstraint("ObjectToCluster",cnsCls)) | |
cns.tangent.value = 1 | |
cns.dirx.value = 0 | |
cns.diry.value = -1 | |
cns.upvct_active.value = 1 | |
cns.upx.value = 1 | |
cns.upy.value = 0 | |
#make dorito | |
dorito = root.AddNull("dorito") | |
dorito.primary_icon.value = 0 | |
dorito.size.value = 0.2 | |
dorito.shadow_icon.value = 8 | |
dorito.shadow_colour_custom.value = 1 | |
dorito.G.value = 1 | |
dorito.shadow_offsetX.value = 0.1 | |
dorito.shadow_scaleX.value = 0 | |
clsCnsNull.AddChild(dorito) | |
dorito.kinematics.local.transform = XSIMath.CreateTransform() | |
setupDorito() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment