private void UpdateCombo() { if (_isUpdateLocked) { return; } _isUpdateLocked = true; if (_combobox == null) { _combobox = GetChild <ComboBoxElement>(); _combobox.SelectedIndexChanged += OnSelectedChanged; } int toSelect = -1; Guid loadedSelected = (Guid)Values[0]; _combobox.ClearItems(); for (int i = 0; i < Surface.Parameters.Count; i++) { var param = Surface.Parameters[i]; _combobox.AddItem(param.Name); if (param.ID == loadedSelected) { toSelect = i; } } _combobox.SelectedIndex = toSelect; _isUpdateLocked = false; }
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; }
private void UpdateCombo() { // Check if is locked if (_isUpdateLocked) { return; } // Lock _isUpdateLocked = true; // Cache combo box control if (_combobox == null) { _combobox = (ComboBoxElement)_children[0]; _combobox.SelectedIndexChanged += OnSelectedChanged; } // Update items int toSelect = -1; Guid loadedSelected = (Guid)Values[0]; _combobox.ClearItems(); int index = 0; for (int i = 0; i < Surface.Parameters.Count; i++) { var param = Surface.Parameters[i]; if (param.IsUIVisible) { _combobox.AddItem(param.Name); if (param.ID == loadedSelected) { toSelect = index; } index++; } } _combobox.SelectedIndex = toSelect; // Unlock _isUpdateLocked = false; }