Unknown property: "addNode" in "<MixinInterface:LayerProperties>"

Try to clone some objects in scene and put it on NEW layer

******************************************************************
a=#()
b=#()
s=#()
layer2=undefined
rollout test_buttons "CloneObjects" width:200 height:96
(
button SelectObjects "Select" pos:[24,24] width:62 height:21
button CloneObjects "Clone" pos:[24,64] width:62 height:20
edittext edtNewName "New Name" pos:[24,48] width:144 height:16 enabled:true text:"FFF"
groupBox grp1 "GroupBox" pos:[5,4] width:179 height:84

on SelectObjects pressed do
(
s=$ as array
)
on CloneObjects pressed do
(
maxops.clonenodes s actualNodeList:&a newNodes:&b
for i=1 to b.count do
(
b[i].name = edtNewName.text as string + "_"+b[i].name
)
layer2 = layermanager.newLayerFromName edtNewName.text as string
for t=1 to b.count do
(
layer2.addNode b[t]
)
max hide inv
)
)
createDialog test_buttons 200 96
*****************************************************************************

The system show messagу

****************************************************
>> MAXScript Rollout Handler Exception: -- Unknown property: "addNode" in "" <<
********************************************************

Why ?????

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Any's picture

BARIGAZY!!!! NO COMENT!!!!

BARIGAZY!!!!
NO COMENT!!!!

barigazy's picture

...

rollout test_buttons "CloneObjects" width:200 height:96
(
	local s=#(), newlayer = layermanager.newLayerFromName
	button SelectObjects "Select" pos:[24,24] width:62 height:21
	button CloneObjects "Clone" pos:[24,64] width:62 height:20
	edittext edtNewName "New Name" pos:[24,48] width:144 height:16 text:"FFF"
	groupBox grp1 "GroupBox" pos:[5,4] width:179 height:84
 
	on SelectObjects pressed do (s = getCurrentSelection())
	on CloneObjects pressed do if s.count > 0 do
	(
		if edtNewName.text == "" then messageBox "Enter Some text" title:"Warning" beep:off else
		(
			local a=#(), b=#(), layer2 = newlayer edtNewName.text
			maxops.clonenodes s actualNodeList:&a newNodes:&b
			for i = 1 to b.count do
			(
				b[i].name = edtNewName.text + "_" + b[i].name
				layer2.addNode b[i]
			)
			max hide inv
		)
	)
)
createDialog test_buttons 200 96

bga

barigazy's picture

...

One more solution. This way you can preserve prefix + original name

try(DestroyDialog ::test_buttons)catch()
rollout test_buttons "CloneObjects" width:200 height:96
(
	local s=#(), newlayer = layermanager.newLayerFromName, getlayer = layerManager.getLayer
	fn checkLayerName string = 
	(
		state = false
		for i = 0 to layerManager.count-1 where (getlayer i).name == string do state = true
		state		
	)
	button SelectObjects "Select" pos:[24,24] width:62 height:21
	button CloneObjects "Clone" pos:[24,64] width:62 height:20
	edittext edtNewName "New Name" pos:[24,48] width:144 height:16 text:"FFF"
	groupBox grp1 "GroupBox" pos:[5,4] width:179 height:84
 
	on SelectObjects pressed do (s = getCurrentSelection() ; clearSelection())
	on CloneObjects pressed do if s.count > 0 do
	(
		if edtNewName.text == "" then messageBox "Enter Some text" title:"Warning" beep:off else
		(
			if checkLayerName edtNewName.text then messageBox "This Layer Already Exists!\nEnter new name" title:"Warning" beep:off else
			(				
				local a=#(), b=#(), layer2 = newlayer edtNewName.text ; layer2.current = on
				for o in s do 
				(
					copy o name:(edtNewName.text + "_" + o.name) ishidden:on
				)
			)
		)
	)
)
createDialog test_buttons 200 96

bga

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.