Render.ru

**system exception**

Артур Сиятелев

Пользователь сайта
Рейтинг
4
#1
Доброго времени суток!
MAXScript выкидывает сообщение об ошибке при попытке исполнения скрипта. Rollout создается, однако, при попытке выбрать объект обработчик pickbutton не срабатывает. Какого рода исключение может скрываться под **system exception** (гуглил — пусто, справку перелопатил — в коде вроде все ок)?

Злополучный скрипт
Код:
(
    local theMesh
 
    fn filterMesh obj = (
        classOf obj == Editable_Mesh
    )   
 
    rollout IntersectWithMesh "Intersection with mesh" (
        timer timerControl interval:50 active:false
        pickButton pickMesh "Pick mesh" width:280 filter:filterMesh
        editText faceHit "Face index:"
        editText normalHit "Normal vector:"
        editText worldHit "World coords:"
        editText baryCoords "Barycentric coords:"
    )
 
    on pickMesh picked obj do (
        if obj != undefined do (
            theMesh = obj
            pickMesh.caption = obj.name
            timerControl.active = true
        )
    )
 
    on timerControl tick do (
        theRay = mapScreenToWorldRay mouse.pos
        theInt = IntersectRayEx theMesh theRay
        if theInt != undefined then (
            faceHit.text = theInt[2] as string
            normalHit.text = theInt[1].dir as string
            worldHit.text = theInt[1].pos as string
            baryCoords.text = theInt[3] as string
        ) else (
            faceHit.text = normalHit.text = worldHit.text = baryCoords.text = ""
        )
    )
   
    createDialog IntersectWithMesh width:300
)
 

igorznag

Мастер
Рейтинг
103
#2
в коде вроде все ок
В коде не все ок. Одна скобка находится в неправильном месте.
Правильно будет так:
Код:
(
    local theMesh
 
    fn filterMesh obj = (
        classOf obj == Editable_Mesh
    )   
 
    rollout IntersectWithMesh "Intersection with mesh" (
        timer timerControl interval:50 active:false
        pickButton pickMesh "Pick mesh" width:280 filter:filterMesh
        editText faceHit "Face index:"
        editText normalHit "Normal vector:"
        editText worldHit "World coords:"
        editText baryCoords "Barycentric coords:"
    
 
    on pickMesh picked obj do (
        if obj != undefined do (
            theMesh = obj
            pickMesh.caption = obj.name
            timerControl.active = true
        )
    )
 
    on timerControl tick do (
        theRay = mapScreenToWorldRay mouse.pos
        theInt = IntersectRayEx theMesh theRay
        if theInt != undefined then (
            faceHit.text = theInt[2] as string
            normalHit.text = theInt[1].dir as string
            worldHit.text = theInt[1].pos as string
            baryCoords.text = theInt[3] as string
        ) else (
            faceHit.text = normalHit.text = worldHit.text = baryCoords.text = ""
        )
    )
   )
    createDialog IntersectWithMesh width:300
)
 
Сверху