ZBrushCentral

Confusion over global variables.

The following routine does not work if viewsPath is a global variable (declared at top level with a [VarDef, viewsPath]), but does work if viewsPath is not declared externally:

[RoutineDef, LoadViews,
[VarSet, firstFilePath, [FileNameAsk, “.JPG”, ,“Choose a view file”]]
[VarSet, viewsPath, [FileNameExtract, firstFilePath, 1]]
[RoutineCall, EnableView, viewsPath, “LEFT.jpg”, “Document:Ortho:L”]
[RoutineCall, EnableView, viewsPath, “RIGHT.jpg”, “Document:Ortho:R”]
[RoutineCall, EnableView, viewsPath, “TOP.jpg”, “Document:Ortho:Top”]
[RoutineCall, EnableView, viewsPath, “BOTTOM.jpg”, “Document:Ortho:Bot”]
[RoutineCall, EnableView, viewsPath, “FRONT.jpg”, “Document:Ortho:Fr”]
[RoutineCall, EnableView, viewsPath, “BACK.jpg”, “Document:Ortho:Bk”]
]

In particular, I’ve verified that if viewsPath is defined globally, then the value passed to each of the EnableView routine calls as the first argument is 0. If I try to do a [VarSet,viewsPath, “foo”] at toplevel, to set the global viewsPath, then the value passed to EnableView is still 0–so somehow the global declaration of viewsPath is messing up its use inside LoadViews.

I’ve looked around, but there doesn’t seem to be a lot of doco to do with global vs. local variables in ZScripts. Can anyone point me in the right direction?

Thanks,
Ken

Try [VarDef, viewsPath,""] to define the variable as a string variable.

Yesss!!! Thank you, Marcus!

Ken