public static void OnAttachedToPanel(AttachToPanelEvent evt) { if (evt.propagationPhase != PropagationPhase.AtTarget || !(evt.target is VisualElement root)) { return; } BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public; var fields = root.GetType().GetFields(bindingFlags); foreach (var field in fields) { foreach (var attribute in field.GetCustomAttributes <FetchAttribute>(false)) { if (attribute is FetchAttribute fetch) { var fieldType = field.FieldType; var query = root.Query(name: fetch.name, className: fetch.className); var queried = query.Where(item => fieldType.IsInstanceOfType(item)).First(); if (queried is IBindable bindable && !string.IsNullOrEmpty(fetch.bindingPath)) { bindable.bindingPath = fetch.bindingPath; } field.SetValue(root, queried); } } } }
private void OnEnter(AttachToPanelEvent evt) { if (this.isActive) { this.SendActivation(); } }
private void OnAttached(AttachToPanelEvent evt) { ownerObjectProperty = evt.destinationPanel.GetType().GetProperty("ownerObject"); ownerObject = ownerObjectProperty.GetValue(evt.destinationPanel); screenPositionProperty = ownerObject.GetType().GetProperty("screenPosition"); var showMode = typeof(EditorWindow).Assembly.GetType("UnityEditor.ShowMode"); showPopupNonFocus = typeof(EditorWindow).GetMethod("ShowPopupWithMode", BindingFlags.Instance | BindingFlags.NonPublic); showValue = Enum.GetValues(showMode).GetValue((int)ShowMode.Tooltip); showValueArray = new[] { showValue, false }; var suggestOptions = Children().OfType <SuggestOptions>().SelectMany(sos => sos.Options) .Union(Children().OfType <SuggestOption>()).ToArray(); SuggestOption = suggestOptions; #if UNITY_2020 textEntry.RegisterValueChangedCallback(OnTextChanged); #elif UNITY_2018 textEntry.OnValueChanged(OnTextChanged); #endif textEntry.RegisterCallback <FocusOutEvent>(OnLostFocus); textEntry.RegisterCallback <FocusInEvent>(OnGainedFocus); textEntry.RegisterCallback <GeometryChangedEvent>(OnGeometryChange); textEntry.RegisterCallback <KeyDownEvent>(OnKeyDown); }
void OnAttachToPanel(AttachToPanelEvent e) { if (NodeModel is IObjectReference modelReference && modelReference.ReferencedObject != null) { TitleLabel?.Bind(new SerializedObject(modelReference.ReferencedObject)); } }
private void OnAttachToPanel(AttachToPanelEvent e) { var h = textHandle; h.useLegacy = e.destinationPanel.contextType == ContextType.Editor; textHandle = h; }
void OnAttachToPanel(AttachToPanelEvent evt) { if (m_TimelineGuideline == null) { SetupTimelineGuideline(evt.destinationPanel.visualTree); } }
private void OnAttached(AttachToPanelEvent evt) { if (parent is TextField textField) { AddToField(textField); } }
private void OnAttachToPanel(AttachToPanelEvent evt) { if (parent is PieChart pieChart) { pieChart.OnSegmentAdded(this); } }
private void OnAttached(AttachToPanelEvent e) { if (this.Q <Label>() is Label) { this.Q <Label>().style.display = DisplayStyle.None; } }
protected override void ExecuteDefaultAction(EventBase evt) { base.ExecuteDefaultAction(evt); if (evt.eventTypeId == DetachFromPanelEvent.TypeId()) { DetachFromPanelEvent dtpe = (DetachFromPanelEvent)evt; if (dtpe.destinationPanel == null) { Undo.ClearUndo(m_GraphViewUndoRedoSelection); Undo.undoRedoPerformed -= UndoRedoPerformed; ScriptableObject.DestroyImmediate(m_GraphViewUndoRedoSelection); m_GraphViewUndoRedoSelection = null; if (!EditorApplication.isPlayingOrWillChangePlaymode && !EditorApplication.isPlaying) { ClearSavedSelection(); } } } else if (evt.eventTypeId == AttachToPanelEvent.TypeId()) { AttachToPanelEvent atpe = (AttachToPanelEvent)evt; if (atpe.originPanel == null) { Undo.undoRedoPerformed += UndoRedoPerformed; m_GraphViewUndoRedoSelection = ScriptableObject.CreateInstance <GraphViewUndoRedoSelection>(); m_GraphViewUndoRedoSelection.hideFlags = HideFlags.HideAndDontSave; } } }
private void OnEnterPanel(AttachToPanelEvent evt) { SearchTextField.visualInput.RegisterCallback <FocusEvent>(OnSearchTextFieldFocus); SearchTextField.visualInput.RegisterCallback <FocusOutEvent>(OnSearchTextFieldFocusOut); SearchTextField.RegisterCallback <ChangeEvent <string> >(OnSearchTextFieldChange); SearchTextField.visualInput.RegisterCallback <KeyDownEvent>(OnKeyDownShortcut); }
private void OnEnterPanel(AttachToPanelEvent e) { if (panel != null) { panel.visualTree.RegisterCallback <KeyDownEvent>(OnKeyDownShortcut); } }
private void OnAttach(AttachToPanelEvent evt) { var codeInline = evt.currentTarget as Label; codeInline.UnregisterCallback <AttachToPanelEvent>(OnAttach); codeInline.RegisterCallback <MouseUpEvent>(CopyToClipboard); }
void OnAttachedToPanel(AttachToPanelEvent evt) { Tools.pivotRotationChanged += UpdateGridSnapEnableState; EditorSnapSettings.gridSnapEnabledChanged += UpdateGridSnapEnableValue; ToolManager.activeToolChanged += UpdateGridSnapEnableState; dropdownClicked += OnDropdownClicked; }
void OnAttachToPanel(AttachToPanelEvent evt) { Selection.selectionChanged += OnSelectionChange; RegisterCallback <DragUpdatedEvent>(OnDragUpdated); RegisterCallback <DragPerformEvent>(OnDragPerform); }
void OnAttachToPanel(AttachToPanelEvent evt) { m_Tag.Changed += Resize; m_Tag.Changed += Timeline.ReloadMetrics; Resize(); }
void OnEnter(AttachToPanelEvent evt) { if (isActive) { SendActivation(); } }
void OnAttachToPanel(AttachToPanelEvent evt) { if (Declaration is IObjectReference modelReference) { m_TitleLabel?.Bind(new SerializedObject(modelReference.ReferencedObject)); } }
void OnAttachToPanel(AttachToPanelEvent evt) { var depth = 0; // Remove from all the depth classes... for (int i = 0; i <= ussFoldoutMaxDepth; i++) { RemoveFromClassList(ussFoldoutDepthClassName + i); } RemoveFromClassList(ussFoldoutDepthClassName + "max"); // Figure out the real depth of this actual Foldout... if (parent != null) { var curParent = parent; while (curParent != null) { if (curParent.GetType() == typeof(Foldout)) { depth++; } curParent = curParent.parent; } } // Add the class name corresponding to that depth if (depth > ussFoldoutMaxDepth) { AddToClassList(ussFoldoutDepthClassName + "max"); } else { AddToClassList(ussFoldoutDepthClassName + depth); } }
private void OnEnterPanel(AttachToPanelEvent evt) { idTextField.RegisterCallback <FocusOutEvent>(OnidTextFieldFocusOut); idTextField.RegisterCallback <ChangeEvent <string> >(OnidTextFieldChange); idTextField.RegisterCallback <KeyDownEvent>(OnKeyDownShortcut); Hide(); }
protected override void ExecuteDefaultAction(EventBase evt) { base.ExecuteDefaultAction(evt); if (evt.eventTypeId == GeometryChangedEvent.TypeId()) { UpdateSeparators(); } else if (evt.eventTypeId == DetachFromPanelEvent.TypeId()) { graphView = null; } else if (evt.eventTypeId == AttachToPanelEvent.TypeId()) { graphView = GetFirstAncestorOfType <GraphView>(); if (graphView != null) { // Restore selections on children. foreach (var child in Children().OfType <GraphElement>()) { graphView.RestorePersitentSelectionForElement(child); } } } }
void AttachToPanel(AttachToPanelEvent evt) { if (Store.GetState().EditorDataModel.ShouldExpandElementUponCreation(this)) { Expand(); } UnregisterCallback <AttachToPanelEvent>(AttachToPanel); }
private void OnAttachToPanel(AttachToPanelEvent evt) { if (evt.destinationPanel == null) { return; } contentContainer.RegisterCallback <MouseDownEvent>(OnMouseDown); }
void OnEnterPanel(AttachToPanelEvent e) { if (presenter == null) { presenter = BuildPresenters(); graphView.presenter = presenter; } }
/// <summary> /// AttachToPanelEvent event callback. /// </summary> /// <param name="e">The event.</param> protected virtual void OnEnterPanel(AttachToPanelEvent e) { if (m_UpdateObserver == null) { m_UpdateObserver = new UpdateObserver(this); } m_CommandDispatcher?.RegisterObserver(m_UpdateObserver); }
void OnAttachedToPanel(AttachToPanelEvent evt) { value = sceneView.sceneViewGrids.showGrid; sceneView.gridVisibilityChanged += SceneViewOngridVisibilityChanged; sceneView.sceneViewGrids.gridRenderAxisChanged += OnSceneViewOngridRenderAxisChanged; OnSceneViewOngridRenderAxisChanged(sceneView.sceneViewGrids.gridAxis); dropdownClicked += OnDropdownClicked; }
private void OnEnterPanel(AttachToPanelEvent e) { if (this.presenter == null) { this.presenter = this.BuildPresenters(); this.graphView.presenter = this.presenter; } }
protected override void ExecuteDefaultAction(EventBase evt) { base.ExecuteDefaultAction(evt); if (evt.eventTypeId == AttachToPanelEvent.TypeId()) { OnAttachToPanelDefaultAction(); } }
void OnTargetAttachedToPanel(AttachToPanelEvent evt) { Add(m_EdgeBubble); if (m_EdgeModel?.OutputPortModel != null) { m_EdgeModel.OutputPortModel.OnValueChanged += OnPortValueChanged; } }
void OnAttachToPanel(AttachToPanelEvent evt) { if (evt.destinationPanel == null) { return; } m_FoldoutDepth = this.GetFoldoutDepth(); }