points at object selection pivots

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  03 March 2012
Smile points at object selection pivots

Hi, I am trying to write a simple script that will allow me to create a point helper(s) at the pivot(s) of a selected object/objects. I have looked on scriptspot but the available script is no longer available. I use MEL mostly and understand the basic requirement for doing this requirement in MAYA, but am having problems getting the for loop right. I have made a start which makes a point helper at the origin for each of the selected objects which are in an array, but I am just having a bit of a stumble at the syntax for writing the rest. Not sure if I need a counter for loop such as:

for (i = 0; i == names_array.count; i++)

but am not sure if the syntax is correct.

Any pointers would be greatly appreciated. I have some Maxscript resources to go through, but am pressed at the moment to be able to divert any time to absorb it and am hoping to get a quicker response that I can implement asap. The code below is probably in need of tidying up, but seems to be a decent start.

Many thanks in advance.

names_array = for i in $* collect i.name
sort names_array

for i in 1 to names_array.count do

Point pos: [0,0,0]

The light goes on, but it seems dim.
  03 March 2012
i'd do something like:

selectionArray = selection as array

for i = 1 to selectionArray.count do
myPoint = Point pos: selectionArray[i].pivot
myPoint.name = ("Point_"+selectionArray[i].name)
Matt Rennie
Sr. Character Rigger
Rockstar North
  03 March 2012
hey Malcolm,

I wanted to same thing a while back, so wrote a quick script as part of my rigging toolbox. Hopefully it will be useful to pick apart and see what is going on - it's essentially matt's code with a UI!

rollout PointParentRo "Point Daddy" width:165 height:155
	fn SetHelperDisplayFlags size cross centermarker box axistripod =
		for i in selection where classof i == point do 
		i.size = size 
		i.cross = cross
		i.centermarker = centermarker
	colorPicker cpPt "" pos:[5,4] width:20 height:14 				
	button btnCreatePoint "Create" pos:[84,108] width:77 height:42 autoDisplay:true  	  	 		
	edittext edtPrefix "" pos:[21,85] width:136 height:14 enabled:false multiline:false
	checkbox chkAddPrefix "" pos:[7,85] width:14 height:16 checked:false
	checkbox chkCM "Center" pos:[31,33] width:53 height:16
	spinner spnsize "Size" pos:[22,109] width:54 height:16 enabled:true range:[0,100,2]
	GroupBox grpd "Display:" pos:[3,19] width:158 height:48
	checkbox chkX "Cross" pos:[92,48] width:46 height:16 checked:true
	checkbox chkBox "Box" pos:[31,48] width:45 height:16 checked:true
	checkbox chkAx "Axis" pos:[92,33] width:43 height:16
	checkbox chkObjwc "Use Object Wirecolor" pos:[32,3] width:120 height:18
	checkbutton ckbLink "Make Parent" pos:[4,130] width:78 height:19 highlightColor:(color 8 61 138) checked:true
	GroupBox grpn "Add Name Prefix" pos:[3,68] width:158 height:35
	on btnCreatePoint pressed do
	local _pts = #()
	   for i in selection do
		mpt = point transform:i.transform wirecolor:(if chkObjwc.checked then i.wirecolor else CpPt.color) name:(uniquename (edtprefix.text + "PointControl_"))  size:spnSize.value cross:chkX.state center:chkCM.state box:chkBox.state axistripod:chkAx.state
		append _pts mpt		
		if ckblink.checked then i.parent = mpt		   
	select _pts
	on chkAddPrefix changed state do edtPrefix.enabled= state
	on chkCM changed state do
		SetHelperDisplayFlags spnSize.value chkX.state chkCM.state chkBox.state chkAx.state
	on spnsize changed val do
		SetHelperDisplayFlags val chkX.state chkCM.state chkBox.state chkAx.state
	on spnsize buttondown do flagForeground selection true
	on spnsize buttonup do flagForeground selection false
	on chkX changed state do
		SetHelperDisplayFlags spnSize.value chkX.state chkCM.state chkBox.state chkAx.state
	on chkBox changed state do
		SetHelperDisplayFlags spnSize.value chkX.state chkCM.state chkBox.state chkAx.state
	on chkAx changed state do
		SetHelperDisplayFlags spnSize.value chkX.state chkCM.state chkBox.state chkAx.state
createdialog PointParentRo style:#(#style_toolwindow, #style_sysmenu)

Read my technical blog - lonerobot.net

Last edited by LoneRobot : 03 March 2012 at 10:47 AM.
  03 March 2012
Cheers guys

thanks very much guys, this is a massive help. am having lots of fun getting used to Maxscript again, so this is truly appreciated.

Hope I can return the favour one day.
The light goes on, but it seems dim.
  03 March 2012
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 03:18 PM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.