Skip to content

Commit

Permalink
ImageWriter: Added metadata node to inject colorspace name
Browse files Browse the repository at this point in the history
  • Loading branch information
lucienfostier committed Apr 7, 2017
1 parent 844b3c8 commit 18b33b1
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 6 deletions.
7 changes: 7 additions & 0 deletions include/GafferImage/ImageWriter.h
Expand Up @@ -55,6 +55,7 @@ namespace GafferImage
{

IE_CORE_FORWARDDECLARE( ColorSpace )
IE_CORE_FORWARDDECLARE( ImageMetadata )
IE_CORE_FORWARDDECLARE( ImagePlug )

class ImageWriter : public GafferDispatch::TaskNode
Expand Down Expand Up @@ -88,6 +89,9 @@ class ImageWriter : public GafferDispatch::TaskNode
Gaffer::StringPlug *colorSpacePlug();
const Gaffer::StringPlug *colorSpacePlug() const;

Gaffer::StringPlug *colorSpaceMetadataNamePlug();
const Gaffer::StringPlug *colorSpaceMetadataNamePlug() const;

Gaffer::ValuePlug *fileFormatSettingsPlug( const std::string &fileFormat );
const Gaffer::ValuePlug *fileFormatSettingsPlug( const std::string &fileFormat ) const;

Expand All @@ -105,6 +109,9 @@ class ImageWriter : public GafferDispatch::TaskNode
ColorSpace *colorSpace();
const ColorSpace *colorSpace() const;

ImageMetadata *meta();
const ImageMetadata *meta() const;

Gaffer::Expression *expression();
const Gaffer::Expression *expression() const;

Expand Down
12 changes: 12 additions & 0 deletions python/GafferImageUI/ImageWriterUI.py
Expand Up @@ -120,6 +120,18 @@ def __colorSpacePresetValues( plug ) :

],

"colorSpaceMetadataName" : [

"description",
"""
Name of the metadata used to store the output image colorspace.
""",

"layout:section", "ColorSpaceMetadata",
"layout:index", -4,

],

"out" : [

"description",
Expand Down
42 changes: 36 additions & 6 deletions src/GafferImage/ImageWriter.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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() );
Expand Down Expand Up @@ -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 )
Expand Down Expand Up @@ -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.

Copy link
@lucienfostier

lucienfostier Apr 7, 2017

Author Owner

@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?

This comment has been minimized.

Copy link
@lucienfostier

lucienfostier Apr 7, 2017

Author Owner
Thread 1 "python" received signal SIGSEGV, Segmentation fault.
0x000000000000023d in ?? ()
(gdb) bt
#0  0x000000000000023d in ?? ()
#1  0x00007fd2052d73c9 in Gaffer::Plug::acceptsChild(Gaffer::GraphComponent const*) const ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libGaffer.so
#2  0x00007fd20530f00f in Gaffer::ValuePlug::acceptsChild(Gaffer::GraphComponent const*) const ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libGaffer.so
#3  0x00007fd20527ba55 in Gaffer::CompoundDataPlug::MemberPlug::acceptsChild(Gaffer::GraphComponent const*) const ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libGaffer.so
#4  0x00007fd2052a394b in Gaffer::GraphComponent::throwIfChildRejected(Gaffer::GraphComponent const*) const ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libGaffer.so
#5  0x00007fd2052a5328 in Gaffer::GraphComponent::addChild(boost::intrusive_ptr<Gaffer::GraphComponent>) ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libGaffer.so
#6  0x00007fd2052796a6 in Gaffer::CompoundDataPlug::addMember(std::string const&, Gaffer::ValuePlug*, std::string const&) ()
---Type <return> to continue, or q <return> to quit---
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libGaffer.so
#7  0x00007fd2052798b1 in Gaffer::CompoundDataPlug::addOptionalMember(std::string const&, Gaffer::ValuePlug*, std::string const&, bool) ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libGaffer.so
#8  0x00007fd1f9f90c2c in GafferImage::ImageWriter::execute() const ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libGafferImage.so
#9  0x00007fd1f9bde347 in GafferDispatchBindings::TaskNodeWrapper<GafferImage::ImageWriter>::execute() const ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libGafferImageBindings.so
#10 0x00007fd203c51426 in GafferDispatch::TaskNode::executeSequence(std::vector<float, std::allocator<float> > const&) const ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libGafferDispatch.so
#11 0x00007fd1f9bdd91b in GafferDispatchBindings::TaskNodeWrapper<GafferImage::ImageWriter>::executeSequence(std::vector<float, std::allocator<float> > const&) const ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libGafferImageBindings.so
#12 0x00007fd203c52f6f in GafferDispatch::TaskNode::TaskPlug::executeSequence(st---Type <return> to continue, or q <return> to quit---
d::vector<float, std::allocator<float> > const&) const ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libGafferDispatch.so
#13 0x00007fd203c406ff in GafferDispatch::Dispatcher::TaskBatch::execute() const ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libGafferDispatch.so
#14 0x00007fd203ebafac in (anonymous namespace)::DispatcherWrapper::taskBatchExecute(GafferDispatch::Dispatcher::TaskBatch const&) ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libGafferDispatchBindings.so
#15 0x00007fd203eca01f in boost::python::objects::caller_py_function_impl<boost::python::detail::caller<void (*)(GafferDispatch::Dispatcher::TaskBatch const&), boost::python::default_call_policies, boost::mpl::vector2<void, GafferDispatch::Dispatcher::TaskBatch const&> > >::operator()(_object*, _object*) ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libGafferDispatchBindings.so
#16 0x00007fd20db65eca in boost::python::objects::function::call(_object*, _object*) const ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libboost_python.so.1.61.0
#17 0x00007fd20db66238 in boost::detail::function::void_function_ref_invoker0<boost::python::objects::(anonymous namespace)::bind_return, void>::invoke(boost::d---Type <return> to continue, or q <return> to quit---
etail::function::function_buffer&) ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libboost_python.so.1.61.0
#18 0x00007fd20db707b3 in boost::python::detail::exception_handler::operator()(boost::function0<void> const&) const ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libboost_python.so.1.61.0
#19 0x00007fd20bb934c7 in boost::detail::function::function_obj_invoker2<boost::_bi::bind_t<bool, boost::python::detail::translate_exception<IECore::Exception, void (*)(IECore::Exception const&)>, boost::_bi::list3<boost::arg<1>, boost::arg<2>, boost::_bi::value<void (*)(IECore::Exception const&)> > >, bool, boost::python::detail::exception_handler const&, boost::function0<void> const&>::invoke(boost::detail::function::function_buffer&, boost::python::detail::exception_handler const&, boost::function0<void> const&) ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libIECorePython.so
#20 0x00007fd20db7057d in boost::python::handle_exception_impl(boost::function0<void>) ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libboost_python.so.1.61.0
#21 0x00007fd20db64b43 in function_call ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libboost_python.so.1.61.0
---Type <return> to continue, or q <return> to quit---
#22 0x00007fd2119e2df3 in PyObject_Call (func=func@entry=0x2c2c1f0, 
    arg=arg@entry=0x7fd211e7de10, kw=kw@entry=0x0) at Objects/abstract.c:2547
#23 0x00007fd211a984c6 in do_call (nk=<optimized out>, na=<optimized out>, 
    pp_stack=0x7ffe412bfb10, func=<optimized out>) at Python/ceval.c:4569
#24 call_function (oparg=<optimized out>, pp_stack=0x7ffe412bfb10)
    at Python/ceval.c:4374
#25 PyEval_EvalFrameEx (f=f@entry=0x7fd1f80519b0, throwflag=throwflag@entry=0)
    at Python/ceval.c:2989
#26 0x00007fd211a9b480 in fast_function (nk=<optimized out>, na=2, 
    n=<optimized out>, pp_stack=0x7ffe412bfcb0, func=<optimized out>)
    at Python/ceval.c:4437
#27 call_function (oparg=<optimized out>, pp_stack=0x7ffe412bfcb0)
    at Python/ceval.c:4372
#28 PyEval_EvalFrameEx (f=f@entry=0x7fd1f80515f0, throwflag=throwflag@entry=0)
    at Python/ceval.c:2989
#29 0x00007fd211a9b480 in fast_function (nk=<optimized out>, na=2, 
    n=<optimized out>, pp_stack=0x7ffe412bfe50, func=<optimized out>)
    at Python/ceval.c:4437
#30 call_function (oparg=<optimized out>, pp_stack=0x7ffe412bfe50)
    at Python/ceval.c:4372
#31 PyEval_EvalFrameEx (f=f@entry=0x7fd1f8051410, throwflag=throwflag@entry=0)
    at Python/ceval.c:2989
#32 0x00007fd211a9e0dd in PyEval_EvalCodeEx (co=<optimized out>, 
---Type <return> to continue, or q <return> to quit---
    globals=<optimized out>, locals=locals@entry=0x0, args=<optimized out>, 
    argcount=argcount@entry=1, kws=kws@entry=0x54f5588, kwcount=1, 
    defs=0x7fd2088f1fa8, defcount=1, closure=0x0) at Python/ceval.c:3584
#33 0x00007fd211a9b365 in fast_function (nk=<optimized out>, na=1, 
    n=<optimized out>, pp_stack=0x7ffe412c0090, func=<optimized out>)
    at Python/ceval.c:4447
#34 call_function (oparg=<optimized out>, pp_stack=0x7ffe412c0090)
    at Python/ceval.c:4372
#35 PyEval_EvalFrameEx (f=f@entry=0x54f53f0, throwflag=throwflag@entry=0)
    at Python/ceval.c:2989
#36 0x00007fd211a9e0dd in PyEval_EvalCodeEx (co=<optimized out>, 
    globals=<optimized out>, locals=locals@entry=0x0, 
    args=args@entry=0x7fd1f8bcdc38, argcount=2, kws=kws@entry=0x0, 
    kwcount=kwcount@entry=0, defs=defs@entry=0x0, defcount=defcount@entry=0, 
    closure=0x0) at Python/ceval.c:3584
#37 0x00007fd211a14eb0 in function_call (func=0x7fd208916cf8, 
    arg=0x7fd1f8bcdc20, kw=0x0) at Objects/funcobject.c:523
#38 0x00007fd2119e2df3 in PyObject_Call (func=func@entry=0x7fd208916cf8, 
    arg=arg@entry=0x7fd1f8bcdc20, kw=kw@entry=0x0) at Objects/abstract.c:2547
#39 0x00007fd2119f19cd in instancemethod_call (func=0x7fd208916cf8, 
    arg=0x7fd1f8bcdc20, kw=0x0) at Objects/classobject.c:2602
#40 0x00007fd2119e2df3 in PyObject_Call (func=func@entry=0x7fd1fab4b9b0, 
    arg=arg@entry=0x7fd1fa644410, kw=<optimized out>)
---Type <return> to continue, or q <return> to quit---
    at Objects/abstract.c:2547
#41 0x00007fd211a94437 in PyEval_CallObjectWithKeywords (
    func=func@entry=0x7fd1fab4b9b0, arg=arg@entry=0x7fd1fa644410, 
    kw=kw@entry=0x0) at Python/ceval.c:4221
#42 0x00007fd211ac3537 in PyEval_CallFunction (obj=0x7fd1fab4b9b0, 
    format=<optimized out>) at Python/modsupport.c:583
#43 0x00007fd203ebc765 in (anonymous namespace)::DispatcherWrapper::doDispatch(GafferDispatch::Dispatcher::TaskBatch const*) const ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libGafferDispatchBindings.so
#44 0x00007fd203c42f25 in GafferDispatch::Dispatcher::dispatch(std::vector<boost::intrusive_ptr<Gaffer::Node>, std::allocator<boost::intrusive_ptr<Gaffer::Node> > > const&) const ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libGafferDispatch.so
#45 0x00007fd203ec30a3 in (anonymous namespace)::dispatch(GafferDispatch::Dispatcher&, boost::python::api::object) ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libGafferDispatchBindings.so
#46 0x00007fd203ec5aec in boost::python::objects::caller_py_function_impl<boost::python::detail::caller<void (*)(GafferDispatch::Dispatcher&, boost::python::api::object), boost::python::default_call_policies, boost::mpl::vector3<void, GafferDispatch::Dispatcher&, boost::python::api::object> > >::operator()(_object*, _o---Type <return> to continue, or q <return> to quit---
bject*) ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libGafferDispatchBindings.so
#47 0x00007fd20db65eca in boost::python::objects::function::call(_object*, _object*) const ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libboost_python.so.1.61.0
#48 0x00007fd20db66238 in boost::detail::function::void_function_ref_invoker0<boost::python::objects::(anonymous namespace)::bind_return, void>::invoke(boost::detail::function::function_buffer&) ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libboost_python.so.1.61.0
#49 0x00007fd20db707b3 in boost::python::detail::exception_handler::operator()(boost::function0<void> const&) const ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libboost_python.so.1.61.0
#50 0x00007fd20bb934c7 in boost::detail::function::function_obj_invoker2<boost::_bi::bind_t<bool, boost::python::detail::translate_exception<IECore::Exception, void (*)(IECore::Exception const&)>, boost::_bi::list3<boost::arg<1>, boost::arg<2>, boost::_bi::value<void (*)(IECore::Exception const&)> > >, bool, boost::python::detail::exception_handler const&, boost::function0<void> const&>::invoke(boost::detail::function::function_buffer&, boost::python::detail::exception_handler const&, boost::function0<void> const&) ()
---Type <return> to continue, or q <return> to quit---
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libIECorePython.so
#51 0x00007fd20db7057d in boost::python::handle_exception_impl(boost::function0<void>) ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libboost_python.so.1.61.0
#52 0x00007fd20db64b43 in function_call ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libboost_python.so.1.61.0
#53 0x00007fd2119e2df3 in PyObject_Call (func=func@entry=0x2c2a5c0, 
    arg=arg@entry=0x7fd1fa5e7dd0, kw=kw@entry=0x0) at Objects/abstract.c:2547
#54 0x00007fd211a984c6 in do_call (nk=<optimized out>, na=<optimized out>, 
    pp_stack=0x7ffe412c0c70, func=<optimized out>) at Python/ceval.c:4569
#55 call_function (oparg=<optimized out>, pp_stack=0x7ffe412c0c70)
    at Python/ceval.c:4374
#56 PyEval_EvalFrameEx (f=f@entry=0x59c8eb0, throwflag=throwflag@entry=0)
    at Python/ceval.c:2989
#57 0x00007fd211a9b480 in fast_function (nk=<optimized out>, na=1, 
    n=<optimized out>, pp_stack=0x7ffe412c0e10, func=<optimized out>)
    at Python/ceval.c:4437
#58 call_function (oparg=<optimized out>, pp_stack=0x7ffe412c0e10)
    at Python/ceval.c:4372
#59 PyEval_EvalFrameEx (f=f@entry=0x7fd1e6f4f210, throwflag=throwflag@entry=0)
---Type <return> to continue, or q <return> to quit---
    at Python/ceval.c:2989
#60 0x00007fd211a9e0dd in PyEval_EvalCodeEx (co=<optimized out>, 
    globals=<optimized out>, locals=locals@entry=0x0, 
    args=args@entry=0x7fd1fa5e7410, argcount=2, kws=kws@entry=0x7fd211f69068, 
    kwcount=kwcount@entry=0, defs=defs@entry=0x0, defcount=defcount@entry=0, 
    closure=0x0) at Python/ceval.c:3584
#61 0x00007fd211a14f85 in function_call (func=0x7fd1fafd2320, 
    arg=0x7fd1fa5e73f8, kw=0x7fd1f804dc58) at Objects/funcobject.c:523
#62 0x00007fd2119e2df3 in PyObject_Call (func=func@entry=0x7fd1fafd2320, 
    arg=arg@entry=0x7fd1fa5e73f8, kw=kw@entry=0x7fd1f804dc58)
    at Objects/abstract.c:2547
#63 0x00007fd211a97fb7 in ext_do_call (nk=<optimized out>, na=<optimized out>, 
    flags=<optimized out>, pp_stack=0x7ffe412c1120, func=0x7fd1fafd2320)
    at Python/ceval.c:4666
#64 PyEval_EvalFrameEx (f=f@entry=0x7fd1e31bae18, throwflag=throwflag@entry=0)
    at Python/ceval.c:3028
#65 0x00007fd211a9e0dd in PyEval_EvalCodeEx (co=<optimized out>, 
    globals=<optimized out>, locals=locals@entry=0x0, 
    args=args@entry=0x7fd1e3cf6578, argcount=2, kws=kws@entry=0x0, 
    kwcount=kwcount@entry=0, defs=defs@entry=0x0, defcount=defcount@entry=0, 
    closure=0x0) at Python/ceval.c:3584
#66 0x00007fd211a14eb0 in function_call (func=0x7fd208924230, 
    arg=0x7fd1e3cf6560, kw=0x0) at Objects/funcobject.c:523
---Type <return> to continue, or q <return> to quit---
#67 0x00007fd2119e2df3 in PyObject_Call (func=func@entry=0x7fd208924230, 
    arg=arg@entry=0x7fd1e3cf6560, kw=kw@entry=0x0) at Objects/abstract.c:2547
#68 0x00007fd2119f19cd in instancemethod_call (func=0x7fd208924230, 
    arg=0x7fd1e3cf6560, kw=0x0) at Objects/classobject.c:2602
#69 0x00007fd2119e2df3 in PyObject_Call (func=func@entry=0x7fd1e35a1a50, 
    arg=arg@entry=0x7fd1e3ce2890, kw=kw@entry=0x0) at Objects/abstract.c:2547
#70 0x00007fd211a509a5 in slot_tp_call (self=<optimized out>, 
    args=0x7fd1e3ce2890, kwds=0x0) at Objects/typeobject.c:5546
#71 0x00007fd2119e2df3 in PyObject_Call (func=func@entry=0x7fd1f8064a50, 
    arg=arg@entry=0x7fd1e3ce2890, kw=<optimized out>)
    at Objects/abstract.c:2547
#72 0x00007fd211a94437 in PyEval_CallObjectWithKeywords (
    func=func@entry=0x7fd1f8064a50, arg=arg@entry=0x7fd1e3ce2890, 
    kw=kw@entry=0x0) at Python/ceval.c:4221
#73 0x00007fd211ac3537 in PyEval_CallFunction (obj=0x7fd1f8064a50, 
    format=<optimized out>) at Python/modsupport.c:583

#74 0x00007fd2028ffac8 in boost::detail::function::function_obj_invoker1<GafferBindings::Detail::Slot<boost::signal<bool (boost::python::api::object), GafferUI::EventSignalCombiner<bool>, int, std::less<int>, boost::function<bool (boost::python::api::object)> >, GafferBindings::DefaultSlotCaller<boost::signal<bool (boost::python::api::object), GafferUI::EventSignalCombiner<bool>, int, std::less<int>, boost::function<bool (boost::python::api::object)> > > >, bool, boost::python::api::object>::invoke(boost::detail::function::function_buffer&, boost::python---Type <return> to continue, or q <return> to quit---
::api::object) ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libGafferUIBindings.so
#75 0x00007fd202904300 in boost::signal1<bool, boost::python::api::object, GafferUI::EventSignalCombiner<bool>, int, std::less<int>, boost::function<bool (boost::python::api::object)> >::operator()(boost::python::api::object) ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libGafferUIBindings.so
#76 0x00007fd202904562 in GafferBindings::Detail::DefaultSignalCallerBase<1, boost::signal<bool (boost::python::api::object), GafferUI::EventSignalCombiner<bool>, int, std::less<int>, boost::function<bool (boost::python::api::object)> > >::call(boost::signal<bool (boost::python::api::object), GafferUI::EventSignalCombiner<bool>, int, std::less<int>, boost::function<bool (boost::python::api::object)> >&, boost::python::api::object) ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libGafferUIBindings.so
#77 0x00007fd2028fe14f in boost::python::objects::caller_py_function_impl<boost::python::detail::caller<bool (*)(boost::signal<bool (boost::python::api::object), GafferUI::EventSignalCombiner<bool>, int, std::less<int>, boost::function<bool (boost::python::api::object)> >&, boost::python::api::object), boost::python::default_call_policies, boost::mpl::vector3<bool, boost::signal<bool (boost::python::api::object), GafferUI::EventSignalCombiner<bool>, int, std::less<int>, boost::function<bool (boost::python::api::object)> >&, boost::python::api::object> > ---Type <return> to continue, or q <return> to quit---
>::operator()(_object*, _object*) ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libGafferUIBindings.so
#78 0x00007fd20db65eca in boost::python::objects::function::call(_object*, _object*) const ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libboost_python.so.1.61.0
#79 0x00007fd20db66238 in boost::detail::function::void_function_ref_invoker0<boost::python::objects::(anonymous namespace)::bind_return, void>::invoke(boost::detail::function::function_buffer&) ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libboost_python.so.1.61.0
#80 0x00007fd20db707b3 in boost::python::detail::exception_handler::operator()(boost::function0<void> const&) const ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libboost_python.so.1.61.0
#81 0x00007fd20bb934c7 in boost::detail::function::function_obj_invoker2<boost::_bi::bind_t<bool, boost::python::detail::translate_exception<IECore::Exception, void (*)(IECore::Exception const&)>, boost::_bi::list3<boost::arg<1>, boost::arg<2>, boost::_bi::value<void (*)(IECore::Exception const&)> > >, bool, boost::python::detail::exception_handler const&, boost::function0<void> const&>::invoke(boost::detail::function::function_buffer&, boost::python::detail::exception_handler const&, boost::function0<void> const&) ()
---Type <return> to continue, or q <return> to quit---
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libIECorePython.so
#82 0x00007fd20db7057d in boost::python::handle_exception_impl(boost::function0<void>) ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libboost_python.so.1.61.0
#83 0x00007fd20db64b43 in function_call ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libboost_python.so.1.61.0
#84 0x00007fd2119e2df3 in PyObject_Call (func=func@entry=0x2cb4760, 
    arg=arg@entry=0x7fd1e3cf6878, kw=kw@entry=0x0) at Objects/abstract.c:2547
#85 0x00007fd2119f19cd in instancemethod_call (func=0x2cb4760, 
    arg=0x7fd1e3cf6878, kw=0x0) at Objects/classobject.c:2602
#86 0x00007fd2119e2df3 in PyObject_Call (func=func@entry=0x7fd1e3d72eb0, 
    arg=arg@entry=0x7fd1e3ce2a90, kw=kw@entry=0x0) at Objects/abstract.c:2547
#87 0x00007fd211a509a5 in slot_tp_call (self=<optimized out>, 
    args=0x7fd1e3ce2a90, kwds=0x0) at Objects/typeobject.c:5546
#88 0x00007fd2119e2df3 in PyObject_Call (func=func@entry=0x7fd1f805b578, 
    arg=arg@entry=0x7fd1e3ce2a90, kw=kw@entry=0x0) at Objects/abstract.c:2547
#89 0x00007fd211a984c6 in do_call (nk=<optimized out>, na=<optimized out>, 
    pp_stack=0x7ffe412c1f80, func=<optimized out>) at Python/ceval.c:4569
#90 call_function (oparg=<optimized out>, pp_stack=0x7ffe412c1f80)
    at Python/ceval.c:4374
---Type <return> to continue, or q <return> to quit---
#91 PyEval_EvalFrameEx (f=f@entry=0x7fd1f802fd38, throwflag=throwflag@entry=0)
    at Python/ceval.c:2989
#92 0x00007fd211a9e0dd in PyEval_EvalCodeEx (co=<optimized out>, 
    globals=<optimized out>, locals=locals@entry=0x0, 
    args=args@entry=0x7fd1e3ce2928, argcount=1, kws=kws@entry=0x7fd211f69068, 
    kwcount=kwcount@entry=0, defs=defs@entry=0x0, defcount=defcount@entry=0, 
    closure=0x0) at Python/ceval.c:3584
#93 0x00007fd211a14f85 in function_call (func=0x7fd1fb3e4e60, 
    arg=0x7fd1e3ce2910, kw=0x7fd1e6f4e280) at Objects/funcobject.c:523
#94 0x00007fd2119e2df3 in PyObject_Call (func=func@entry=0x7fd1fb3e4e60, 
    arg=arg@entry=0x7fd1e3ce2910, kw=kw@entry=0x7fd1e6f4e280)
    at Objects/abstract.c:2547
#95 0x00007fd211a97fb7 in ext_do_call (nk=<optimized out>, na=<optimized out>, 
    flags=<optimized out>, pp_stack=0x7ffe412c2290, func=0x7fd1fb3e4e60)
    at Python/ceval.c:4666
#96 PyEval_EvalFrameEx (f=f@entry=0x7fd1e6f33420, throwflag=throwflag@entry=0)
    at Python/ceval.c:3028
#97 0x00007fd211a9e0dd in PyEval_EvalCodeEx (co=<optimized out>, 
    globals=<optimized out>, locals=locals@entry=0x0, 
    args=args@entry=0x7fd1e3ce2ba8, argcount=1, kws=kws@entry=0x0, 
    kwcount=kwcount@entry=0, defs=defs@entry=0x0, defcount=defcount@entry=0, 
    closure=0x0) at Python/ceval.c:3584
#98 0x00007fd211a14eb0 in function_call (func=0x7fd208924230, 
---Type <return> to continue, or q <return> to quit---
    arg=0x7fd1e3ce2b90, kw=0x0) at Objects/funcobject.c:523
#99 0x00007fd2119e2df3 in PyObject_Call (func=func@entry=0x7fd208924230, 
    arg=arg@entry=0x7fd1e3ce2b90, kw=kw@entry=0x0) at Objects/abstract.c:2547
#100 0x00007fd2119f19cd in instancemethod_call (func=0x7fd208924230, 
    arg=0x7fd1e3ce2b90, kw=0x0) at Objects/classobject.c:2602
#101 0x00007fd2119e2df3 in PyObject_Call (func=func@entry=0x7fd1fab61fa0, 
    arg=arg@entry=0x7fd211f69050, kw=kw@entry=0x0) at Objects/abstract.c:2547
#102 0x00007fd211a509a5 in slot_tp_call (self=<optimized out>, 
    args=0x7fd211f69050, kwds=0x0) at Objects/typeobject.c:5546
#103 0x00007fd2119e2df3 in PyObject_Call (func=func@entry=0x7fd1f8064990, 
    arg=arg@entry=0x7fd211f69050, kw=<optimized out>)
    at Objects/abstract.c:2547
#104 0x00007fd211a94437 in PyEval_CallObjectWithKeywords (func=0x7fd1f8064990, 
    arg=0x7fd211f69050, kw=<optimized out>) at Python/ceval.c:4221
#105 0x00007fd1fd209c5c in PySide::SignalManager::callPythonMetaMethod(QMetaMethod const&, void**, _object*, bool) ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libpyside-python2.7.so.1.2
#106 0x00007fd1fd20fdcd in PySide::GlobalReceiverV2::qt_metacall(QMetaObject::Call, int, void**) ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libpyside-python2.7.so.1.2
#107 0x00007fd201acc392 in QMetaObject::activate(QObject*, QMetaObject const*, i---Type <return> to continue, or q <return> to quit---
nt, void**) ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libQtCore.so.4
#108 0x00007fd20149bd22 in QAbstractButton::clicked(bool) ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libQtGui.so.4
#109 0x00007fd20120a173 in ?? ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libQtGui.so.4
#110 0x00007fd20120b1c3 in ?? ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libQtGui.so.4
#111 0x00007fd20120b2ac in QAbstractButton::mouseReleaseEvent(QMouseEvent*) ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libQtGui.so.4
#112 0x00007fd1fc674be3 in QPushButtonWrapper::mouseReleaseEvent(QMouseEvent*)
    ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/python/PySide/QtGui.so
#113 0x00007fd200ed6186 in QWidget::event(QEvent*) ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libQtGui.so.4
#114 0x00007fd1fc6721ab in QPushButtonWrapper::event(QEvent*) ()
---Type <return> to continue, or q <return> to quit---
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/python/PySide/QtGui.so
#115 0x00007fd200e86e5c in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libQtGui.so.4
#116 0x00007fd200e8d576 in QApplication::notify(QObject*, QEvent*) ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libQtGui.so.4
#117 0x00007fd1fc31663e in QApplicationWrapper::notify(QObject*, QEvent*) ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/python/PySide/QtGui.so
#118 0x00007fd201ab8b5d in QCoreApplication::notifyInternal(QObject*, QEvent*)
    ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libQtCore.so.4
#119 0x00007fd200e8cd03 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libQtGui.so.4
#120 0x00007fd200efe520 in ?? ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libQtGui.so.4
---Type <return> to continue, or q <return> to quit---
#121 0x00007fd200efc8bc in QApplication::x11ProcessEvent(_XEvent*) ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libQtGui.so.4
#122 0x00007fd200f22d92 in ?? ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libQtGui.so.4
#123 0x00007fd1ffd45197 in g_main_context_dispatch ()
   from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#124 0x00007fd1ffd453f0 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#125 0x00007fd1ffd4549c in g_main_context_iteration ()
   from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#126 0x00007fd201ae4535 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libQtCore.so.4
#127 0x00007fd200f22e26 in ?? ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libQtGui.so.4
#128 0x00007fd201ab77af in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libQtCore.so.4
#129 0x00007fd201ab7aa5 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag---Type <return> to continue, or q <return> to quit---
>) ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libQtCore.so.4
#130 0x00007fd201abca69 in QCoreApplication::exec() ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/lib/libQtCore.so.4
#131 0x00007fd1fc312f4d in Sbk_QApplicationFunc_exec_ ()
   from /home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/python/PySide/QtGui.so
#132 0x00007fd211a9b63c in call_function (oparg=<optimized out>, 
    pp_stack=0x7ffe412c3820) at Python/ceval.c:4336
#133 PyEval_EvalFrameEx (f=f@entry=0x7fd1f803dd00, throwflag=throwflag@entry=0)
    at Python/ceval.c:2989
#134 0x00007fd211a9b480 in fast_function (nk=<optimized out>, na=1, 
    n=<optimized out>, pp_stack=0x7ffe412c39c0, func=<optimized out>)
    at Python/ceval.c:4437
#135 call_function (oparg=<optimized out>, pp_stack=0x7ffe412c39c0)
    at Python/ceval.c:4372
#136 PyEval_EvalFrameEx (f=f@entry=0x3299d80, throwflag=throwflag@entry=0)
    at Python/ceval.c:2989
#137 0x00007fd211a9b480 in fast_function (nk=<optimized out>, na=2, 
    n=<optimized out>, pp_stack=0x7ffe412c3b60, func=<optimized out>)
    at Python/ceval.c:4437
---Type <return> to continue, or q <return> to quit---
#138 call_function (oparg=<optimized out>, pp_stack=0x7ffe412c3b60)
    at Python/ceval.c:4372
#139 PyEval_EvalFrameEx (f=f@entry=0x7fd1fb3d0da8, throwflag=throwflag@entry=0)
    at Python/ceval.c:2989
#140 0x00007fd211a9b480 in fast_function (nk=<optimized out>, na=2, 
    n=<optimized out>, pp_stack=0x7ffe412c3d00, func=<optimized out>)
    at Python/ceval.c:4437
#141 call_function (oparg=<optimized out>, pp_stack=0x7ffe412c3d00)
    at Python/ceval.c:4372
#142 PyEval_EvalFrameEx (f=f@entry=0x7fd1fb3d0bc0, throwflag=throwflag@entry=0)
    at Python/ceval.c:2989
#143 0x00007fd211a9b480 in fast_function (nk=<optimized out>, na=1, 
    n=<optimized out>, pp_stack=0x7ffe412c3ea0, func=<optimized out>)
    at Python/ceval.c:4437
#144 call_function (oparg=<optimized out>, pp_stack=0x7ffe412c3ea0)
    at Python/ceval.c:4372
#145 PyEval_EvalFrameEx (f=f@entry=0x7fd211e8db00, throwflag=throwflag@entry=0)
    at Python/ceval.c:2989
#146 0x00007fd211a9e0dd in PyEval_EvalCodeEx (co=co@entry=0x7fd211e47eb0, 
    globals=globals@entry=0x7fd211f3e168, locals=locals@entry=0x7fd211f3e168, 
    args=args@entry=0x0, argcount=argcount@entry=0, kws=kws@entry=0x0, 
    kwcount=kwcount@entry=0, defs=defs@entry=0x0, defcount=defcount@entry=0, 
    closure=closure@entry=0x0) at Python/ceval.c:3584
---Type <return> to continue, or q <return> to quit---
#147 0x00007fd211a9e212 in PyEval_EvalCode (co=co@entry=0x7fd211e47eb0, 
    globals=globals@entry=0x7fd211f3e168, locals=locals@entry=0x7fd211f3e168)
    at Python/ceval.c:669
#148 0x00007fd211ac6f62 in run_mod (arena=0x250b410, flags=0x7ffe412c4140, 
    locals=0x7fd211f3e168, globals=0x7fd211f3e168, 
    filename=0x7fd211e47eb0 "\002", mod=<optimized out>)
    at Python/pythonrun.c:1376
#149 PyRun_FileExFlags (fp=fp@entry=0x24d04e0, 
    filename=filename@entry=0x7ffe412c579c "/home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/bin/gaffer.py", start=start@entry=257, 
    globals=globals@entry=0x7fd211f3e168, locals=locals@entry=0x7fd211f3e168, 
    closeit=closeit@entry=1, flags=flags@entry=0x7ffe412c4140)
    at Python/pythonrun.c:1362
#150 0x00007fd211ac82f9 in PyRun_SimpleFileExFlags (fp=fp@entry=0x24d04e0, 
    filename=filename@entry=0x7ffe412c579c "/home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/bin/gaffer.py", closeit=closeit@entry=1, 
    flags=flags@entry=0x7ffe412c4140) at Python/pythonrun.c:948
#151 0x00007fd211ac89a3 in PyRun_AnyFileExFlags (fp=fp@entry=0x24d04e0, 
    filename=filename@entry=0x7ffe412c579c "/home/gafferdev/dev/gaffer/gafferDependencies-0.32.0.0-linux/bin/gaffer.py", closeit=closeit@entry=1, 
    flags=flags@entry=0x7ffe412c4140) at Python/pythonrun.c:752
#152 0x00007fd211ade02d in Py_Main (argc=<optimized out>, argv=<optimized out>)
    at Modules/main.c:640
---Type <return> to continue, or q <return> to quit---
#153 0x00007fd210cb9830 in __libc_start_main (main=0x400680 <main>, argc=2, 
    argv=0x7ffe412c42f8, init=<optimized out>, fini=<optimized out>, 
    rtld_fini=<optimized out>, stack_end=0x7ffe412c42e8)
    at ../csu/libc-start.c:291
#154 0x00000000004006b1 in _start ()

This comment has been minimized.

Copy link
@johnhaddon

johnhaddon Apr 7, 2017

I don't think execute() is the right place to be adding this, because we'll be adding a new plug every time the ImageWriter executes. I would expect this to work from the constructor, since it shouldn't hit python at all. But I think it might be easier to just add it directly to the image spec rather than use a node.

Also though, I'm a bit unsure about this one - an extra bit of metadata seems very likely to confuse an already confusing topic, since OIIIO already has a colorspace metadata of its own, and many of the file formats have alternative ways of specifying colorspace. Let's chat about this a bit more - could it be that we're better off without, or even that we should allow the defaultColorSpaceFunction to provide arbitrary metadata?

One last thing, putting the stack trace in has linked this commit to all tickets between 1 and 154! I think this can be avoided next time by using triple backticks to put it in a code block like so :

#153 0x00007fd210cb9830 in __libc_start_main (main=0x400680
, argc=2,
argv=0x7ffe412c42f8, init=, fini=,
rtld_fini=, stack_end=0x7ffe412c42e8)
at ../csu/libc-start.c:291
#154 0x00000000004006b1 in _start ()

if( !inPlug()->getInput<ImagePlug>() )
{
throw IECore::Exception( "No input image." );
Expand Down Expand Up @@ -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();
}

Expand Down

0 comments on commit 18b33b1

Please sign in to comment.