#title = AREA QUAD
#info = Insert a quad area clicking on the [Insert button]
#icon = areaQ.png

var()
{
 selected
 root
 istance
 pickedx
 pickedy
 pickedz
 istance1
 pickedx1
 pickedy1
 pickedz1
 istance2
 pickedx2
 pickedy2
 pickedz2
 istance3
 pickedx3
 pickedy3
 pickedz3
 istance4
 pickedx4
 pickedy4
 pickedz4
}

onButtonClick()
{
 scene.deselectAll()
 selected = onButtonClick.getType()
 istance = scene.createIstance(selected,scene.root)
 pickedx = onGizmoMove.getX()
 pickedy = onGizmoMove.getY()
 pickedz = onGizmoMove.getZ()
 scene.setPosition(istance,pickedx,pickedy,pickedz)
 istance1 = scene.createIstance(selected,istance|scene.getRoot())
 pickedx1 = onGizmoMove.getX(10)
 pickedy1 = onGizmoMove.getY()
 pickedz1 = onGizmoMove.getZ(10)
 scene.setPosition(istance1,pickedx1,pickedy1,pickedz1)
 istance2 = scene.createIstance(selected,istance|scene.getRoot())
 pickedx2 = onGizmoMove.getX(10)
 pickedy2 = onGizmoMove.getY()
 pickedz2 = onGizmoMove.getZ(-10)
 scene.setPosition(istance2,pickedx2,pickedy2,pickedz2)
 istance3 = scene.createIstance(selected,istance|scene.getRoot())
 pickedx3 = onGizmoMove.getX(-10)
 pickedy3 = onGizmoMove.getY()
 pickedz3 = onGizmoMove.getZ(-10)
 scene.setPosition(istance3,pickedx3,pickedy3,pickedz3)
 istance4 = scene.createIstance(selected,istance|scene.getRoot())
 pickedx4 = onGizmoMove.getX(-10)
 pickedy4 = onGizmoMove.getY()
 pickedz4 = onGizmoMove.getZ(10)
 scene.setPosition(istance4,pickedx4,pickedy4,pickedz4)
 scene.selectIstance(istance)
 root=scene.getField(istance,"MESH")
 scene.deleteField(root)
}


