Skip to content

Commit

Permalink
more
Browse files Browse the repository at this point in the history
  • Loading branch information
johnhaddon committed Dec 7, 2023
1 parent 6e5b055 commit b365747
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/Gaffer/PlugAlgo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,12 @@ void replacePlug( Gaffer::GraphComponent *parent, PlugPtr plug )

bool Gaffer::PlugAlgo::dependsOnCompute( const ValuePlug *plug )
{
std::cerr << "dependsOnCompute 1 " << plug->fullName() << std::endl;
if( plug->children().empty() )
{
std::cerr << "dependsOnCompute 2 " << plug->fullName() << std::endl;
plug = plug->source<Gaffer::ValuePlug>();
std::cerr << "dependsOnCompute 3 " << plug->fullName() << std::endl;
return plug->direction() == Plug::Out && IECore::runTimeCast<const ComputeNode>( plug->node() );
}
else
Expand Down
13 changes: 8 additions & 5 deletions src/Gaffer/Switch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,27 +420,30 @@ const Plug *Switch::oppositePlug( const Plug *plug, const Context *context ) con

void Switch::updateInternalConnection()
{
std::cerr << "Switch::plugInputChanged 1" << fullName() << std::endl;
std::cerr << "Switch::updateInternalConnection 1 " << fullName() << std::endl;
Plug *out = outPlug();
if( !out )
{
return;
}
std::cerr << "Switch::plugInputChanged 2" << fullName() << std::endl;
std::cerr << "Switch::updateInternalConnection 2 " << fullName() << std::endl;

if( PlugAlgo::dependsOnCompute( enabledPlug() ) || PlugAlgo::dependsOnCompute( indexPlug() ) )
{
std::cerr << "Switch::updateInternalConnection 2.5 " << fullName() << std::endl;
// We can't use an internal connection to implement the switch,
// because the index might vary from context to context. We must
// therefore implement switching via hash()/compute().
out->setInput( nullptr );
std::cerr << "Switch::plugInputChanged 3" << fullName() << std::endl;
std::cerr << "Switch::updateInternalConnection 3 " << fullName() << std::endl;
return;
}

std::cerr << "Switch::updateInternalConnection 3.5 " << fullName() << std::endl;

Plug *in = const_cast<Plug *>( oppositePlug( out, Context::current() ) );
std::cerr << "Switch::plugInputChanged 4" << fullName() << std::endl;
std::cerr << "Switch::updateInternalConnection 4 " << fullName() << std::endl;
out->setInput( in );
std::cerr << "Switch::plugInputChanged 5" << fullName() << std::endl;
std::cerr << "Switch::updateInternalConnection 5 " << fullName() << std::endl;

}

0 comments on commit b365747

Please sign in to comment.