Пример #1
0
 static void OnEditTextRequested(Unity.Modifier.GraphElements.Blackboard blackboard, VisualElement blackboardField, string newName)
 {
     if (blackboardField is BlackboardVariableField field)
     {
         field.Store.Dispatch(new RenameElementAction((Unity.Modifier.GraphToolsFoundation.Model.IRenamable)field.GraphElementModel, newName));
         field.UpdateTitleFromModel();
     }
 }
Пример #2
0
        void OnMoveItemRequested(Unity.Modifier.GraphElements.Blackboard blackboard, int index, VisualElement field)
        {
            // TODO: Workaround to prevent moving item above a BlackboardThisField, as all check code is executed
            // within Unity.GraphElements.BlackboardSection in private or internal functions
            bool hasBlackboardThisField = (blackboard as Blackboard)?.Sections?[0]?.Children()
                                          ?.Any(x => x is BlackboardThisField) ?? false;

            if (index == 0 && hasBlackboardThisField)
            {
                return;
            }

            var currentGraphModel = Store.GetState().CurrentGraphModel;

            currentGraphModel.Stencil.GetBlackboardProvider().MoveItemRequested(Store, index, field);
        }
Пример #3
0
        // TODO: Enable when GraphView supports it
        //        void UpdateProperties(PersistedProperties properties)
        //        {
        //            var newPosition = properties.position;
        //            var newSize = properties.size;
        //            var newAutoDimOpacityEnabled = properties.isAutoDimOpacityEnabled;
        //
        //            float validateFloat = newPosition.x + newPosition.y + newPosition.z + newSize.x + newSize.y;
        //            if (float.IsInfinity(validateFloat) || float.IsNaN(validateFloat) || newSize.x < float.Epsilon || newSize.y < float.Epsilon)
        //                return;
        //
        //            SetPosition(new Rect(newPosition, newSize));
        //
        //            if ((this.IsAutoDimOpacityEnabled() && !newAutoDimOpacityEnabled) ||
        //                (!this.IsAutoDimOpacityEnabled() && newAutoDimOpacityEnabled))
        //                this.ToggleAutoDimOpacity(VisualElementExtensions.StartingOpacity.Min);
        //
        //            UpdatePersistedProperties(newPosition, newSize, newAutoDimOpacityEnabled);
        //        }

        void OnAddItemRequested(Unity.Modifier.GraphElements.Blackboard blackboard)
        {
            var currentGraphModel = Store.GetState().CurrentGraphModel;

            currentGraphModel.Stencil.GetBlackboardProvider().AddItemRequested(Store, (IAction)null);
        }