private async Task UpdatePreviewAsset() { if (!previewChangeLock.Wait(0)) { return; } try { // copy currentPreview to a local variable because it might be modified in a different thread. IAssetPreview localPreview = currentPreview; if (localPreview != null) { await localPreview.Update(); } Logger.Info("Preview updated following to a a property change."); } catch (Exception e) { Logger.Error("Unable to update the preview after a property change.", e); } finally { previewChangeLock.Release(); } }
public override void AttachPreview(IAssetPreview preview) { texturePreview = (TexturePreview)preview; texturePreview.NotifyTextureLoaded += UpdateTextureInfo; UpdateTextureInfo(); AttachPreviewTexture(preview); }
public override void AttachPreview(IAssetPreview preview) { heightmapPreview = (HeightmapPreview)preview; heightmapPreview.NotifyHeightmapLoaded += UpdateHeightmapInfo; UpdateHeightmapInfo(); AttachPreviewTexture(preview); }
public override void AttachPreview(IAssetPreview preview) { soundPreview = (SoundPreview)preview; soundPreview.ProvideDispatcher(Dispatcher); PlayCommand.IsEnabled = !soundPreview.IsPlaying; PauseCommand.IsEnabled = soundPreview.IsPlaying; soundPreview.UpdateViewModelTime += UpdateViewModelTime; }
public override void AttachPreview(IAssetPreview preview) { AttachPreviewTexture(preview); spriteSheetPreview = (SpriteSheetPreview)preview; DisplayMode = spriteSheetPreview.Mode; // Reset the current frame from the view model into the preview PreviewCurrentFrame = previewCurrentFrame; }
public override void AttachPreview(IAssetPreview preview) { skyboxPreview = (SkyboxPreview)preview; if (skyboxPreview != null) { SetValue(ref glossiness, skyboxPreview.Glossiness); SetValue(ref metalness, skyboxPreview.Metalness); } }
protected void AttachPreviewTexture(IAssetPreview preview) { textureBasePreview = (ITextureBasePreview)preview; var availableMipMaps = textureBasePreview.GetAvailableMipMaps(); PreviewAvailableMipMaps.Clear(); PreviewAvailableMipMaps.AddRange(availableMipMaps.Select(x => $"Level {x}")); textureBasePreview.DisplayMipMap(ParseMipMapLevel(PreviewSelectedMipMap)); textureBasePreview.SpriteScaleChanged += (s, e) => SpriteScale = textureBasePreview.SpriteScale; }
public override void AttachPreview(IAssetPreview preview) { animationPreview = (AnimationPreview)preview; animationPreview.SetTimeScale(timeScale); currentTime = 0.0f; animationPreview.UpdateViewModelTime = UpdateViewModelTime; // Automatically play the animation Play(); }
public void UpdateView(IAssetPreview assetPreview) { var viewModel = previewer.PreviewViewModel; if (viewModel != null) { viewModel.AttachPreview(previewer); DataContext = viewModel; } UpdateXenkoView(); }
public void InitializeView(IPreviewBuilder previewBuilder, IAssetPreview assetPreview) { previewer = assetPreview; builder = previewBuilder; var viewModel = previewer.PreviewViewModel; if (viewModel != null) { viewModel.AttachPreview(previewer); DataContext = viewModel; } UpdateXenkoView(); Loaded += OnLoaded; }
public override void AttachPreview(IAssetPreview preview) { spriteStudioSheetPreview = (SpriteStudioSheetPreview)preview; }
public override void AttachPreview(IAssetPreview preview) { modelPreview = (ModelPreview)preview; }
private async Task ChangePreviewAsset() { if (!previewChangeLock.Wait(0)) { return; } AssetViewModel asset = null; IAssetPreview nextPreview = null; try { if (currentPreview != null) { IAssetPreview previousPreview; // Ensure that the current preview won't be disposed twice with a lock lock (previewLock) { previousPreview = currentPreview; currentPreview = null; } await previousPreview.IsInitialized(); await previousPreview.Dispose(); Logger.Info($"Unloaded previous preview of {previousPreview.AssetViewModel.Url}."); } lock (previewLock) { if (previewBuildQueue != null) { asset = previewBuildQueue; nextPreview = GetPreviewForAsset(previewBuildQueue); previewBuildQueue = null; } currentPreview = nextPreview; } if (asset != null && nextPreview != null) { previewView = await nextPreview.Initialize(asset, this); if (previewView != null) { Logger.Info($"Initialized preview of {nextPreview.AssetViewModel.Url}."); } } else { previewView = null; } } catch (Exception e) { lock (previewLock) { currentPreview = null; } previewView = null; Logger.Error("An exception occurred while changing the previewed asset", e); } finally { previewChangeLock.Release(); } // Notify that the previewed asset has changed, so the editor view can update its visual tree. PreviewAssetUpdated?.Invoke(this, EventArgs.Empty); }
/// <inheritdoc/> public abstract void AttachPreview(IAssetPreview preview);
public override void AttachPreview(IAssetPreview preview) { // Nothing for now }
public override void AttachPreview(IAssetPreview preview) { spriteFontPreview = (SpriteFontPreview)preview; spriteFontPreview.SetPreviewString(PreviewString); }
public override void AttachPreview(IAssetPreview preview) { this.materialPreview = (MaterialPreview)preview; SetPrimitive(SelectedPrimitive); }