Question of "layer" in the Visual_scene

Hi

We are using Maya plug-in for generating the DAE document, And in our dae document, we have:

 
<library_visual_scenes> 
    <visual_scene id="VisualSceneNode" name="tentacle_test_2"> 
    ... 
    <node id="pCube8" name="pCube8" type="NODE"> 
    <extra> 
        <technique profile="MAYA"> 
          <layer name="Mesh">polySurface1</layer> 
          <layer name="Skeleton_and_parts">joint1 joint2... 

We are very interested in getting the layer in the <technique profile=“MAYA”>, but not sure how to get it efficiently. We found domLayer in the domVisual_Scene but under domEvaluate_scene, which seems to be something else based on def of <evaluate_scene>. And we can not convert it to IDREF_array either because there is no count attribute.

How could we convert layer here?

Thanks a lot in advance

Reading <extra> data is simple with the DOM. I’m assuming you’re using DOM 2.0 here.

Let’s say ‘vsLib’ is a daeElement pointer to the <library_visual_scenes> element. You could read the <extra> data like this:

if (daeElement* extra = vsLib->getChild("extra")) {
    if (daeElement* technique = extra->getChild("technique")) {
        daeElementRefArray children = technique->getChildren();
        for (size_t i = 0; i < children.getCount(); i++) {
            if (string("layer") == children[i]->getElementName()) {
                // Print <layer> info
                cout << "Layer name = " << children[i]->getAttribute("name") << endl;
                cout << "Layer values = " << children[i]->getCharData() << endl;
            }
        }
    }
}

It looks like the character data is a whitespace separated list of values. There’s a cdom::tokenize function that you can use for breaking up the values based on whitespace if you need it.

#include <dae/daeUtils.h>
list<string> values = cdom::tokenize(str, " 
	");

Steve

Hi Steve

Thanks a lot for the help. This is what we want. The layer plays very important role in our system.