Skip to content

Commit

Permalink
Merge pull request #2 from alexge50/develop
Browse files Browse the repository at this point in the history
v0.2.0
  • Loading branch information
alexge50 authored Jul 23, 2019
2 parents 46397d1 + e9a2a73 commit ebcd1ae
Show file tree
Hide file tree
Showing 151 changed files with 4,438 additions and 2,903 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "3rdparty/nodeeditor"]
path = 3rdparty/nodeeditor
url = https://github.com/paceholder/nodeeditor.git
url = https://github.com/alexge50/nodeeditor
[submodule "3rdparty/Qt-Color-Widgets"]
path = 3rdparty/Qt-Color-Widgets
url = https://gitlab.com/mattia.basaglia/Qt-Color-Widgets.git
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/nodeeditor
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ cmake_minimum_required(VERSION 3.9)
project(GIE)

if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -Wno-deprecated-declarations")
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -Wno-deprecated-declarations")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
endif()
Expand All @@ -15,6 +17,7 @@ if(NOT TARGET Catch2)
add_subdirectory(3rdparty/Catch2)
endif()
add_subdirectory(3rdparty/Qt-Color-Widgets)
add_subdirectory(util)
add_subdirectory(gie)
add_subdirectory(modules)
add_subdirectory(gui)
Expand Down
32 changes: 28 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# GIE
![](https://img.shields.io/badge/version-0.1.0-blue.svg)
![](https://img.shields.io/badge/version-0.2.0-blue.svg)

GIE (Generative Image Editor, `/jəī/`) is a node based image editor, inspired by Blender's material node editing feature. Building upon the descriptive nature of visual data flow programming, each node represent a mutation done to a source image.
GIE (Generative Image Editor, `/jəī/`) is a node based image editor, inspired by Blender's material node editing feature. Building upon the descriptive nature of visual data flow programming, each node represents a mutation done to a source image.

![gie screen shot](screenshots/screenshot-1.png)
![GIE](screenshots/gie.jpg)

## Usage
The UI is intended to be relatively straight-forward. Much like in Blender, the right click context menu contains all possible nodes. In order to use pictures as sources, the user has to import them through the menu present on the top bar.
Expand All @@ -19,6 +19,7 @@ Requirements:
* c++17 compatible compiler (gcc recommended!)
* boost.python
* qt5
* python environment + numpy and scipy

```bash
git clone https://github.com/alexge50/gie.git
Expand All @@ -34,7 +35,30 @@ make install
### Windows
* binaries coming soon

## Screenshots

![gie screen shot](screenshots/screenshot-4.png)

![gie screen shot](screenshots/screenshot-1.png)

![gie screen shot](screenshots/screenshot-2.png)

![gie screen shot](screenshots/screenshot-3.png)

## Change log
`version 0.2.0`:
* live code reload
* numpy integration
* moved compute work to separated thread
* added various nodes
* log console

`version 0.1.0`:
* initial version
* load/open project
* import/export images
* node based editor

## TODO
* custom Qt UI theme
* allow user side scripting from the interface - creating nodes that invoke user code
* multi-threading - allowing multiple nodes to be run at the same time
3 changes: 3 additions & 0 deletions ci/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ RUN apt-get install -qq -y --no-install-recommends \
python3 \
libboost-dev \
libboost-python1.67-dev \
libboost-numpy1.67-dev \
qt5-default \
libqt5opengl5-dev \
libqt5designer5 \
qttools5-dev \
xvfb

ENTRYPOINT ["/bin/bash"]
2 changes: 1 addition & 1 deletion ci/build-app
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ BUILD_DIR=$PWD/build
mkdir $BUILD_DIR
cd $BUILD_DIR
cmake ..
cmake --build . --target gie_test
make
cd gie
./gie_test
24 changes: 4 additions & 20 deletions gie/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,14 @@ project(gie_library VERSION 0.0.0 DESCRIPTION "GenerativeImageEditor library")
set(CMAKE_CXX_STANDARD 17)
include(GNUInstallDirs)

set(LIBRARY_SOURCES
include/gie/Argument.h
include/gie/NodeDrawable.h
include/gie/ScriptGraph/Execute.h
include/gie/ScriptGraph/ScriptGraph.h
include/gie/NodeLogic.h
include/gie/Node.h
include/gie/Program.h
include/gie/PythonContext.h
include/gie/Value.h
src/Program.cpp
src/PythonContext.cpp
src/ScriptGraph/Execute.cpp
src/ScriptGraph/ScriptGraph.cpp
include/gie/NodeUtil.h
src/NodeUtil.cpp
include/gie/Result.h
)
file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS src/*)
file(GLOB_RECURSE HEADERS CONFIGURE_DEPENDS include/*)

find_package(Boost COMPONENTS python3 REQUIRED)
find_package(PythonLibs REQUIRED)

add_library(gie STATIC ${LIBRARY_SOURCES})
target_link_libraries(gie PUBLIC ${Boost_LIBRARIES} ${PYTHON_LIBRARIES})
add_library(gie STATIC ${SOURCES} ${HEADERS} include/gie/NodeId.h)
target_link_libraries(gie PUBLIC util ${Boost_LIBRARIES} ${PYTHON_LIBRARIES})
target_include_directories(gie PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
Expand Down
18 changes: 17 additions & 1 deletion gie/include/gie/Argument.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,30 @@
#ifndef GIE_LIBRARY_ARGUMENT_H
#define GIE_LIBRARY_ARGUMENT_H

#include <string>
#include <gie/Type.h>
#include <gie/Value.h>
#include <gie/NodeId.h>

#include <StrongAlias.h>

#include <string>
#include <vector>
#include <memory>
#include <utility>
#include <variant>


struct ArgumentMetadata
{
std::string m_argumentName;
Type m_argumentType;
};

struct NoArgument {};

using ArgumentId = StrongAlias<std::size_t, struct ArgumentIdTag>;
using ArgumentValue = std::variant<NodeId, Value, NoArgument>;

using Arguments = std::vector<ArgumentValue>;

#endif //GIE_LIBRARY_ARGUMENT_H
73 changes: 73 additions & 0 deletions gie/include/gie/Error.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
//
// Created by alex on 7/14/19.
//

#ifndef GIE_ERROR_H
#define GIE_ERROR_H

class NodeInterfaceError
{
public:
enum class errors
{
TypeCheckingFailed = 0,
IncorrectNodeId,
IncorrectSymbolName
};

explicit NodeInterfaceError(errors error): m_error{error} {}

const char* what()
{
static const char* names[] = {"TypeCheckingFailed", "IncorrectNodeId", "IncorrectSymbolName"};

return names[static_cast<int>(m_error)];
}

private:
errors m_error;
};

class ExecutionInterfaceError
{
public:
enum class errors
{
PythonInternalError = 0,
InvalidArguments
};

explicit ExecutionInterfaceError(errors error, NodeId id, std::optional<std::string> detail = std::nullopt):
m_error{error},
m_id{id},
m_detail{std::move(detail)}
{}

std::string what()
{
static const char* names[] = {"PythonInternalError", "InvalidArguments"};
std::string buffer = names[static_cast<int>(error())];
buffer += "(";
buffer += std::to_string(id().get());
buffer += ")";

if(m_detail)
{
buffer += ": ";
buffer += m_detail.value();
}

return buffer;
}

NodeId id() const { return m_id; }
errors error() const { return m_error; }
const std::optional<std::string>& detail() const { return m_detail; }

private:
errors m_error;
NodeId m_id;
std::optional<std::string> m_detail;
};

#endif //GIE_ERROR_H
34 changes: 25 additions & 9 deletions gie/include/gie/Node.h
Original file line number Diff line number Diff line change
@@ -1,26 +1,42 @@
#include <utility>

#include <utility>

//
// Created by alex on 11/17/18.
//

#ifndef GIE_LIBRARY_NODE_H
#define GIE_LIBRARY_NODE_H

#include "NodeDrawable.h"
#include "NodeLogic.h"
#include "NodeMetadata.h"
#include <gie/Argument.h>
#include <gie/NodeId.h>
#include <gie/PythonContext.h>

#include <vector>
#include <memory>
#include <cstddef>

using NodeId = std::size_t;

struct Node
class Node
{
NodeDrawable m_drawable;
NodeLogic m_logic;
NodeMetadata m_metadata;
private:
Node(Arguments arguments, SymbolId symbolId):
arguments{std::move(arguments)},
m_symbolId{symbolId}
{}

public:
Arguments arguments;

public:
const SymbolId& symbolId() const { return m_symbolId; }

private:
SymbolId m_symbolId;

friend std::optional<Node> makeNode(const PythonContext&, const std::string& name, Arguments);
};

std::optional<Node> makeNode(const PythonContext&, const std::string& name, Arguments);

#endif //GIE_LIBRARY_NODE_H
15 changes: 0 additions & 15 deletions gie/include/gie/NodeDrawable.h

This file was deleted.

29 changes: 29 additions & 0 deletions gie/include/gie/NodeId.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// Created by alex on 7/14/19.
//

#ifndef GIE_NODEID_H
#define GIE_NODEID_H

#include <StrongAlias.h>
#include <functional>

using NodeId = StrongAlias<std::size_t, struct NodeIdTag>;

inline bool operator==(const NodeId& lhs, const NodeId& rhs) { return lhs.get() == rhs.get(); }

namespace std
{
template<> struct hash<NodeId>
{
using argument_type = NodeId;
using result_type = std::size_t;

result_type operator()(const NodeId& id) const noexcept
{
return (std::hash<std::size_t>{})(id.get());
}
};
}

#endif //GIE_NODEID_H
27 changes: 0 additions & 27 deletions gie/include/gie/NodeLogic.h

This file was deleted.

24 changes: 0 additions & 24 deletions gie/include/gie/NodeMetadata.h

This file was deleted.

Loading

0 comments on commit ebcd1ae

Please sign in to comment.