private void BuildActionsPanel() { var layer = project.selectedLayer; var layerActions = layer.actions; actions.Items.Clear(); GUILayout.Reset(); GUILayout.actionPropertyIndex = 0; // Draw layer specific properties. if (layer is LayerNoise layerNoise) { GUILayout.PropertyField(new SerializedProperty(layerNoise, "IsColor")); var btn = GUILayout.Button("Regenerate Noise"); btn.Click += (sender, evt) => { layerNoise.GenerateImage(); EventBus.OnLayerActionChanged(sender); }; } // Draw the required primary transform. GUILayout.PropertyField(new SerializedProperty(Transform, "IsAnchored")); if (Transform.IsAnchored) { GUILayout.PropertyField(new SerializedProperty(Transform, "Anchor")); } else { GUILayout.PropertyField(new SerializedProperty(Transform, "Position")); } GUILayout.PropertyField(new SerializedProperty(Transform, "Rotation")); GUILayout.PropertyField(new SerializedProperty(Transform, "Scale")); // Call the draw method on all the layer actions (excluding the transform). foreach (var action in layerActions) { try { action.Draw(); } catch (DrawNotImplementedException) { GUILayout.HandleNoDrawAction(action); } } // Add the the actions to the panel to be physically drawn to the screen. int index = 0; foreach (var guiAction in GUILayout.Actions) { var processingIndex = project.selectedLayer.ActionProcessingIndex; if (guiAction.Header != null) { actions.Items.Add(guiAction.Header); } guiAction.Layer = project.selectedLayer; foreach (var panel in guiAction.panels) { if (guiAction.action == null || !guiAction.action.Collapsed) { actions.Items.Add(panel); } } if (guiAction.action != null && index > 0 && !guiAction.action.Collapsed) { var progressBar = new ProgressBar { IsIndeterminate = true, Margin = new Thickness(0, 5, 0, 0), Visibility = Visibility.Hidden, Name = $"ActionProgress_{index}" }; actions.Items.Add(progressBar); } // if (guiAction.action != null && index < GUILayout.Actions.Count - 1) { var top = guiAction.action != null && guiAction.action.Collapsed ? 0 : 10; var separator = new Separator { Margin = new Thickness(0, 0, 0, 0), Background = new SolidColorBrush(Color.FromRgb(0x0, 0x0, 0x0)) }; actions.Items.Add(separator); // } index++; } }