Results 1 to 3 of 3

Thread: LW Camera to Apple Motion Camera

  1. #1
    Newbie Member
    Join Date
    Oct 2008
    Location
    Leicester, UK
    Posts
    11

    LW Camera to Apple Motion Camera

    Tried to make a Camera exporter for Apple motion. I'm nearly there but the orientation is a bit out. Is there anyone out there that would like to pick this up and finish off?


    generic
    {

    valueMultiplier = 100;

    //camera = Camera();
    scene = Scene();
    numOfFrames = scene.frameend;
    fps = scene.fps;

    reqbegin("Select Object");
    c1 = ctlallitems("From Object");
    return if !reqpost();
    objectf = c1.value;
    motionTimeMultiplier = 6144;

    fileName = objectf.name + ".motn";

    file = File(fileName,"w") || error("Couldn't open output file!");

    //start of motion file
    file.writeln("<?xml version="1.0" encoding="UTF-8"?>");
    file.writeln("<!DOCTYPE ozxmlscene>");
    file.writeln("<ozml version="5.8">");
    file.writeln("<factory id="1" uuid="7d468273c013498e9806a0d7bc32fddf">");
    file.writeln("<description>Project</description>");
    file.writeln("<manufacturer>Apple</manufacturer>");
    file.writeln("<version>1</version>");
    file.writeln("</factory>");

    file.writeln("<factory id="2" uuid="de1a9415beb34e5fb0964d1528bef14a">");
    file.writeln("<description>Camera</description>");
    file.writeln("<manufacturer>Apple</manufacturer>");
    file.writeln("<version>1</version>");
    file.writeln("</factory>");

    file.writeln("<scene>");
    file.writeln("<sceneSettings>");
    file.writeln("<width>1920</width>");
    file.writeln("<height>1080</height>");
    file.writeln("<duration>120</duration>");
    file.writeln("<shouldOverrideFCDuration>0</shouldOverrideFCDuration>");
    file.writeln("<frameRate>25</frameRate>");
    file.writeln("<NTSC>0</NTSC>");
    file.writeln("<channels>4</channels>");
    file.writeln("<pixelAspectRatio>1</pixelAspectRatio>");
    file.writeln("<workingGamut>0</workingGamut>");
    file.writeln("<viewGamut>-1</viewGamut>");
    file.writeln("<backgroundColor red="0" green="0" blue="0" alpha="1"/>");
    file.writeln("<audioChannels>2</audioChannels>");
    file.writeln("<audioBitsPerSample>32</audioBitsPerSample>");
    file.writeln("<fieldRenderingMode>0</fieldRenderingMode>");
    file.writeln("<motionBlurSamples>8</motionBlurSamples>");
    file.writeln("<motionBlurDuration>0.5</motionBlurDuration>");
    file.writeln("<sharpScaling>0</sharpScaling>");
    file.writeln("<startTimecode>0</startTimecode>");
    file.writeln("<presetPath>/Users/pete/Library/Application Support/Motion/Presets/Project/1080p.preset</presetPath>");
    file.writeln("<backgroundMode>0</backgroundMode>");
    file.writeln("<reflectionRecursionLimit>2</reflectionRecursionLimit>");
    file.writeln("<glyphOSCMode>0</glyphOSCMode>");
    file.writeln("<animateFlag>0</animateFlag>");
    file.writeln("<parameterColorSpaceID>3</parameterColorSpaceID>");
    file.writeln("<savePreviewMovie>0</savePreviewMovie>");
    file.writeln("</sceneSettings>");

    file.writeln("<currentFrame>6144 153600 1 0</currentFrame>");
    file.writeln("<timeRange offset="0 1 1 0" duration="737280 153600 1 0"/>");
    file.writeln("<playRange offset="0 1 1 0" duration="737280 153600 1 0"/>");
    file.writeln("<flags>1</flags>");
    file.writeln("<flags>1</flags>");
    file.writeln("<audioTracks>0</audioTracks>");
    file.writeln("<timemarkerset/>");
    file.writeln("<guideset/>");
    file.writeln("<curvesets selected="1"/>");

    file.writeln("<scenenode name="Project" id="3000000358" factoryID="1" version="5">");
    file.writeln("<flags>0</flags>");
    file.writeln("<timing in="0 1 1 0" out="-6144 153600 1 0" offset="0 1 1 0"/>");
    file.writeln("<foldFlags>0</foldFlags>");
    file.writeln("<baseFlags>16</baseFlags>");
    file.writeln("<parameter name="Properties" id="1" flags="8589938704"/>");
    file.writeln("<parameter name="Object" id="2" flags="8589938704"/>");
    file.writeln("</scenenode>");

    file.writeln("<scenenode name="Camera" id="3000000361" factoryID="2" version="5">");
    file.writeln("<aspectRatio>1</aspectRatio>");
    file.writeln("<flags>0</flags>");
    file.writeln("<timing in="0 1 1 0" out="731136 153600 1 0" offset="0 1 1 0"/>");
    file.writeln("<foldFlags>0</foldFlags>");
    file.writeln("<baseFlags>17</baseFlags>");
    file.writeln("<parameter name="Properties" id="1" flags="8589938704">");
    file.writeln("<parameter name="Transform" id="100" flags="8589938704">");

    file.writeln("<parameter name="Position" id="101" flags="8589938704">");
    file.writeln("<foldFlags>11</foldFlags>");

    //custom stuff here
    //channel x POSITION
    file.writeln("<parameter name="X" id="1" flags="8606711824">");
    file.writeln("<curve type="1" default="0" value="0">");

    file.writeln("<numberOfKeypoints>" + numOfFrames + "</numberOfKeypoints>");
    for(i = 0; i <= numOfFrames; i++)
    {
    time = i / fps;
    file.writeln("<keypoint interpolation="1" flags="0">");
    file.writeln("<time>" + (i * motionTimeMultiplier) + " 153600 1 0</time>");
    vec = objectf.getWorldPosition(time);
    val = vec.x;
    file.writeln("<value>" + (valueMultiplier * val) + "</value>");
    file.writeln("</keypoint>");
    }
    file.writeln("</curve>");
    file.writeln("</parameter>");


    //channel y POSITION
    file.writeln("<parameter name="Y" id="2" flags="8606711824">");
    file.writeln("<curve type="1" default="0" value="0">");

    file.writeln("<numberOfKeypoints>" + numOfFrames + "</numberOfKeypoints>");
    for(i = 0; i <= numOfFrames; i++)
    {
    time = i / fps;
    file.writeln("<keypoint interpolation="1" flags="0">");
    file.writeln("<time>" + (i * motionTimeMultiplier) + " 153600 1 0</time>");
    vec = objectf.getWorldPosition(time);
    val = vec.y;
    file.writeln("<value>" + (valueMultiplier * val) + "</value>");
    file.writeln("</keypoint>");
    }
    file.writeln("</curve>");
    file.writeln("</parameter>");


    //channel z POSITION
    file.writeln("<parameter name="Z" id="3" flags="8606711824">");
    file.writeln("<curve type="1" default="0" value="0">");

    file.writeln("<numberOfKeypoints>" + numOfFrames + "</numberOfKeypoints>");
    for(i = 0; i <= numOfFrames; i++)
    {
    time = i / fps;
    file.writeln("<keypoint interpolation="1" flags="0">");
    file.writeln("<time>" + (i * motionTimeMultiplier) + " 153600 1 0</time>");
    vec = objectf.getWorldPosition(time);
    val = vec.z;
    file.writeln("<value>" + (valueMultiplier * val) + "</value>");
    file.writeln("</keypoint>");
    }
    file.writeln("</curve>");
    file.writeln("</parameter>");




    file.writeln("</parameter>");
    file.writeln("");

    //rotation
    file.writeln("<parameter name="Rotation" id="109" flags="8589938704">");
    file.writeln("<foldFlags>11</foldFlags>");

    //loop through rotation x
    file.writeln("<parameter name="X" id="1" flags="8606711824">");
    file.writeln("<curve type="1" default="0" value="0">");

    file.writeln("<numberOfKeypoints>" + numOfFrames + "</numberOfKeypoints>");
    for(i = 0; i <= numOfFrames; i++)
    {
    time = i / fps;
    file.writeln("<keypoint interpolation="1" flags="0">");
    file.writeln("<time>" + (i * motionTimeMultiplier) + " 153600 1 0</time>");
    vec = objectf.getWorldRotation(time);

    val = vec.y / 57.2957795130823;

    file.writeln("<value>" + val + "</value>");
    file.writeln("</keypoint>");
    }
    file.writeln("</curve>");
    file.writeln("</parameter>");

    //loop through ROTATION y
    file.writeln("<parameter name="Y" id="2" flags="8606711824">");
    file.writeln("<curve type="1" default="0" value="0">");

    file.writeln("<numberOfKeypoints>" + numOfFrames + "</numberOfKeypoints>");
    //loop through keyframes
    for(i = 0; i <= numOfFrames; i++)
    {
    time = i / fps;
    file.writeln("<keypoint interpolation="1" flags="0">");
    file.writeln("<time>" + (i * motionTimeMultiplier) + " 153600 1 0</time>");
    vec = objectf.getWorldRotation(time);

    val = vec.x / 57.2957795130823;

    file.writeln("<value>" + val + "</value>");
    file.writeln("</keypoint>");
    }
    file.writeln("</curve>");
    file.writeln("</parameter>");

    //loop through ROTATION z
    file.writeln("<parameter name="Z" id="3" flags="8606711824">");
    file.writeln("<curve type="1" default="0" value="0">");

    file.writeln("<numberOfKeypoints>" + numOfFrames + "</numberOfKeypoints>");
    for(i = 0; i <= numOfFrames; i++)
    {
    time = i / fps;
    file.writeln("<keypoint interpolation="1" flags="0">");
    file.writeln("<time>" + (i * motionTimeMultiplier) + " 153600 1 0</time>");
    vec = objectf.getWorldRotation(time);

    val = vec.z / 57.2957795130823;

    file.writeln("<value>" + val + "</value>");
    file.writeln("</keypoint>");
    }
    file.writeln("</curve>");
    file.writeln("</parameter>");



    file.writeln("</parameter>");
    file.writeln("");

    //finish the motion file
    file.writeln("</parameter>");
    file.writeln("</parameter>");
    file.writeln("<parameter name="Object" id="2" flags="8589938704">");
    file.writeln("<parameter name="Camera Type" id="200" flags="8606777360" default="1" value="0"/>");
    file.writeln("<parameter name="Far Plane" id="203" flags="8606711808" default="10000" value="12317.645019878171"/>");
    file.writeln("</parameter>");
    file.writeln("</scenenode>");
    file.writeln("</scene>");
    file.writeln("</ozml>");

    file.close();
    info("Done");

    }

  2. #2
    Newbie Member
    Join Date
    Oct 2008
    Location
    Leicester, UK
    Posts
    11
    I finished this if anyone is interested. Just a couple of axis needed to be inverted.

  3. #3
    Super Member
    Join Date
    May 2008
    Location
    Indy
    Posts
    432
    Nice. I will give it a go after spring break.q
    Robert Wilson, MA Deaf Ed.
    Indiana Deaf School
    This e-mail may contain information protected under the Family Educational Rights and Privacy Act.

Tags for this Thread

Bookmarks

Posting Permissions

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