Skip to content

Commit

Permalink
Merge pull request #87 from radiumgame/development
Browse files Browse the repository at this point in the history
New node system
  • Loading branch information
LandonHarter authored Jun 12, 2023
2 parents c789fd2 + 8859bab commit a581664
Show file tree
Hide file tree
Showing 95 changed files with 3,281 additions and 3,307 deletions.
Binary file modified .gradle/7.1/executionHistory/executionHistory.bin
Binary file not shown.
Binary file modified .gradle/7.1/executionHistory/executionHistory.lock
Binary file not shown.
Binary file modified .gradle/7.1/fileHashes/fileHashes.bin
Binary file not shown.
Binary file modified .gradle/7.1/fileHashes/fileHashes.lock
Binary file not shown.
Binary file modified .gradle/7.1/fileHashes/resourceHashesCache.bin
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/outputFiles.bin
Binary file not shown.
Binary file modified .gradle/checksums/checksums.lock
Binary file not shown.
Binary file modified .gradle/checksums/md5-checksums.bin
Binary file not shown.
Binary file modified .gradle/checksums/sha1-checksums.bin
Binary file not shown.
Binary file removed EngineAssets/Editor/Icons/node-scripting.jpg
Binary file not shown.
Binary file added EngineAssets/Editor/Icons/node_scripting.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added EngineAssets/Editor/NodeEditor/Math/add.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added EngineAssets/Editor/NodeEditor/Math/divide.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added EngineAssets/Editor/NodeEditor/Math/greater.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added EngineAssets/Editor/NodeEditor/Math/less.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added EngineAssets/Editor/NodeEditor/Math/minus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added EngineAssets/Editor/NodeEditor/Math/multiply.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added EngineAssets/Editor/NodeEditor/event.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 25 additions & 24 deletions EngineAssets/editor.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ Size=1928,980
Collapsed=0

[Window][Game Viewport]
Pos=389,52
Size=733,611
Pos=271,52
Size=970,606
Collapsed=0
DockId=0x00000001,0

[Window][Scene Hierarchy]
Pos=8,52
Size=379,576
Size=261,604
Collapsed=0
DockId=0x00000007,0

[Window][Inspector]
Pos=1124,157
Size=468,735
Pos=1243,157
Size=349,735
Collapsed=0
DockId=0x0000000B,0

Expand All @@ -43,7 +43,7 @@ Collapsed=0
DockId=0x0000000A,0

[Window][Preferences]
Pos=443,228
Pos=814,187
Size=887,400
Collapsed=0

Expand All @@ -53,8 +53,8 @@ Size=1143,91
Collapsed=0

[Window][Project Explorer]
Pos=389,665
Size=733,227
Pos=271,660
Size=970,232
Collapsed=0
DockId=0x00000002,0

Expand All @@ -69,14 +69,14 @@ Size=667,460
Collapsed=0

[Window][Viewport Controls]
Pos=1124,52
Size=468,103
Pos=1243,52
Size=349,103
Collapsed=0
DockId=0x00000008,0

[Window][Lighting]
Pos=1559,173
Size=353,851
Pos=1186,157
Size=406,735
Collapsed=0
DockId=0x0000000B,1

Expand Down Expand Up @@ -122,9 +122,10 @@ Size=1437,747
Collapsed=0

[Window][Node Scripting]
Pos=319,130
Size=1079,667
Pos=327,52
Size=914,606
Collapsed=0
DockId=0x00000001,1

[Window][Shader Editor]
Pos=430,141
Expand Down Expand Up @@ -192,8 +193,8 @@ Size=1102,265
Collapsed=0

[Window][###CONSOLE]
Pos=8,630
Size=379,262
Pos=8,658
Size=261,234
Collapsed=0
DockId=0x0000000C,0

Expand Down Expand Up @@ -244,16 +245,16 @@ Collapsed=0

[Docking][Data]
DockSpace ID=0x115F147C Window=0xE96CCF45 Pos=8,52 Size=1584,840 Split=X
DockNode ID=0x00000003 Parent=0x115F147C SizeRef=1434,840 Split=X
DockNode ID=0x00000003 Parent=0x115F147C SizeRef=1553,840 Split=X
DockNode ID=0x00000005 Parent=0x00000003 SizeRef=1173,948 Split=X
DockNode ID=0x0000000D Parent=0x00000005 SizeRef=379,519 Split=Y Selected=0x9A68760C
DockNode ID=0x00000007 Parent=0x0000000D SizeRef=350,708 CentralNode=1 Selected=0x9A68760C
DockNode ID=0x0000000C Parent=0x0000000D SizeRef=350,262 Selected=0x1F4FE5A4
DockNode ID=0x0000000E Parent=0x00000005 SizeRef=733,519 Split=Y Selected=0xAE7BB42F
DockNode ID=0x00000001 Parent=0x0000000E SizeRef=1168,707 Selected=0xAE7BB42F
DockNode ID=0x00000002 Parent=0x0000000E SizeRef=1168,263 Selected=0x1BE2321A
DockNode ID=0x0000000D Parent=0x00000005 SizeRef=261,519 Split=Y Selected=0x9A68760C
DockNode ID=0x00000007 Parent=0x0000000D SizeRef=350,604 CentralNode=1 Selected=0x9A68760C
DockNode ID=0x0000000C Parent=0x0000000D SizeRef=350,234 Selected=0x1F4FE5A4
DockNode ID=0x0000000E Parent=0x00000005 SizeRef=970,519 Split=Y Selected=0xAE7BB42F
DockNode ID=0x00000001 Parent=0x0000000E SizeRef=1168,606 Selected=0xAE7BB42F
DockNode ID=0x00000002 Parent=0x0000000E SizeRef=1168,232 Selected=0x1BE2321A
DockNode ID=0x00000006 Parent=0x00000003 SizeRef=409,948 Selected=0xF02CD328
DockNode ID=0x00000004 Parent=0x115F147C SizeRef=468,840 Split=Y Selected=0xF02CD328
DockNode ID=0x00000004 Parent=0x115F147C SizeRef=349,840 Split=Y Selected=0xF02CD328
DockNode ID=0x00000009 Parent=0x00000004 SizeRef=339,703 Split=Y Selected=0xF02CD328
DockNode ID=0x00000008 Parent=0x00000009 SizeRef=339,86 Selected=0x637B2906
DockNode ID=0x0000000B Parent=0x00000009 SizeRef=339,615 Selected=0xF02CD328
Expand Down
2 changes: 1 addition & 1 deletion EngineAssets/editor.settings
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"Theme":3,"ThemePath":"","UseDiscord":true,"EditorCameraSpeed":4.0,"EditorCameraSensitivity":1.0,"MaxConsoleLogs":100}
{"Theme":1,"ThemePath":"","UseDiscord":true,"EditorCameraSpeed":4.0,"EditorCameraSensitivity":1.0,"MaxConsoleLogs":100}
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ dependencies {

runtimeOnly "de.fabmax:physx-jni:1.0.0:natives-windows"

testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.2'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
}

test {
Expand Down
Binary file modified build/tmp/compileJava/previous-compilation-data.bin
Binary file not shown.
7 changes: 7 additions & 0 deletions src/main/java/Radium/Editor/EditorGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,13 @@ public static String Dropdown(String label, int displayValue, String[] displayEn
return null;
}

public static int DropdownIndex(String label, int displayValue, String[] displayEnum) {
ImInt val = new ImInt(displayValue);
ImGui.combo(label, val, displayEnum, displayEnum.length);

return val.get();
}

public static void AudioPlayer(AudioClip clip) {
ImDrawList dl = ImGui.getWindowDrawList();
ImVec2 cp = ImGui.getCursorScreenPos();
Expand Down
11 changes: 3 additions & 8 deletions src/main/java/Radium/Editor/EditorTheme.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ public class EditorTheme {

protected EditorTheme() {}

public static void MonoChrome() {
ImGuiStyle style = ImGui.getStyle();
public static void MonoChrome(ImGuiStyle style) {
style.setAlpha(1.0f);
style.setChildRounding(3);
style.setWindowRounding(3);
Expand Down Expand Up @@ -61,9 +60,7 @@ public static void MonoChrome() {
style.setColor(ImGuiCol.ModalWindowDimBg, ImColor.floatToColor(0.04f, 0.10f, 0.09f, 0.51f));
}

public static void Dark() {
ImGuiStyle style = ImGui.getStyle();

public static void Dark(ImGuiStyle style) {
style.setFrameRounding(4.0f);
style.setGrabRounding(4.0f);
style.setColor(ImGuiCol.Text, ImColor.floatToColor(0.95f, 0.96f, 0.98f, 1.00f));
Expand Down Expand Up @@ -117,9 +114,7 @@ public static void Dark() {

}

public static void ModernDark() {
ImGuiStyle style = ImGui.getStyle();

public static void ModernDark(ImGuiStyle style) {
style.setAntiAliasedLines(true);
style.setAntiAliasedFill(true);

Expand Down
29 changes: 25 additions & 4 deletions src/main/java/Radium/Editor/Files/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,28 @@ public class Parser {
public static List<File> prefabs = new ArrayList<>();
private static final String[] prefabExtension = new String[] { "prefab" };

public static List<File> nodeGraphs = new ArrayList<>();
private static final String[] nodeGraphExtensions = new String[] { "graph" };

protected Parser() {}

public static void ParseAll() {
File projectRoot = Project.Current().assetsDirectory;
FileSearch(projectRoot, all);

for (File f : all) {
if (FileUtility.IsFileType(f, imageExtensions)) {
String extension = FileUtility.GetFileExtension(f);

if (FileUtility.IsFileType(f, extension, imageExtensions)) {
images.add(f);
} else if (FileUtility.IsFileType(f, animationExtensions)) {
} else if (FileUtility.IsFileType(f, extension, animationExtensions)) {
animations.add(f);
} else if (FileUtility.IsFileType(f, audioExtensions)) {
} else if (FileUtility.IsFileType(f, extension, audioExtensions)) {
audio.add(f);
} else if (FileUtility.IsFileType(f, prefabExtension)) {
} else if (FileUtility.IsFileType(f, extension, prefabExtension)) {
prefabs.add(f);
} else if (FileUtility.IsFileType(f, extension, nodeGraphExtensions)) {
nodeGraphs.add(f);
}
}
}
Expand All @@ -50,6 +57,20 @@ public static void LoadImages() {
}
}

public static void UpdateGraphs() {
nodeGraphs.clear();
File projectRoot = Project.Current().assetsDirectory;

List<File> newGraphs = new ArrayList<>();
FileSearch(projectRoot, newGraphs);

for (File f : newGraphs) {
if (FileUtility.IsFileType(f, nodeGraphExtensions)) {
nodeGraphs.add(f);
}
}
}

private static void FileSearch(File directory, List<File> allFiles) {
for (File f : directory.listFiles()) {
if (f.isFile()) {
Expand Down
1 change: 0 additions & 1 deletion src/main/java/Radium/Editor/Gui.java
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ public static void StartFrame() {
io.setDisplaySize(winWidth[0], winHeight[0]);
io.setDisplayFramebufferScale((float) fbWidth[0] / winWidth[0], (float) fbHeight[0] / winHeight[0]);
io.setMousePos((float) mousePosX[0], (float) mousePosY[0]);
io.setFramerate(1.0f / Time.deltaTime);

// Update the mouse cursor
final int imguiCursor = imgui.ImGui.getMouseCursor();
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/Radium/Editor/Icons.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ public static void Initialize() {
icons.put("animation", Load("EngineAssets/Editor/Explorer/animation.png"));
icons.put("audio", Load("EngineAssets/Editor/Explorer/audio.png"));
icons.put("prefab", Load("EngineAssets/Editor/gameobject.png"));
icons.put("node_event", Load("EngineAssets/Editor/NodeEditor/event.png"));
icons.put("node_graph", Load("EngineAssets/Editor/Icons/node_scripting.png"));
icons.put("search", Load("EngineAssets/Editor/search.png"));
}

public static int GetIcon(String name) {
Expand Down
25 changes: 25 additions & 0 deletions src/main/java/Radium/Editor/Inspector.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package Radium.Editor;

import Radium.Editor.Files.Parser;
import Radium.Engine.Application;
import Radium.Engine.Component;
import Radium.Engine.Components.Physics.Rigidbody;
import Radium.Engine.Components.Scripting.NodeScripting;
import Radium.Engine.Graphics.Texture;
import Radium.Engine.Input.Input;
import Radium.Engine.Input.Keys;
Expand Down Expand Up @@ -264,6 +266,7 @@ public static void Render() {
if (submenus.get(i).get(0).submenu != "") {
if (ImGui.treeNodeEx(submenus.get(i).get(0).submenu, ImGuiTreeNodeFlags.FramePadding | ImGuiTreeNodeFlags.SpanAvailWidth)) {
for (Component comp : submenus.get(i)) {
if (comp.Hide) continue;
ImGui.image(comp.icon, 20, 20);
ImGui.sameLine();
if (ImGui.treeNodeEx(comp.name, ImGuiTreeNodeFlags.FramePadding | ImGuiTreeNodeFlags.SpanAvailWidth | ImGuiTreeNodeFlags.Leaf)) {
Expand Down Expand Up @@ -310,6 +313,8 @@ public static void Render() {
}
} else {
for (Component comp : submenus.get(i)) {
if (comp.Hide) continue;

ImGui.image(comp.icon, 20, 20);
ImGui.sameLine();
if (ImGui.treeNodeEx(comp.name, ImGuiTreeNodeFlags.FramePadding | ImGuiTreeNodeFlags.SpanAvailWidth | ImGuiTreeNodeFlags.Leaf)) {
Expand Down Expand Up @@ -353,8 +358,28 @@ public static void Render() {
}
}
}
if (ImGui.treeNodeEx("Node Graphs", ImGuiTreeNodeFlags.FramePadding | ImGuiTreeNodeFlags.SpanAvailWidth)) {
for (File graph : Parser.nodeGraphs) {
ImGui.image(Icons.GetIcon("node_graph"), 25, 25);
ImGui.sameLine();
if (ImGui.treeNodeEx(graph.getName(), ImGuiTreeNodeFlags.FramePadding | ImGuiTreeNodeFlags.SpanAvailWidth | ImGuiTreeNodeFlags.Leaf)) {
if (ImGui.isItemClicked()) {
SceneHierarchy.current.AddComponent(new NodeScripting(graph));

componentChooserOpen = false;
ImGui.closeCurrentPopup();
}

ImGui.treePop();
}
}

ImGui.treePop();
}
} else {
for (Component comp : components) {
if (comp.Hide) continue;

if (comp.name.toLowerCase().contains(search.get().toLowerCase())) {
ImGui.image(comp.icon, 20, 20);
ImGui.sameLine();
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/Radium/Editor/KeyBindManager.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package Radium.Editor;

import Radium.Editor.Debug.Debug;
import Radium.Editor.MousePicking.MousePicking;
import Radium.Editor.NodeScripting.NodeScripting;
import Radium.Engine.Input.Input;
import Radium.Engine.Input.Keys;
import Radium.Engine.SceneManagement.SceneManager;
Expand Down Expand Up @@ -35,7 +34,7 @@ public static void RegisterKeybind(Keys[] keys, Runnable action) {
*/
public static void Initialize() {
RegisterKeybind(new Keys[] { Keys.Delete }, () -> {
if (SceneHierarchy.current != null) {
if (SceneHierarchy.current != null && !NodeScripting.FocusingEditor) {
SceneHierarchy.current.Destroy();
SceneHierarchy.current = null;
}
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/Radium/Editor/MenuBar.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package Radium.Editor;

import Radium.Editor.NodeScripting.NodeScripting;
import Radium.Integration.Project.Project;
import Radium.Engine.EventSystem.EventSystem;
import Radium.Engine.EventSystem.Events.Event;
Expand Down Expand Up @@ -139,11 +140,9 @@ public static void RenderMenuBar() {
window.Render = true;
}
}

/*
if (ImGui.menuItem("Node Scripting")) {
NodeScripting.Render = true;
}*/
}

ImGui.endMenu();
} else {
Expand Down
16 changes: 9 additions & 7 deletions src/main/java/Radium/Editor/MousePicking/MousePicking.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,15 @@ public static void Render() {
GL11.glReadPixels((int)mouse.x, (int)mouse.y,1,1, GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, data);
int pickedID = data[0] + data[1] * 256 + data[2] * 256 * 256;

if (pickedID == 0 || pickedID < 0 || pickedID - 1 >= SceneManager.GetCurrentScene().gameObjectsInScene.size()) {
SceneHierarchy.current = null;
} else {
SceneHierarchy.current = SceneManager.GetCurrentScene().gameObjectsInScene.get(pickedID - 1);
SceneHierarchy.OpenTreeNodes(SceneHierarchy.current);
SceneHierarchy.ScrollTo(SceneHierarchy.current);
ProjectExplorer.SelectedFile = null;
if (hasRendered) {
if (pickedID == 0 || pickedID < 0 || pickedID - 1 >= SceneManager.GetCurrentScene().gameObjectsInScene.size()) {
SceneHierarchy.current = null;
} else {
SceneHierarchy.current = SceneManager.GetCurrentScene().gameObjectsInScene.get(pickedID - 1);
SceneHierarchy.OpenTreeNodes(SceneHierarchy.current);
SceneHierarchy.ScrollTo(SceneHierarchy.current);
ProjectExplorer.SelectedFile = null;
}
}
}

Expand Down
Loading

0 comments on commit a581664

Please sign in to comment.