reading Strings from raw daeElements in Collada DOM

Hello everyone,

this might be a very simple thing to do, but I have trouble finding out how, and the Collada DOM documentation doesn’t help either:

I’m exporting custom attributes from maya into a <node>, which looks like this:

<node id="playerStart1" name="playerStart1" type="NODE">

  <technique profile="MAYA">
      <soc_type short_name="soc_type" type="string">PLAYER_START</soc_type>
      <soc_startSpeed short_name="soc_startSpeed" type="float">0</soc_startSpeed>

soc_type and soc_startSpeed are custom attributes that I added to Maya’s transform node, and that get exported in this way by Collada Maya.

My code can reach the daeElement* for the <soc_type> element, but now I’m stuck:

How do I read the string “PLAYER_START” from the element with the Collada DOM? In an ordinary XML DOM, you have a Text node that contains the text data, but there is no such node in Collada’s DOM. There is a daeElement::getValuePointer() method, but it only returns raw memory that doesn’t look like it is my string (the docs say it should be typecast to the ‘appropriate type’ - but how do I find out which one is appropriate?)

I also think that the answer to this question should go into the 101 document (which I find a great idea anyway!), maybe together with a thorough description of the DAE metatype system (which looks powerful, but appears too complex to be only documented with doxygen, as you don’t get an overall picture of how it works)

Thanks in advance,


To access elements inside the <extra><technique profile=""> you need to do two things. 1. iterate over the element’s using the technique element’s getContents array. 2. cast the daeElement that is in that array to a domAny.

The domAny class has a getValue function that will return the string. You can also query the number, names and values of attributes. also all as strings.

With your example you would need to cast the first element in the contents array to domAny (probably want to check getElementName to make sure it is dynamic_attributes) then iterate over it’s children in the contents array.