static State ToggleLockConstantNode(State previousState, ToggleLockConstantNodeAction action)
        {
            bool needUpdate = false;

            foreach (IConstantNodeModel constantNodeModel in action.ConstantNodeModels)
            {
                if (constantNodeModel is ConstantNodeModel model)
                {
                    Undo.RegisterCompleteObjectUndo(model.SerializableAsset, "Set IsLocked");
                    model.IsLocked = !model.IsLocked;
                    needUpdate     = true;
                }
            }

            if (needUpdate)
            {
                IEnumerable <IGraphElementModel> changedModels = action.ConstantNodeModels;
                ((VSGraphModel)previousState.CurrentGraphModel).LastChanges.ChangedElements.AddRange(changedModels);
            }

            return(previousState);
        }
Beispiel #2
0
        static State ToggleLockConstantNode(State previousState, ToggleLockConstantNodeAction action)
        {
            bool needUpdate = false;

            foreach (IConstantNodeModel constantNodeModel in action.ConstantNodeModels)
            {
                var model = constantNodeModel as ConstantNodeModel;
                if (model != null)
                {
                    model.IsLocked = !model.IsLocked;
                    needUpdate     = true;
                }
            }

            if (needUpdate)
            {
                IEnumerable <IGraphElementModel> changedModels = action.ConstantNodeModels;
                ((VSGraphModel)previousState.CurrentGraphModel).LastChanges.ChangedElements.AddRange(changedModels);
            }

            return(previousState);
        }