Game Development Reference
In-Depth Information
Here are a few examples of useful queries:
node —list all the <node> elements in the document;
node[@id] —list all the <node> elements in the document that have an id ;
def:node[@id="camera1"] —find the <node> element with a specific id ;
def:node[@id="camera1"]/.. —find the parent element for the <node> ele-
ment with a specific id
Here's another example from checking an issue with a C4D COLLADA export.
The coherency test reports ERROR: (type=node,id=ID206) bind_material does
not exist . Let's use those parameters in an XPath query. As this is a standard
querylanguagelet'suseXMLNotepadthistime(see Figure9.12 ) .
The query looks for any element named node with a parameter id equal to
“ID206.” The “a:” prefix is used to refer to the COLLADA schema as indicated
in the search box. This shows that the node “ID206” has an instance of geometry
“ID207,” but no material binding as returned by the coherency test. Selecting an-
other node shows how bind_material should be a child of instance_geometry ,
which is indeed an error. Continuing our investigation, we can search for the geom-
etry with an id equal to “ID207” //a:geometry[@id=''ID207''] which shows a
geometry whose mesh contains sources and vertices but no triangles or other form
of geometry. So, now we can report the issue as a C4D exporter bug, and without
waiting for this bug to be fixed, we can simply delete the bogus geometry and the
corresponding instance_geometry (the geometry from the faulty document).
9.9 Absolute versus Relative Paths
A very common issue with COLLADA content is related to missing or misplaced
external content referenced by the document. It is a very common issue to forget
to configure the exporter to use a relative path when exporting the content, or
for an exporter to not provide that option. If the content is exported using the
relative path, the external references such as images will be found in a location
relative to the position of the .dae document, so that it is possible to copy all the
files together, in a zip archive, for example, when the creator needs to send the
exported document to someone else.
Typically, a COLLADA document will load just fine, but no texture will be
displayed. Let's use our XPath tool to query the location of external referenced
images in a large COLLADA document using //def:init_from . If the results look
like file:///C:/MyProject/Collada-Models/images/HMN09_st06_02.jpg then
we know the exporter has been using an absolute path, and if the images are
not in exactly the same location, they cannot be found.
Note that exporting with an absolute path is not necessarily a bad thing; some
teams have decided that all computers will have a special mounted drive to share
Search WWH ::




Custom Search