Hi,

Yes it is possible, but not via the GeoReader. You also need to subclass the GeoReaderFormat. I've just realised that this isn't documented in the ndk examples, which is an oversight on our part and I'll look into updating this.

Basically, if you define my3DReader, you also need to define a my3DReaderFormat. Within the format, you then need to implement the knobs callback. I've attached a simple example of how to do this with the my3dReader example. (note: I haven't tried building this, but should give you enough of a starting point to do what you want).

If you want to access the format's knobs from within your reader, you need to store the ReadGeo that's passed into the reader's constructor. You can then access the handler and it's knobs using something like:

my3dReaderFormat* pfmt = dynamic_cast<my3dReaderFormat*>(_pReadGeo->handler());
  knob* myKnob =  _pReadGeo->knob("read_on_each_frame");

Also in your my3dReader you need to change:

GeoReader::Description my3dReader::description("my3d\0", my3dReader::Build, my3dReader::Test);

to

GeoReader::Description my3dReader::description("my3d\0", my3dReader::build, my3dReaderFormat::buildformat, my3dReader::test, NULL, false);

Hope that helps, let me know if something isn't clear.

Cheers,

Peter.


On 14/03/2013 02:50, Jonathan Egstad wrote:
It should be possible to add knobs to a GeoReader in 7.0.

Haven't done it yet myself but I believe the Alembic reader leverages this.

I think it uses the same basic methodology as the Reader class, so you can check exrReader.cpp for an example implementation.

-jonathan

On Mar 13, 2013, at 7:26 PM, Ivan Busquets <[email protected] <mailto:[email protected]>> wrote:

Hi Blake,

Unless something has changed in the API recently, I don't think you can.
You would need to derive from SourceGeo instead, and then build all the knobs you need in there.

Unfortunately, this means your reader will use a separate node, as opposed to the standard ReadGeo.

I believe Jonathan gave some more details on this a while back.




On Wed, Mar 13, 2013 at 3:47 PM, Blake Sloan <[email protected] <mailto:[email protected]>> wrote:

    Is it straightforward to add a knob to a GeoReader? I've added
    the knobs() prototype to the class definition of my derived class
    and used the usual method to add knobs to the control panel. They
    don't show up. Is there an example of this anywhere? The
    my3dReader example does not have custom knobs.

    Once again, sorry if this is already well-covered.

    -b

-- *B*l*a*k*e* S*l*o*a*n
    *S*o*f*t*w*a*r*e, *C*o*l*o*r*
    *D*i*g*i*t*a*l* D*o*m*a*i*n*

    _______________________________________________
    Nuke-dev mailing list
    [email protected]
    <mailto:[email protected]>,
    http://forums.thefoundry.co.uk/
    http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev


_______________________________________________
Nuke-dev mailing list
[email protected] <mailto:[email protected]>, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev


_______________________________________________
Nuke-dev mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev

// my3dReaderFormat.cpp
// Copyright (c) 2013 The Foundry Visionmongers Ltd.  All Rights Reserved.

#include "my3dReaderFormat.h"

#include "DDImage/Knobs.h"

using namespace DD::Image;

my3dReaderFormat::my3dReaderFormat()
  , _readOnEachFrame(false)
{
}

void my3dReaderFormat::knobs(Knob_Callback f)
{
  // This places knobs in the format specific area of the main tab
  Bool_knob(f, &_readOnEachFrame, "read_on_each_frame", "read on each frame");
  SetFlags( f, Knob::EARLY_STORE);
  Tooltip(f, "Activate this to read the objects on each frame. This should be 
activated for animated objects.");
}

void my3dReaderFormat::extraKnobs(Knob_Callback f)
{
  // This places knobs after all other knobs
  // (For example, the "SceneGraph" tab knob and sceneView knob in the 
abcReader)
}

void my3dReaderFormat::append(Hash& new_hash)
{
  new_hash.append(_readOnEachFrame);
}

/*! Build the my3d file interface
 */
/*static*/ GeoReaderFormat* my3dReaderFormat::buildformat(ReadGeo* iop)
{
  return new my3dReaderFormat();
}

// Copyright (c) 2013 The Foundry Visionmongers Ltd.  All Rights Reserved.

#ifndef DDImage_my3DReaderFormat_h
#define DDImage_my3DReaderFormat_h

#include "DDImage/ReadGeo.h"

namespace DD
{
  namespace Image
  {
    class my3dReaderFormat : public GeoReaderFormat
    {
      friend class my3dReader;

    private:

      bool        _readOnEachFrame;

    public:

      my3dReaderFormat();
      virtual ~my3dReaderFormat() {};

      static GeoReaderFormat* buildformat(ReadGeo* iop);

      // GeoReaderFormat
      virtual void knobs(Knob_Callback c);
      virtual void extraKnobs(Knob_Callback c);
      virtual void append(Hash& hash);
      //~GeoReaderFormat
    };
  }
}

#endif // DDImage_my3DReaderFormat_h

// Copyright (c) 2013 The Foundry Visionmongers Ltd.  All Rights Reserved.
_______________________________________________
Nuke-dev mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev

Reply via email to