Ejemplo n.º 1
0
    // Boost V1.34 and below requires explicit cloning support
    attribute_cache::attribute_cache  (attribute_cache const& rhs)
      : keynames_(rhs.keynames_), 
        inited_(rhs.inited_), extensible_(rhs.extensible_)
    {
        a_map_type::const_iterator end = rhs.a_map_.end();
        for (a_map_type::const_iterator it = rhs.a_map_.begin(); it != end; ++it)
#if BOOST_VERSION <= 103301
            a_map_.insert(it.key(), new_clone(*it));
#else
            a_map_.insert((*it).first, new_clone(*(*it).second));
#endif
        last_it_ = get_end_iter();
    }
Ejemplo n.º 2
0
	graph( const graph& other)
	{
		std::map<const node_type*, node_type*> relation;
		
		for( const_node_iterator it( other.nodes().begin()); it != other.nodes().end(); ++it)
		{
			node_type *n = new_clone( *it);
			relation[&(*it)] = n;
			nodes().push_back( n);
		}
		
		for( const_edge_iterator it( other.edges().begin()); it != other.edges().end(); ++it)
			add_edge( edge_type( relation[it->src], relation[it->dst], it->port));
	}
Ejemplo n.º 3
0
 inline T* new_clone( const T* r )
 {
     return r ? new_clone( *r ) : 0;
 }
Ejemplo n.º 4
0
 static U* allocate_clone( const U& r )
 {
     return new_clone( r );
 }
Ejemplo n.º 5
0
void import_multichannel_exr( const boost::filesystem::path& p, bool relative, bool sequence)
{
    bool tiled;

    if(!Imf::isOpenExrFile( filesystem::file_cstring( p), tiled))
    {
        app().error( "Can't open EXR file");
        return;
    }

    Imf::InputFile ifile( filesystem::file_cstring( p));
    const Imf::ChannelList& ch_list( ifile.header().channels());

    std::set<std::string> channel_set;
    for( Imf::ChannelList::ConstIterator it( ch_list.begin()); it != ch_list.end(); ++it)
        channel_set.insert( std::string( it.name()));

    if( channel_set.empty())
    {
        app().error( "EXR file has no channels");
        return;
    }

    app().document().composition().deselect_all();
    std::auto_ptr<undo::add_nodes_command_t> command( new undo::add_nodes_command_t());

    image::input_node_t *node = new image::input_node_t( p, sequence, app().document().composition().composition_dir());
    node->set_composition( &app().document().composition());
    node->create_params();
    node->select( true);
    app().ui()->main_window()->composition_view().place_node( node);

    const int node_spacing = 120;

    Imath::V2f loc( node->location());
    loc.x += node_spacing;

    std::set<std::string> layer_set;
    ch_list.layers( layer_set);

    for( std::set<std::string>::iterator sit( layer_set.begin()); sit != layer_set.end(); ++sit)
    {
        Imf::ChannelList::ConstIterator it, last;
        ch_list.channelsInLayer( *sit, it, last);

        std::auto_ptr<node_t> node_copy( new_clone( *node));
        node->set_location( loc);
        loc.x += node_spacing;
        import_layer( node_copy.get(), it, last, channel_set);
        command->add_node( node_copy);
    }

    std::vector<std::string> channels;

    // handle color layer
    if( channel_set.count( "R") || channel_set.count( "B") || channel_set.count( "B"))
    {
        channels.push_back( "A");
        channels.push_back( "B");
        channels.push_back( "G");
        channels.push_back( "R");

        std::auto_ptr<node_t> node_copy( new_clone( *node));
        node->set_location( loc);
        loc.x += node_spacing;
        import_layer( node_copy.get(), channels, channel_set);
        command->add_node( node_copy);
    }

    if( channel_set.count( "Y") || channel_set.count( "RY") || channel_set.count( "BY"))
    {
        channels.push_back( "A");
        channels.push_back( "BY");
        channels.push_back( "RY");
        channels.push_back( "Y");

        std::auto_ptr<node_t> node_copy( new_clone( *node));
        node->set_location( loc);
        loc.x += node_spacing;
        import_layer( node_copy.get(), channels, channel_set);
        command->add_node( node_copy);
    }

    if( !channel_set.empty())
    {
        for( std::set<std::string>::iterator cit( channel_set.begin()); cit != channel_set.end(); ++cit)
        {
            channels.push_back( *cit);

            if( channels.size() == 4)
            {
                std::auto_ptr<node_t> node_copy( new_clone( *node));
                node->set_location( loc);
                loc.x += node_spacing;
                import_layer( node_copy.get(), channels, channel_set);
                command->add_node( node_copy);
            }
        }

        if( !channels.empty())
        {
            std::auto_ptr<node_t> node_copy( new_clone( *node));
            node->set_location( loc);
            loc.x += node_spacing;
            import_layer( node_copy.get(), channels, channel_set);
            command->add_node( node_copy);
        }
    }

    command->redo();
    app().document().undo_stack().push_back( command);
    app().document().composition().selection_changed();
    app().ui()->update();
    delete node;
}