Skip to content

Commit

Permalink
- Fixed GroupCommentNode Headline cutting off text. Fixes: [#24](#24)
Browse files Browse the repository at this point in the history
- Fixed Frame action being triggerd while in an editable VisualElement. Fixes: [#27](#27)
- Added customization of the hierarchical layer for GroupCommentNodes. Fixes: [#25](#25)
  • Loading branch information
Doppelkeks committed May 10, 2023
1 parent 613453d commit 4988abb
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 9 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,4 +222,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [0.3.8] - 2023-05-09
### Fixed
- Removed janky workaround for re-initializing a graph after playmode in exchange for a better solution. Fixes: [#23](https://github.com/Gentlymad-Studios/NewGraph/issues/23)
- Removed janky workaround for re-initializing a graph after playmode in exchange for a better solution. Fixes: [#23](https://github.com/Gentlymad-Studios/NewGraph/issues/23)

## [0.3.9] - 2023-05-10
### Fixed
- Fixed GroupCommentNode Headline cutting off text. Fixes: [#24](https://github.com/Gentlymad-Studios/NewGraph/issues/24)
- Fixed Frame action being triggerd while in an editable VisualElement. Fixes: [#27](https://github.com/Gentlymad-Studios/NewGraph/issues/27)
### Added
- Added customization of the hierarchical layer for GroupCommentNodes. Fixes: [#25](https://github.com/Gentlymad-Studios/NewGraph/issues/25)
10 changes: 4 additions & 6 deletions Editor/Controllers/GraphController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public GraphController(VisualElement uxmlRoot, VisualElement root, Type inspecto
{ Actions.SelectionChanged, OnSelected },
{ Actions.SelectionCleared, OnDeselected },
{ Actions.EdgeDrop, OnEdgeDrop },
{ Actions.Rename, OnRename }
{ Actions.Rename, OnRename },
};


Expand Down Expand Up @@ -97,12 +97,10 @@ private void OnEdgeDrop(object edge) {
}
}

private bool IsFocusedElementNullOrNotBindable => graphView.focusController == null || graphView.focusController.focusedElement == null || !(graphView.focusController.focusedElement is IBindable);

private void OpenContextMenu(MouseDownEvent evt) {
if (evt.button == 1) {
graphView.schedule.Execute(() => {
if (IsFocusedElementNullOrNotBindable) {
if (graphView.IsFocusedElementNullOrNotBindable) {
SearchWindow.Open(contextMenu, graphView);
}
});
Expand Down Expand Up @@ -182,7 +180,7 @@ private void OnDeselected(object data = null) {
/// </summary>
/// <param name="data">currently unused, check selected lists to get the actual selected objects...</param>
public void OnCopy(object data = null) {
if (IsFocusedElementNullOrNotBindable) {
if (graphView.IsFocusedElementNullOrNotBindable) {
List<NodeView> nodesToCapture = new List<NodeView>();

graphView.ForEachSelectedNodeDo((node) => {
Expand All @@ -201,7 +199,7 @@ public void OnCopy(object data = null) {
/// </summary>
/// <param name="data">currently unused, check selected lists to get the actual selected objects...</param>
public void OnPaste(object data = null) {
if (IsFocusedElementNullOrNotBindable) {
if (graphView.IsFocusedElementNullOrNotBindable) {
copyPasteHandler.Resolve(graphData, (nodes) => {
Undo.RecordObject(graphData.BaseObject, "Paste Action");
// position node clones relative to the current mouse position & add them to the current graph
Expand Down
2 changes: 2 additions & 0 deletions Editor/Settings/GraphSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ public static string PathPartialToCategory {
public static Image ResetButtonIcon => new Image() { image = EditorGUIUtility.IconContent(Settings.resetButtonIcon).image };

public string windowName = nameof(GraphWindow);

public int groupCommentNodeLayer = -20;

public string resetButtonTooltip = "Reset this value back to the default value.";
public string resetAllLabel = "Reset All To Default";
Expand Down
5 changes: 4 additions & 1 deletion Editor/Views/Nodes/GroupCommentNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
using UnityEngine.UIElements;

namespace NewGraph {

using static GraphSettingsSingleton;

[Node]
public class GroupCommentNode : INode, IUtilityNode {

Expand Down Expand Up @@ -64,7 +67,7 @@ public void Initialize(NodeController nodeController) {
this.nodeController = nodeController;
nodeView = nodeController.nodeView;
// we want our node view to be "behind" all nodes so we give it its own layer
nodeView.Layer = -20;
nodeView.Layer = Settings.groupCommentNodeLayer;
nodeView.style.width = width;
nodeView.style.height = height;
nodeView.AddToClassList(nameof(CommentNode));
Expand Down
12 changes: 12 additions & 0 deletions Editor/Views/USS/NewGraph.uss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@
--grid-background-color: rgba(45, 45, 45, 1);
}

NodeView.CommentNode VisualElement.node-title {
height: auto;
}

NodeView.CommentNode VisualElement.node-title PropertyField TextField TextInput TextElement {
white-space: normal;
}

NodeView.CommentNode VisualElement.node-title PropertyField TextField TextInput {
flex-direction: column;
}

.EditableLabelElement {
flex-direction: row;
padding-right: 3px;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "com.gentlymad.newgraph",
"version": "0.3.8",
"version": "0.3.9",
"displayName": "NewGraph",
"description": "A general data oriented node graph solution. This is build upon the idea to visualize complex data structures as graph networks without having to modify already established data classes, except adding [Node], [Port] and [SerializeReference] attributes to call classes that should show in the Graph View.",
"unity": "2022.2",
Expand Down

0 comments on commit 4988abb

Please sign in to comment.