Results 1 to 2 of 2

Thread: sid usage

  1. #1

    sid usage

    I have a question about the usage of sid's in Collada files.

    In the specification doc it says:


    '... Then follows one or more sub-identifiers. Each is preceeded by a literal '/' character as path separator. The sub-identifiers are taken from a child of the element identified by the first part. For nested elements, multiple sub-identifiers may be used to idenfiy the path to the targetted element.'

    And I've seen in the xsd that only certain collada node types can have an sid attribute.

    Following is two code examples. In both I want to reference the YFOV parameter of the camera.

    In the first example there are no sids for <technique> <optics> and <program> elements, in the second example these have sids.
    The second example is invalid according to the xsd.

    The first has two param1 and param2 sids making it impossible to reference these using the first example, thankfully the yfov has a sid of param0 and can be uniquely identified using 'cameraShape1-lib/param0'. If sids on technique, optics and program are not allowed then the first example is bugged and each param should have a unique sid.

    The spec seems to state that technique,optics and program should have sids on them ('..multiple sub-identifiers may be used to identify the path to the targetted element') so that you can reference the yfov with something like this:
    'cameraShape1-lib/technique1/optics0/param0'

    But the xsd doesn't allow this.

    So which example is correct?

    'cameraShape1-lib/technique1/optics0/param0'

    or

    'cameraShape1-lib/param0'???


    Examples:

    1.

    Code :
      <library type="CAMERA">
        <camera id="cameraShape1-lib" name="cameraShape1">
          <technique profile="MAYA">
            <optics>
              <program url="PERSPECTIVE">
                <param name="VERTICAL_APERTURE" type="float" flow="IN">1.13284</param>
                <param name="HORIZONTAL_APERTURE" type="float" flow="IN" sid="param1">2.0955</param>
                <param name="LENS_SQUEEZE" type="float" flow="IN" sid="param2">1.</param>
              </program>
            </optics>
          </technique>
          <technique profile="COMMON">
            <optics>
              <program url="PERSPECTIVE">
                <param name="YFOV" type="float" flow="IN" sid="param0">18.3855</param>
                <param name="ZNEAR" type="float" flow="IN" sid="param1">1.e-002</param>
                <param name="ZFAR" type="float" flow="IN" sid="param2">1000.</param>
              </program>
            </optics>
          </technique>
        </camera>
      </library>

    2.

    Code :
      <library type="CAMERA">
        <camera id="cameraShape1-lib" name="cameraShape1">
          <technique profile="MAYA" sid="technique0">
            <optics sid="optics0">
              <program url="PERSPECTIVE" sid="program0">
                <param name="VERTICAL_APERTURE" type="float" flow="IN">1.13284</param>
                <param name="HORIZONTAL_APERTURE" type="float" flow="IN" sid="param1">2.0955</param>
                <param name="LENS_SQUEEZE" type="float" flow="IN" sid="param2">1.</param>
              </program>
            </optics>
          </technique>
          <technique profile="COMMON" sid="technique1">
            <optics sid="optics0">
              <program url="PERSPECTIVE" sid="program0">
                <param name="YFOV" type="float" flow="IN" sid="param0">9.34899</param>
                <param name="ZNEAR" type="float" flow="IN" sid="param1">1.e-002</param>
                <param name="ZFAR" type="float" flow="IN" sid="param2">1000.</param>
              </program>
            </optics>
          </technique>
        </camera>
      </library>

  2. #2
    Senior Member
    Join Date
    Apr 2005
    Location
    Feeling Software, Montreal, Quebec
    Posts
    111
    There's quite a bit of discussion right now about the "sid" attribute amongst the partners. Most of it originates from exactly the problems you mention.

    I believe that the current proposal, as implemented by newer versions of the DCC translators, forces you to do a breath-first search for your target. So that your first example is correct.

    So, your animation target is : "cameraShape1-lib/param0" and you traverse the XML tree, starting from the "cameraShape1-lib" node, until you find the correct sid:
    - Check for the wanted "sid". If this is the correct one, stop here or traverse further if you have more sids in your target.
    - If there is no "id" or "sid" attributes on this node, traverse its children

    ______________________________
    Guillaume Laforte
    Feeling Software Inc
    http://www.feelingsoftware.com
    Guillaume Laforte
    Feeling Software Inc
    http://www.feelingsoftware.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •