Skip to content

Commit

Permalink
remove toolbar system add menu and adding warning text when in play mode
Browse files Browse the repository at this point in the history
  • Loading branch information
tbg10101 committed Jul 27, 2023
1 parent 73e2703 commit c632d76
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions Editor/Scripts/GraphEditor/GraphSystemGroupEditorWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ private void CreateGUI() {
return _addNodeChoices
.Select(path => new GraphSystemGroupGraphView.AddNodeAction(path, dropdownMenuAction => {
SystemTypeReference systemReference = AssetDatabase.LoadAssetAtPath<SystemTypeReference>(path);
_graphView.AddSystemNode(systemReference.GetInstanceID(), dropdownMenuAction.eventInfo.localMousePosition);
_graphView.AddSystemNode(
systemReference.GetInstanceID(),
dropdownMenuAction.eventInfo.localMousePosition);
PopulateNodeCreationChoices();
}))
.ToArray();
Expand Down Expand Up @@ -68,23 +70,11 @@ private void CreateGUI() {

_toolbar = new();

PopulateNodeCreationChoices();
DropdownField nodeCreateDropDown = new("Create Node", _addNodeChoices, -1);
nodeCreateDropDown.RegisterValueChangedCallback(evt => {
if (string.IsNullOrEmpty(evt.newValue)) {
return;
}

SystemTypeReference systemReference = AssetDatabase.LoadAssetAtPath<SystemTypeReference>(evt.newValue);
_graphView.AddSystemNode(systemReference.GetInstanceID());
nodeCreateDropDown.index = -1;
PopulateNodeCreationChoices();
});
_toolbar.Add(nodeCreateDropDown);

_loadedLabel = new Label("");
_toolbar.Add(_loadedLabel);

_toolbar.Add(new ToolbarSpacer { flex = true});

Button saveButton = new(Save) {
text = "Save"
};
Expand Down Expand Up @@ -142,8 +132,7 @@ private void PopulateNodeCreationChoices() {
existingInstanceIdsNative.Dispose();

HashSet<string> existingNodeGuids = new();
for (int i = 0; i < existingNodeGuidsNative.Length; i++) {
GUID existingGuid = existingNodeGuidsNative[i];
foreach (GUID existingGuid in existingNodeGuidsNative) {
existingNodeGuids.Add(existingGuid.ToString());
}

Expand Down Expand Up @@ -219,6 +208,10 @@ private void OnGUI() {
if (_serializedObject) {
string dirtyFlag = _graphView.Dirty ? " *" : "";
_loadedLabel.text = $"{_serializedObject.name} - {_propertyName}{dirtyFlag}";

if (Application.isPlaying) {
_loadedLabel.text = $"{_loadedLabel.text} !! changes do not take effect in play mode !!";
}
} else {
_loadedLabel.text = "";
}
Expand Down

0 comments on commit c632d76

Please sign in to comment.