Wrap ARC not working

Discussion of the xtools Toolkit

Moderators:xbytor, DavideBarranca, Paul MR

Post Reply
rhytha
Wrap ARC not working

Post by rhytha » Tue Nov 23, 2010 11:38 am

Hi X,

We generated a wrap, arc js using actiontojs, but when we executed it was not working, i have attached the code below for your review, as well as scriptlistern log file.

Code: Select all//
//==================== Action 2 ==============
//
function Action2() {
  // Set
  function step1(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putProperty(cTID('Chnl'), sTID("selection"));
    desc1.putReference(cTID('null'), ref1);
    var ref2 = new ActionReference();
    ref2.putEnumerated(cTID('Chnl'), cTID('Chnl'), cTID('Trsp'));
    desc1.putReference(cTID('T   '), ref2);
    executeAction(cTID('setd'), desc1, dialogMode);
  };

  // Transform
  function step2(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putEnumerated(cTID('Lyr '), cTID('Ordn'), cTID('Trgt'));
    desc1.putReference(cTID('null'), ref1);
    desc1.putEnumerated(cTID('FTcs'), cTID('QCSt'), sTID("QCSAverage"));
    var desc2 = new ActionDescriptor();
    desc2.putUnitDouble(cTID('Hrzn'), cTID('#Pxl'), -2.27373675443232e-13);
    desc2.putUnitDouble(cTID('Vrtc'), cTID('#Pxl'), 0);
    desc1.putObject(cTID('Ofst'), cTID('Ofst'), desc2);
    var desc3 = new ActionDescriptor();
    desc3.putEnumerated(sTID("warpStyle"), sTID("warpStyle"), sTID("warpArc"));
    desc3.putDouble(sTID("warpValue"), 10);
    desc3.putDouble(sTID("warpPerspective"), 0);
    desc3.putDouble(sTID("warpPerspectiveOther"), 0);
    desc3.putEnumerated(sTID("warpRotate"), cTID('Ornt'), cTID('Hrzn'));
    desc3.putInteger(sTID("uOrder"), 4);
    desc3.putInteger(sTID("vOrder"), 2);
    desc1.putObject(cTID('warp'), cTID('warp'), desc3);
    executeAction(cTID('Trnf'), desc1, dialogMode);
  };

  // Set
  function step3(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putProperty(cTID('Chnl'), sTID("selection"));
    desc1.putReference(cTID('null'), ref1);
    desc1.putEnumerated(cTID('T   '), cTID('Ordn'), cTID('None'));
    executeAction(cTID('setd'), desc1, dialogMode);
  };

  step1();      // Set
  step2();      // Transform
  step3();      // Set
};


Scriptlistener Code
Code: Select all// =======================================================
var id12 = charIDToTypeID( "setd" );
    var desc3 = new ActionDescriptor();
    var id13 = charIDToTypeID( "null" );
        var ref2 = new ActionReference();
        var id14 = charIDToTypeID( "Chnl" );
        var id15 = charIDToTypeID( "fsel" );
        ref2.putProperty( id14, id15 );
    desc3.putReference( id13, ref2 );
    var id16 = charIDToTypeID( "T   " );
        var ref3 = new ActionReference();
        var id17 = charIDToTypeID( "Chnl" );
        var id18 = charIDToTypeID( "Chnl" );
        var id19 = charIDToTypeID( "Trsp" );
        ref3.putEnumerated( id17, id18, id19 );
    desc3.putReference( id16, ref3 );
executeAction( id12, desc3, DialogModes.NO );

// =======================================================
var id20 = charIDToTypeID( "Trnf" );
    var desc4 = new ActionDescriptor();
    var id21 = charIDToTypeID( "null" );
        var ref4 = new ActionReference();
        var id22 = charIDToTypeID( "Lyr " );
        var id23 = charIDToTypeID( "Ordn" );
        var id24 = charIDToTypeID( "Trgt" );
        ref4.putEnumerated( id22, id23, id24 );
    desc4.putReference( id21, ref4 );
    var id25 = charIDToTypeID( "FTcs" );
    var id26 = charIDToTypeID( "QCSt" );
    var id27 = charIDToTypeID( "Qcsa" );
    desc4.putEnumerated( id25, id26, id27 );
    var id28 = charIDToTypeID( "Ofst" );
        var desc5 = new ActionDescriptor();
        var id29 = charIDToTypeID( "Hrzn" );
        var id30 = charIDToTypeID( "#Pxl" );
        desc5.putUnitDouble( id29, id30, 0.000000 );
        var id31 = charIDToTypeID( "Vrtc" );
        var id32 = charIDToTypeID( "#Pxl" );
        desc5.putUnitDouble( id31, id32, 0.000000 );
    var id33 = charIDToTypeID( "Ofst" );
    desc4.putObject( id28, id33, desc5 );
    var id34 = stringIDToTypeID( "warp" );
        var desc6 = new ActionDescriptor();
        var id35 = stringIDToTypeID( "warpStyle" );
        var id36 = stringIDToTypeID( "warpStyle" );
        var id37 = stringIDToTypeID( "warpArc" );
        desc6.putEnumerated( id35, id36, id37 );
        var id38 = stringIDToTypeID( "warpValue" );
        desc6.putDouble( id38, 10.000000 );
        var id39 = stringIDToTypeID( "warpPerspective" );
        desc6.putDouble( id39, 0.000000 );
        var id40 = stringIDToTypeID( "warpPerspectiveOther" );
        desc6.putDouble( id40, 0.000000 );
        var id41 = stringIDToTypeID( "warpRotate" );
        var id42 = charIDToTypeID( "Ornt" );
        var id43 = charIDToTypeID( "Hrzn" );
        desc6.putEnumerated( id41, id42, id43 );
        var id44 = stringIDToTypeID( "uOrder" );
        desc6.putInteger( id44, 4 );
        var id45 = stringIDToTypeID( "vOrder" );
        desc6.putInteger( id45, 2 );
    var id46 = stringIDToTypeID( "warp" );
    desc4.putObject( id34, id46, desc6 );
executeAction( id20, desc4, DialogModes.NO );

// =======================================================
var id47 = charIDToTypeID( "setd" );
    var desc7 = new ActionDescriptor();
    var id48 = charIDToTypeID( "null" );
        var ref5 = new ActionReference();
        var id49 = charIDToTypeID( "Chnl" );
        var id50 = charIDToTypeID( "fsel" );
        ref5.putProperty( id49, id50 );
    desc7.putReference( id48, ref5 );
    var id51 = charIDToTypeID( "T   " );
    var id52 = charIDToTypeID( "Ordn" );
    var id53 = charIDToTypeID( "None" );
    desc7.putEnumerated( id51, id52, id53 );
executeAction( id47, desc7, DialogModes.NO );

rhytha

Wrap ARC not working

Post by rhytha » Tue Nov 23, 2010 12:36 pm

Code: Select all                 function step4(enabled, withDialog) {
               if (enabled != undefined && !enabled)
                    return;
                   var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
                   var desc1 = new ActionDescriptor();
                   var ref1 = new ActionReference();
                   ref1.putEnumerated(cTID('Lyr '), cTID('Ordn'), cTID('Trgt'));
                   desc1.putReference(cTID('null'), ref1);
                   desc1.putEnumerated(cTID('FTcs'), cTID('QCSt'), sTID("QCSAverage"));
   
                  var desc3 = new ActionDescriptor();
                  desc3.putEnumerated(sTID("warpStyle"), sTID("warpStyle"), sTID("warpArc"));
                  desc3.putDouble(sTID("warpValue"), 10);
                  desc3.putDouble(sTID("warpPerspective"), 0);
                  desc3.putDouble(sTID("warpPerspectiveOther"), 0);
                  desc3.putEnumerated(sTID("warpRotate"), cTID('Ornt'), cTID('Hrzn'));
                  desc3.putInteger(sTID("uOrder"), 4);
                  desc3.putInteger(sTID("vOrder"), 2);
                  desc1.putObject(cTID('warp'), cTID('warp'), desc3);
                  executeAction(cTID('Trnf'), desc1, dialogMode);
           };


Post Reply