public SimpleInfoOverlayModel( ViewerSdk.IVRViewerSdk viewerSdk, CoreSdk.ModelManager modelManager) : base(modelManager) { this.runningSince = DateTime.UtcNow; this.viewerSdk = viewerSdk; // We will use monospaced font, 32 pixels high. this.fontFace = new CoreSdk.FontFace("Courier New", height: 32); // Tell Core SDK in which pass and stage we want to render. this.Subscribe( CoreSdk.PassSubscription.Overlay, CoreSdk.StageSubscription.Text); var currentProject = viewerSdk.ProjectManager.CurrentProject; // As rendering happens in a separate thread and viewer is not thread-safe, // it is recommended to cache any viewer SDK variable locally for later use in the Render method. this.ProjectName = currentProject.Name; this.ProjectFileName = currentProject.FileName; // Register our model for rendering. this.Setup(); }
public bool DestroyPlugin(ViewerSdk.IVRViewerSdk viewerSdk) { if (this.model != null) { this.deinitializeModel(); } // As core SDK is disposed when a project is loaded, we listen to its disposal/initialization // in order to restore model when a new project is loaded. viewerSdk.ForPreview.CoreSdkInitialized -= this.viewerSdk_CoreSdkInitialized; viewerSdk.ForPreview.CoreSdkDisposing -= this.viewerSdk_CoreSdkDisposing; return(true); }
public bool CreatePlugin(ViewerSdk.IVRViewerSdk viewerSdk) { this.viewerSdk = viewerSdk; if (viewerSdk.ForPreview.Core != null) { // Core SDK is available - initialize model right away. this.initializeModel(); } viewerSdk.ForPreview.CoreSdkInitialized += this.viewerSdk_CoreSdkInitialized; viewerSdk.ForPreview.CoreSdkDisposing += this.viewerSdk_CoreSdkDisposing; return(true); }