Master List of Scripts

Didn´t meant to spoil your party - just a small hint, if you just did´t know.:redface:

Cheers
Frank

No party spoiled! I assumed this was a feature in the new version, or at least I'd be surprised if it weren't.
I guess this is a question for Martin, but does he have a blog about his progress?
Just wondering.

-cg
 
The export obj sequence script

Hi.
I'd like to get this on the "Master list of scripts". It was a reply to someone on a different specific script thread and it is especially useful to those of us working in After Effects with the Element3D plugin.

Code:
function buildUI( tool ) { 
    tool.addParameterSeparator('Export OBJ Sequence');   
    tool.addParameterInt("fps", 30, 1, 1200, false, false);
    tool.addParameterInt("first frame", 0, 0, 100000, false, false);
    tool.addParameterInt("last frame", 1, 0, 100000, false, false);
    tool.addParameterString("*basename", "3DFrame_", true);
    tool.addParameterSeparator('');
    tool.addParameterSeparator('Relies on *basename (not dialog)!');
    tool.addParameterSeparator('');
  //  tool.addParameterSeparator('Dialog\'s directory path is used,');
  //  tool.addParameterSeparator('dialog\'s file name is NOT!');
  //  tool.addParameterSeparator('(So you can enter anything)');
    tool.addParameterButton("          OBJ Sequence", "Export ...", "exportObjSeq");

}
function exportObjSeq( tool ) {
   doc = tool.document();
   var basenm = tool.getParameter("*basename");
   //I admit this is kludgey - the path is used, the filename totally ignored; ui's basename is used
   svReturned=OS.runSavePanel("obj");
   if (svReturned != null) {
    var f=new File(svReturned);
    var dirPath = f.directory() + "/";
    var fps = tool.getParameter("fps");
    var thisFr = tool.getParameter("first frame");
    var lastFr = tool.getParameter("last frame");
   
    for ( var i = thisFr; i <= lastFr; i++ )
     {    
       doc.setAnimPosition(1/fps*(i));
       var svfile = dirPath + basenm + i.toString() + ".obj";
       doc.saveToFile(svfile, 'obj');
       0;
     }

    OS.messageBox('', "Done saving frames " + thisFr.toString() + " to " + lastFr.toString() + ".");
   }
 
Here are two renaming scripts

Hello, all.
A pair of renaming scripts for you.
"Multi-Rename" and "Multi-NumberSequenceRename". These are both Tool scripts, so they go into Scripts/Tool/.
They are a big help for organizing your project, and for other automation tricks, like scripts that do operations based on object name.
Would be great to get them on the Master List page.

[edit] Hello? Is anyone maintaining the Master List?
 

Attachments

  • two_C3D_renaming_scripts.zip
    2.6 KB · Views: 564
Last edited:
pendulum tag script for v7

As some of you may know, v7 introduces an expression tag script example called "CircleExpression".
I wrote a fun one based on this and here it is. Pendulum.


Code:
// PendulumExpression.js
// (c) 2014 Martin Wengenmayer (morphed from CircleExpression by CR Green)
//
// This script is in the public domain. Feel free to modify it or use 
// it as a starting point for your own creations.
//
// Purpose: 
//      Demonstrates how to create a custom expression tag.
//

function buildUI(tag){
    tag.addParameterInt("priority",10,0,1000,true,true);
    tag.addParameterSeparator("PendulumExpression.js");
    tag.addParameterFloat("speed", 5, 0, 1000, false, false);
    tag.addParameterFloat("maxAngle", 20, 0, 90, false, false);
    tag.addParameterFloat("restTime", 20, 0, 90, false, false);
    tag.addParameterSelector("axis", ["Y", "Z"], false, false);

}   
    

function performExpression(tag){
    var owner=tag.owner();
    var doc=tag.document();
    var t=doc.animationTime();
    
    var speed=tag.getParameter("speed");
    var maxAngle=tag.getParameter("maxAngle");
    var restTime=tag.getParameter("restTime");
    var axisSel = parseInt(tag.getParameter("axis"));
    
    var startDelaySecs = 0;
    
    var ampl = ((t-startDelaySecs)*(0-maxAngle)/(restTime-startDelaySecs)+maxAngle);
    var o = Math.sin(t* speed)*ampl;
    rest=0;//degress of rest zero
    if (t >= restTime) {
      v=rest;
    } else {
      v=(rest + o);
    }
    
    p=owner.getParameter("rotation");
    
    if (axisSel == 0) {
      owner.setParameter("rotation", new Vec3D(p.x, v, p.z), false );
    }else{
      owner.setParameter("rotation", new Vec3D(p.x, p.y, v), false );
    }
}
 
Back
Top