3131#include < Core/Datatypes/Geometry.h>
3232#include < Core/Logging/Log.h>
3333
34- // TODO remove once method is extracted below
35- #include < Dataflow/Network/Connection.h>
36-
3734// Needed to fix conflict between define in X11 header
3835// and eigen enum member.
3936#ifdef Success
@@ -58,14 +55,19 @@ ALGORITHM_PARAMETER_DEF(Render, GeometryFeedbackInfo);
5855ViewScene::ViewScene () : ModuleWithAsyncDynamicPorts(staticInfo_)
5956{
6057 INITIALIZE_PORT (GeneralGeom);
61-
62- get_state ()->connect_state_changed ([this ]() { processViewSceneObjectFeedback (); });
6358}
6459
6560void ViewScene::setStateDefaults ()
6661{
6762 auto state = get_state ();
6863 state->setValue (BackgroundColor, ColorRGB (0.0 , 0.0 , 0.0 ).toString ());
64+ postStateChangeInternalSignalHookup ();
65+ }
66+
67+ void ViewScene::postStateChangeInternalSignalHookup ()
68+ {
69+ std::cout << " view scene hooking up state change slot" << std::endl;
70+ get_state ()->connect_state_changed ([this ]() { processViewSceneObjectFeedback (); });
6971}
7072
7173void ViewScene::portRemovedSlotImpl (const PortId& pid)
@@ -134,24 +136,17 @@ void ViewScene::asyncExecute(const PortId& pid, DatatypeHandle data)
134136
135137void ViewScene::processViewSceneObjectFeedback ()
136138{
137- std::cout << " slot for state change in VS module" << std::endl;
139+ // TODO: match ID of touched geom object with port id, and send that info back too.
140+ // std::cout << "slot for state change in VS module" << std::endl;
138141 auto state = get_state ();
139142 auto newInfo = state->getValue (Parameters::GeometryFeedbackInfo).toVector ();
143+ // std::cout << "feedback info: " << newInfo << std::endl;
140144 if (feedbackInfo_ != newInfo)
141145 {
142- std::cout << " new feedback info: " << newInfo << std::endl;
146+ // std::cout << "new feedback info: " << newInfo << std::endl;
143147 feedbackInfo_ = newInfo;
144148
145- // TODO: extract method in Module class
146- for (auto & inputPort : inputPorts ())
147- {
148- if (inputPort->nconnections () > 0 )
149- {
150- auto connection = inputPort->connection (0 ); // only one incoming connection for input ports
151- VariableHandle info (new Variable (Name (inputPort->id ().toString ()), feedbackInfo_));
152- connection->oport_ ->sendConnectionFeedback (info);
153- }
154- }
149+ sendFeedbackUpstreamAlongIncomingConnections (feedbackInfo_);
155150 }
156151}
157152
0 commit comments