Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Action Scripting Question - Leaving Current Values Alone

Community Beginner ,
May 03, 2019 May 03, 2019

Hi,

I'm very new to the land of scripting for Photoshop. I've a ton of experience working with .NET, but not a lot on JavaScript, or the Photoshop object model. I've managed to work out what I need to change from the script listener output and I think I've a handle on what it is doing, but not quite whether I can pick and choose! So, the way I'm reading the script is;

First variable obtains a pointer to the object that is to be manipulated

The action descriptor variables then seems to build the new property values

Am I right in assuming that if you don't "put" a new value into one of the property elements it will retain its original value when it is passed into the execution action?

Thanks,

David

TOPICS
Actions and scripting
510
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Beginner , May 03, 2019 May 03, 2019

Got it working and looks like I've answered my own question - no you can't remove all the other values, which is a bummer when you want to play with the camera postion! The reason it failed was;

a. I had removed what I thought was irrelevant property sets

b. I didn't have the 3D layer selected

Now my object is rotating nicely about the y-axis, all I have to puzzle out now is the export routine!

Translate
Adobe
Community Expert ,
May 03, 2019 May 03, 2019

Yes, if you don't change the values, they will remind what they were, when the code was recorded. You just want to put variables in places that you want to be able to alter the original values.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 03, 2019 May 03, 2019

Thanks Chuck,

Just had an attempt at this trying to rotate the mesh on a 3d object. Does the mesh have to be selected for the action to operate or are some things just not allowed?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 03, 2019 May 03, 2019

I would like to suggest that you should check out the Clean SL script make sue you get the latest version. I can help you make functiols from Scriptlistener code.

Clean SL

JJMack
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 03, 2019 May 03, 2019

Ah, on looking that doesn't actually answer the question; say I have a recording that looks like:

var idsetthreeDMeshPosition = stringIDToTypeID( "set3DMeshPosition" );

    var desc195 = new ActionDescriptor();

    var idkeythreeDNameList = stringIDToTypeID( "key3DNameList" );

        var list19 = new ActionList();

        list19.putString( """Sphere""" );

    desc195.putList( idkeythreeDNameList, list19 );

    var idkeythreeDPositionsList = stringIDToTypeID( "key3DPositionsList" );

        var list20 = new ActionList();

            var desc196 = new ActionDescriptor();

            var idkeythreeDXPos = stringIDToTypeID( "key3DXPos" );

            desc196.putDouble( idkeythreeDXPos, 0.000000 );

            var idkeythreeDYPos = stringIDToTypeID( "key3DYPos" );

            desc196.putDouble( idkeythreeDYPos, 0.500000 );

            var idkeythreeDZPos = stringIDToTypeID( "key3DZPos" );

            desc196.putDouble( idkeythreeDZPos, 0.000000 );

        var idkeythreeDPosition = stringIDToTypeID( "key3DPosition" );

        list20.putObject( idkeythreeDPosition, desc196 );

    desc195.putList( idkeythreeDPositionsList, list20 );

    var idkeythreeDDirectionsList = stringIDToTypeID( "key3DDirectionsList" );

        var list21 = new ActionList();

            var desc197 = new ActionDescriptor();

            var idkeythreeDXDir = stringIDToTypeID( "key3DXDir" );

            desc197.putDouble( idkeythreeDXDir, -0.000000 );

            var idkeythreeDYDir = stringIDToTypeID( "key3DYDir" );

            desc197.putDouble( idkeythreeDYDir, 64.524368 );

            var idkeythreeDZDir = stringIDToTypeID( "key3DZDir" );

            desc197.putDouble( idkeythreeDZDir, -0.000000 );

        var idkeythreeDDirection = stringIDToTypeID( "key3DDirection" );

        list21.putObject( idkeythreeDDirection, desc197 );

    desc195.putList( idkeythreeDDirectionsList, list21 );

    var idkeythreeDScalesList = stringIDToTypeID( "key3DScalesList" );

        var list22 = new ActionList();

            var desc198 = new ActionDescriptor();

            var idkeythreeDCurrentObjectXScale = stringIDToTypeID( "key3DCurrentObjectXScale" );

            desc198.putDouble( idkeythreeDCurrentObjectXScale, 1.000000 );

            var idkeythreeDCurrentObjectYScale = stringIDToTypeID( "key3DCurrentObjectYScale" );

            desc198.putDouble( idkeythreeDCurrentObjectYScale, 1.000000 );

            var idkeythreeDCurrentObjectZScale = stringIDToTypeID( "key3DCurrentObjectZScale" );

            desc198.putDouble( idkeythreeDCurrentObjectZScale, 1.000000 );

        var idkeythreeDScale = stringIDToTypeID( "key3DScale" );

        list22.putObject( idkeythreeDScale, desc198 );

    desc195.putList( idkeythreeDScalesList, list22 );

    var idkeythreeDEulerList = stringIDToTypeID( "key3DEulerList" );

        var list23 = new ActionList();

            var desc199 = new ActionDescriptor();

            var idkeythreeDXDir = stringIDToTypeID( "key3DXDir" );

            desc199.putDouble( idkeythreeDXDir, -0.000000 );

            var idkeythreeDYDir = stringIDToTypeID( "key3DYDir" );

            desc199.putDouble( idkeythreeDYDir, 64.524368 );

            var idkeythreeDZDir = stringIDToTypeID( "key3DZDir" );

            desc199.putDouble( idkeythreeDZDir, -0.000000 );

            var idkeythreeDXPos = stringIDToTypeID( "key3DXPos" );

            desc199.putDouble( idkeythreeDXPos, 0.000000 );

            var idkeythreeDYPos = stringIDToTypeID( "key3DYPos" );

            desc199.putDouble( idkeythreeDYPos, 0.500000 );

            var idkeythreeDZPos = stringIDToTypeID( "key3DZPos" );

            desc199.putDouble( idkeythreeDZPos, 0.000000 );

            var idkeythreeDXScale = stringIDToTypeID( "key3DXScale" );

            desc199.putDouble( idkeythreeDXScale, 1.000000 );

            var idkeythreeDYScale = stringIDToTypeID( "key3DYScale" );

            desc199.putDouble( idkeythreeDYScale, 1.000000 );

            var idkeythreeDZScale = stringIDToTypeID( "key3DZScale" );

            desc199.putDouble( idkeythreeDZScale, 1.000000 );

        var idkeythreeDEuler = stringIDToTypeID( "key3DEuler" );

        list23.putObject( idkeythreeDEuler, desc199 );

    desc195.putList( idkeythreeDEulerList, list23 );

executeAction( idsetthreeDMeshPosition, desc195, DialogModes.NO );

I do not want to change anything bar the key3DYDir in key3DDirectionsList and key3DEulerList, can my script omit everything that is not these values or their partner elements (i.e. I'd need to retain desc195, list21, desc197, list23 and desc199)?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 03, 2019 May 03, 2019

I do not understand 3D.  Of if a function mage from that Action Manager code would be useful.  It woyld look like this....

JJMack
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 03, 2019 May 03, 2019

JJMack
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 03, 2019 May 03, 2019
LATEST

Got it working and looks like I've answered my own question - no you can't remove all the other values, which is a bummer when you want to play with the camera postion! The reason it failed was;

a. I had removed what I thought was irrelevant property sets

b. I didn't have the 3D layer selected

Now my object is rotating nicely about the y-axis, all I have to puzzle out now is the export routine!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 03, 2019 May 03, 2019

I'm not sure about that. Some things just aren't script-able.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines