-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,6 +63,7 @@ OIIO_NAMESPACE_USING | |
#include "GafferImage/ImagePlug.h" | ||
#include "GafferImage/OpenImageIOAlgo.h" | ||
#include "GafferImage/ColorSpace.h" | ||
#include "GafferImage/ImageMetadata.h" | ||
|
||
using namespace std; | ||
using namespace Imath; | ||
|
@@ -721,7 +722,13 @@ ImageWriter::ImageWriter( const std::string &name ) | |
ExpressionPtr expression = new Expression( "__expression" ); | ||
addChild( expression ); | ||
|
||
ImageMetadataPtr imageMetadata = new ImageMetadata( "__metaData" ); | ||
addChild( imageMetadata ); | ||
imageMetadata->inPlug()->setInput( colorSpace->outPlug() ); | ||
//imageMetadata->metadataPlug()->addOptionalMember( "gaffer:colorspace", new StringPlug() , "colorSpace" ); | ||
|
||
addChild( new StringPlug( "colorSpace" ) ); | ||
addChild( new StringPlug( "colorSpaceMetadataName" ) ); | ||
addChild( new ImagePlug( "out", Plug::Out, Plug::Default & ~Plug::Serialisable ) ); | ||
|
||
outPlug()->setInput( inPlug() ); | ||
|
@@ -845,25 +852,44 @@ const Expression *ImageWriter::expression() const | |
return getChild<Expression>( g_firstPlugIndex+4 ); | ||
} | ||
|
||
GafferImage::ImageMetadata *ImageWriter::meta() | ||
{ | ||
return getChild<GafferImage::ImageMetadata>( g_firstPlugIndex+5 ); | ||
} | ||
|
||
const GafferImage::ImageMetadata *ImageWriter::meta() const | ||
{ | ||
return getChild<GafferImage::ImageMetadata>( g_firstPlugIndex+5 ); | ||
} | ||
|
||
Gaffer::StringPlug *ImageWriter::colorSpacePlug() | ||
{ | ||
return getChild<StringPlug>( g_firstPlugIndex+5 ); | ||
return getChild<StringPlug>( g_firstPlugIndex+6 ); | ||
} | ||
|
||
const Gaffer::StringPlug *ImageWriter::colorSpacePlug() const | ||
{ | ||
return getChild<StringPlug>( g_firstPlugIndex+5 ); | ||
return getChild<StringPlug>( g_firstPlugIndex+6 ); | ||
} | ||
|
||
Gaffer::StringPlug *ImageWriter::colorSpaceMetadataNamePlug() | ||
{ | ||
return getChild<StringPlug>( g_firstPlugIndex+7 ); | ||
} | ||
|
||
const Gaffer::StringPlug *ImageWriter::colorSpaceMetadataNamePlug() const | ||
{ | ||
return getChild<StringPlug>( g_firstPlugIndex+7 ); | ||
} | ||
|
||
GafferImage::ImagePlug *ImageWriter::outPlug() | ||
{ | ||
return getChild<ImagePlug>( g_firstPlugIndex+6 ); | ||
return getChild<ImagePlug>( g_firstPlugIndex+8 ); | ||
} | ||
|
||
const GafferImage::ImagePlug *ImageWriter::outPlug() const | ||
{ | ||
return getChild<ImagePlug>( g_firstPlugIndex+6 ); | ||
return getChild<ImagePlug>( g_firstPlugIndex+8 ); | ||
} | ||
|
||
Gaffer::ValuePlug *ImageWriter::fileFormatSettingsPlug( const std::string &fileFormat ) | ||
|
@@ -978,6 +1004,10 @@ void ImageWriter::execute() const | |
// and then probably removing it again on the way back into C++. That would mean that the ImageWriter is deleted before it's even constructed. | ||
Expression *e = const_cast<Expression *>( expression() ); | ||
e->setExpression( string( "parent[\"__colorSpace\"][\"outputSpace\"] = context.get(\"gaffer:colorspace\", \"\") " ), string( "python" ) ); | ||
|
||
ImageMetadata *m = const_cast<ImageMetadata *>( meta() ); | ||
m->metadataPlug()->addOptionalMember( "gaffer:colorspace", new StringPlug() , "colorSpace" ); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
lucienfostier
Author
Owner
|
||
|
||
if( !inPlug()->getInput<ImagePlug>() ) | ||
{ | ||
throw IECore::Exception( "No input image." ); | ||
|
@@ -1081,13 +1111,13 @@ void ImageWriter::execute() const | |
if ( spec.tile_width == 0 ) | ||
{ | ||
FlatScanlineWriter flatScanlineWriter( out, fileName, processDataWindow, imageFormat ); | ||
ImageAlgo::parallelGatherTiles( colorSpace()->outPlug(), spec.channelnames, processor, flatScanlineWriter, processDataWindow, ImageAlgo::TopToBottom ); | ||
ImageAlgo::parallelGatherTiles( meta()->outPlug(), spec.channelnames, processor, flatScanlineWriter, processDataWindow, ImageAlgo::TopToBottom ); | ||
flatScanlineWriter.finish(); | ||
} | ||
else | ||
{ | ||
FlatTileWriter flatTileWriter( out, fileName, processDataWindow, imageFormat ); | ||
ImageAlgo::parallelGatherTiles( colorSpace()->outPlug(), spec.channelnames, processor, flatTileWriter, processDataWindow, ImageAlgo::TopToBottom ); | ||
ImageAlgo::parallelGatherTiles( meta()->outPlug(), spec.channelnames, processor, flatTileWriter, processDataWindow, ImageAlgo::TopToBottom ); | ||
flatTileWriter.finish(); | ||
} | ||
|
||
|
@johnhaddon,
I thought it would be a good idea to add a metadata node to inject the metadata colorspace name into it.
I'm getting crashes again with this, it's going through python again it seems?
I suppose I dont have to use a metadata node and I can modify the outPlug of the colorSpace node during the execute?