3D to 2D ScreenSpace
  • Hi,

    when I run the 3D to 2D ScreenSpace script nothing happens, no UI. Any ideas?

    Thanks

  • Is it in your scriptUI folder?

  • Hey Julian,

    With this script, the resulting expression uses single quote marks for the layer source: thiscomp.layer('layername');
    Ideally, using double quotes is better: thiscomp.layer("layername");
    Otherwise, when changing the source layer name- the expression wont update.

    To fix this, change line 48 in your javascript from:
    myString = "L = thisComp.layer('"+ myName + "'); L.toComp([0,0,0]);";

    to:
    myString = "L = thisComp.layer(\""+ myName + "\"); L.toComp(L.anchorPoint);";
  • You shouldn't use L.toComp(L.anchorPoint) since this prevents you from getting the position of the layer if it's anchor point is off-centered.
    So Julian is right to use L.toComp([0,0,0]) even though in the case of a 3D Solid this will give you the top-left corner of the solid and not the center. If you want the script to give you the center of the solid this should be changed to (assuming the layer variable is called myLayer):

    myString = "L = thisComp.layer(\""+ myName + "\"); L.toComp([";
    myString +=  myLayer.nullLayer  ?  "0, 0" : ( myLayer.width/2 + ", " + myLayer.height/2 )  ;
    myString += ",0]);";

  • Hey Kevin, yeah I seem to have just copypasted my own ft-toolbar adaptation of the code. Either way, fixing the quotation marks is essential! For me using anchor point is more versatile, at least for the job I am currently working on. 
  • Sorry guys, I promise I will make the following fixes to this script soon (this was my first, and quite frankly opening it up and looking at it again is a SMH moment, also did not have this forum bookmarked so... sorry for the delay as well.)

     

    1. Single use (bake only, expression only) buttons for use with RD_scriptlauncher or Launch pad

    2. The UI based one will include an option to use the anchor point instead of Layer corners.

    3.  The UI will launch as a window and as a dockable panel.

    4. The quotation mark bug will be addressed. (Thanks Nathan, I had no idea)

  • Hi,

    Any progress on an updated version of this script.?

    Thanks :)
  • Worked perfectly. A total lifesaver!!!
  • for ppl who could not get it to work.
    put the script into the script folder of afx
    load it
    go to menu - windows - all the way down you will find "3dto2dscreenspace"
    works perfectly


    thank you very much for the script!!!
  • Is there any way to run this script on multiple layers at the same time?  When converting hundreds of tracking nulls it would help.  Also, would there be a way to convert 2d position coordinates to 3d position coordinates within a comp with a camera and have the 3d position stick to where the 2d screen position is?  Thanks.
  • This script would much be more useful if it attached to the anchorpoint of a 3D layer instead of just the upper left corner. :-(
  • Why i cant run script from menu??