Exemplo n.º 1
0
GraphComponent *GraphComponent::commonAncestor( const GraphComponent *other, IECore::TypeId ancestorType )
{
	set<GraphComponent *> candidates;
	GraphComponent *ancestor = m_parent;
	while( ancestor )
	{
		if( ancestor->isInstanceOf( ancestorType ) )
		{
			candidates.insert( ancestor );
		}
		ancestor = ancestor->m_parent;
	}

	ancestor = other->m_parent;
	while( ancestor )
	{
		if( ancestor->isInstanceOf( ancestorType ) )
		{
			if( candidates.find( ancestor )!=candidates.end() )
			{
				return ancestor;
			}
		}
		ancestor = ancestor->m_parent;
	}
	return 0;

}
Exemplo n.º 2
0
 string ComponentFileName(size_t cnt, const string &folder, const GraphComponent<Graph>& component) {
     stringstream ss;
     ss << folder << cnt;
     if(component.name().size() > 0)
         ss << "graph_" << component.name();
     ss << ".dot";
     return ss.str();
 }
//==============================================================================
void HostFilterComponent::loadPluginFromFile (const File& file)
{
    DBG ("HostFilterComponent::loadPluginFromFile");

    GraphComponent* graph = main->getGraph ();

    if (graph) graph->loadAndAppendPlugin (file, 100, 100);
}
Exemplo n.º 4
0
 string ComponentName(const GraphComponent<Graph>& component) {
     cnt_++;
     stringstream ss;
     ss << name_ << "_" << cnt_;
     if(component.name().size() > 0)
         ss << "_" << component.name();
     ss << "." << extension_;
     return ss.str();
 }
Exemplo n.º 5
0
 void Visualize(const GraphComponent<Graph>& component, GraphPrinter<Graph> &printer) {
     printer.open();
     printer.AddVertices(component.vertices().begin(), component.vertices().end());
     for (auto e_it = component.e_begin(); e_it != component.e_end();
             ++e_it) {
         printer.AddEdge(*e_it);
     }
     printer.close();
 }
Exemplo n.º 6
0
 bool Check(const GraphComponent<Graph> & component) const {
     if (component.v_size() <= min_vertex_number_
             || component.v_size() >= max_vertex_number_)
         return false;
     for (auto iterator = component.e_begin(); iterator != component.e_end();
             ++iterator) {
         if (this->graph().length(*iterator) <= max_length_) {
             return true;
         }
     }
     return false;
 }
Exemplo n.º 7
0
static void loadShaderParameters( const OSLQuery &query, Gaffer::CompoundPlug *parametersPlug, bool keepExistingValues )
{	
	
	// if we're not preserving existing values then remove all existing parameter plugs - the various
	// plug creators above know that if a plug exists then they should preserve its values.
	
	if( !keepExistingValues )
	{
		parametersPlug->clearChildren();
	}
	
	// make sure we have a plug to represent each parameter, reusing plugs wherever possible.
	
	set<string> validPlugNames;
	for( size_t i = 0; i < query.nparams(); ++i )
	{
		const OSLQuery::Parameter *parameter = query.getparam( i );
		const Plug::Direction direction = parameter->isoutput ? Plug::Out : Plug::In;
		if( direction != parametersPlug->direction() )
		{
			continue;
		} 
		
		if( parameter->name.find( "." ) != string::npos )
		{
			// member of a struct - will be loaded when the struct is loaded
			continue;
		}
		
		const Plug *plug = loadShaderParameter( query, parameter, parametersPlug, keepExistingValues );

		if( plug )
		{
			validPlugNames.insert( parameter->name );
		}
	}
	
	// remove any old plugs which it turned out we didn't need
	
	if( keepExistingValues )
	{
		for( int i = parametersPlug->children().size() - 1; i >= 0; --i )
		{
			GraphComponent *child = parametersPlug->getChild<GraphComponent>( i );
			if( validPlugNames.find( child->getName().string() ) == validPlugNames.end() )
			{
				parametersPlug->removeChild( child );
			}
		}
	}
	
}
Exemplo n.º 8
0
GraphComponent *GraphComponent::ancestor( IECore::TypeId type )
{
	GraphComponent *a = m_parent;
	while( a )
	{
		if( a->isInstanceOf( type ) )
		{
			return a;
		}
		a = a->m_parent;
	}
	return 0;
}
Exemplo n.º 9
0
void Graph::buildDataStructure ()
{
    int lastReachedVertex = 0;
	
    while (lastReachedVertex < size)
    {
		if (!reachedVertices[lastReachedVertex])
		{
			GraphComponent *component = new GraphComponent(this);
			std::list<int> *connectedVertices = new std::list<int>();
			std::list<int> *nextVertices = new std::list<int>();
			nextVertices->push_back(lastReachedVertex);
			reachedVertices[lastReachedVertex] = true;
			
			while (!nextVertices->empty())
			{
				int vertex = nextVertices->front();
				nextVertices->pop_front();
				
				connectedVertices->push_back(vertex);
				graphComponents[vertex] = component;
				
				Vertices *adjVertices = getAdjacentVertices(vertex,size);
				for (Vertices::iterator it = adjVertices->begin(); it != adjVertices->end(); ++it)
				{
					int adjVertex = *it;
					if (!reachedVertices[adjVertex])
					{
						nextVertices->push_back(adjVertex);
						reachedVertices[adjVertex] = true;
					}
				}
				delete adjVertices;
			}
			
			delete nextVertices;
			
			component->setVertices(connectedVertices);
			graphComponentSet->insert(component);
			
			delete connectedVertices;			
		}
		
		lastReachedVertex++;
    }
	
    for (GraphComponentSet::iterator it = graphComponentSet->begin(); it != graphComponentSet->end(); ++it)
		(*it)->buildDataStructure();
}
Exemplo n.º 10
0
void InternalGraph::assignPath(AntPath * pt)
{
    GraphComponent * gc;
    const std::vector<PathElement *> & path = pt->getPath();
    for (int i = 0; i < path.size(); ++ i)
    {
        if (path[i]->request == 0) continue;
        gc = vertices[path[i]->request-1];
        if (gc->getType() == GraphComponent::VMACHINE)
        {
            curNodesRes[path[i]->resource] -= gc->getRequired();
            curNodesRam[path[i]->resource] -= gc->getRequiredRam();
        }
        else if (gc->getType() == GraphComponent::STORAGE) curStoresRes[path[i]->resource] -= gc->getRequired();
    }
}
Exemplo n.º 11
0
void GraphComponent::addChildInternal( GraphComponentPtr child )
{
	child->parentChanging( this );
	GraphComponent *previousParent = child->m_parent;
	if( previousParent )
	{
		// remove the child from the previous parent, but don't emit parentChangedSignal.
		// this prevents a parent changed signal with new parent 0 followed by a parent
		// changed signal with the new parent.
		previousParent->removeChildInternal( child, false );
	}
	m_children.push_back( child );
	child->m_parent = this;
	child->setName( child->m_name.value() ); // to force uniqueness
	childAddedSignal()( this, child.get() );
	child->parentChangedSignal()( child.get(), previousParent );
}
Exemplo n.º 12
0
void WriteSimpleComponent(const GraphComponent<Graph>& gc,
		const string& file_name, shared_ptr<GraphColorer<Graph>> colorer,
		const GraphLabeler<Graph> &labeler) {
    EmptyGraphLinker<Graph> linker;
    ofstream os;
    os.open(file_name);
	omnigraph::visualization::ComponentVisualizer<Graph>(gc.g(), false).Visualize(gc, os, labeler, *colorer, linker);
	os.close();
}
void HostFilterComponent::menuItemSelected (int menuItemID,
                                            int topLevelMenuIndex)
{
    Config* config = Config::getInstance();
    GraphComponent* graph = main->getGraph ();

    switch (topLevelMenuIndex)
    {
    case 0: // CommandCategories::file
        {
            // handle recent plugins selection
            int fileID = menuItemID - CommandIDs::recentPlugins;
            if (fileID >= 0 && fileID < config->recentPlugins.getNumFiles())
            {
                File fileToLoad = config->recentPlugins.getFile (fileID);

                if (graph)
                    graph->loadAndAppendPlugin (config->recentPlugins.getFile (fileID), 100, 100);

                break;
            }

            // handle recent session selection
            fileID = menuItemID - CommandIDs::recentSessions;
            if (fileID >= 0 && fileID < config->recentSessions.getNumFiles())
            {
                MemoryBlock fileData;
                File fileToLoad = config->recentSessions.getFile (fileID);

                if (fileToLoad.existsAsFile()
                    && fileToLoad.loadFileAsData (fileData))
                {
                    getFilter ()->setStateInformation (fileData.getData (), fileData.getSize());

                    Config::getInstance()->addRecentSession (fileToLoad);
                    Config::getInstance()->lastSessionFile = fileToLoad;
                }
            }
            break;
        }
    }

    toFront (true);
}
Exemplo n.º 14
0
void WriteComponent(const GraphComponent<Graph>& gc,
		const string& file_name, shared_ptr<GraphColorer<Graph>> colorer,
		const GraphLabeler<Graph> &labeler) {
    EmptyGraphLinker<Graph> linker;
    BorderDecorator<Graph> component_colorer(gc, *colorer, "yellow");
    ofstream os;
    os.open(file_name);
	omnigraph::visualization::ComponentVisualizer<Graph>(gc.g(), true).Visualize(gc, os, labeler, component_colorer, linker);
	os.close();
}
Exemplo n.º 15
0
static boost::python::list values( GraphComponent &c )
{
	const GraphComponent::ChildContainer &ch = c.children();
	boost::python::list l;
	for( GraphComponent::ChildContainer::const_iterator it=ch.begin(); it!=ch.end(); it++ )
	{
		l.append( *it );
	}
	return l;
}
Exemplo n.º 16
0
void GraphComponent::addChildInternal( GraphComponentPtr child, size_t index )
{
	child->parentChanging( this );
	GraphComponent *previousParent = child->m_parent;
	if( previousParent )
	{
		// remove the child from the previous parent, but don't emit parentChangedSignal.
		// this prevents a parent changed signal with new parent null followed by a parent
		// changed signal with the new parent.
		previousParent->removeChildInternal( child, false );
	}

	m_children.insert( m_children.begin() + min( index, m_children.size() ), child );
	child->m_parent = this;
	child->setName( child->m_name.value() ); // to force uniqueness
	Signals::emitLazily( m_signals.get(), &Signals::childAddedSignal, this, child.get() );
	child->parentChanged( previousParent );
	Signals::emitLazily( child->m_signals.get(), &Signals::parentChangedSignal, child.get(), previousParent );
}
Exemplo n.º 17
0
static Plug *loadStructParameter( const OSLQuery &query, const OSLQuery::Parameter *parameter, Gaffer::CompoundPlug *parent, bool keepExistingValues )
{
	CompoundPlug *result = NULL;

	const string name = plugName( parameter );
	CompoundPlug *existingPlug = parent->getChild<CompoundPlug>( name );
	if( existingPlug )
	{
		if( !keepExistingValues )
		{
			existingPlug->clearChildren();
		}
		result = existingPlug;
	}
	else
	{
		result = new CompoundPlug( name, parent->direction(), Plug::Default | Plug::Dynamic );
	}
	
	for( vector<string>::const_iterator it = parameter->fields.begin(), eIt = parameter->fields.end(); it != eIt; ++it )
	{
		std::string fieldName = parameter->name + "." + *it;
		loadShaderParameter( query, query.getparam( fieldName ), result, keepExistingValues );
	}
	
	// remove any old plugs which it turned out we didn't need
	
	if( keepExistingValues )
	{
		for( int i = result->children().size() - 1; i >= 0; --i )
		{
			GraphComponent *child = result->getChild<GraphComponent>( i );
			if( std::find( parameter->fields.begin(), parameter->fields.end(), child->getName().string() ) == parameter->fields.end() )
			{
				result->removeChild( child );
			}
		}
	}
	
	parent->setChild( name, result );
	
	return result;
}
Exemplo n.º 18
0
static boost::python::list keys( GraphComponent &c )
{
	const GraphComponent::ChildContainer &ch = c.children();
	boost::python::list l;
	for( GraphComponent::ChildContainer::const_iterator it=ch.begin(); it!=ch.end(); it++ )
	{
		l.append( (*it)->getName().c_str() );
	}
	return l;
}
Exemplo n.º 19
0
static void delItem( GraphComponent &g, const char *n )
{
	GraphComponentPtr c = g.getChild<GraphComponent>( n );
	if( c )
	{
		g.removeChild( c );
		return;
	}

	PyErr_SetString( PyExc_KeyError, n );
	throw_error_already_set();
}
Exemplo n.º 20
0
static boost::python::tuple children( GraphComponent &c, IECore::TypeId typeId )
{
	const GraphComponent::ChildContainer &ch = c.children();
	boost::python::list l;
	for( GraphComponent::ChildContainer::const_iterator it=ch.begin(); it!=ch.end(); it++ )
	{
		if( (*it)->isInstanceOf( typeId ) )
		{
			l.append( *it );
		}
	}
	return boost::python::tuple( l );
}
Exemplo n.º 21
0
static GraphComponentPtr getItem( GraphComponent &g, long index )
{
	long s = g.children().size();

	if( index < 0 )
	{
		index += s;
	}

	if( index >= s || index < 0 )
	{
		PyErr_SetString( PyExc_IndexError, "GraphComponent index out of range" );
		throw_error_already_set();
	}

	return g.getChild<GraphComponent>( index );
}
Exemplo n.º 22
0
unsigned int InternalGraph::selectVertex(AntPath* pt, unsigned int cur, std::set<unsigned int> & available, bool& s, std::map<Element *, std::set<Link *> >& chan)
{
    // choose request
    unsigned int vertex = 0;
    unsigned int size = available.size();
    std::vector<double> roulette(size);
    std::vector<unsigned int> rouletteIndex(size);
    double value = 0, sum = 0;
    unsigned int index = 0;
    std::set<unsigned int>::iterator itEnd = available.end();
    for (std::set<unsigned int>::iterator i = available.begin(); i != itEnd; i ++, index ++)
    {
        value = pow(arcs[cur][*i]->pher, pherDeg)*pow(arcs[cur][*i]->heur, heurDeg);
        sum += value;
        roulette[index] = sum;
        rouletteIndex[index] = *i;
    }

    double choose = rand()/(double)RAND_MAX * sum;
    if (ZERO(sum))
    {
        std::set<unsigned int>::iterator sel = available.begin();
        vertex = *sel;
        available.erase(sel);
    }
    else
    {
        for (unsigned int i = 0; i < size; ++ i)
        {
            if (choose < roulette[i])
            {
                vertex = rouletteIndex[i];
                unsigned int res = available.erase(rouletteIndex[i]);
                assert(res == 1);
                break;
            }
        }
    }

// choose resource
    GraphComponent * gc = vertices[vertex-1];
    unsigned int res = gc->chooseResource(curNodesRam, pherDeg, heurDeg);
    if (res >= gc->getResNum())
    {
        // failed to choose a resource
        s = false;
        return vertex;
    }

    if (gc->getType() == GraphComponent::VMACHINE)
    {
        curNodesRes[res] -= gc->getRequired();
        curNodesRam[res] -= gc->getRequiredRam();
        updateInternalHeuristic(res, GraphComponent::VMACHINE);
        std::map<Element *, std::set<Link *> >::iterator iter = chan.find(gc->getPointer());
        std::set<Link *> * chanPtr = (iter != chan.end()) ? &(iter->second) : NULL;
        pt->addElement(new PathElement(vertex, gc->getPointer(), res, physNodes[res], chanPtr));
    }
    else if (gc->getType() == GraphComponent::STORAGE)
    {
        curStoresRes[res] -= gc->getRequired();
        updateInternalHeuristic(res, GraphComponent::STORAGE);
        std::map<Element *, std::set<Link *> >::iterator iter = chan.find(gc->getPointer());
        std::set<Link *> * chanPtr = (iter != chan.end()) ? &(iter->second) : NULL;
        pt->addElement(new PathElement(vertex, gc->getPointer(), res, physStores[res], chanPtr));
    }

    s = true;
    return vertex;
}
bool HostFilterComponent::perform (const InvocationInfo& info)
{
    Config* config = Config::getInstance();

    GraphComponent* graph = main->getGraph ();
    Transport* transport = getFilter()->getTransport();

    switch (info.commandID)
    {
    //----------------------------------------------------------------------------------------------
    case CommandIDs::pluginOpen:
        {
            graph->loadAndAppendPlugin ();
            break;
        }
    case CommandIDs::pluginClose:
        {
            graph->closeSelectedPlugins ();
            break;
        }
    case CommandIDs::pluginClear:
        {
            graph->closeAllPlugins ();
            break;
        }
    case CommandIDs::showPluginListEditor:
        {
           if (PluginListWindow::currentPluginListWindow == 0)
               PluginListWindow::currentPluginListWindow = new PluginListWindow (knownPluginList);

           PluginListWindow::currentPluginListWindow->toFront (true);
            
            break;
        }

    //----------------------------------------------------------------------------------------------
#ifndef JOST_VST_PLUGIN
    case CommandIDs::audioOptions:
        {
            StandaloneFilterWindow* window = findParentComponentOfClass ((StandaloneFilterWindow*) 0);
            if (window)
                window->showAudioSettingsDialog ();

            break;
        }
#endif

    case CommandIDs::audioPlay:
        {
            transport->play ();
            break;
        }
    case CommandIDs::audioPlayPause:
        {
            transport->togglePlay ();
            break;
        }
    case CommandIDs::audioStop:
        {
            transport->stop ();
            break;
        }
    case CommandIDs::audioRecord:
        {
            transport->record ();
            break;
        }
    case CommandIDs::audioRewind:
        {
            transport->rewind ();
            break;
        }
    case CommandIDs::audioLoop:
        {
            transport->setLooping (! transport->isLooping());
            break;
        }

    //----------------------------------------------------------------------------------------------
    case CommandIDs::sessionNew:
        {
           bool retValue = 
               AlertWindow::showYesNoCancelBox (AlertWindow::WarningIcon,
                                             T("Unsaved Changes"),
                                             T("Are you sure you want to close the current session? You may lose any unsaved changes."));
            if (retValue)
            {
               closePluginEditorWindows ();
               getFilter()->getHost ()->closeAllPlugins (true);

               clearComponents ();
               Config::getInstance()->lastSessionFile = File::nonexistent;
               rebuildComponents ();
            }
            break;
        }
    
    case CommandIDs::sessionLoad:
        {
            FileChooser myChooser (T("Load a session file..."),
                                    Config::getInstance ()->lastSessionDirectory,
                                    JOST_SESSION_WILDCARD, JOST_USE_NATIVE_FILE_CHOOSER);

            if (myChooser.browseForFileToOpen())
            {
              bool retValue = 
               AlertWindow::showYesNoCancelBox (AlertWindow::WarningIcon,
                                             T("Unsaved Changes"),
                                             T("Are you sure you want to close the current session? You may lose any unsaved changes."));
               if (retValue)
               {

                MemoryBlock fileData;
                File fileToLoad = myChooser.getResult();

                if (fileToLoad.existsAsFile()
                    && fileToLoad.loadFileAsData (fileData))
                {
                    getFilter ()->setStateInformation (fileData.getData (), fileData.getSize());

                    Config::getInstance()->addRecentSession (fileToLoad);
                    Config::getInstance()->lastSessionFile = fileToLoad;
                }
               }
            }
            break;
        }
    case CommandIDs::sessionSave:
        {
            handleSaveCommand();
            break;
        }
    case CommandIDs::sessionSaveNoPrompt:
        {
            handleSaveCommand(true);
            break;
        }

    case CommandIDs::audioStemsStartStop:
        {
            getHost()->toggleStemRendering();
            break;
        }
    case CommandIDs::audioStemsSetup:
        {
            FileChooser myChooser (T("Save Rendered Stem Files To..."),
                                    Config::getInstance ()->lastStemsDirectory);
            if (myChooser.browseForDirectory ())
            {
                Config::getInstance ()->lastStemsDirectory = myChooser.getResult();
            }
            break; 
        }

    //----------------------------------------------------------------------------------------------
    case CommandIDs::appToolbar:
        {
            toolbar->showCustomisationDialog (*factory,
                                              Toolbar::allCustomisationOptionsEnabled);
                                              // (Toolbar::allowIconsOnlyChoice | Toolbar::showResetToDefaultsButton));
            break;
        }
    case CommandIDs::appBrowser:
        {
            setBrowserVisible (! config->showBrowser, config->browserLeft);
            break;
        }
    case CommandIDs::appFullScreen:
        {
            DocumentWindow* window = findParentComponentOfClass <DocumentWindow> ();
            if (window) {
                window->setFullScreen (! window->isFullScreen ());
                window->setMenuBar (window->isFullScreen () ? 0 : this);
            }
            break;
        }
    case CommandIDs::appExit:
        {
            deleteAndZero(PluginListWindow::currentPluginListWindow);
            JUCEApplication::getInstance()->systemRequestedQuit();
            break;
        }
    case CommandIDs::appAbout:
        {
//            Image* splashImage = ImageCache::getFromMemory (Resource::jost_about,
//                                                            Resource::jost_about_size);
         // todo: move appResourcesFolder() to somewhere everyone can use it
#if JUCE_MAC
			File appResourcesFolder(File::getSpecialLocation(File::currentApplicationFile).getChildFile("./Contents/Resources"));
#else
			File appResourcesFolder(File::getSpecialLocation(File::currentApplicationFile).getParentDirectory());
#endif
			File splashImageFile(appResourcesFolder.getChildFile("JiveAbout.png"));
            Image* splashImage = ImageFileFormat::loadFrom(splashImageFile);
            SplashScreen* splash = new SplashScreen();
            splash->show (T(JucePlugin_Name), splashImage, 3500, false);
            break;
        }

    //----------------------------------------------------------------------------------------------
    default:
        return false;
    }

    return true;
}
Exemplo n.º 24
0
 bool Check(const GraphComponent<Graph> &component) const {
     return component.v_size() >= min_vertex_number_;
 }
Exemplo n.º 25
0
static GraphComponentPtr commonAncestor( GraphComponent &g, const GraphComponent *other, IECore::TypeId t )
{
	return g.commonAncestor( other, t );
}
Exemplo n.º 26
0
static GraphComponentPtr ancestor( GraphComponent &g, IECore::TypeId t )
{
	return g.ancestor( t );
}
Exemplo n.º 27
0
static int length( GraphComponent &g )
{
	return g.children().size();
}
Exemplo n.º 28
0
 bool ContainsEdge(const GraphComponent<Graph>& component, EdgeId e) const {
     return component.edges().find(e) != component.edges().end();
 }
Exemplo n.º 29
0
void RenderManShader::loadShaderParameters( const IECore::Shader *shader, Gaffer::CompoundPlug *parametersPlug, bool keepExistingValues )
{	
	const CompoundData *typeHints = shader->blindData()->member<CompoundData>( "ri:parameterTypeHints", true );
	
	const StringVectorData *orderedParameterNamesData = shader->blindData()->member<StringVectorData>( "ri:orderedParameterNames", true );
	const vector<string> &orderedParameterNames = orderedParameterNamesData->readable();
	
	const StringVectorData *outputParameterNamesData = shader->blindData()->member<StringVectorData>( "ri:outputParameterNames", true );
	const vector<string> &outputParameterNames = outputParameterNamesData->readable();
	
	const CompoundData *annotations = shader->blindData()->member<CompoundData>( "ri:annotations", true );
	
	// if we're not preserving existing values then remove all existing parameter plugs - the various
	// plug creators above know that if a plug exists then they should preserve its values.
	
	if( !keepExistingValues )
	{
		for( int i = parametersPlug->children().size() - 1; i >= 0; --i )
		{
			parametersPlug->removeChild( parametersPlug->getChild<GraphComponent>( i ) );
		}
	}
	
	// make sure we have a plug to represent each parameter, reusing plugs wherever possible.
	
	set<string> validPlugNames;
	for( vector<string>::const_iterator it = orderedParameterNames.begin(), eIt = orderedParameterNames.end(); it != eIt; it++ )
	{
		if( std::find( outputParameterNames.begin(), outputParameterNames.end(), *it ) != outputParameterNames.end() )
		{
			continue;
		}
	
		// splines are represented by two parameters matched by a naming convention, and we map
		// those two parameters to a single SplinePlug.
	
		const bool endsWithValues = ends_with( *it, "Values" );
		const bool endsWithPositions = ends_with( *it, "Positions" );
		if( endsWithPositions || endsWithValues )
		{
			string plugName( *it, 0, it->size() - ( endsWithValues ? 6 : 9 ) );
			if( validPlugNames.find( plugName ) != validPlugNames.end() )
			{
				continue;
			}
			
			// must use a smart pointers here because we may assign the data the parser creates (and which we therefore own)
			ConstFloatVectorDataPtr positions = shader->parametersData()->member<FloatVectorData>( plugName + "Positions" );
			ConstDataPtr values = shader->parametersData()->member<Data>( plugName + "Values" );
			
			if( positions && values )
			{
				const StringData *defaultValuesAnnotation = annotations->member<StringData>( plugName + "Values.defaultValue" );
				const StringData *defaultPositionsAnnotation = annotations->member<StringData>( plugName + "Positions.defaultValue" );

				if( defaultValuesAnnotation )
				{
					DataPtr parsedValues;
					if( values->isInstanceOf( Color3fVectorData::staticTypeId() ) )
					{
						parsedValues = parseColors( defaultValuesAnnotation->readable() );
					}
					else
					{
						parsedValues = parseFloats( defaultValuesAnnotation->readable() );
					}

					if( parsedValues )
					{
						values = parsedValues;
					}
					else
					{
						msg(
							Msg::Warning, "RenderManShader::loadShaderParameters",
							boost::format( "Unable to parse default value \"%s\" for parameter \"%s\"" ) % defaultValuesAnnotation->readable() % ( plugName + "Values" )
						);
					}
				}

				if( defaultPositionsAnnotation )
				{
					FloatVectorDataPtr parsedPositions = parseFloats( defaultPositionsAnnotation->readable() );
					if( parsedPositions )
					{
						positions = parsedPositions;
					}
					else
					{
						msg(
							Msg::Warning, "RenderManShader::loadShaderParameters",
							boost::format( "Unable to parse default value \"%s\" for parameter \"%s\"" ) % defaultPositionsAnnotation->readable() % ( plugName + "Positions" )
						);
					}
				}

				switch( values->typeId() )
				{
					case FloatVectorDataTypeId  :
						loadSplineParameter<SplineffPlug>( parametersPlug, plugName, positions, values );
						break;
					case Color3fVectorDataTypeId :
						loadSplineParameter<SplinefColor3fPlug>( parametersPlug, plugName, positions, values );
						break;
					default :
						msg(
							Msg::Warning, "RenderManShader::loadShaderParameters",
							boost::format( "Spline \"%s\" has unsupported value type \"%s\"" ) % plugName % values->typeName()
						);
				}
				validPlugNames.insert( plugName );
				continue;
			}
			
		}
	
		// the other parameter types map more simply to a single plug each.
	
		const StringData *typeHint = typeHints->member<StringData>( *it, false );
		const Data *defaultValue = shader->parametersData()->member<Data>( *it );
		switch( defaultValue->typeId() )
		{
			case StringDataTypeId :
				if( typeHint && typeHint->readable() == "shader" )
				{
					loadCoshaderParameter( parametersPlug, *it );
				}
				else
				{
					loadParameter<StringPlug>( parametersPlug, *it, static_cast<const StringData *>( defaultValue )->readable() );
				}
				break;
			case FloatDataTypeId :
				loadNumericParameter( parametersPlug, *it, static_cast<const FloatData *>( defaultValue )->readable(), annotations );
				break;
			case Color3fDataTypeId :
				loadCompoundNumericParameter<Color3fPlug>( parametersPlug, *it, static_cast<const Color3fData *>( defaultValue )->readable(), annotations );
				break;
			case V3fDataTypeId :
				loadCompoundNumericParameter<V3fPlug>( parametersPlug, *it, static_cast<const V3fData *>( defaultValue )->readable(), annotations );
				break;
			case StringVectorDataTypeId :
				if( typeHint && typeHint->readable() == "shader" )
				{
					loadCoshaderArrayParameter( parametersPlug, *it, static_cast<const StringVectorData *>( defaultValue ) );
				}
				else
				{
					loadArrayParameter<StringVectorDataPlug>( parametersPlug, *it, defaultValue, annotations );
				}
				break;
			case FloatVectorDataTypeId :
				loadArrayParameter<FloatVectorDataPlug>( parametersPlug, *it, defaultValue, annotations );
				break;
			case Color3fVectorDataTypeId :
				loadArrayParameter<Color3fVectorDataPlug>( parametersPlug, *it, defaultValue, annotations );
				break;
			case V3fVectorDataTypeId :
				loadArrayParameter<V3fVectorDataPlug>( parametersPlug, *it, defaultValue, annotations );
				break;		
			default :
				msg(
					Msg::Warning, "RenderManShader::loadShaderParameters",
					boost::format( "Parameter \"%s\" has unsupported type \"%s\"" ) % *it % defaultValue->typeName()
				);
		}
		
		validPlugNames.insert( *it );
	}
	
	// remove any old plugs which it turned out we didn't need
	
	if( keepExistingValues )
	{
		for( int i = parametersPlug->children().size() - 1; i >= 0; --i )
		{
			GraphComponent *child = parametersPlug->getChild<GraphComponent>( i );
			if( validPlugNames.find( child->getName().string() ) == validPlugNames.end() )
			{
				parametersPlug->removeChild( child );
			}
		}
	}
	
}
	//may be used for conjugate closure
	GraphComponent(const GraphComponent& component, bool add_conjugate, const string &name = "") : graph_(component.graph_), name_(name)
//		vertices_(component.vertices_.begin(), component.vertices_.end()),
//		edges_(component.edges_.begin(), component.edges_.end())
	{
		Fill(component.v_begin(), component.v_end(), add_conjugate);
	}