Notifications
Clear all

[Closed] cloning a wired object

The following rollout creates two boxes, wires their rotations and clones one of the boxes…

(
rollout wireclone "Clone Test"
(
button btn_b "Make Boxes" 
 button btn_wire "Connect"
button btn_c "Clone Box 2"

local b1, b2, amt = 1, p=paramWire

on btn_b pressed do
(
 b1 = box()
 b2 = box pos:[50,0,0]
)

on btn_wire pressed do
(
 p.disconnect2Way b1.rotation.controller.z_rotation.controller\
  b2.rotation.controller.z_rotation.controller
 p.connect2way b1.rotation.controller[#Z_Rotation]\
 b2.rotation.controller[#Z_Rotation] \
 ("Z_Rotation/"+amt as string + "*-1") \
 ("Z_Rotation*"+ amt as string + "*-1")
)

on btn_c pressed do
(maxOps.CloneNodes b2 offset:[50,0,50])

)
createDialog wireclone 200 100
)

Is there a way to clone the wiring along with the object, so rotating box 1 will rotate both box2 and the box2 clone? If so, can the same method be used to clone a script controller? Many thanks.