private void CompleteCells() { var capacity = ViewerControl.LayoutManager.RootCell.DisplayCapacity; var currentCellCount = ViewerControl.CellCount; var deltaCellCount = capacity - currentCellCount; if (deltaCellCount == 0) { return; } // cell count is less // TODO-later: New FilmingControlCell(), not smell good var cells = new List <FilmingControlCell>(); for (var i = 0; i < deltaCellCount; i++) { cells.Add(new FilmingControlCell()); } ViewerControl.AddCells(cells); // cell count is more, not move, for performance conside ( ViewerControl only have interface to remove a cell, then refresh ) // Register CellImpl.MouseDown Event for (var i = 0; i < deltaCellCount; i++) { var cellImpl = cells[i].Control; Debug.Assert(cellImpl != null); cellImpl.MouseDown -= CellImplOnMouseDown; cellImpl.MouseDown += CellImplOnMouseDown; } }
protected override void InitializeControl() { AddRenderModeSelectionControl(); animationComboBox = ViewerControl.AddSelection("Animation", (animation, _) => { modelSceneNode?.SetAnimation(animation); }); animationPlayPause = ViewerControl.AddCheckBox("Autoplay", true, isChecked => { if (modelSceneNode != null) { modelSceneNode.AnimationController.IsPaused = !isChecked; } }); animationTrackBar = ViewerControl.AddTrackBar("Animation Frame", frame => { if (modelSceneNode != null) { modelSceneNode.AnimationController.Frame = frame; } }); animationPlayPause.Enabled = false; animationTrackBar.Enabled = false; }
void SetupIceColours() { if (!allowBlink) { blinkOn = true; ViewerControl.Invalidate(); return; } if (CharacterDocument.ICEColours) { if (blinkTimer != null) { blinkTimer.Stop(); blinkTimer.Dispose(); blinkTimer = null; InvalidateBlinkingCharacters(); } } else if (blinkTimer == null && HasViewer) { blinkTimer = new UITimer(); blinkTimer.Interval = 0.25; blinkTimer.Elapsed += delegate { blinkOn = !blinkOn; InvalidateBlinkingCharacters(); }; blinkTimer.Start(); } }
protected override void InitializeControl() { AddRenderModeSelectionControl(); worldLayersComboBox = ViewerControl.AddMultiSelection("World Layers", (worldLayers) => { SetEnabledLayers(new HashSet <string>(worldLayers)); }); savedCameraPositionsControl = new SavedCameraPositionsControl(); savedCameraPositionsControl.SaveCameraRequest += OnSaveCameraRequest; savedCameraPositionsControl.RestoreCameraRequest += OnRestoreCameraRequest; ViewerControl.AddControl(savedCameraPositionsControl); ViewerControl.AddCheckBox("Show triggers", false, v => { foreach (var n in triggerNodes) { n.Enabled = v; } }); ViewerControl.AddCheckBox("Show entity colliders", false, v => { foreach (var n in colliderNodes) { n.Enabled = v; } }); }
protected override void LoadScene() { if (model != null) { modelSceneNode = new ModelSceneNode(Scene, model); SetAvailableAnimations(modelSceneNode.GetSupportedAnimationNames()); Scene.Add(modelSceneNode, false); var meshGroups = modelSceneNode.GetMeshGroups(); if (meshGroups.Count() > 1) { meshGroupListBox = ViewerControl.AddMultiSelection("Mesh Group", selectedGroups => { modelSceneNode.SetActiveMeshGroups(selectedGroups); }); meshGroupListBox.Items.AddRange(modelSceneNode.GetMeshGroups().ToArray <object>()); foreach (var group in modelSceneNode.GetActiveMeshGroups()) { meshGroupListBox.SetItemChecked(meshGroupListBox.FindStringExact(group), true); } } } else { SetAvailableAnimations(Enumerable.Empty <string>()); } if (mesh != null) { meshSceneNode = new MeshSceneNode(Scene, mesh); Scene.Add(meshSceneNode, false); } }
private void viewReport_Click(object sender, EventArgs e) { if (!ValidateVisiblePrompts()) { return; } bool flag = false; try { SaveControlValuesToReport(autoSubmit: false); flag = true; } catch (Exception e2) { ViewerControl.UpdateUIState(e2); } if (flag) { if (this.ViewButtonClick != null) { this.ViewButtonClick(this, EventArgs.Empty); } return; } try { EnsureParamsLoaded(); } catch (Exception e3) { ViewerControl.UpdateUIState(e3); } }
public ViewerControlAdapter() { InitializeComponent(); // TODO-later: ViewerControl Configure Path From Class Configure ViewerControl.InitializeWithoutCommProxy(@"D:/UIH/appdata/filming/config/"); //Configure.Environment.Instance.ApplicationPath); ViewerControl.CanSelectCellByLeftClick = false; //Disable inner mouse left button down events. }
protected override void InitializeControl() { AddRenderModeSelectionControl(); animationComboBox = ViewerControl.AddSelection("Animation", (animation, _) => { modelSceneNode?.SetAnimation(animation); }); }
private async Task Init() { StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Resources/GettingStarted.pdf")); if (file != null) { await ViewerControl.ActivateWithFileAsync(file); } }
public UIPositionManager(ViewerControl smViewer, ViewerControl veViewer) { _smPos = new MapPosition(this); _vePos = new MapPosition(this); smViewer.Initialize(GetSMPos, "Source Map Position"); veViewer.Initialize(GetVEPos, "Virtual Earth Position"); smUpdate = smViewer; veUpdate = veViewer; slaved = false; }
private void OnChangeCredentialsClicked(object sender, LinkLabelLinkClickedEventArgs e) { try { EnsureParamsLoaded(forceCredentialsShown: true, null); } catch (Exception e2) { ViewerControl.UpdateUIState(e2); } }
protected override void InitializeControl() { drawCallsLabel = ViewerControl.AddLabel("Drawcalls: 0"); AddRenderModeSelectionControl(); animationComboBox = ViewerControl.AddSelection("Animation", (animation, _) => { modelSceneNode?.SetAnimation(animation); }); }
public void InitViewer(QmapMesh qmm) { this.qmm = qmm; viewerAvatar = viewerAvatarDefaultValue; viewerCamPosition = ViewerCamPositionDefaultValue; viewerControl = ViewerControlDefaultValue; //var (vo,_, istat) = qmm.GetWcMeshPosFromLambda(0.5f, 0.5f); var(vo, _, istat) = qmm.GetWcMeshPosProjectedAlongY(viewerDefaultPosition); transform.position = vo; transform.localRotation = Quaternion.Euler(viewerDefaultRotation); qcmdescriptor = qmm.descriptor; BuildViewer(); }
protected override void InitializeControl() { AddRenderModeSelectionControl(); worldLayersComboBox = ViewerControl.AddMultiSelection("World Layers", (worldLayers) => { SetEnabledLayers(new HashSet <string>(worldLayers)); }); savedCameraPositionsControl = new SavedCameraPositionsControl(); savedCameraPositionsControl.SaveCameraRequest += OnSaveCameraRequest; savedCameraPositionsControl.RestoreCameraRequest += OnRestoreCameraRequest; ViewerControl.AddControl(savedCameraPositionsControl); }
protected override void LoadScene() { if (model != null) { modelSceneNode = new ModelSceneNode(Scene, model); SetAvailableAnimations(modelSceneNode.GetSupportedAnimationNames()); Scene.Add(modelSceneNode, false); var meshGroups = modelSceneNode.GetMeshGroups(); if (meshGroups.Count() > 1) { meshGroupListBox = ViewerControl.AddMultiSelection("Mesh Group", selectedGroups => { modelSceneNode.SetActiveMeshGroups(selectedGroups); }); meshGroupListBox.Items.AddRange(modelSceneNode.GetMeshGroups().ToArray <object>()); foreach (var group in modelSceneNode.GetActiveMeshGroups()) { meshGroupListBox.SetItemChecked(meshGroupListBox.FindStringExact(group), true); } } modelSceneNode.AnimationController.RegisterUpdateHandler((animation, frame) => { if (animationTrackBar.TrackBar.Value != frame) { animationTrackBar.UpdateValueSilently(frame); } var maximum = animation == null ? 1 : animation.FrameCount - 1; if (animationTrackBar.TrackBar.Maximum != maximum) { animationTrackBar.TrackBar.Maximum = maximum; } animationTrackBar.Enabled = animation != null; animationPlayPause.Enabled = animation != null; }); } else { SetAvailableAnimations(Enumerable.Empty <string>()); } if (mesh != null) { meshSceneNode = new MeshSceneNode(Scene, mesh); Scene.Add(meshSceneNode, false); } }
private async void OnClickInitialize(object sender, RoutedEventArgs e) { var context = await RunStaAsync(() => { var result = CausalityContext.LoadCausalityContextFromDump(null); foreach (var node in result.Nodes) { var displayString = node.CreateDisplayText(); } return(result); }); ViewerControl.LoadFromCausalityContext(context); }
private void OnDependencyChanged(object sender, EventArgs e) { try { SaveControlValuesToReport(autoSubmit: true); ParameterControl parameterControl = (ParameterControl)sender; ReportParameterInfoCollection reportParameterInfoCollection = ViewerControl.Report.GetParameters(); if (reportParameterInfoCollection[parameterControl.ParameterInfo.Name].HasUnsatisfiedDownstreamParametersWithDefaults) { ViewerControl.Report.SetParameters(new ReportParameter[0]); reportParameterInfoCollection = null; } EnsureParamsLoaded(forceCredentialsShown: false, reportParameterInfoCollection); } catch (Exception e2) { ViewerControl.UpdateUIState(e2); } }
protected void AddRenderModeSelectionControl() { if (renderModeComboBox == null) { renderModeComboBox = ViewerControl.AddSelection("Render Mode", (renderMode, _) => { foreach (var node in Scene.AllNodes) { node.SetRenderMode(renderMode); } if (SkyboxScene != null) { foreach (var node in SkyboxScene.AllNodes) { node.SetRenderMode(renderMode); } } }); } }
protected override void LoadScene() { if (world != null) { var loader = new WorldLoader(GuiContext, world); var result = loader.Load(Scene); if (result.Skybox != null) { SkyboxScene = new Scene(GuiContext); var skyboxLoader = new WorldLoader(GuiContext, result.Skybox); var skyboxResult = skyboxLoader.Load(SkyboxScene); SkyboxScale = skyboxResult.SkyboxScale; SkyboxOrigin = skyboxResult.SkyboxOrigin; ViewerControl.AddCheckBox("Show Skybox", ShowSkybox, (v) => ShowSkybox = v); } var worldLayers = Scene.AllNodes .Select(r => r.LayerName) .Distinct(); SetAvailableLayers(worldLayers); if (worldLayers.Any()) { // TODO: Since the layers are combined, has to be first in each world node? worldLayersComboBox.SetItemCheckState(0, CheckState.Checked); foreach (var worldLayer in result.DefaultEnabledLayers) { worldLayersComboBox.SetItemCheckState(worldLayersComboBox.FindStringExact(worldLayer), CheckState.Checked); } } if (result.CameraMatrices.Any()) { if (cameraComboBox == default) { cameraComboBox = ViewerControl.AddSelection("Camera", (cameraName, index) => { if (index > 0) { if (result.CameraMatrices.TryGetValue(cameraName, out var cameraMatrix)) { Scene.MainCamera.SetFromTransformMatrix(cameraMatrix); } cameraComboBox.SelectedIndex = 0; } }); cameraComboBox.Items.Add("Set view to camera..."); cameraComboBox.SelectedIndex = 0; } cameraComboBox.Items.AddRange(result.CameraMatrices.Keys.ToArray <object>()); } var physNodes = Scene.AllNodes.OfType <PhysSceneNode>().Distinct(); triggerNodes = physNodes.Where(n => n.IsTrigger); colliderNodes = physNodes.Where(n => !n.IsTrigger); } if (worldNode != null) { var loader = new WorldNodeLoader(GuiContext, worldNode); loader.Load(Scene); var worldLayers = Scene.AllNodes .Select(r => r.LayerName) .Distinct() .ToList(); SetAvailableLayers(worldLayers); for (var i = 0; i < worldLayersComboBox.Items.Count; i++) { worldLayersComboBox.SetItemChecked(i, true); } } ShowBaseGrid = false; ViewerControl.Invoke((Action)savedCameraPositionsControl.RefreshSavedPositions); }
protected override void LoadScene() { if (model != null) { modelSceneNode = new ModelSceneNode(Scene, model); SetAvailableAnimations(modelSceneNode.GetSupportedAnimationNames()); Scene.Add(modelSceneNode, false); phys = model.GetEmbeddedPhys(); if (phys == null) { var refPhysicsPaths = model.GetReferencedPhysNames(); if (refPhysicsPaths.Any()) { //TODO are there any models with more than one vphys? if (refPhysicsPaths.Count() != 1) { Console.WriteLine($"Model has more than 1 vphys ({refPhysicsPaths.Count()})." + " Please report this on https://github.com/SteamDatabase/ValveResourceFormat and provide the file that caused this."); } var newResource = Scene.GuiContext.LoadFileByAnyMeansNecessary(refPhysicsPaths.First() + "_c"); if (newResource != null) { phys = (PhysAggregateData)newResource.DataBlock; } } } var meshGroups = modelSceneNode.GetMeshGroups(); if (meshGroups.Count() > 1) { meshGroupListBox = ViewerControl.AddMultiSelection("Mesh Group", selectedGroups => { modelSceneNode.SetActiveMeshGroups(selectedGroups); }); meshGroupListBox.Items.AddRange(modelSceneNode.GetMeshGroups().ToArray <object>()); foreach (var group in modelSceneNode.GetActiveMeshGroups()) { meshGroupListBox.SetItemChecked(meshGroupListBox.FindStringExact(group), true); } } var materialGroups = model.GetMaterialGroups(); if (materialGroups.Count() > 1) { materialGroupListBox = ViewerControl.AddSelection("Material Group", (selectedGroup, _) => { modelSceneNode?.SetSkin(selectedGroup); }); materialGroupListBox.Items.AddRange(materialGroups.ToArray <object>()); materialGroupListBox.SelectedIndex = 0; } modelSceneNode.AnimationController.RegisterUpdateHandler((animation, frame) => { if (animationTrackBar.TrackBar.Value != frame) { animationTrackBar.UpdateValueSilently(frame); } var maximum = animation == null ? 1 : animation.FrameCount - 1; if (animationTrackBar.TrackBar.Maximum != maximum) { animationTrackBar.TrackBar.Maximum = maximum; } animationTrackBar.Enabled = animation != null; animationPlayPause.Enabled = animation != null; }); } else { SetAvailableAnimations(Enumerable.Empty <string>()); } if (mesh != null) { meshSceneNode = new MeshSceneNode(Scene, mesh); Scene.Add(meshSceneNode, false); } if (phys != null) { physSceneNode = new PhysSceneNode(Scene, phys); Scene.Add(physSceneNode, false); //disabled by default. Enable if viewing only phys or model without meshes physSceneNode.Enabled = (modelSceneNode == null || !modelSceneNode.RenderableMeshes.Any()); ViewerControl.AddCheckBox("Show Physics", physSceneNode.Enabled, (v) => { physSceneNode.Enabled = v; }); } }