public override void OnDrawOutport(int outportIndex, OutportContainer outportContainer) { base.OnDrawOutport(outportIndex, outportContainer); SerializedProperty setterValueProp = TargetProperty.FindPropertyRelative(BlackboardSetter.SetterValueVarName); outportContainer.OutportBody.Add(new Label(BlackboardSetter.GetOutportLabel(setterValueProp))); }
public override void OnDrawOutport(int outportIndex, OutportContainer outportContainer) { base.OnDrawOutport(outportIndex, outportContainer); SerializedProperty conditionalProp = TargetProperty .FindPropertyRelative(BlackboardConditional.ConditionalsVarName) .GetArrayElementAtIndex(outportIndex); outportContainer.OutportBody.Add(new Label(BlackboardConditional.GetOutportLabel(conditionalProp))); }
public override void OnDrawPrimaryBody(VisualElement primaryBodyContainer) { base.OnDrawPrimaryBody(primaryBodyContainer); string blackboardEleId = TargetProperty.FindPropertyRelative(BlackboardConditional.BlackboardElementIdVarName).stringValue; BlackboardElement blackboardElement = NodeGraph.BlackboardProperties.GetElementById(blackboardEleId); Label selectedEleLabel = new Label(blackboardElement == null ? "None" : blackboardElement.Name); selectedEleLabel.style.unityTextAlign = TextAnchor.MiddleCenter; selectedEleLabel.style.fontSize = 18; primaryBodyContainer.Add(selectedEleLabel); }
/// <summary> /// Call this to clear and redraw the whole node. /// TODO: Why are we passing in portViews? /// </summary> public void Repaint(List <PortView> portViews = null) { TargetProperty.serializedObject.Update(); OnRepaint?.Invoke(); m_nodeDisplayContainers.ClearDisplays(portViews != null); OnDrawHeader(m_nodeDisplayContainers.HeaderContainer); OnDrawTitle(m_nodeDisplayContainers.PreTitleContainer, m_nodeDisplayContainers.PostTitleContainer); OnDrawPrimaryBody(m_nodeDisplayContainers.PrimaryBodyContainer); OnDrawInport(m_nodeDisplayContainers.InportContainer); for (int i = 0; i < TargetProperty.FindPropertyRelative(ANode.OutportsVarName).arraySize; i++) { if (portViews != null) { m_nodeDisplayContainers.AddNewOutport(portViews[i]); } OnDrawOutport(i, m_nodeDisplayContainers.OutportContainers[i]); } OnDrawSecondaryBody(m_nodeDisplayContainers.SecondaryBodyContainer); OnDrawFooter(m_nodeDisplayContainers.FooterContainer); }
private void ValidateBlackboardElement(int undoGroup = -1) { TargetProperty.serializedObject.Update(); if (undoGroup == -1) { undoGroup = Undo.GetCurrentGroup(); } BlackboardSetter target = (Target as BlackboardSetter); if (BlackboardProperties.GetElementById(target.BlackboardElementId) == null) { TargetProperty.FindPropertyRelative(BlackboardSetter.BlackboardElementIdVarName).stringValue = ""; SerializedProperty setterValueProp = TargetProperty.FindPropertyRelative(BlackboardSetter.SetterValueVarName); setterValueProp.managedReferenceValue = null; TargetProperty.serializedObject.ApplyModifiedProperties(); } Undo.CollapseUndoOperations(undoGroup); TargetProperty.serializedObject.Update(); }
private void ValidateBlackboardElement(int undoGroup = -1) { TargetProperty.serializedObject.Update(); if (undoGroup == -1) { undoGroup = Undo.GetCurrentGroup(); } BlackboardConditional target = (Target as BlackboardConditional); if (BlackboardProperties.GetElementById(target.BlackboardElementId) == null) { TargetProperty.FindPropertyRelative(BlackboardConditional.BlackboardElementIdVarName).stringValue = ""; SerializedProperty conditionalsList = TargetProperty.FindPropertyRelative(BlackboardConditional.ConditionalsVarName); NodeGraph.RemoveAllOutportsFromNode(TargetProperty); conditionalsList.arraySize = 0; TargetProperty.serializedObject.ApplyModifiedProperties(); } Undo.CollapseUndoOperations(undoGroup); TargetProperty.serializedObject.Update(); }