In test_input(), return true if the input can be cast to a CameraOp, and
false otherwise:


bool TestOperator::test_input(int n, DD::Image::Op* op)
{
   std::cout<<"test_input"<    if (n == 0)
      return dynamic_cast(CameraOp) != 0;
    return false;
}

Hope that helps.

Cheers,
Ivan

On Thu, Oct 6, 2011 at 9:16 AM, AcidDrippa
<nuke-dev-re...@thefoundry.co.uk>wrote:

> **
> Hi,
>
> I've been experimenting with the NDK for the first time. So my first aim
> was to create a custom node and perform an input connection.
>
> I derived my operator from the Op class (like given in the SimpleAxis
> sample) and I want a single input connection from a camera.
>
> The dll compiles perfectly fine and I am able to create my node in the
> graph window, but I cannot connect the camera node to my node.
>
> These are the methods I used:
>
> NOTE: I haven't given the #includes and namespace in this snippet, but
> everything else is pretty much the same
>
> *Code:*
> static const char* const CLASS = "TestOperator";
> static const char* const HELP = "Testing NDK development";
>
> class TestOperator : public DD::Image::Op
> {
>
> public:
>    TestOperator(Node* node) : Op(node){}
>
>    virtual ~TestOperator(){};
>
>    virtual int minimum_inputs() const;
>    virtual int maximum_inputs() const;
>
>    DD::Image::CameraOp* input0() const { return
> (DD::Image::CameraOp*)(DD::Image::Op::input0()); }
>
>    virtual bool test_input(int n, DD::Image::Op* op);
>
>         const char* Class() const {return CLASS;}
>    const char* node_help() const {return HELP;}
>
>    static DD::Image::Op* build(Node* node);
>
> protected:
>
>    void _validate(bool for_real);
>
> };
>
> const Op::Description TestOperator::d(CLASS, "TestOperator",
> TestOperator::build);
>
> void TestOperator::_validate(bool for_real)
> {
>    std::cout<<"In validate"<**validate(for_real);
>     }
> }
>
> int TestOperator::minimum_inputs() const
> {
>    return 1;
> }
>
> int TestOperator::maximum_inputs() const
> {
>    return 1;
> }
>
> bool TestOperator::test_input(int n, DD::Image::Op* op)
> {
>    std::cout<<"test_input"<**    if (n == 0)
>       return dynamic_cast**(op) != 0;
>     return false;
> }
>
> Op* TestOperator::build(Node* node)
> {
>    return new TestOperator(node);
> }
>
>
>
> Am I missing something?
>
> Any suggestions would be helpful.
>
> Thanks
>
> _______________________________________________
> Nuke-dev mailing list
> Nuke-dev@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev
>
>
_______________________________________________
Nuke-dev mailing list
Nuke-dev@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev

Reply via email to