How to Deactivate a scene without Disposing of it using Remoting

Q and A about functionality and how to solve a special task for your application.

Moderator: Support

Post Reply
Etienne
Posts: 29
Joined: 20 Oct 2014, 19:46
Location: Los Angeles, California

How to Deactivate a scene without Disposing of it using Remoting

Post by Etienne » 21 Nov 2019, 05:31

I've been trying to remove a scene from a port using

Code: Select all

PortStatus(portIID, portIndex.Value, null, null, null, null)
but it seems to dispose of the scene instead of simply removing it from the port. The Remoting4 Demo uses the same approach and disposes of the scene if you use the Deactivate option in the Loaded Scenes context menu.

Is it possible to simply remove the scene from the port but keep it loaded and reuse later on?

Thanks for your help with this.

User avatar
Karol
Posts: 575
Joined: 10 Jan 2012, 12:07

Re: How to Deactivate a scene without Disposing of it using Remoting

Post by Karol » 21 Nov 2019, 11:26

Hi Etienne,

why do you assume that the PortStatus() call disposes the scene?
Actually it does not!
You have to call Release() to dispose the scene.

Best Regards
Karol

Etienne
Posts: 29
Joined: 20 Oct 2014, 19:46
Location: Los Angeles, California

Re: How to Deactivate a scene without Disposing of it using Remoting

Post by Etienne » 21 Nov 2019, 17:35

In general you are correct, the deactivated scene just returns to Validated state, but if you have a scene loaded in a scene layer's port and deactivate it, it gets disposed (or at least that's what the SceneStatus code says). If you ignore the code and try to reactivate the disposed scene, you get an activation error.

You should be able to replicate this by creating a scene with two scene layers. Save the "layout" scene with scenes in each layer. Deactivate one of the scenes and you will see that it will show as "Disposed" (in the Remoting4 Demo).

Thanks a lot for that demo project BTW, it's been very useful.

Post Reply