DD::Image::Write Class Reference

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

List of all members.

Public Member Functions

 Write (Node *node=0)
virtual Executableexecutable ()
virtual bool isWrite () const
void execute ()
virtual void beginExecuting ()
virtual void endExecuting ()
virtual int minimum_inputs () const
virtual int maximum_inputs () const
virtual ExecMode execViewMode ()
virtual ExecMode execFrameMode ()
const std::set< int > & views ()
virtual int split_input (int i) const
virtual const
DD::Image::OutputContext
inputContext (int, int, OutputContext &c) const
const char * filename () const
const char * getFilename () const
const char * fname () const
void filename (const char *f)
virtual const char * file_type () const
bool set_file_type (const char *)
bool set_file_type_from_filename (Knob *knob=0)
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)
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)
int knob_changed (Knob *)
const char * Class () const
const char * node_help () const
unsigned node_color () const
Hash getHashOfInputs ()
void status (double f)
virtual void setOutputContext (const OutputContext &lrContext)
WritergetWriter ()
virtual void detach ()
void updateDefaultLUT ()

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)
void _request (int x, int y, int r, int t, ChannelMask, int count)
void engine (int y, int x, int r, ChannelMask, Row &)
 Needed to allow different contexts to have different passthroughs.
void append (DD::Image::Hash &hash)

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) [protected, virtual]
void Write::_request ( int  x,
int  y,
int  r,
int  t,
ChannelMask  m,
int  count 
) [protected, virtual]

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 
) [protected, virtual]

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 [virtual]

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 ( ) [virtual]

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 ( ) [virtual]

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 ( ) [virtual]

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 [virtual]
const OutputContext & Write::inputContext ( int  a,
int  n,
OutputContext c 
) const [virtual]
const char * Write::file_type ( ) const [virtual]

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(), DD::Image::Op::knob(), 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 = 0)

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::Op::error_message(), 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::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::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.

Reimplemented from DD::Image::FileOp.

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

Referenced by _validate(), and execute().

void Write::detach ( ) [virtual]

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::panel_visible(), and DD::Image::LUTInfo::updateColorspaceDefaultValue().

Referenced by set_file_type().