Пример #1
0
        private void ElementDeletedCallback(VisualElement ve)
        {
            if (m_MathBook == null)
            {
                return;
            }

            switch (ve.userData)
            {
            case MathNode node:
                m_GraphView.window.DestroyNode(node);
                break;

            case MathPlacemat placemat:
                m_GraphView.window.DestroyPlacemat(placemat);
                break;

            case MathStickyNote stickyNote:
                m_GraphView.window.DestroyStickyNote(stickyNote);
                break;

            case MathBookField mathBookField:
                m_MathBook.inputOutputs.RemoveField(mathBookField);

                // Removes the containing row from its parent section
                BlackboardRow row = ve.GetFirstAncestorOfType <BlackboardRow>();
                if (row != null)
                {
                    row.RemoveFromHierarchy();
                }

                break;
            }
        }
Пример #2
0
 void DeleteField(BlackboardRow field, FieldModel fieldModel)
 {
     fieldModel.RemoveFromStruct();
     field.RemoveFromHierarchy();
     SetModelDirty();
 }