Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '-----------------------------------------------------------------------------------------------------------------'
- 'Creates a Grid (*-ShrinkCenter) for each object in the selection to be used with my shrinkwrap script, then pose 'constrains it to it's object with an offset of -90 on the Z rotation axis and makes it a child of the same object 'to keep things tidy.
- '-----------------------------------------------------------------------------------------------------------------'
- dim oCol, oSelection, oSelecto, oModelo, oSelName, oShrinky, oSubdCtrlCheck
- 'Set up a regExp for later use
- set regEx = New RegExp
- 'Define a collection(oCol) for adding objects to
- Set oCol = CreateObject( "XSI.Collection" )
- 'Check if an object is selected
- if Application.Selection.count > 1 Then
- 'Add the application selection to oCol
- Set oSelection = Application.Selection
- for i = 0 to (oSelection.Count - 1)
- 'Set a new Regex pattern that finds any letters after - at the end of its name
- regEx.Pattern = "-[a-zA-Z]+$"
- 'Reset oSubdCtrlCheck
- oSubdCtrlCheck = "Nothing"
- 'Execute the regex on the selection
- Set Matches = regEx.Execute(oSelection(i))
- For Each Match in Matches
- oSubdCtrlCheck = Match.Value
- Next
- 'If the selection doesnt end in -SubdCtrl then add it to the oCol Collection.
- if oSubdCtrlCheck <> "-SubdCtrl" then
- Logmessage oSelection(i) & " winked at me!, added to oCol"
- oCol.add oSelection(i)
- else
- Logmessage oSelection(i) & " thinks I'm ugly :(, rejected"
- end if
- next
- elseIf Application.Selection.count = 1 Then
- oCol.add Application.Selection(0)
- else
- 'If no object is selected, start a picksession
- LogMessage "Select The Control Mesh (-Modelling)"
- PickObject "Select The Control Mesh (-Modelling)", " ", oSelecto
- 'Add Picksession object to oCol
- oCol.add oSelecto
- end if
- for i = 0 to (oCol.count-1)
- set oSelecto = oCol(i)
- 'Remove Model name from oSelecto
- oModelo = oSelecto.Model
- oSelName = replace( oSelecto, oModelo&".", "")
- 'Create a new grid to be used as a shrinkwrap target
- Preferences.SetPreferenceValue "Interaction.autoinspect", false
- set oShrinky = CreatePrim ("Grid", "MeshSurface", oSelName & "-ShrinkCenter")
- Preferences.SetPreferenceValue "Interaction.autoinspect", true
- 'Pose constrain the shrink center to original object
- ApplyCns "Pose", oShrinky, oSelecto
- 'Adjust the shrink center's pose constrain scale to 50x on all axis, and -90deg on z rotation axis
- SetValue oShrinky & ".kine.posecns.sclx", 50
- SetValue oShrinky & ".kine.posecns.scly", 50
- SetValue oShrinky & ".kine.posecns.sclz", 50
- SetValue oShrinky & ".kine.posecns.rotz", -90
- 'Disable all of the shrink center's visibility options
- SetValue oShrinky & ".visibility.shdwcast", False
- SetValue oShrinky & ".visibility.shdwrecv", False
- SetValue oShrinky & ".visibility.primray", False
- SetValue oShrinky & ".visibility.scndray", False
- SetValue oShrinky & ".visibility.trnscast", False
- SetValue oShrinky & ".visibility.trnsvis", False
- SetValue oShrinky & ".visibility.causvis", False
- SetValue oShrinky & ".visibility.globcast", False
- SetValue oShrinky & ".visibility.globvis", False
- SetValue oShrinky & ".visibility.viewvis", False
- SetValue oShrinky & ".visibility.rendvis", False
- ParentObj "B:" & oSelecto, oShrinky
- LogMessage "Created " & oShrinky
- next
- SelectObj oCol
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement