DD::Image::Write Class Reference

Inherits DD::Image::FileIop, and DD::Image::Executable.

Public Member Functions

 Write (Node *node=nullptr)
 
Executableexecutable () override
 
bool isWrite () const override
 
void execute () override
 
void beginExecuting () override
 
void endExecuting () override
 
int minimum_inputs () const override
 
int maximum_inputs () const override
 
ExecMode execViewMode () override
 
ExecMode execFrameMode () override
 
const std::set< int > & views () override
 
int split_input (int i) const override
 
const DD::Image::OutputContextinputContext (int, int, OutputContext &c) const override
 
const char * filename () const override
 
const char * getFilename () const override
 
const char * fname () const
 
void filename (const char *f)
 
const char * file_type () const override
 
bool set_file_type (const char *)
 
bool set_file_type_from_filename (Knob *knob=nullptr)
 
ChannelMask channels () const
 
void channels (ChannelMask m)
 
void depth (int d)
 
int depth () const
 
int num_channels () const
 
Channel channel_written_to (int i) const
 
bool raw () const
 
void raw (bool v)
 
bool premult () const
 
void premult (bool v)
 
bool reading () const
 
const MetaData::Bundle_fetchMetaData (const char *key) override
 
void input0get (int y, int x, int r, ChannelMask mask, Row &row)
 
void inputnget (int n, int y, int x, int r, ChannelMask, Row &, float fracCPU)
 
void inputnget (int n, int y, int x, int r, ChannelMask, Row &)
 
void internalError (const char *fmt,...)
 
void filetype_knobs (Knob_Callback f)
 
void knobs (Knob_Callback) override
 
int knob_changed (Knob *) override
 
const char * Class () const override
 
const char * node_help () const override
 
unsigned node_color () const override
 
Hash getHashOfInputs ()
 
void status (double f)
 
void setOutputContext (const OutputContext &lrContext) override
 
WritergetWriter ()
 
void detach () override
 
void updateDefaultLUT ()
 
OpHints opHints () const override
 Return hints to control when and how this op will be evaluated by the top-down system.
 
- Public Member Functions inherited from DD::Image::Executable
 Executable (Op *op)
 
virtual bool isExecuteThreadSafe () const
 
virtual unsigned int getFrameProgress () const
 
virtual std::string getFrameProgressMessage () const
 
void setViewsToExecute (const std::set< int > &view)
 
void clearViewsToExecute ()
 
const std::set< int > & viewsToExecute ()
 
void frameRangeKnobs (Knob_Callback)
 provide frame range knobs and a 'limit to frame range'
 
virtual bool skipForContext (const OutputContext &context) const
 
int frameRangeKnobsChanged (DD::Image::Knob *knob)
 

Static Public Member Functions

static const char *const * file_types ()
 
static void enableWatermarking ()
 

Static Public Attributes

static const Description d
 

Protected Member Functions

void _validate (bool) override
 
void _request (int x, int y, int r, int t, ChannelMask, int count) override
 
void engine (int y, int x, int r, ChannelMask, Row &) override
 Needed to allow different contexts to have different passthroughs. More...
 
void append (DD::Image::Hash &hash) override
 

Friends

class WriteImpl
 

Additional Inherited Members

- Public Types inherited from DD::Image::Executable
enum  ExecMode { WriteOne, WriteAny, WriteMany }
 

Detailed Description

This is a base class for a file writer.

All the work is done by the various subclasses of Writer. Write just chooses what subclass to instantiate and returns the output from it, and correctly destroys and instantiates new ones as needed.

Calling Iop::execute() initiates writing the file.

Member Function Documentation

void Write::_validate ( bool  for_real)
overrideprotectedvirtual

Modify the info to show what is actually written to the file. This assumes the normal behavior that the file clips to the format and writes the channels packed together as the first N channels. It assumes that if you have set the mask to "all" then you are writing a file format that preserves channel names.

Reimplemented from DD::Image::Iop.

References DD::Image::ChannelSet::all(), DD::Image::Writer::clipToFormat(), depth(), detach(), DD::Image::Op::error(), DD::Image::Enumeration_KnobI::getError(), DD::Image::Writer::getImpl(), DD::Image::Format::height(), DD::Image::IopInfoOwner::info(), DD::Image::IopInfoOwner::info_, DD::Image::Iop::input(), DD::Image::Op::inputs(), internalError(), DD::Image::Box::intersect(), DD::Image::ChannelSet::intersection(), DD::Image::Op::knob(), DD::Image::Op::node(), DD::Image::Writer::setLUT(), DD::Image::LUT::test(), DD::Image::LUTInfo::updateColorspaceDefaultValue(), DD::Image::Op::validate(), and DD::Image::Format::width().

void Write::_request ( int  x,
int  y,
int  r,
int  t,
ChannelMask  m,
int  count 
)
overrideprotectedvirtual

Shuffles the channels according to which ones will be written.

Reimplemented from DD::Image::Iop.

References DD::Image::ChannelSet::all(), channel_written_to(), DD::Image::Writer::clipToFormat(), DD::Image::Iop::input(), DD::Image::Op::inputs(), and DD::Image::Iop::request().

void Write::engine ( int  y,
int  x,
int  r,
ChannelMask  channels,
Row row 
)
overrideprotectedvirtual

Needed to allow different contexts to have different passthroughs.

Shuffles the channels according to which ones will be written.

Implements DD::Image::Iop.

References DD::Image::ChannelSet::all(), channel_written_to(), DD::Image::Writer::clipToFormat(), DD::Image::Row::copy(), DD::Image::Row::erase(), DD::Image::Iop::get(), DD::Image::Row::pre_copy(), DD::Image::IopInfoOwner::r(), and DD::Image::Row::writable().

bool Write::isWrite ( ) const
overridevirtual

This is not true if the input is not connected (to avoid writing black frames but without producing an error) and is not true if "reading" is turned on.

Reimplemented from DD::Image::Executable.

References DD::Image::ValueStuffI::get_value(), DD::Image::Op::knob(), and DD::Image::Op::node_input().

void Write::endExecuting ( )
overridevirtual

Calls finish() on the Writer if it is writing a movie file. If reading is turned on it acts like user hit the Reload button.

Reimplemented from DD::Image::Executable.

References DD::Image::Writer::finish(), and DD::Image::Writer::movie().

Executable::ExecMode Write::execViewMode ( )
overridevirtual

Returns WriteMany if the Writer object asks for more than one in Writer::split_input(), indicating that (most likely) more than one view is wanted. Returns WriteOne otherwise, indicating it is a waste of time to call this with different views. Nuke will detect if the filename changes when the view changes and will call this multiple times with different filenames, otherwise complain if the user asks for more than one view to execute.

Reimplemented from DD::Image::Executable.

References DD::Image::Writer::split_input(), DD::Image::Executable::WriteMany, and DD::Image::Executable::WriteOne.

Executable::ExecMode Write::execFrameMode ( )
overridevirtual

Returns WriteMany if the Writer object returns true for movie(). Returns WriteOne otherwise, indicating it is a waste of time to call this with different frames. Nuke will detect if the filename changes when the frame changes and will call this multiple times with different filenames, otherwise complain if the user asks for more than one frame to execute.

Reimplemented from DD::Image::Executable.

References DD::Image::Writer::movie(), DD::Image::Executable::WriteMany, and DD::Image::Executable::WriteOne.

int Write::split_input ( int  i) const
overridevirtual
const OutputContext & Write::inputContext ( int  a,
int  n,
OutputContext c 
) const
overridevirtual
const char * Write::file_type ( ) const
overridevirtual

Return the type of file this will write. This is set by set_file_type() or set_file_type_from_filename() or by validate() if neither of these is done. This is actually the null-sepearted list of names from the DD::Image::Writer::Description object.

Implements DD::Image::FileOp.

Referenced by set_file_type().

bool Write::set_file_type ( const char *  name)

Set the type of file the Writer will write. The type is a string like "cin" or "jpeg". Returns true if the new type is different than the previous one. Notice that if the type changes all settings on Writer-specific knobs are lost.

If this type is not found or is zero then file_type() is set to zero. If the node is then executed it will attempt to figure out the type from the filename, and if that fails it will cause an error.

file_types() returns a list of available names. You may also be able to set other names like "sgi16" that are not in this list, these typically initialize some knobs to non-default values.

References DD::Image::Writer::Description::constructor, detach(), file_type(), DD::Image::Writer::Description::find(), DD::Image::Writer::getImpl(), internalError(), DD::Image::Op::knob(), DD::Image::plugin_error(), DD::Image::LUTInfo::registerForCallbacks(), DD::Image::ValueStuffI::set_value(), updateDefaultLUT(), and DD::Image::Knob::visible().

Referenced by set_file_type_from_filename().

bool Write::set_file_type_from_filename ( Knob knob = nullptr)

If the filename has "name:" near the start, try using that to set the file type. If that fails, try using the file extension. This is automatically done by execute() and validate() if this or set_file_type() has not been called.

References DD::Image::Knob::get_text(), DD::Image::plugin_error(), and set_file_type().

int Write::depth ( ) const

Does Writer::depth(). Current implementation returns the number of channels turned on in the selector and in the input.

References DD::Image::IopInfoOwner::channels(), DD::Image::Iop::input(), DD::Image::Iop::input0(), and DD::Image::ChannelSet::size().

Referenced by _validate(), and execute().

Channel Write::channel_written_to ( int  i) const
void Write::inputnget ( int  n,
int  y,
int  x,
int  r,
ChannelMask  channels,
Row row,
float  fracCPU 
)

Get line from the input, and launch multiple threads to read other lines so they are ready to be returned when this is called next time.

References DD::Image::TopDownGraphEvaluator::Enabled(), DD::Image::TopDownGraphEvaluator::Execute(), DD::Image::Iop::get(), DD::Image::Iop::input(), and DD::Image::Thread::numThreads.

void Write::internalError ( const char *  fmt,
  ... 
)

Calls Op::error(), but prefixes "filename: " to the message.

References DD::Image::Op::critical(), strlcpy(), and vsnprintf().

Referenced by _validate(), execute(), and set_file_type().

void Write::detach ( )
overridevirtual

Cleans up the writer when the dag is detached.

Reimplemented from DD::Image::Op.

Referenced by _validate(), and set_file_type().

void Write::enableWatermarking ( )
static

Use this to set a watermark iop to be applied immediately before all writes, without showing it on the DAG. There is no function to turn this off again, as there should be no need.

void Write::updateDefaultLUT ( )

Update the colorspace knob so that the 'default' entry contains text specifying what that default currently is

References DD::Image::Writer::getImpl(), DD::Image::Op::node(), DD::Image::Op::panel_visible(), and DD::Image::LUTInfo::updateColorspaceDefaultValue().

Referenced by set_file_type().



©2024 The Foundry Visionmongers, Ltd. All Rights Reserved.
www.thefoundry.co.uk