/// <summary> /// Gets the context. /// </summary> /// <param name="surface">The Surface.</param> /// <returns>The restored context.</returns> public VisjectSurfaceContext Get(VisjectSurface surface) { var context = surface.RootContext; var count = _path?.Length ?? 0; for (int i = count - 1; i >= 0; i--) { var found = false; foreach (var child in context.Children) { if (child.Context.SurfaceName == _path[i]) { found = true; context = child; break; } } if (!found) { throw new Exception(string.Format("Missing context \'{0}\' in \'{1}\'", _path[i], context.Context.SurfaceName)); } } return(context); }
public AddRemoveNodeAction(SurfaceNode node, bool isAdd) { _surface = node.Surface; _context = new ContextHandle(node.Context); _nodeId = node.ID; _isAdd = isAdd; }
public MoveNodesAction(VisjectSurfaceContext context, uint[] nodeIds, Vector2 locationDelta) { _surface = context.Surface; _context = new ContextHandle(context); _nodeIds = nodeIds; _locationDelta = locationDelta; }
/// <summary> /// Initializes a new instance of the <see cref="VisjectContextNavigationButton"/> class. /// </summary> /// <param name="surface">The parent surface.</param> /// <param name="context">The target context.</param> /// <param name="x">The x position.</param> /// <param name="y">The y position.</param> /// <param name="height">The height.</param> public VisjectContextNavigationButton(VisjectSurface surface, ISurfaceContext context, float x, float y, float height) : base(x, y, height) { Surface = surface; Context = context; Text = context.SurfaceName + "/"; }
public EditNodeConnections(VisjectSurfaceContext context, SurfaceNode node) { _surface = context.Surface; _context = new ContextHandle(context); _nodeId = node.ID; CaptureConnections(node, out _before); }
/// <inheritdoc /> public void Dispose() { _surface = null; _inputBefore = null; _inputAfter = null; _outputBefore = null; _outputAfter = null; }
private void UpdateCombo() { if (_isUpdating) { return; } _isUpdating = true; // Cache combo box if (_combobox == null) { _combobox = (ComboBoxElement)_children[0]; _combobox.SelectedIndexChanged += OnSelectedChanged; } // Update items Type type = null; var toSelect = (string)Values[1]; var asset = FlaxEngine.Content.Load <GameplayGlobals>((Guid)Values[0]); _combobox.ClearItems(); if (asset) { var values = asset.DefaultValues; var tooltips = new string[values.Count]; var i = 0; foreach (var e in values) { _combobox.AddItem(e.Key); tooltips[i++] = "Type: " + CustomEditorsUtil.GetTypeNameUI(e.Value.GetType()) + ", default value: " + e.Value; if (toSelect == e.Key) { type = e.Value.GetType(); } } _combobox.Tooltips = tooltips; } // Preserve selected item _combobox.SelectedItem = toSelect; // Update output value type var box = GetBox(0); if (type == null) { box.Enabled = false; } else { box.Enabled = true; box.CurrentType = VisjectSurface.GetValueTypeConnectionType(type); } _isUpdating = false; }
public ConnectBoxesAction(InputBox iB, OutputBox oB, bool connect) { _surface = iB.Surface; _context = new ContextHandle(iB.ParentNode.Context); _connect = connect; _input = new BoxHandle(iB); _output = new BoxHandle(oB); CaptureConnections(iB, out _inputBefore); CaptureConnections(oB, out _outputBefore); }
/// <inheritdoc /> public MaterialWindow(Editor editor, AssetItem item) : base(editor, item) { // Split Panel 1 _split1 = new SplitPanel(Orientation.Horizontal, ScrollBars.None, ScrollBars.None) { DockStyle = DockStyle.Fill, SplitterValue = 0.7f, Parent = this }; // Split Panel 2 _split2 = new SplitPanel(Orientation.Vertical, ScrollBars.None, ScrollBars.Vertical) { DockStyle = DockStyle.Fill, SplitterValue = 0.4f, Parent = _split1.Panel2 }; // Material preview _preview = new MaterialPreview(true) { Parent = _split2.Panel1 }; // Material properties editor var propertiesEditor = new CustomEditorPresenter(null); propertiesEditor.Panel.Parent = _split2.Panel2; _properties = new PropertiesProxy(); propertiesEditor.Select(_properties); propertiesEditor.Modified += OnMaterialPropertyEdited; // Surface _surface = new VisjectSurface(this, SurfaceType.Material) { Parent = _split1.Panel1, Enabled = false }; // Toolstrip _saveButton = (ToolStripButton)_toolstrip.AddButton(Editor.UI.GetIcon("Save32"), Save).LinkTooltip("Save"); _toolstrip.AddSeparator(); _toolstrip.AddButton(editor.UI.GetIcon("PageScale32"), _surface.ShowWholeGraph).LinkTooltip("Show whole graph"); }
public EditNodeValuesAction(SurfaceNode node, object[] before, bool graphEdited) { if (before == null) { throw new ArgumentNullException(nameof(before)); } if (node?.Values == null) { throw new ArgumentNullException(nameof(node)); } if (before.Length != node.Values.Length) { throw new ArgumentException(nameof(before)); } _surface = node.Surface; _context = new ContextHandle(node.Context); _nodeId = node.ID; _before = before; _after = (object[])node.Values.Clone(); _graphEdited = graphEdited; }
/// <inheritdoc /> public void Dispose() { _surface = null; _before = null; _after = null; }
/// <inheritdoc /> public Sample(uint id, VisjectSurface surface, NodeArchetype nodeArch, GroupArchetype groupArch) : base(id, surface, nodeArch, groupArch) { }
/// <inheritdoc /> public void Dispose() { _surface = null; _nodeIds = null; }
/// <inheritdoc /> public SurfaceNodeParamsGet(uint id, VisjectSurface surface, NodeArchetype nodeArch, GroupArchetype groupArch) : base(id, surface, nodeArch, groupArch) { }
/// <summary> /// Creates the get node. /// </summary> /// <param name="id">The identifier.</param> /// <param name="surface">The surface.</param> /// <param name="arch">The node archetype.</param> /// <param name="groupArch">The group archetype.</param> /// <returns></returns> public static SurfaceNode CreateGetNode(uint id, VisjectSurface surface, NodeArchetype arch, GroupArchetype groupArch) { return(new SurfaceNodeParamsGet(id, surface, arch, groupArch)); }
/// <inheritdoc /> public void Dispose() { _surface = null; _nodeValues = null; }
/// <inheritdoc /> public SurfaceNodeMaterial(uint id, VisjectSurface surface, NodeArchetype nodeArch, GroupArchetype groupArch) : base(id, surface, nodeArch, groupArch) { }