[Closed] getting and setting camera
so I took code you submit above, pray a little however their was not much hope in me after so many tryouts and pres ctr+e
and…
this is what I received:
– Error occurred in anonymous codeblock; filename: E:\WORK\doctor emporary; position: 71; line: 3
– Frame:
– sceneName: “C:\Users\piotr\Documents\3dsMax\scenes\2.max”
– activeCam: undefined
– activeCamera: undefined
– Unknown property: “name” in undefined
So I closed all aplications, restart computer, load some scene with active cameras, insure I have active camera view, Evaluate and… again Error
What’s going on with this ?
Maxscript hightlight error line in editor: activeCam = activeCam.name
?
(
sceneName = maxFilePath + maxFileName
activeCam = getActiveCamera()
if activeCam != undefined then
(
activeCamName = activeCam.name
resetMaxFile #noPrompt
mergeMAXFile sceneName #noRedraw #AutoRenameDups #useMergedMtlDups #alwaysReparent
activeCamera = (getNodeByName activeCamName)
select activeCamera
viewport.setCamera activeCamera
)
else
messagebox "No active camera found" title:""
)
Thank You for your patience and lenience , it works, but only in your configuration so I have to figure out how to adjust my code to this one but finally it works.
There is only one tiny detail I can’t figure this out: How to force max to remember active view(in case there is no camera view at all) and then after reset scene select this same active view. For example when I operate on top view and then after reset I want max to jump(select)
this same view(in this case top but it can be others)
Do You know this?
If no, thank You anyway,your code was very helpfull.