I don't really know how to call this but this script basically create and connect a box projection node, driven by a locator, to a the selected texture.
It gives a more visual and easy representation of the projection. Box in that case but you can change the type.
For instanced I copied the script few times and created shelf icon for the other types.
Just select the texture node and run this script ( Python)
- Code: Select all
import maya.cmds as cmds
#Octane_Projection_Setup
#Select the texture node to project and run the script. It will create a locator linked to the projection to make the transform more easy to manipulate.
#You can change the projection type by changing the octaneBoxProjection with what you need
#Nodes creations
TextureNode = cmds.ls(sl=1)
NameSuffix = TextureNode[0]
ProjectionNode = cmds.createNode('octaneBoxProjection', n='octaneBoxProjection_'+NameSuffix)
TransformNode = cmds.createNode('octaneTransform3D', n='octaneTransform3D_'+NameSuffix)
ConversionNode = cmds.createNode('unitConversion', n='unitConversion_'+NameSuffix)
LocatorNode = cmds.spaceLocator(n='Locator_'+NameSuffix)
#Connections
cmds.connectAttr('Locator_'+NameSuffix+'.rotate','unitConversion_'+NameSuffix+'.input')
cmds.connectAttr('unitConversion_'+NameSuffix+'.output','octaneTransform3D_'+NameSuffix+'.Rotation')
cmds.connectAttr('Locator_'+NameSuffix+'.scale','octaneTransform3D_'+NameSuffix+'.Scale')
cmds.connectAttr('Locator_'+NameSuffix+'.translate','octaneTransform3D_'+NameSuffix+'.Translation')
cmds.connectAttr('octaneTransform3D_'+NameSuffix+'.outTransform','octaneBoxProjection_'+NameSuffix+'.Transform')
cmds.connectAttr('octaneBoxProjection_'+NameSuffix+'.outProj',NameSuffix+'.Projection')
#SetAttributes
cmds.setAttr('unitConversion_'+NameSuffix+'.conversionFactor',57.296)
Don't hesitate to improve it if you want! This is quick and bad scripting, I don't have the skill for that
Cheers!