Report post

Are you sure you want to report the post shown below? This will send an email to the ATVO administrators. Please include a short reason for reporting.

Users reporting for no reason may be locked out.


Post

Posted by Nick Thissen
on
You can already do that via the regular Camera Controls of course.

If you still want to do it in your theme controls, with a script you can do it. Unfortunately it looks like I never added actions to execute when the selected driver changes. I'll see if I can add that in the near future.

Meanwhile you can let your script run continuously (enable Auto-execute), and simply remember the selected entity and react when it has changed. Something like this should work. If you notice an impact on performance from the script running every update, you can always add a 'elapsed time' check to only execute if some time has passed.

using System;
using ATVO.ThemesSDK;
using ATVO.ThemeEditor.ThemeModels;
using ATVO.ThemeEditor.Scripting.DotNET;
using ATVO.ThemesSDK.Data.Entity;

namespace Scripts
{
public class ChangeFocus : IScript
{
private IEntity _selectedEntity;

public object Execute(ThemeContentItem item, object value, string parameter, ISimulation sim)
{
var picker = item.Theme.DriverPickers.Find("DriverPicker1");
var entity = picker.SelectedEntity;

// Is anyone selected, and did the selection change?
if (entity != null && entity != _selectedEntity)
{
// Change camera focus
sim.CameraManager.Show(entity);

// Remember this is the newly selected entity
_selectedEntity = entity;
}

return null;
}
}
}