Esempio n. 1
0
            private void DeleteParameter(string name)
            {
                var action = new AddRemoveParamAction
                {
                    Proxy = _proxy,
                    IsAdd = false,
                    Name  = name,
                };

                _proxy.Window.Undo.AddAction(action);
                action.Do();
            }
Esempio n. 2
0
            /// <summary>
            /// Removes the parameter.
            /// </summary>
            /// <param name="index">The index.</param>
            private void DeleteParameter(int index)
            {
                var window = (VisjectSurfaceWindow <TAsset, TSurface, TPreview>)Values[0];
                var action = new AddRemoveParamAction
                {
                    Window = window,
                    IsAdd  = false,
                    Index  = index,
                };

                window.Surface.Undo.AddAction(action);
                action.Do();
            }
Esempio n. 3
0
            private void AddParameter(Type type)
            {
                var asset = _proxy?.Asset;

                if (asset == null || asset.WaitForLoaded())
                {
                    return;
                }
                var action = new AddRemoveParamAction
                {
                    Proxy        = _proxy,
                    IsAdd        = true,
                    Name         = StringUtils.IncrementNameNumber("New parameter", x => OnParameterRenameValidate(null, x)),
                    DefaultValue = TypeUtils.GetDefaultValue(new ScriptType(type)),
                };

                _proxy.Window.Undo.AddAction(action);
                action.Do();
            }
Esempio n. 4
0
            /// <summary>
            /// Adds the parameter.
            /// </summary>
            /// <param name="type">The type.</param>
            private void AddParameter(ParameterType type)
            {
                var window   = (VisjectSurfaceWindow <TAsset, TSurface, TPreview>)Values[0];
                var material = window?.Asset;

                if (material == null || !material.IsLoaded)
                {
                    return;
                }
                var action = new AddRemoveParamAction
                {
                    Window = window,
                    IsAdd  = true,
                    Name   = "New parameter",
                    Type   = type,
                    Index  = window.Surface.Parameters.Count,
                };

                window.Surface.Undo.AddAction(action);
                action.Do();
            }
Esempio n. 5
0
 /// <summary>
 /// Called when parameter remove undo action is performed.
 /// </summary>
 /// <param name="action">The action.</param>
 protected virtual void OnParamRemoveUndo(AddRemoveParamAction action)
 {
     _refreshPropertiesOnLoad = true;
     //_propertiesEditor.BuildLayoutOnUpdate();
     _propertiesEditor.BuildLayout();
 }
Esempio n. 6
0
 /// <summary>
 /// Called when parameter add undo action is performed.
 /// </summary>
 /// <param name="action">The action.</param>
 protected virtual void OnParamAddUndo(AddRemoveParamAction action)
 {
     _refreshPropertiesOnLoad = true;
 }