Jump to content
  • Advertisement
Sign in to follow this  

Question on this maxscript

This topic is 1413 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

try(destroydialog orderPoints) catch()
rollout orderPoints "Order Points" width:200
(
	fn sortByPosComponent v1 v2 order:#(1,2,3) dir:1 = 
	(
		act = if v1.pos[order[1]] < v2.pos[order[1]] then -1 else if v1.pos[order[1]] > v2.pos[order[1]] then 1 else 
			if order[2] != undefined then sortByPosComponent v1 v2 order:(deleteitem order 1) else 0
		act*dir
	)
	label lb "Order:" align:#right offset:[-20,4] across:3
	dropdownlist order_dd items:#("xyz", "xzy", "yzx", "yxz", "zxy", "zyx") width:44 align:#left offset:[-16,0] tooltip:"Sorting Order"
	checkbox reverse_ch "Reverse" width:90 align:#left offset:[-14,3] tooltip:"Use Reverse Order"
	edittext base_ed text:"Pallete" width:194 align:#left offset:[-12,2] tooltip:"Point Base Name"
	
	button rename_bt "Rename Points" width:190 align:#left offset:[-8,2] tooltip:"Rename Selected Points\n + Control\t- All Points"
	
	fn makeOrder = for k=1 to 3 collect (bit.charasint order_dd.selected[k] - 119)

	on rename_bt pressed do undo "Rename Points" on 
	(
		nodes = if keyboard.controlpressed then selection else helpers
		pp = for p in nodes where iskindof p Point collect p
		if pp.count > 0 do
		(
			dir = if reverse_ch.state then -1 else 1
			qsort pp sortByPosComponent order:(makeOrder()) dir:dir
			id = 0
			d = orange/pp.count
			for p in pp do 
			(
				c = orange - id*d
				p.name = base_ed.text + (formattedprint (id += 1) format:"05d")
				p.wirecolor = c
			)
		)
		pp
	)
)
createdialog orderPoints

Pallet01 Pallet02 Pallet03 Pallet077...

The output is incorrect. There are 3 three objects in the first row that are named correctly.

The next several items are named incorrectly.

Any help?

Thanks Jack

Edited by lucky6969b

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!