public override void Initialize(LayoutElementsContainer layout) { DevAccount devAccount = ToolAuthentication.LoadLastSignedInUser(); layout.Header("Account"); if (devAccount != null) { layout.Label("Username: "******"Id: " + devAccount.Id); layout.Label("Type: " + devAccount.AccountType); } else { layout.Label("Not logged in"); } layout.Header("Sandbox"); var sb = layout.TextBox(); var setSb = layout.Button("Set Sandbox"); setSb.Button.Clicked += () => SandboxHelper.SetSandbox(sb.Text); var retail = layout.Button("Switch to retail"); setSb.Button.Clicked += () => SandboxHelper.SetSandbox("RETAIL"); }
public override void Initialize(LayoutElementsContainer layout) { base.Initialize(layout); var surface = Values[0] as ImplicitSurface.ImplicitSurface; layout.Space(20); var updateButton = layout.Button("Update", Color.Green); updateButton.Button.Clicked += () => { surface.CreateVirtualModel(); surface.UpdateMesh(); }; var saveButton = layout.Button("Save", Color.Green); saveButton.Button.Clicked += () => { if (surface.Model && surface.Model.IsVirtual) { new Task(() => { surface.Actor.Model = null; surface.Model.Save(true, $"Content/ImplicitSurface/{surface.ID}_Model.flax"); }).Start(); } }; }
public override void Initialize(LayoutElementsContainer layout) { base.Initialize(layout); var skeletonActor = Values[0] as SkeletonToActors; layout.Space(20); var updateButton = layout.Button("Create", Color.Green); updateButton.Button.Clicked += () => { skeletonActor.Create(); }; var saveButton = layout.Button("Save", Color.Green); saveButton.Button.Clicked += () => { if (skeletonActor.VirtualModel && skeletonActor.VirtualModel.IsVirtual) { new Task(() => { skeletonActor.VirtualModel.Save(true, $"Content/SkeletonActor/{skeletonActor.ID}_SkinnedModel.flax"); }).Start(); } }; }
public override void Initialize(LayoutElementsContainer layout) { var window = ((PropertiesProxy)Values[0])._window; if (window == null) { layout.Label("Loading...", TextAlignment.Center); return; } // Texture properties { var texture = window.Asset; var group = layout.Group("General"); group.Label("Format: " + texture.Format); group.Label(string.Format("Size: {0}x{1}", texture.Width, texture.Height)); group.Label("Mip levels: " + texture.MipLevels); group.Label("Memory usage: " + Utilities.Utils.FormatBytesCount(texture.TotalMemoryUsage)); } base.Initialize(layout); layout.Space(10); var reimportButton = layout.Button("Reimport"); reimportButton.Button.Clicked += () => ((PropertiesProxy)Values[0]).Reimport(); }
public override void Initialize(LayoutElementsContainer layout) { var window = ((PropertiesProxy)Values[0])._window; if (window == null) { layout.Label("Loading...", TextAlignment.Center); return; } // Audio properties { var audio = window.Asset; AudioClip.AudioDataInfo info; audio.GetInfo(out info); int originalSize, importedSize; Editor.Internal_GetAudioClipMetadata(audio.unmanagedPtr, out originalSize, out importedSize); var group = layout.Group("General"); group.Label("Format: " + audio.Format); group.Label("Length: " + (Mathf.CeilToInt(audio.Length * 100.0f) / 100.0f) + "s"); group.Label(string.Format("{0}kHz, channels: {1}, bit depth: {2}", info.SampleRate / 1000, info.NumChannels, info.BitDepth)); group.Label("Original size: " + Utilities.Utils.FormatBytesCount((ulong)originalSize)); group.Label("Imported size: " + Utilities.Utils.FormatBytesCount((ulong)importedSize)); group.Label("Compression ratio: " + Mathf.CeilToInt((float)importedSize / originalSize * 100.0f) + "%"); } base.Initialize(layout); layout.Space(10); var reimportButton = layout.Button("Reimport"); reimportButton.Button.Clicked += () => ((PropertiesProxy)Values[0]).Reimport(); }
public override void Initialize(LayoutElementsContainer layout) { var proxy = (BuildTabProxy)Values[0]; _platform = proxy.Selector.Selected; var platformObj = proxy.PerPlatformOptions[_platform]; if (!platformObj.IsSupported) { layout.Label("This platform is not supported on this system.", TextAlignment.Center); } else if (platformObj.IsAvailable) { string name; switch (_platform) { case PlatformType.Windows: name = "Windows"; break; case PlatformType.XboxOne: name = "Xbox One"; break; case PlatformType.UWP: name = "Windows Store"; break; case PlatformType.Linux: name = "Linux"; break; case PlatformType.PS4: name = "PlayStation 4"; break; case PlatformType.XboxScarlett: name = "Xbox Scarlett"; break; case PlatformType.Android: name = "Android"; break; default: name = CustomEditorsUtil.GetPropertyNameUI(_platform.ToString()); break; } var group = layout.Group(name); group.Object(new ReadOnlyValueContainer(platformObj)); _buildButton = layout.Button("Build").Button; _buildButton.Clicked += OnBuildClicked; } else { platformObj.OnNotAvailableLayout(layout); } }
public override void Initialize(LayoutElementsContainer layout) { _proxy = (PropertiesProxy)Values[0]; if (_proxy?.DefaultValues == null) { layout.Label("Loading...", TextAlignment.Center); return; } var isPlayModeActive = _proxy.Window.Editor.StateMachine.IsPlayMode; if (isPlayModeActive) { layout.Label("Play mode is active. Editing runtime values.", TextAlignment.Center); layout.Space(10); foreach (var e in _proxy.DefaultValues) { var name = e.Key; var value = _proxy.Asset.GetValue(name); var valueContainer = new VariableValueContainer(_proxy, name, value, false); var propertyLabel = new PropertyNameLabel(name) { Tag = name, }; string tooltip = null; if (_proxy.DefaultValues.TryGetValue(name, out var defaultValue)) { tooltip = "Default value: " + defaultValue; } layout.Object(propertyLabel, valueContainer, null, tooltip); } } else { foreach (var e in _proxy.DefaultValues) { var name = e.Key; var value = e.Value; var valueContainer = new VariableValueContainer(_proxy, name, value, true); var propertyLabel = new ClickablePropertyNameLabel(name) { Tag = name, }; propertyLabel.MouseLeftDoubleClick += (label, location) => StartParameterRenaming(name, label); propertyLabel.SetupContextMenu += OnPropertyLabelSetupContextMenu; layout.Object(propertyLabel, valueContainer, null, "Type: " + CustomEditorsUtil.GetTypeNameUI(value.GetType())); } // TODO: improve the UI layout.Space(40); var addParamType = layout.ComboBox().ComboBox; addParamType.Items = AllowedTypes.Select(CustomEditorsUtil.GetTypeNameUI).ToList(); addParamType.SelectedIndex = 0; _addParamType = addParamType; var addParamButton = layout.Button("Add").Button; addParamButton.Clicked += OnAddParamButtonClicked; } }
private void OnAfterLayout(LayoutElementsContainer layout) { layout.Space(10); var button = layout.Button("Render").Button; button.TooltipText = "Start the Scene Animation rendering using the specified options"; button.Clicked += StartRendering; }
/// <inheritdoc /> public override void Initialize(LayoutElementsContainer layout) { base.Initialize(layout); layout.Space(10); _cookButton = layout.Button("Cook"); _cookButton.Button.Clicked += OnCookButtonClicked; }
public override void Initialize(LayoutElementsContainer layout) { base.Initialize(layout); layout.Space(20); var button = layout.Button("New on the edge", Color.DarkGray); button.Button.Clicked += () => (Values[0] as JumpTrajectoryPreview)?.CreateNewOnTheEdge(); }
public override void Initialize(LayoutElementsContainer layout) { base.Initialize(layout); layout.Space(10); var reimportButton = layout.Button("Reimport"); reimportButton.Button.Clicked += () => ((PropertiesProxy)Values[0]).Reimport(); }
public override void Initialize(LayoutElementsContainer layout) { base.Initialize(layout); layout.Button(NetworkGUI.hostText, Color.DarkSlateGray).Button.Clicked += () => { NetworkManager.Instance.hostType = AnthillNet.HostType.Server; NetworkManager.Instance.StartHost(); }; layout.Button(NetworkGUI.connectText, Color.DarkSlateGray).Button.Clicked += () => { NetworkManager.Instance.hostType = AnthillNet.HostType.Client; NetworkManager.Instance.StartHost(); }; layout.Button(NetworkGUI.stopText, Color.DarkSlateGray).Button.Clicked += () => NetworkManager.Instance.StopHost(); var dispose = layout.Button(NetworkGUI.disposeTest, Color.DarkSlateGray); dispose.Button.Clicked += () => NetworkManager.Instance.Dispose(); dispose.Button.TextColor = Color.IndianRed; Editor.Instance.StateMachine.StateChanging += OnStateChanging; }
/// <inheritdoc /> public override void Initialize(LayoutElementsContainer layout) { base.Initialize(layout); if (Values.HasDifferentTypes == false) { layout.Space(10); _bake = layout.Button("Bake").Button; _bake.Clicked += BakeButtonClicked; } }
public override void Initialize(LayoutElementsContainer layout) { base.Initialize(layout); var saveButton = layout.Button("Create material set", Color.Green); saveButton.Button.Clicked += () => { FlaxEditor.Editor.SaveJsonAsset("Content/VoxelMaterials.json", new VoxelMaterialSet()); }; }
/// <inheritdoc /> public override void Initialize(LayoutElementsContainer layout) { base.Initialize(layout); if (Values.HasDifferentTypes == false) { // Add 'Bake' button layout.Space(10); var button = layout.Button("Bake"); button.Button.Clicked += BakeButtonClicked; } }
private void ShowJoin() { _layout.ContainerControl.DisposeChildren(); //_layout.ContainerControl.AnchorStyle = AnchorStyle.Upper; EditingSessionPlugin.Instance.SessionState = EditingSessionPlugin.State.Join; _layout.ClearLayout(); _layout.Space(5); var label = _layout.Label("Joining Session", TextAlignment.Center); var fontReference = label.Label.Font; fontReference.Size = 11; label.Label.Font = fontReference; _layout.Space(5); var clientSettingsEditor = new CustomEditorPresenter(null); clientSettingsEditor.Panel.Parent = _layout.ContainerControl; clientSettingsEditor.Select(_clientSettings); var button = _layout.Button("Join"); var returnButton = _layout.Button("Return"); button.Button.Clicked += async() => { button.Button.Enabled = false; var session = new ClientSession(); bool connected = await session.Start(_clientSettings); button.Button.Enabled = true; if (connected) { EditingSessionPlugin.Instance.Session = session; ShowSession(); } }; returnButton.Button.Clicked += () => ShowNoSession(); }
public override void Initialize(LayoutElementsContainer layout) { var proxy = (BuildTabProxy)Values[0]; _platform = proxy.Selector.Selected; var platformObj = proxy.PerPlatformOptions[_platform]; var group = layout.Group(CustomEditorsUtil.GetPropertyNameUI(_platform.ToString())); group.Object(new ReadOnlyValueContainer(platformObj)); _buildButton = layout.Button("Build").Button; _buildButton.Clicked += OnBuildClicked; }
public override void Initialize(LayoutElementsContainer layout) { var proxy = (BuildTabProxy)Values[0]; _platform = proxy.Selector.Selected; var platformObj = proxy.PerPlatformOptions[_platform]; if (platformObj.IsAvailable) { string name; switch (_platform) { case PlatformType.Windows: name = "Windows"; break; case PlatformType.XboxOne: name = "Xbox One"; break; case PlatformType.WindowsStore: name = "Windows Store"; break; case PlatformType.Linux: name = "Linux"; break; default: name = CustomEditorsUtil.GetPropertyNameUI(_platform.ToString()); break; } var group = layout.Group(name); group.Object(new ReadOnlyValueContainer(platformObj)); _buildButton = layout.Button("Build").Button; _buildButton.Clicked += OnBuildClicked; } else { platformObj.OnNotAvailableLayout(layout); } }
public override void Initialize(LayoutElementsContainer layout) { var window = ((PropertiesProxy)Values[0])._window; var texture = window?.Asset; if (texture == null || !texture.IsLoaded) { layout.Label("Loading...", TextAlignment.Center); return; } // Texture info var general = layout.Group("General"); general.Label("Format: " + texture.Format); general.Label(string.Format("Size: {0}x{1}", texture.Width, texture.Height)); general.Label("Mip levels: " + texture.MipLevels); general.Label("Memory usage: " + Utilities.Utils.FormatBytesCount(texture.TotalMemoryUsage)); // Texture properties var properties = layout.Group("Properties"); var textureGroup = new CustomValueContainer(new ScriptType(typeof(int)), texture.TextureGroup, (instance, index) => texture.TextureGroup, (instance, index, value) => { texture.TextureGroup = (int)value; window.MarkAsEdited(); }); properties.Property("Texture Group", textureGroup, new TextureGroupEditor(), "The texture group used by this texture."); // Import settings base.Initialize(layout); // Reimport layout.Space(10); var reimportButton = layout.Button("Reimport"); reimportButton.Button.Clicked += () => ((PropertiesProxy)Values[0]).Reimport(); }
public override void Initialize(LayoutElementsContainer layout) { base.Initialize(layout); var button = layout.Button("Run", Color.Green); button.Button.Clicked += () => { if (!HasDifferentValues) { var action = Values[0] as Action; try { action?.Invoke(); } catch (Exception e) { Debug.LogException(e); throw; } } }; }
/// <inheritdoc /> public override void Initialize(LayoutElementsContainer layout) { var window = Values[0] as IVisjectSurfaceWindow; var asset = window?.VisjectAsset; if (asset == null) { layout.Label("No parameters"); return; } if (asset.LastLoadFailed) { layout.Label("Failed to load asset"); return; } if (!asset.IsLoaded) { layout.Label("Loading..."); return; } var parameters = window.VisjectSurface.Parameters; GroupElement lastGroup = null; for (int i = 0; i < parameters.Count; i++) { var p = parameters[i]; if (!p.IsPublic) { continue; } var pIndex = i; var pValue = p.Value; var attributes = p.Meta.GetAttributes(); if (attributes == null || attributes.Length == 0) { attributes = DefaultAttributes; } var itemLayout = layout; var name = p.Name; // Editor Display var editorDisplay = (EditorDisplayAttribute)attributes.FirstOrDefault(x => x is EditorDisplayAttribute); if (editorDisplay?.Group != null) { if (lastGroup == null || lastGroup.Panel.HeaderText != editorDisplay.Group) { lastGroup = layout.Group(editorDisplay.Group); lastGroup.Panel.Open(false); } itemLayout = lastGroup; } else { lastGroup = null; itemLayout = layout; } if (editorDisplay?.Name != null) { name = editorDisplay.Name; } // Space var space = (SpaceAttribute)attributes.FirstOrDefault(x => x is SpaceAttribute); if (space != null) { itemLayout.Space(space.Height); } // Header var header = (HeaderAttribute)attributes.FirstOrDefault(x => x is HeaderAttribute); if (header != null) { itemLayout.Header(header.Text); } var propertyValue = new CustomValueContainer ( p.Type, pValue, (instance, index) => ((IVisjectSurfaceWindow)instance).GetParameter(pIndex), (instance, index, value) => ((IVisjectSurfaceWindow)instance).SetParameter(pIndex, value), attributes ); var propertyLabel = new DraggablePropertyNameLabel(name) { Tag = pIndex, Drag = OnDragParameter }; var tooltip = (TooltipAttribute)attributes.FirstOrDefault(x => x is TooltipAttribute); propertyLabel.MouseLeftDoubleClick += (label, location) => StartParameterRenaming(pIndex, label); propertyLabel.SetupContextMenu += OnPropertyLabelSetupContextMenu; var property = itemLayout.AddPropertyItem(propertyLabel, tooltip?.Text); property.Object(propertyValue); } // Parameters creating var newParameterTypes = window.NewParameterTypes; if (newParameterTypes != null) { layout.Space(parameters.Count > 0 ? 10 : 4); var newParam = layout.Button("Add parameter..."); newParam.Button.ButtonClicked += OnAddParameterButtonClicked; layout.Space(10); } }
/// <inheritdoc /> public override void Initialize(LayoutElementsContainer layout) { var window = Values[0] as VisjectSurfaceWindow <TAsset, TSurface, TPreview>; var asset = window?.Asset; if (asset == null) { layout.Label("No parameters"); return; } if (!asset.IsLoaded) { layout.Label("Loading..."); return; } var parameters = window.Surface.Parameters; for (int i = 0; i < parameters.Count; i++) { var p = parameters[i]; if (!p.IsPublic) { continue; } var pIndex = i; var pValue = p.Value; Type pType; object[] attributes = null; switch (p.Type) { case ParameterType.CubeTexture: pType = typeof(CubeTexture); break; case ParameterType.Texture: case ParameterType.NormalMap: pType = typeof(Texture); break; case ParameterType.RenderTarget: case ParameterType.RenderTargetArray: case ParameterType.RenderTargetCube: case ParameterType.RenderTargetVolume: pType = typeof(RenderTarget); break; default: pType = p.Value.GetType(); // TODO: support custom attributes with defined value range for parameter (min, max) attributes = DefaultAttributes; break; } var propertyValue = new CustomValueContainer ( pType, pValue, (instance, index) => ((VisjectSurfaceWindow <TAsset, TSurface, TPreview>)instance).GetParameter(pIndex), (instance, index, value) => ((VisjectSurfaceWindow <TAsset, TSurface, TPreview>)instance).SetParameter(pIndex, value), attributes ); var propertyLabel = new DragablePropertyNameLabel(p.Name) { Tag = pIndex, Drag = DragParameter }; propertyLabel.MouseLeftDoubleClick += (label, location) => StartParameterRenaming(pIndex, label); propertyLabel.MouseRightClick += (label, location) => ShowParameterMenu(pIndex, label, ref location); var property = layout.AddPropertyItem(propertyLabel); property.Object(propertyValue); } // Parameters creating var newParameterTypes = window.NewParameterTypes; if (newParameterTypes != null) { if (parameters.Count > 0) { layout.Space(10); } var paramType = layout.Enum(newParameterTypes); paramType.Value = (int)ParameterType.Float; var newParam = layout.Button("Add parameter"); newParam.Button.Clicked += () => AddParameter((ParameterType)paramType.Value); } }
/// <inheritdoc /> public override void Initialize(LayoutElementsContainer layout) { var materialWin = Values[0] as MaterialWindow; var material = materialWin?.Asset; if (material == null) { _parametersHash = -1; layout.Label("No parameters"); return; } if (!material.IsLoaded) { _parametersHash = -2; layout.Label("Loading..."); return; } _parametersHash = material._parametersHash; var parameters = material.Parameters; for (int i = 0; i < parameters.Length; i++) { var p = parameters[i]; if (!p.IsPublic) { continue; } var pIndex = i; var pValue = p.Value; var pGuidType = false; Type pType; switch (p.Type) { case MaterialParameterType.CubeTexture: pType = typeof(CubeTexture); pGuidType = true; break; case MaterialParameterType.Texture: case MaterialParameterType.NormalMap: pType = typeof(Texture); pGuidType = true; break; case MaterialParameterType.RenderTarget: pType = typeof(RenderTarget); pGuidType = true; break; default: pType = p.Value.GetType(); break; } var propertyValue = new CustomValueContainer( pType, pValue, (instance, index) => { // Get material parameter var win = (MaterialWindow)instance; return(win.Asset.Parameters[pIndex].Value); }, (instance, index, value) => { // Set material parameter and surface parameter var win = (MaterialWindow)instance; // Visject surface paramaters are only value type objects so convert value if need to (eg. instead of texture ref write texture id) var surfaceParam = value; if (pGuidType) { surfaceParam = (value as FlaxEngine.Object)?.ID ?? Guid.Empty; } win.Asset.Parameters[pIndex].Value = value; win.Surface.Parameters[pIndex].Value = surfaceParam; win._paramValueChange = true; } ); var propertyLabel = new DragablePropertyNameLabel(p.Name); propertyLabel.Tag = pIndex; propertyLabel.MouseLeftDoubleClick += (label, location) => StartParameterRenaming(pIndex, label); propertyLabel.MouseRightClick += (label, location) => ShowParameterMenu(pIndex, label, ref location); propertyLabel.Drag = DragParameter; var property = layout.AddPropertyItem(propertyLabel); property.Object(propertyValue); } if (parameters.Length > 0) { layout.Space(10); } // Parameters creating var paramType = layout.Enum(typeof(NewParameterType)); paramType.Value = (int)NewParameterType.Float; var newParam = layout.Button("Add parameter"); newParam.Button.Clicked += () => AddParameter((ParameterType)paramType.Value); }