Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
scarsty committed Jan 27, 2022
2 parents 93c5c01 + 31a658c commit 7723904
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 27 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ target_include_directories (${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/3rdparty
target_include_directories (${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/3rdparty/imnodes)
target_include_directories (${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/3rdparty/ImGuiFileDialog)

target_link_libraries (${PROJECT_NAME} PRIVATE IMGUI glfw)
target_link_libraries (${PROJECT_NAME} PRIVATE IMGUI)
find_package(SDL2 REQUIRED)
target_include_directories(${PROJECT_NAME} PRIVATE ${SDL2_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} PRIVATE ${SDL2_LIBRARIES})
Expand Down
4 changes: 2 additions & 2 deletions cmake/imgui.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ endif()
# Vulkan, Metal, OpenGL, WebGPU, DirectX
macro (CHECK_PACKAGES)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
find_package(SDL2 REQUIRED)
find_package(glfw3 REQUIRED)
find_package(SDL2 QUIET)
find_package(glfw3 QUIET)
find_package(Vulkan QUIET)
endmacro()

Expand Down
2 changes: 1 addition & 1 deletion nn-editor/ccccloader.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ class ccccLoader : public NodeLoader
virtual void fileToNodes(const std::string& filename, std::deque<Node>& nodes) override;
virtual void nodesToFile(const std::deque<Node>& nodes, const std::string& filename) override;
//virtual std::vector<std::string> efftiveKeys(const std::string& type) override;
virtual void refreshNodeValues(Node& n);
virtual void refreshNodeValues(Node& n) override;
};

2 changes: 1 addition & 1 deletion nn-editor/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ int main(int argc, char* argv[])
if (renderer == NULL)
{
SDL_Log("Error creating SDL_Renderer!");
return false;
return -1;
}
#endif

Expand Down
34 changes: 17 additions & 17 deletions nn-editor/main.mm
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,32 @@
#import <Cocoa/Cocoa.h>

namespace MacOSCode{
char* openFile(){
@autoreleasepool {
id panl = [NSOpenPanel openPanel];
[panl setAllowsMultipleSelection:NO];
[panl setCanChooseDirectories:NO];
[panl setCanCreateDirectories:YES];
[panl setCanChooseFiles:YES];
if([panl runModal]==NSModalResponseOK){
NSString* filepath = [[[panl URLs] firstObject] path];
if(filepath){
if([filepath length] > 0){
char* f = new char[[filepath length]]();
memcpy(f, [filepath cStringUsingEncoding:NSUTF8StringEncoding], [filepath length]);
return f;
char* openFile(){
@autoreleasepool {
id panl = [NSOpenPanel openPanel];
[panl setAllowsMultipleSelection:NO];
[panl setCanChooseDirectories:NO];
[panl setCanCreateDirectories:YES];
[panl setCanChooseFiles:YES];
if([panl runModal]==NSModalResponseOK){
NSString* filepath = [[[panl URLs] firstObject] path];
if(filepath){
if([filepath length] > 0){
char* f = new char[[filepath length]]();
memcpy(f, [filepath cStringUsingEncoding:NSUTF8StringEncoding], [filepath length]);
return f;
}else{
return NULL;
}
}else{
return NULL;
}
}else{
return NULL;
}
}else{
return NULL;
}
}
}
}

int main(int argc, char* argv[])
{
Expand Down
11 changes: 6 additions & 5 deletions nn-editor/nn_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ class ColorNodeEditor
{
filePathName =n;
}
delete n;
return filePathName;
#else
std::string filePathName;
Expand Down Expand Up @@ -361,8 +362,9 @@ class ColorNodeEditor

// The node editor window
std::string window_title = u8"Neural Net Editor";
ImGui::SetWindowSize(window_title.c_str(), ImGui::GetIO().DisplaySize);
ImGui::Begin(window_title.c_str(), NULL, flags);
ImGui::SetWindowSize(window_title.c_str(), ImGui::GetIO().DisplaySize);
window_title.clear();

//if (ImGui::) //close window
if (ImGui::BeginMenuBar())
Expand Down Expand Up @@ -476,6 +478,7 @@ class ColorNodeEditor
// emulate_three_button_mouse ? &ImGui::GetIO().KeyAlt : NULL;
//}
//ImGui::Columns(1);
ImNodes::BeginNodeEditor();

{
select_id_ = -1;
Expand All @@ -486,8 +489,6 @@ class ColorNodeEditor
erase_select_ = 0;
}

ImNodes::BeginNodeEditor();

// Handle new nodes
// These are driven by the user, so we place this code before rendering the nodes
{
Expand Down Expand Up @@ -765,7 +766,6 @@ class ColorNodeEditor
}
}
ImNodes::MiniMap(0.5f, minimap_location_);
ImNodes::EndNodeEditor();

// Handle new links
// These are driven by Imnodes, so we place the code after EndNodeEditor().
Expand Down Expand Up @@ -927,7 +927,8 @@ class ColorNodeEditor
}

//refresh_pos_link();


ImNodes::EndNodeEditor();
ImGui::End();
first_run_ = 0;
}
Expand Down

0 comments on commit 7723904

Please sign in to comment.