void Constant::_validate(bool)
{
  // Set the user-selected channels, see if any are non-zero:
  bool non_zero = false;
  info_.channels(Mask_None);
  for (int z = 0; z < 4; z++) {
    info_.turn_on(channel[z]);
    if (color[z])
      non_zero = true;
  }
  // When used internally by other plugins they don't set formats,
  // they just put the format into the info_. Detect this and don't
  // write over the format they chose:
  if (formats.format()) {
    info_.format(*formats.format());
    info_.full_size_format(*formats.fullSizeFormat());
  }
  info_.black_outside(!non_zero);
#if 1
  // Use a bounding box the size of the image. This is what most file
  // readers would do if they read an image that was a solid color:
  info_.set(format());
#else
  // Use a 1x1 bounding box. This should be correct as the color is
  // replicated from the one pixel everywhere. However plenty of
  // operators have dependencies on the bounding box.  Some pre-4.8
  // versions of Nuke did this if and only if the constant was black,
  // but even that caused problems.
  info_.set(format().x(), format().y(), format().x() + 1, format().y() + 1);
#endif
  info_.first_frame(first_frame);
  info_.last_frame(last_frame);
}
        void _validate(bool for_real)
        {
            // TODO: create a new format from our m_buffer->width & m_buffer->height
            // and return that

            info_.full_size_format(*m_formats.fullSizeFormat());
            info_.format(*m_formats.format());
            info_.channels(Mask_RGBA);
            info_.set(format());
        }
 Constant(Node* node) : Black(node)
 {
   channel[0] = Chan_Red;
   channel[1] = Chan_Green;
   channel[2] = Chan_Blue;
   channel[3] = Chan_Alpha;
   color[0] = color[1] = color[2] = color[3] = 0;
   first_frame = 1;
   last_frame = 1;
   formats.format(0);
 }
示例#4
0
文件: Aton.cpp 项目: jonntd/Aton
        void _validate(bool for_real)
        {
            // do we need to open a port?
            if ( m_server.isConnected()==false && !m_inError && m_legit )
                changePort(m_port);
            
            if (m_stat.progress > 0)
                status(m_stat.progress,
                       m_stat.ram,
                       m_stat.p_ram,
                       m_stat.time);
            
            // handle any connection error
            if ( m_inError )
                error(m_connectionError.c_str());

            // setup format etc
            info_.format(*m_fmtp.fullSizeFormat());
            info_.full_size_format(*m_fmtp.format());
            
            // add aovs as nuke channels
            std::string rgba = "RGBA";
            std::string z = "Z";
            std::string n = "N";
            std::string p = "P";
            
            for(std::vector<std::string>::iterator it = m_aovs.begin(); it != m_aovs.end(); ++it)
            {
                if (it->compare(rgba)==0)
                {
                    if (!m_channels.contains(Chan_Red))
                    {
                        m_channels.insert(Chan_Red);
                        m_channels.insert(Chan_Green);
                        m_channels.insert(Chan_Blue);
                        m_channels.insert(Chan_Alpha);
                    }
                }
                else if (it->compare(z)==0)
                {
                    if (!m_channels.contains(Chan_Z))
                        m_channels.insert( Chan_Z );
                }
                else if (it->compare(n)==0 || it->compare(p)==0)
                {
                    if (!m_channels.contains(channel((boost::format("%s.X")%it->c_str()).str().c_str())))
                    {
                        m_channels.insert( channel((boost::format("%s.X")%it->c_str()).str().c_str()) );
                        m_channels.insert( channel((boost::format("%s.Y")%it->c_str()).str().c_str()) );
                        m_channels.insert( channel((boost::format("%s.Z")%it->c_str()).str().c_str()) );
                    }
                }
                else
                {
                    if (!m_channels.contains( channel((boost::format("%s.red")%it->c_str()).str().c_str())))
                    {
                        m_channels.insert( channel((boost::format("%s.red")%it->c_str()).str().c_str()) );
                        m_channels.insert( channel((boost::format("%s.blue")%it->c_str()).str().c_str()) );
                        m_channels.insert( channel((boost::format("%s.green")%it->c_str()).str().c_str()) );
                    }
                }
            }
            
            info_.channels( m_channels );
            info_.set(info().format());
        }