matrix type giving me trouble

scaronscaron Fabric for Houdini Posts: 171

Arnold has an AtMatrix which is a float[4][4]. In my previous kl2edk version of these bindings I used...

alias Float32 AtMatrix[4][4];

but kludge is making this in the .py...

ext.add_alias('AtMatrix', 'float [4][4]')\
  .add_comment("""/** 4-by-4 matrix */""")

and this in the .cpp...

struct Float32[4][4]_CxxConstPtr;
struct Float32[4][4]_CxxMutablePtr;
struct Float32[4][4]_CxxConstRef;
struct Float32[4][4]_CxxMutableRef;

but it gives me this error when compiling...

matrix.cpp:68:15: error: expected unqualified-id before '[' token
 struct Float32[4][4]_CxxConstPtr;


  • scaronscaron Fabric for Houdini Posts: 171
    edited January 10

    I should mention that kludge discover is making the correct alias from the above example, I found this line in the kl file...

    /** 4-by-4 matrix */ alias Float32 AtMatrix[4][4];

    But while trying to workaround this I followed the USD example and some of the documentation about add_mirror...

    So while using this in the .py...

    ext.add_mirror('AtMatrix', 'Mat44', 'Math')\
      .add_comment("""/** 4-by-4 matrix */""")

    I get this error when compling...

    matrix.cpp: In function 'void matrix_AiM4Identity_64c2c99561144beb5a32719bc8265bc4(Fabric::EDK::KL::Traits<float [4][4]>::INParam)':
    matrix.cpp:5066:22: error: invalid array assignment
         _KLUDGE_LIB_mout = _KLUDGE_EDK_mout;

    I can hand edit the cpp to be like my old extension code. From this...

    AtMatrix _KLUDGE_LIB_mout;
    _KLUDGE_LIB_mout = _KLUDGE_EDK_mout;

    To this...

    AtMatrix& _KLUDGE_LIB_mout = reinterpret_cast<AtMatrix &>(_KLUDGE_LIB_mout);

    And I am able to fix that single line, but obviously I shouldn't be editing the .cpp directly. Thoughts?

  • scaronscaron Fabric for Houdini Posts: 171

    One more thing, the function which is being wrapped should be using io since the value is being passed in needs to be changed inside the function. I don't see any mention of how to control this in the documentation.

Sign In or Register to comment.