feat: operator table transfer
This commit is contained in:
@@ -67,7 +67,7 @@ qt_add_executable(${AppExec}
|
|||||||
${ENGINE_SOURCES}
|
${ENGINE_SOURCES}
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(${AppExec} PRIVATE Qt6::Core Qt6::Widgets Qt6::SvgWidgets Qt6::OpenGLWidgets glm::glm Eigen3::Eigen TBB::tbb)
|
target_link_libraries(${AppExec} PRIVATE Qt6::Core Qt6::Widgets Qt6::SvgWidgets Qt6::OpenGLWidgets glm::glm Eigen3::Eigen TBB::tbb Boost::filesystem Boost::system)
|
||||||
target_include_directories(${AppExec} PUBLIC src)
|
target_include_directories(${AppExec} PUBLIC src)
|
||||||
|
|
||||||
# tests
|
# tests
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ enzo::nt::NetworkManager* enzo::nt::NetworkManager::getInstance()
|
|||||||
|
|
||||||
enzo::nt::GeometryOperator& enzo::nt::NetworkManager::getGeoOperator(nt::OpId opId)
|
enzo::nt::GeometryOperator& enzo::nt::NetworkManager::getGeoOperator(nt::OpId opId)
|
||||||
{
|
{
|
||||||
|
std::cout << "gop size middle getter: " << gopStore_.size() <<"\n"; // <- size 0
|
||||||
if(opId>gopStore_.size())
|
if(opId>gopStore_.size())
|
||||||
{
|
{
|
||||||
throw std::out_of_range("OpId: " + std::to_string(opId) + " > max opId: " + std::to_string(maxOpId_) + "\n");
|
throw std::out_of_range("OpId: " + std::to_string(opId) + " > max opId: " + std::to_string(maxOpId_) + "\n");
|
||||||
@@ -51,6 +52,7 @@ bool enzo::nt::NetworkManager::isValidOp(nt::OpId opId)
|
|||||||
|
|
||||||
void enzo::nt::NetworkManager::setDisplayOp(OpId opId)
|
void enzo::nt::NetworkManager::setDisplayOp(OpId opId)
|
||||||
{
|
{
|
||||||
|
std::cout << "gop size before: " << gopStore_.size() <<"\n";
|
||||||
displayOp_=opId;
|
displayOp_=opId;
|
||||||
std::vector<enzo::nt::OpId> dependencyGraph = getDependencyGraph(opId);
|
std::vector<enzo::nt::OpId> dependencyGraph = getDependencyGraph(opId);
|
||||||
enzo::geo::Geometry prevGeometry;
|
enzo::geo::Geometry prevGeometry;
|
||||||
@@ -60,8 +62,10 @@ void enzo::nt::NetworkManager::setDisplayOp(OpId opId)
|
|||||||
{
|
{
|
||||||
cookOp(dependencyOpId);
|
cookOp(dependencyOpId);
|
||||||
}
|
}
|
||||||
|
std::cout << "gop size middle: " << gopStore_.size() <<"\n"; // <- size: 1
|
||||||
enzo::nt::GeometryOperator& displayOp = getGeoOperator(opId);
|
enzo::nt::GeometryOperator& displayOp = getGeoOperator(opId);
|
||||||
updateDisplay(displayOp.getOutputGeo(0));
|
getInstance()->updateDisplay(displayOp.getOutputGeo(0));
|
||||||
|
std::cout << "gop size after: " << gopStore_.size() <<"\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void enzo::nt::NetworkManager::cookOp(enzo::nt::OpId opId)
|
void enzo::nt::NetworkManager::cookOp(enzo::nt::OpId opId)
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public:
|
|||||||
static std::optional<OpId> getDisplayOp();
|
static std::optional<OpId> getDisplayOp();
|
||||||
static bool isValidOp(nt::OpId opId);
|
static bool isValidOp(nt::OpId opId);
|
||||||
static GeometryOperator& getGeoOperator(nt::OpId opId);
|
static GeometryOperator& getGeoOperator(nt::OpId opId);
|
||||||
void setDisplayOp(OpId opId);
|
static void setDisplayOp(OpId opId);
|
||||||
|
|
||||||
#ifdef UNIT_TEST
|
#ifdef UNIT_TEST
|
||||||
static void _reset();
|
static void _reset();
|
||||||
|
|||||||
@@ -5,8 +5,12 @@
|
|||||||
void enzo::op::OperatorTable::addOperator(nt::opConstructor ctorFunc)
|
void enzo::op::OperatorTable::addOperator(nt::opConstructor ctorFunc)
|
||||||
{
|
{
|
||||||
std::cout << "OPERATOR TABLE ADDED\n";
|
std::cout << "OPERATOR TABLE ADDED\n";
|
||||||
// ctorFunc(5);
|
|
||||||
ctorStore_.push_back(ctorFunc);
|
ctorStore_.push_back(ctorFunc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enzo::nt::opConstructor enzo::op::OperatorTable::getOpConstructor(size_t pos)
|
||||||
|
{
|
||||||
|
return ctorStore_.at(pos);
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<enzo::nt::opConstructor> enzo::op::OperatorTable::ctorStore_;
|
std::vector<enzo::nt::opConstructor> enzo::op::OperatorTable::ctorStore_;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
#include "Engine/Network/NetworkManager.h"
|
#include "Engine/Network/NetworkManager.h"
|
||||||
|
#include "Engine/Operator/GeometryOpDef.h"
|
||||||
|
|
||||||
namespace enzo::op
|
namespace enzo::op
|
||||||
{
|
{
|
||||||
@@ -9,6 +10,7 @@ class BOOST_SYMBOL_EXPORT OperatorTable
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void addOperator(nt::opConstructor ctorFunc);
|
static void addOperator(nt::opConstructor ctorFunc);
|
||||||
|
static nt::opConstructor getOpConstructor(size_t pos);
|
||||||
private:
|
private:
|
||||||
static std::vector<nt::opConstructor> ctorStore_;
|
static std::vector<nt::opConstructor> ctorStore_;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "Gui/Network/Network.h"
|
#include "Gui/Network/Network.h"
|
||||||
#include "Engine/Operator/GeometryConnection.h"
|
#include "Engine/Operator/GeometryConnection.h"
|
||||||
#include "Engine/Operator/GeometryOperator.h"
|
#include "Engine/Operator/GeometryOperator.h"
|
||||||
|
#include "Engine/Operator/OperatorTable.h"
|
||||||
#include "Engine/Types.h"
|
#include "Engine/Types.h"
|
||||||
#include "Gui/Network/DisplayFlagButton.h"
|
#include "Gui/Network/DisplayFlagButton.h"
|
||||||
#include "Gui/Network/NodeEdgeGraphic.h"
|
#include "Gui/Network/NodeEdgeGraphic.h"
|
||||||
@@ -297,7 +298,7 @@ void Network::keyPressEvent(QKeyEvent *event)
|
|||||||
}
|
}
|
||||||
case(Qt::Key_F):
|
case(Qt::Key_F):
|
||||||
{
|
{
|
||||||
if(auto newNode = createNode(&GOP_transform::ctor))
|
if(auto newNode = createNode(op::OperatorTable::getOpConstructor(0)))
|
||||||
{
|
{
|
||||||
newNode->setPos(viewPos);
|
newNode->setPos(viewPos);
|
||||||
}
|
}
|
||||||
@@ -383,7 +384,7 @@ void Network::mouseReleaseEvent(QMouseEvent *event)
|
|||||||
NodeGraphic* prevDisplayNode = nodeStore_.at(*prevDisplayOpId);
|
NodeGraphic* prevDisplayNode = nodeStore_.at(*prevDisplayOpId);
|
||||||
prevDisplayNode->setDisplayFlag(false);
|
prevDisplayNode->setDisplayFlag(false);
|
||||||
}
|
}
|
||||||
nm->setDisplayOp(opId);
|
enzo::nt::NetworkManager::setDisplayOp(opId);
|
||||||
static_cast<DisplayFlagButton*>(clickedDisplayFlag)->setEnabled(true);
|
static_cast<DisplayFlagButton*>(clickedDisplayFlag)->setEnabled(true);
|
||||||
}
|
}
|
||||||
if(state_==State::MOVING_NODE)
|
if(state_==State::MOVING_NODE)
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QSurfaceFormat>
|
#include <QSurfaceFormat>
|
||||||
|
#include "Engine/Operator/OperatorTable.h"
|
||||||
|
#include <boost/dll/import.hpp>
|
||||||
|
|
||||||
#include "Interface.h"
|
#include "Interface.h"
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
// set up rendering
|
||||||
QSurfaceFormat format;
|
QSurfaceFormat format;
|
||||||
format.setRenderableType(QSurfaceFormat::OpenGL);
|
format.setRenderableType(QSurfaceFormat::OpenGL);
|
||||||
format.setVersion(3, 2);
|
format.setVersion(3, 2);
|
||||||
@@ -13,6 +16,14 @@ int main(int argc, char **argv)
|
|||||||
format.setSamples(4);
|
format.setSamples(4);
|
||||||
QSurfaceFormat::setDefaultFormat(format);
|
QSurfaceFormat::setDefaultFormat(format);
|
||||||
|
|
||||||
|
// setup table
|
||||||
|
auto initPlugin = boost::dll::import_symbol<void(void (*addOperator)(enzo::nt::opConstructor))>(
|
||||||
|
"build/src/OpDefs/libenzoOps1.so", "newSopOperator"
|
||||||
|
);
|
||||||
|
|
||||||
|
initPlugin(enzo::op::OperatorTable::addOperator);
|
||||||
|
|
||||||
|
|
||||||
QApplication app (argc, argv);
|
QApplication app (argc, argv);
|
||||||
|
|
||||||
EnzoUI interface;
|
EnzoUI interface;
|
||||||
|
|||||||
Reference in New Issue
Block a user