/// <inheritdoc /> public override void Initialize(LayoutElementsContainer layout) { element = layout.ComboBox(); element.ComboBox.SetItems(LayersAndTagsSettings.GetCurrentLayers()); element.ComboBox.SelectedIndex = (int)Values[0]; element.ComboBox.SelectedIndexChanged += OnSelectedIndexChanged; }
/// <inheritdoc /> public override void Initialize(LayoutElementsContainer layout) { _combobox = layout.ComboBox(); ReloadOptions(_combobox.ComboBox); _combobox.ComboBox.SelectedIndexChanged += OnComboBoxSelectedIndexChanged; _combobox.ComboBox.PopupShowing += ReloadOptions; }
public override void Initialize(LayoutElementsContainer layout) { _proxy = (PropertiesProxy)Values[0]; if (_proxy?.DefaultValues == null) { layout.Label("Loading...", TextAlignment.Center); return; } var isPlayModeActive = _proxy.Window.Editor.StateMachine.IsPlayMode; if (isPlayModeActive) { layout.Label("Play mode is active. Editing runtime values.", TextAlignment.Center); layout.Space(10); foreach (var e in _proxy.DefaultValues) { var name = e.Key; var value = _proxy.Asset.GetValue(name); var valueContainer = new VariableValueContainer(_proxy, name, value, false); var propertyLabel = new PropertyNameLabel(name) { Tag = name, }; string tooltip = null; if (_proxy.DefaultValues.TryGetValue(name, out var defaultValue)) { tooltip = "Default value: " + defaultValue; } layout.Object(propertyLabel, valueContainer, null, tooltip); } } else { foreach (var e in _proxy.DefaultValues) { var name = e.Key; var value = e.Value; var valueContainer = new VariableValueContainer(_proxy, name, value, true); var propertyLabel = new ClickablePropertyNameLabel(name) { Tag = name, }; propertyLabel.MouseLeftDoubleClick += (label, location) => StartParameterRenaming(name, label); propertyLabel.SetupContextMenu += OnPropertyLabelSetupContextMenu; layout.Object(propertyLabel, valueContainer, null, "Type: " + CustomEditorsUtil.GetTypeNameUI(value.GetType())); } // TODO: improve the UI layout.Space(40); var addParamType = layout.ComboBox().ComboBox; addParamType.Items = AllowedTypes.Select(CustomEditorsUtil.GetTypeNameUI).ToList(); addParamType.SelectedIndex = 0; _addParamType = addParamType; var addParamButton = layout.Button("Add").Button; addParamButton.Clicked += OnAddParamButtonClicked; } }
/// <inheritdoc /> public override void Initialize(LayoutElementsContainer layout) { element = layout.ComboBox(); element.ComboBox.SelectedIndexChanged += OnSelectedIndexChanged; // Set tag names element.ComboBox.AddItem(NoTagText); element.ComboBox.AddItems(LayersAndTagsSettings.GetCurrentTags()); }
/// <inheritdoc /> public override void Initialize(LayoutElementsContainer layout) { // Get the target options _options = Options; if (_options == null) { throw new ArgumentNullException(); } int selectedIndex = -1; bool hasDifferentTypes = Values.HasDifferentTypes; var type = Type; _type = type; // Type var typeEditor = layout.ComboBox("Type", "Type of the object value. Use it to change the object."); for (int i = 0; i < _options.Length; i++) { typeEditor.ComboBox.AddItem(_options[i].Name); selectedIndex = _options[i].Type == type ? i : selectedIndex; } typeEditor.ComboBox.SupportMultiSelect = false; typeEditor.ComboBox.SelectedIndex = hasDifferentTypes ? -1 : selectedIndex; typeEditor.ComboBox.SelectedIndexChanged += OnSelectedIndexChanged; // Editing different types is not supported if (Values.HasDifferentTypes) { var property = layout.AddPropertyItem("Value"); property.Label("Different Values"); return; } // Nothing to edit if (Values.HasNull) { var property = layout.AddPropertyItem("Value"); property.Label("<null>"); return; } // Value var values = new CustomValueContainer(type, (instance, index) => instance, (instance, index, value) => { }); values.AddRange(Values); var editor = CustomEditorsUtil.CreateEditor(type); layout.Property("Value", values, editor); }
/// <inheritdoc /> public override void Initialize(LayoutElementsContainer layout) { _element = layout.ComboBox(); _element.ComboBox.SelectedIndexChanged += OnSelectedIndexChanged; _element.ComboBox.AddItem("None"); var groups = GameSettings.Load <StreamingSettings>(); if (groups?.TextureGroups != null) { for (int i = 0; i < groups.TextureGroups.Length; i++) { _element.ComboBox.AddItem(groups.TextureGroups[i].Name); } } }
/// <inheritdoc /> public override void Initialize(LayoutElementsContainer layout) { var editors = Editor.Instance.CodeEditing.Editors; var options = new string[editors.Count + 1]; options[0] = "None"; for (int i = 0; i < editors.Count; i++) { options[i + 1] = editors[i].Name; } _combobox = layout.ComboBox(); _combobox.ComboBox.SetItems(options); _combobox.ComboBox.SelectedItem = (string)Values[0]; _combobox.ComboBox.SelectedIndexChanged += OnComboBoxSelectedIndexChanged; }
/// <inheritdoc /> public override void Initialize(LayoutElementsContainer layout) { element = layout.ComboBox(); element.ComboBox.SelectedIndexChanged += OnSelectedIndexChanged; // Set node names if (ParentEditor != null && ParentEditor.Values.Count == 1 && ParentEditor.Values[0] is BoneSocket boneSocket && boneSocket.Parent is AnimatedModel animatedModel && animatedModel.SkinnedModel && !animatedModel.SkinnedModel.WaitForLoaded()) { var nodes = animatedModel.SkinnedModel.Nodes; for (int nodeIndex = 0; nodeIndex < nodes.Length; nodeIndex++) { element.ComboBox.AddItem(nodes[nodeIndex].Name); } } }
/// <inheritdoc /> public override void Initialize(LayoutElementsContainer layout) { // Get the target options _options = Options; if (_options == null) { throw new ArgumentNullException(); } int selectedIndex = -1; bool hasDifferentTypes = Values.HasDifferentTypes; var type = Type; _type = type; // Type var typeEditor = layout.ComboBox(TypeComboBoxName, "Type of the object value. Use it to change the object."); for (int i = 0; i < _options.Length; i++) { typeEditor.ComboBox.AddItem(_options[i].Name); selectedIndex = _options[i].Type == type.Type ? i : selectedIndex; } typeEditor.ComboBox.SupportMultiSelect = false; typeEditor.ComboBox.SelectedIndex = hasDifferentTypes ? -1 : selectedIndex; typeEditor.ComboBox.SelectedIndexChanged += OnSelectedIndexChanged; // Editing different types is not supported if (Values.HasDifferentTypes) { var property = layout.AddPropertyItem("Value"); property.Label("Different Values"); return; } // Nothing to edit if (Values.HasNull) { var property = layout.AddPropertyItem("Value"); property.Label("<null>"); return; } // Value var values = new CustomValueContainer(type, (instance, index) => instance, (instance, index, value) => { }); values.AddRange(Values); var editor = CustomEditorsUtil.CreateEditor(type); var style = editor.Style; if (style == DisplayStyle.InlineIntoParent) { layout.Object(values, editor); } else if (style == DisplayStyle.Group) { var group = layout.Group("Value", true); group.Panel.Open(false); group.Object(values, editor); // Remove empty group if (group.ContainerControl.ChildrenCount == 0) { layout.Children.Remove(group); group.Panel.Dispose(); } } else { layout.AddPropertyItem("Value").Object(values, editor); } }