Notifications
Clear all

[Closed] Get Selected UVW Faces

Hello,

I was wondering if I am doing this syntax correctly? If it all possible, could someone explain?

		button theCopyUVButton "Copy" width:80 align:#left offset:[0,0]
		on theCopyUVButton pressed do
		(
			selection[1].modifiers[1].GroupCreateBySelection()
			GUV = selection[1].modifiers[1].getSelectedFaces() 
		)
		button thePasteUVButton "Paste" width:80 align:#center offset:[-160,-26]
		on thePasteUVButton pressed do
		(
			selection[1].modifiers[1].selectFaces GUV.selection
			selection[1].modifiers[1].GroupCreateBySelection()

I know it has to do with this line:

GUV = selection[1].modifiers[1].getSelectedFaces()

selection[1].modifiers[1].selectFaces GUV.selection

Here is the original Syntax via the reference I found on the site:

<Unwrap_UVW>.getSelectedFaces()
Returns the face selection from the Editor as bitarray.

Exposed via unwrap2 interface in 3ds Max 5 and higher.

<Unwrap_UVW>.selectFaces selection
Sets the face selection in the Editor using the supplied bitArray.

Exposed via unwrap2 interface in 3ds Max 5 and higher.

Link: https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2016/ENU/MAXScript-Help/files/GUID-496CE46A-EBD3-40C2-9637-3F21E0F0B0FB-htm.html

Thank you in advance.

1 Reply

Figured it out and learned something to share with people who are new to programming:

Add ” local GUV ” to the top of the rollout.

local GUV = local Variable

So you are storing a variable that can be used locally amongst all the buttons.

Cheers

rollout rWNGenerate "Group Uv Tool"
	(
		local GUV
		button theCopyUVButton "Copy" width:80 align:#left offset:[0,0]
		on theCopyUVButton pressed do
		(
			GUV = selection[1].modifiers[1].getSelectedFaces()
			selection[1].modifiers[1].GroupCreateBySelection()
			print GUV
		)
		button thePasteUVButton "Paste" width:80 align:#center offset:[-160,-26]
		on thePasteUVButton pressed do
		(
			print GUV
			selection[1].modifiers[1].selectFaces GUV
			selection[1].modifiers[1].GroupCreateBySelection()
		
		)
		button theClearUVButton "Clear" width:80 align:#right offset:[0,0]
		on theClearUVButton pressed do
		(
			selection[1].modifiers[1].GroupDeleteBySelection()
		)
	)