Unigine.Plugins.SpiderVision.Manager Class
This class provides auxiliary functions for configuring the plugin, as well as access to an object of DisplaysConfig class.
Manager Class
Properties
DisplaysConfig Config#
The DisplaysConfig class instance that stores the complete configuration data.
string ComputerName#
The name of the computer on which the viewport is to be displayed. If this parameter is not set, the viewport can be displayed on any PC. If set, the viewport is only displayed on the PC that has a matching name.
bool Enabled#
The value indicating if the SpiderVision plugin is enabled.
bool IsConfiguratorEnabled#
The value indicating if the configurator window is open.
Event EventComputerNameChanged#
The event triggered on changing a computer name. You can subscribe to events via
Connect() and unsubscribe via Disconnect(). You can also use EventConnection and
EventConnections classes for convenience (see examples below).
The event handler signature is as follows: myhandler()
For more details see the Event Handling article.
Usage Example
// implement the ComputerNameChanged event handler
void computernamechanged_event_handler()
{
Log.Message("\Handling ComputerNameChanged event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections computernamechanged_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Manager.EventComputerNameChanged.Connect(computernamechanged_event_connections, computernamechanged_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Manager.EventComputerNameChanged.Connect(computernamechanged_event_connections, () => {
Log.Message("Handling ComputerNameChanged event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
computernamechanged_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the ComputerNameChanged event with a handler function
Manager.EventComputerNameChanged.Connect(computernamechanged_event_handler);
// remove subscription to the ComputerNameChanged event later by the handler function
Manager.EventComputerNameChanged.Disconnect(computernamechanged_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection computernamechanged_event_connection;
// subscribe to the ComputerNameChanged event with a lambda handler function and keeping the connection
computernamechanged_event_connection = Manager.EventComputerNameChanged.Connect(() => {
Log.Message("Handling ComputerNameChanged event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
computernamechanged_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
computernamechanged_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
computernamechanged_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring ComputerNameChanged events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Manager.EventComputerNameChanged.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Manager.EventComputerNameChanged.Enabled = true;
Members
int FindViewportID ( string viewport_name ) #
Returns the of the viewport window with the specified name.Arguments
- string viewport_name - Name of the viewport.
Return value
ID of the viewport window with the specified name if it exists, otherwise -1.int FindGroupID ( string group_name ) #
Returns the of the viewport group with the specified name.Arguments
- string group_name - Name of the viewport group.
Return value
ID of the viewport group with the specified name if it exists, otherwise -1.void SetProjectionEnabled ( int viewport_id, bool enabled ) #
Sets a value indicating if the projection for the specified viewport (correction of the image according to projection) is enabled. If disabled, the image is rendered as seen from the point of view without any distortions (i.e. regardless of the viewport plane position in the configuration space). If enabled, the image takes into account the projection angle (i.e. the viewport plane position relative to the point of view in the configuration space) and distorts the rendered image accordingly.Arguments
- int viewport_id - ID of the viewport window.
- bool enabled - true to enable projection for the specified viewport; false - to disable.
void SetViewportCustomPlayer ( int viewport_id, Player player ) #
Assigns a player to the specified viewport.Arguments
- int viewport_id - ID of the viewport window.
- Player player - The player camera.
void SetViewportViewOffset ( int viewport_id, vec3 offset ) #
Sets a camera view offset (eye position) for the viewport with the specified ID.Arguments
- int viewport_id - ID of the viewport window.
- vec3 offset - Camera view offset coordinates along the corresponding axes.
void SetGroupCustomPlayer ( int group_id, Player player ) #
Assigns a player to the specified group of viewports.Arguments
- int group_id - ID of the viewport group.
- Player player - The player camera.
void SetGroupViewOffset ( int group_id, vec3 offset ) #
Sets a camera view offset (eye position) for the viewport group with the specified ID.Arguments
- int group_id - ID of the viewport group.
- vec3 offset - Camera view offset coordinates along the corresponding axes.
EngineWindowViewport GetEngineWindow ( int viewport_id ) #
Returns the engine window viewport for the specified viewport.Arguments
- int viewport_id - ID of the viewport window.
Return value
The engine window viewport.Last update:
13.12.2024
Помогите сделать статью лучше
Была ли эта статья полезной?
(или выберите слово/фразу и нажмите Ctrl+Enter