Set Active Camera by WINGUID

Smart people ~ Great Scripts
Post Reply
User avatar
trueBlue
Captain
Posts: 2105
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Set Active Camera by WINGUID

Post by trueBlue » 22 Apr 2018, 17:59

Learned something new from Workspace shortcuts today.
It's always been a pain, and well still is, that most of tools in Workspace need to have the 3D Window in focus in order for them to work.
So I tried using the WINGUID, which is labeled as the 'Workspace 3D Window' in shortcuts to set a view from an object I am working on.
The below command worked in all layouts, with and without the 3D window in focus.

Code: Select all

D3DView.SetActiveCamera("", '17D544A3-3F58-436B-83E7-F8B4D7D4E7C5')

stan
Master Chief Petty Officer
Posts: 497
Joined: 21 May 2009, 17:20

Re: Set Active Camera by WINGUID

Post by stan » 23 Apr 2018, 21:59

seem great for a layout with one 3d view, but it changes every view to the same view in 4 view so not really good for that or any layout with two or more views.. that guid might be good for render setting ie; wire solid ...changing grids in all views too if possible..

User avatar
trueBlue
Captain
Posts: 2105
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Set Active Camera by WINGUID

Post by trueBlue » 23 Apr 2018, 22:19

Yeah , I noticed that.
This one does not change every window.

Code: Select all

D3DView.SetActiveCamera("", '{2C152F81-45A2-4035-8896-9E49D60C8A7A}')
As an example that I am going to use for Spot and Projector lights for a Camera view.
View ON

Code: Select all

Node.Select("%THIS_NAME%")
Node.ConRemove("%THIS_NAME%", "Camera")
Node.ExportConnector("%THIS_NAME%" + "/Camera", "Camera", "", 1, 1)
D3DView.SetActiveCamera("", '{2C152F81-45A2-4035-8896-9E49D60C8A7A}')
Space.Unselect()
View Off

Code: Select all

Space.Unselect()
D3DView.SetActiveCamera('/D3DView/' + Node.SubObject("/D3DView", 0), '{2C152F81-45A2-4035-8896-9E49D60C8A7A}')
Node.ConRemove("%THIS_NAME%", "Camera")

Post Reply