void ImageGilFilterProcessor<SView, DView>::setup( const OFX::RenderArguments& args )
{
	ImageGilProcessor<DView>::setup( args );

	// source view
//	TUTTLE_LOG_INFOS;
//	TUTTLE_LOG_VAR( TUTTLE_INFO, "src - fetchImage " << time );
	_src.reset( _clipSrc->fetchImage( args.time ) );
	if( ! _src.get() )
		BOOST_THROW_EXCEPTION( exception::ImageNotReady()
				<< exception::dev() + "Error on clip " + quotes(_clipSrc->name())
				<< exception::time( args.time ) );
	if( _src->getRowDistanceBytes() == 0 )
		BOOST_THROW_EXCEPTION( exception::WrongRowBytes()
				<< exception::dev() + "Error on clip " + quotes(_clipSrc->name())
				<< exception::time( args.time ) );
	//	_srcPixelRod = _src->getRegionOfDefinition(); // bug in nuke, returns bounds
	_srcPixelRod   = _clipSrc->getPixelRod( args.time, args.renderScale );
	_srcView = ImageGilProcessor<DView>::template getCustomView<SView>( _src.get(), _srcPixelRod );

//	// Make sure bit depths are same
//	if( this->_src->getPixelDepth() != this->_dst->getPixelDepth() ||
//	    this->_src->getPixelComponents() != this->_dst->getPixelComponents() )
//		BOOST_THROW_EXCEPTION( exception::BitDepthMismatch() );
}
示例#2
0
	virtual void setup( const OFX::RenderArguments& args )
	{
		// destination view
//		TUTTLE_COUT_INFOS;
//		TUTTLE_COUT_VAR( "dst - fetchImage " << time );
		_dst.reset( _clipDst->fetchImage( args.time ) );
		if( !_dst.get() )
			BOOST_THROW_EXCEPTION( exception::ImageNotReady()
				<< exception::dev() + "Error on clip " + quotes(_clipDst->name()) );
		if( _dst->getRowDistanceBytes() == 0 )
			BOOST_THROW_EXCEPTION( exception::WrongRowBytes()
				<< exception::dev() + "Error on clip " + quotes(_clipDst->name()) );
		
		//		_dstPixelRod = _dst->getRegionOfDefinition(); // bug in nuke, returns bounds
		_dstPixelRod       = _clipDst->getPixelRod( args.time, args.renderScale );
		_dstPixelRodSize.x = ( this->_dstPixelRod.x2 - this->_dstPixelRod.x1 );
		_dstPixelRodSize.y = ( this->_dstPixelRod.y2 - this->_dstPixelRod.y1 );
	}
示例#3
0
    virtual void setup(const OFX::RenderArguments& args)
    {
        ImageProcessor::setup(args);

        // source view
        _src.reset(_clipSrc->fetchImage(args.time));
        if(!_src.get())
            BOOST_THROW_EXCEPTION(exception::ImageNotReady()
                                  << exception::dev() + "Error on clip " + quotes(_clipSrc->name()));
        if(_src->getRowDistanceBytes() == 0)
            BOOST_THROW_EXCEPTION(exception::WrongRowBytes()
                                  << exception::dev() + "Error on clip " + quotes(_clipSrc->name()));

        if(OFX::getImageEffectHostDescription()->hostName == "uk.co.thefoundry.nuke")
        {
            // bug in nuke, getRegionOfDefinition() on OFX::Image returns bounds
            _srcPixelRod = _clipSrc->getPixelRod(args.time, args.renderScale);
        }
        else
        {
            _srcPixelRod = _src->getRegionOfDefinition();
        }
    }
示例#4
0
	MissingHostFeature( const std::string& feature )
	{
		* this << ofxStatus( kOfxStatErrMissingHostFeature );
		* this << user() + "Missing feature: " + quotes(feature);
	}
 inline const ProcessEdgeAtTime& getInputEdgeByClipName(const std::string& inputClipName, const OfxTime time) const
 {
     Key k(inputClipName, time);
     ProcessEdgeAtTimeByClipName::const_iterator it = _inEdges.find(k);
     if(it == _inEdges.end())
         BOOST_THROW_EXCEPTION(exception::Bug() << exception::dev() + "No input clip " + quotes(inputClipName) +
                                                       " at time " + time + " inside input edges map.");
     return *(it->second);
 }
示例#6
0
void OfxhPluginCache::scanPluginFiles()
{
	std::set<std::string> foundBinFiles;

	for( std::list<std::string>::iterator paths = _pluginPath.begin();
	     paths != _pluginPath.end();
	     ++paths )
	{
		scanDirectory( foundBinFiles, *paths, _nonrecursePath.find( *paths ) == _nonrecursePath.end() );
	}

	OfxhPluginBinaryList::iterator i = _binaries.begin();
	while( i != _binaries.end() )
	{
		if( foundBinFiles.find( i->getFilePath() ) == foundBinFiles.end() )
		{
			// the binary was in the cache, but was not on the path
			setDirty();
			i = _binaries.erase( i );
		}
		else
		{
			const bool binChanged = i->hasBinaryChanged();

			// the binary was in the cache, but the binary has changed and thus we need to reload
			if( binChanged )
			{
				i->loadPluginInfo( this );
				setDirty();
			}

			for( int j = 0; j < i->getNPlugins(); ++j )
			{
				OfxhPlugin& plug                   = i->getPlugin( j );
				try
				{
					APICache::OfxhPluginAPICacheI& api = plug.getApiHandler();

					if( binChanged )
					{
						api.loadFromPlugin( plug ); // may throw
					}

					std::string reason;

					if( api.pluginSupported( plug, reason ) )
					{
						addPlugin( &plug );
						api.confirmPlugin( plug );
					}
					else
					{
						TUTTLE_COUT_ERROR(
							"Ignoring plugin " << quotes(plug.getIdentifier()) <<
							": unsupported, " << reason << "." );
					}
				}
				catch(...)
				{
					TUTTLE_COUT_ERROR(
						"Ignoring plugin " << quotes(plug.getIdentifier()) <<
						": loading error." );
					
				}
			}

			++i;
		}
	}
}
示例#7
0
/**
 * @brief The overridden render function
 * @param[in]   args     Rendering parameters
 */
void HistogramPlugin::render(const OFX::RenderArguments& args)
{
    if(!_clipSrc->isConnected())
        BOOST_THROW_EXCEPTION(exception::ImageNotConnected());

    boost::scoped_ptr<OFX::Image> src(_clipSrc->fetchImage(args.time));
    if(!src.get())
        BOOST_THROW_EXCEPTION(exception::ImageNotReady() << exception::dev() + "Error on clip " + quotes(_clipSrc->name())
                                                         << exception::time(args.time));
    if(src->getRowDistanceBytes() == 0)
        BOOST_THROW_EXCEPTION(exception::WrongRowBytes() << exception::dev() + "Error on clip " + quotes(_clipSrc->name())
                                                         << exception::time(args.time));

    boost::scoped_ptr<OFX::Image> dst(_clipDst->fetchImage(args.time));
    if(!dst.get())
        BOOST_THROW_EXCEPTION(exception::ImageNotReady() << exception::dev() + "Error on clip " + quotes(_clipDst->name())
                                                         << exception::time(args.time));
    if(dst->getRowDistanceBytes() == 0)
        BOOST_THROW_EXCEPTION(exception::WrongRowBytes() << exception::dev() + "Error on clip " + quotes(_clipDst->name())
                                                         << exception::time(args.time));

    setIsRendering(true); // plugin is rendering

    // Copy buffer
    const OfxRectI bounds = dst->getBounds();
    if(src->isLinearBuffer() && dst->isLinearBuffer())
    {
        const std::size_t imageDataBytes = dst->getBoundsImageDataBytes();
        if(imageDataBytes)
        {
            void* dataSrcPtr = src->getPixelAddress(bounds.x1, bounds.y1);
            void* dataDstPtr = dst->getPixelAddress(bounds.x1, bounds.y1);
            memcpy(dataDstPtr, dataSrcPtr, imageDataBytes);
        }
    }
    else
    {
        const std::size_t rowBytesToCopy = dst->getBoundsRowDataBytes();
        for(int y = bounds.y1; y < bounds.y2; ++y)
        {
            void* dataSrcPtr = src->getPixelAddress(bounds.x1, y);
            void* dataDstPtr = dst->getPixelAddress(bounds.x1, y);
            memcpy(dataDstPtr, dataSrcPtr, rowBytesToCopy);
        }
    }

    setIsRendering(false); // plugin is not rendering anymore

    if(this->hasOverlayData())
    {
        this->getOverlayData()._isDataInvalid = true;
        this->redrawOverlays();
    }

    if(OFX::getImageEffectHostDescription()->hostName ==
       "uk.co.thefoundry.nuke") /// @todo: HACK Nuke doesn't call changeClip function when time is changed
    {
        if(getOverlayData().isCurrentTimeModified(args.time)) // if time is changed
        {
            this->redrawOverlays(); // redraw scene
        }
    }
}
示例#8
0
文件: rare.cpp 项目: smaugmuds/xsmaug
void char_leaving( char_data * ch, int howleft )
{
   auth_data *old_auth = NULL;

   /*
    * new auth 
    */
   old_auth = get_auth_name( ch->name );
   if( old_auth != NULL )
      if( old_auth->state == AUTH_ONLINE )
         old_auth->state = AUTH_OFFLINE;  /* Logging off */

   ch->pcdata->camp = howleft;

   if( howleft == 0 )   /* Rented at an inn */
   {
      switch ( ch->in_room->area->continent )
      {
         case ACON_ONE:
            ch->pcdata->one = ch->in_room->vnum;
            break;
         default:
            break;
      }
   }

   /*
    * Get 'em dismounted until we finish mount saving -- Blodkai, 4/97 
    */
   if( ch->position == POS_MOUNTED )
      interpret( ch, "dismount" );

   if( ch->morph )
      interpret( ch, "revert" );

   if( ch->desc )
   {
      if( ch->timer > 24 )
         update_connhistory( ch->desc, CONNTYPE_IDLE );
      else
         update_connhistory( ch->desc, CONNTYPE_QUIT );
   }

   list < obj_data * >::iterator iobj;
   for( iobj = ch->carrying.begin(  ); iobj != ch->carrying.end(  ); )
   {
      obj_data *obj = *iobj;
      ++iobj;

      inventory_scan( ch, obj );
   }
   quotes( ch );
   quitting_char = ch;
   ch->save(  );

   if( sysdata->save_pets )
   {
      list < char_data * >::iterator pet;

      for( pet = ch->pets.begin(  ); pet != ch->pets.end(  ); )
      {
         char_data *cpet = *pet;
         ++pet;

         cpet->extract( true );
      }
   }

   /*
    * Synch clandata up only when clan member quits now. --Shaddai 
    */
   if( ch->pcdata->clan )
      save_clan( ch->pcdata->clan );

   saving_char = NULL;
   ch->extract( true );

   for( int x = 0; x < MAX_WEAR; ++x )
      for( int y = 0; y < MAX_LAYERS; ++y )
         save_equipment[x][y] = NULL;
}
示例#9
0
TInt CRfsScript::ParseNextCommandL( CRfsCommand* aCommand )
    {
    const TDesC* commands[ KRfsNumberOfCommands ] =
        {    
        &KRfsCommand1,
        &KRfsCommand2,
        &KRfsCommand3,
        &KRfsCommand4,
        &KRfsCommand5,
        &KRfsCommand6,
        &KRfsCommand7,
        &KRfsCommand8
        };
    
    TInt startIndex;
    TInt endIndex;

    FOREVER
        {

        // check if index is beyond the descriptor already

        if ( iIndex >= iLength )
            {
            return KRfsEndOfScript;
            }

        // go to the beginning of the "command word"

        startIndex = iIndex;
        SkipSpace( startIndex );

        // go to the end of the "command word"

        endIndex = startIndex;
        FindEnd( endIndex );

        if ( endIndex - startIndex > 0 && !IsComment( startIndex ) )
            {
            break;
            }

        // if the line is commented out, skip it

        iIndex = NextLine( startIndex );
        }

    // create TPtrC to the "command word"

    TPtrC command( &iScript[ startIndex ], endIndex - startIndex );
    
    TRfsCommandId commandId( ERfsCommandUnknown );

    // determine the command id

    for ( TInt i = 0; i < KRfsNumberOfCommands ; i++ )
        {
        if ( !command.CompareF( *( commands[ i ] ) ) )
            {
            commandId = (TRfsCommandId)i;
            break;
            }
        }

    TInt ret( KErrGeneral ); // returns this if there is a syntax error in line

    if ( commandId != ERfsCommandUnknown )
        {
        TInt numberOfParams( 0 );        
        TInt start = endIndex;

        FOREVER
            {
            TBool quotes( EFalse );
            SkipSpace( start, &quotes );

            TInt end = start;
            if ( FindEnd( end, quotes ) )
                {
                if ( end - start > 0 && !IsComment( start) )
                    {
                    numberOfParams++;
                    start = end;
                    continue;
                    }
                }
            break;
            }

        if ( VerifyNumberOfParameters( commandId, numberOfParams ) )
            {
            // set command information if the command parameter has been given

            if ( aCommand )
                {
                TPtrC* params = new( ELeave ) TPtrC[ numberOfParams ];
                
                // fetch parameter information

                for ( TInt i = 0; i < numberOfParams ; i++ )
                    {
                    TInt paramStart = endIndex;
                    TBool quotes( EFalse );

                    SkipSpace( paramStart, &quotes );

                    TInt paramEnd = paramStart;
                    FindEnd( paramEnd, quotes );

                    TInt realStart( paramStart );
                    TInt realEnd( paramEnd );

                    if ( quotes )
                        {
                        realStart++;
                        realEnd--;
                        }

                    params[ i ].Set( &iScript[ realStart ], realEnd - realStart );

                    endIndex = paramEnd;
                    }

                // aCommand gets ownership of paramStarts and paramLengths

                aCommand->Set( commandId, numberOfParams, params );
                }

            iIndex = NextLine ( endIndex );
            ret = KErrNone;
            }
        }