go3d/go-collada — pull request #3 by GlenKelley (2013-09-18 01:22:32+00:00)
Title: Stop xcns from selecting self

Firstly, thanks for the work in creating a Collada Importer in Go.

When I try and use the library to import collada files, the program enters an infinite loop, with the stack trace

... repeated
imp.obj_NodeDef()
imp.load_ChildNode()
imp.init_ChildNode()
imp.obj_ChildNode()
imp.load_NodeDef()
imp.init_NodeDef()
imp.obj_NodeDef()
imp.objs_NodeDef() <-- loops back to here
imp.load_VisualSceneDef()
imp.init_VisualSceneDef()
imp.obj_VisualSceneDef()
imp.objs_VisualSceneDef()
imp.libs_visual_scenes()
imp.libs_All()
imp.ImportCollada()

It was getting stuck on the following xml node (from a sample collada file you can test here http://www.thingiverse.com/thing:482/#files)

The problem is caused because `xcns()` can return **itself** in the return list, if the 'self' node matches the selection criteria. This is defined behaviour of the https://github.com/go-forks/xmlx package.

I have tried a fix with minimal impact, to strip the existing node from the return list. This is done by testing the parent of the first node and rejecting it if it matches the node passed in.

If this bug does not happen for you, would you have an example collada (*.dea) file I could try to figure out what caused this error for me?

Also, what is the License for this project? Would you mind if I created an open source fork and made changes (like removing global state, so I can run this in parallel within a larger application)?