Skip to content

Commit

Permalink
A lot of changes and fixes, which will be described in the release no…
Browse files Browse the repository at this point in the history
…tes; Added GitHub Actions for testing purposes.
  • Loading branch information
Azzinoth committed Jun 16, 2024
1 parent ff367bd commit 252484d
Show file tree
Hide file tree
Showing 14 changed files with 594 additions and 194 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/Build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Build

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:
runs-on: windows-latest
strategy:
matrix:
build_type: [Debug, Release]

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Checkout master branch
run: git checkout master

# In order to build we need to use tests branch.
- name: Copy files from master branch to temporary folder
run: |
mkdir "${{github.workspace}}\master_temp"
robocopy "${{github.workspace}}\" "${{github.workspace}}\master_temp" /NFL /E /XD "${{github.workspace}}\master_temp"
# Robocopy will return 1 if successful, so we need to exit with 0 to avoid triggering a failure for this step
if ($LastExitCode -eq 1) {
echo "All files were copied successfully. Continuing..."
exit 0
} elseif ($LastExitCode -gt 7) {
echo "An error occurred during file copying. Exiting..."
exit $LastExitCode
}
- name: Checkout tests branch
run: |
git checkout tests
- name: Copy master branch files from temporary folder to MasterBranchCode folder
run: |
robocopy "${{github.workspace}}\master_temp" "${{github.workspace}}\MasterBranchCode" /NFL /E
# Robocopy will return 1 if successful, so we need to exit with 0 to avoid triggering a failure for this step
if ($LastExitCode -eq 1) {
echo "All files were copied successfully. Continuing..."
exit 0
} elseif ($LastExitCode -gt 7) {
echo "An error occurred during file copying. Exiting..."
exit $LastExitCode
}
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}

- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{ matrix.build_type }}
85 changes: 85 additions & 0 deletions .github/workflows/ContinuousIntegration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: ContinuousIntegration

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
types: [opened, reopened, synchronize]

jobs:
ContinuousIntegration:
runs-on: windows-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Checkout master branch
run: git checkout master

- name: Copy files from master branch to temporary folder
run: |
mkdir "${{github.workspace}}\master_temp"
robocopy "${{github.workspace}}\" "${{github.workspace}}\master_temp" /NFL /E /XD "${{github.workspace}}\master_temp"
# Robocopy will return 1 if successful, so we need to exit with 0 to avoid triggering a failure for this step
if ($LastExitCode -eq 1) {
echo "All files were copied successfully. Continuing..."
exit 0
} elseif ($LastExitCode -gt 7) {
echo "An error occurred during file copying. Exiting..."
exit $LastExitCode
}
- name: Checkout tests branch
run: git checkout tests

- name: Copy master branch files from temporary folder to MasterBranchCode folder
run: |
robocopy "${{github.workspace}}\master_temp" "${{github.workspace}}\MasterBranchCode" /NFL /E
# Robocopy will return 1 if successful, so we need to exit with 0 to avoid triggering a failure for this step
if ($LastExitCode -eq 1) {
echo "All files were copied successfully. Continuing..."
exit 0
} elseif ($LastExitCode -gt 7) {
echo "An error occurred during file copying. Exiting..."
exit $LastExitCode
}
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release

- name: Build
run: cmake --build ${{github.workspace}}/build --config Release

- name: Ensure all files are in place
run: |
Move "${{github.workspace}}\build\Release\Visual_Node_System_Tests.exe" "${{github.workspace}}\Visual_Node_System_Tests.exe"
- name: Run test
run: |
$processStartInfo = New-Object System.Diagnostics.ProcessStartInfo
$processStartInfo.FileName = "Visual_Node_System_Tests.exe"
Write-Host "Starting the executable..."
$process = New-Object System.Diagnostics.Process
$process.StartInfo = $processStartInfo
$process.Start() | Out-Null
Write-Host "Executable started."
Write-Host "Waiting for the process to exit..."
$process.WaitForExit(10000) # 10 seconds
if ($process.ExitCode -ne 0) {
Write-Host "Some tests failed. Please check the test results."
exit 1
}
- name: Print additional test results if failed
if: failure()
run: |
Get-Content "Results.xml" | ForEach-Object {
Write-Host $_
}
30 changes: 15 additions & 15 deletions GroupComment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,21 @@ void GroupComment::Draw() {}

Json::Value GroupComment::ToJson()
{
Json::Value result;

result["ID"] = ID;
result["position"]["x"] = Position.x;
result["position"]["y"] = Position.y;
result["size"]["x"] = Size.x;
result["size"]["y"] = Size.y;
result["caption"] = Caption;
result["bMoveElementsWithComment"] = bMoveElementsWithComment;
result["BackgroundColor"]["x"] = BackgroundColor.x;
result["BackgroundColor"]["y"] = BackgroundColor.y;
result["BackgroundColor"]["z"] = BackgroundColor.z;
result["BackgroundColor"]["w"] = BackgroundColor.w;

return result;
Json::Value Result;

Result["ID"] = ID;
Result["position"]["x"] = Position.x;
Result["position"]["y"] = Position.y;
Result["size"]["x"] = Size.x;
Result["size"]["y"] = Size.y;
Result["caption"] = Caption;
Result["bMoveElementsWithComment"] = bMoveElementsWithComment;
Result["BackgroundColor"]["x"] = BackgroundColor.x;
Result["BackgroundColor"]["y"] = BackgroundColor.y;
Result["BackgroundColor"]["z"] = BackgroundColor.z;
Result["BackgroundColor"]["w"] = BackgroundColor.w;

return Result;
}

void GroupComment::FromJson(Json::Value Json)
Expand Down
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# Visual Node System

![build](https://github.com/Azzinoth/VisualNodeSystem-Example/actions/workflows/Build.yml/badge.svg?branch=master)
<div align="center">
<h1> Visual Node System </h1>
<img src="https://github.com/Azzinoth/VisualNodeSystem/actions/workflows/Build.yml/badge.svg" alt="Build Status">
<img src="https://github.com/Azzinoth/VisualNodeSystem/actions/workflows/ContinuousIntegration.yml/badge.svg" alt="Continuous Integration">
</div>

This library provides a powerful framework for creating and managing visual node systems. These are typically used in graphical programming environments, game logic builders, and AI behavior tree editors.

Master branch is free of tests to maintain its lightweightness. All test-related stuff (except GitHub Actions) is located in the [Tests Branch](https://github.com/Azzinoth/VisualNodeSystem/tree/tests)

## Key Features

- **Unchanged Dear Imgui**: This project does not depend on modifications to Dear Imgui.
Expand All @@ -27,6 +31,11 @@ This library provides a powerful framework for creating and managing visual node

- **JSON Serialization**: The library provides functionalities to serialize/deserialize the node data to/from JSON format.

- **Integrated Copy/Paste**: With the help of JSON serialization/deserialization, elements can be copied from one node area to the same or another node area.
<div align="center">
<img src="https://github.com/Azzinoth/VisualNodeSystem/blob/media/Copy and Paste.gif" width="60%">
</div>

- **Node Factory For Child Node Creation**: The library includes a system for creating child nodes using node factory, which enables JSON serialization of custom nodes.

- **Custom Context Menus**: The library supports the integration of custom context menus.
Expand Down
Loading

0 comments on commit 252484d

Please sign in to comment.