private void DeleteParameter(string name) { var action = new AddRemoveParamAction { Proxy = _proxy, IsAdd = false, Name = name, }; _proxy.Window.Undo.AddAction(action); action.Do(); }
/// <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(); }
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(); }
/// <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(); }
/// <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(); }
/// <summary> /// Called when parameter add undo action is performed. /// </summary> /// <param name="action">The action.</param> protected virtual void OnParamAddUndo(AddRemoveParamAction action) { _refreshPropertiesOnLoad = true; }