Syntax of calibration.xml?

Answered

Comments

3 comments

  • Avatar
    Aaron Curtis
    Aha! Tokens are here: Camera export and file formats

    I still would like to know what the syntax / template language is. For example, what sort of math is allowed, what is .ip .ltc, what is the g in $(tx:g), what is requiresGeoref, etc.
    0
    Comment actions Permalink
  • Avatar
    Kruzma
    Aaron Curtis wrote:
    I still would like to know what the syntax / template language is. For example, what sort of math is allowed, what is .ip .ltc, what is the g in $(tx:g), what is requiresGeoref, etc.


    Hello Aaron,
    I don't know details of the syntax either. Everything I know is already explained here - the post you already found.
    But I will try to help you here.

    Everything outside brackets with dollar sign - $() is printed to file as it is. e.g. if you see in calibration.xml something like this

    Code:
    "cameraShape$(index+1:d).ip"

    for first camera (with index 0) it will print:

    Code:
    "cameraShape1.ip"

    Here we can see that everything outside brackets was printed untouched. So .ip or .ltc got nothing to do with exporter syntax, it's probably just part of Maya export format.

    Inside the brackets you can use simple arithmetic like *,/,+,- maybe % (modulo) or even binary operations.
    And mysterious 'g' after tokenName: is just formatting for your number - see C++ documentation of printf.

    Commonly used formattings:
    Code:
      $(token:f) - prints floating point number (I think this is default, so $(token:f) is same as $(token) 
      $(token:d) - prints decimal number
      $(token:e) - prints floating number in scientific notation
      $(token:g) - prints the shortest representation: %e or %f
      $(token:.8) - prints floating point number with 8 digits after decimal point

    I hope this will help you. Just write here if something wasn't clear enough.

    EDIT:
    There are other things to explain as I read calibration.xml.
    You can print/not to print something if some condition is fulfilled.
    e.g.
    Code:
    $If( bImagePlane, ..)

    If variable bImagePlane is true, then everything after comma is printed, if bImagePlane is false, then nothing is printed.

    But where bImagePlane came from?
    Code:
    <format mask="*.ma" desc="Maya 2013 ascii scene" writer="cvs" undistortImages="1" undistortPrincipal="1">
       <parameter name="Export image planes" type="bool" default="true" variable="bImagePlane" />
            <body>
            ...
            </body>
    </format>

    This are user defined parameters which are displayed in Export Registration Dialog. But there can be other variables, like 'isGeoreferenced' in maya export and honestly I don't know where it came from.

    To warn you, everything I write here are just my hypothesis from seeing calibration.xml file.
    0
    Comment actions Permalink
  • Avatar
    Aaron Curtis
    Hey thanks Kruzma, that's super helpful! I presume they are using some off-the-shelf template language here, would be nice to know which one it is. Silly that we have to reverse-engineer this stuff.
    0
    Comment actions Permalink

Please sign in to leave a comment.