Giter Club home page Giter Club logo

descriptor-info's People

Contributors

javieraroche avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

descriptor-info's Issues

descriptor to JSON is already buil-in in Photoshop

var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") ); 
var desc = executeActionGet(ref)
var convertDesc = new ActionDescriptor();
convertDesc.putObject( stringIDToTypeID("object"), stringIDToTypeID("object"), desc );
var jsonDesc = executeAction( stringIDToTypeID("convertJSONdescriptor"), convertDesc, DialogModes.NO );
jsonDesc.getString(stringIDToTypeID("json") );

Raw format problem

I have JSON arguments listener based on this tool and I noticed some strange behavior.

When worked in Photoshop, there was a lag. My .log file jumped from 150Kb size to 68MB size.
I saw that there was 25 000 000 characters in "Raw data type" value.
Photoshop then began acting strangely.

I'm not sure exactly what happened. But I think we could reduce the length of the value to 10 000 characters by default. And if we want more then we would use the flag.

If it occurs again, I will tell you.

List of messed StringIDs and CharIDs

Just for info.

"application": "C:\Program Files\Adobe\Adobe Photoshop CC 2015 (16.1.2)"
"date": "Saturday, April 02 2016 23:59:40"

	"messedUpIDs":
	{
			"'Algn'":
			[
				"align",
				"alignment"
			],

			"'AntA'":
			[
				"antiAlias",
				"antiAliasedPICTAcquire"
			],

			"'BckL'":
			[
				"backgroundLayer",
				"backgroundLevel"
			],

			"'BlcG'":
			[
				"blackGenerationType",
				"blackGenerationCurve"
			],

			"'BlcL'":
			[
				"blackLevel",
				"blackLimit"
			],

			"'Blks'":
			[
				"blacks",
				"blocks"
			],

			"'BlrM'":
			[
				"blurMethod",
				"blurMore"
			],

			"'BrgC'":
			[
				"brightnessEvent",
				"brightnessContrast"
			],

			"'BrsD'":
			[
				"brushDetail",
				"brushesDefine"
			],

			"'Brsh'":
			[
				"brush",
				"brushes"
			],

			"'Clcl'":
			[
				"calculation",
				"calculations"
			],

			"'ClrP'":
			[
				"colorPalette",
				"coloredPencil"
			],

			"'Cnst'":
			[
				"constant",
				"constrain"
			],
			"'CntC'":
			[
				"centerCropMarks",
				"conteCrayon"
			],

			"'Cntr'":
			[
				"center",
				"contrast"
			],

			"'CrtD'":
			[
				"createDroplet",
				"createDuplicate"
			],

			"'CstP'":
			[
				"customPalette",
				"customPhosphors"
			],

			"'Cstm'":
			[
				"custom",
				"customPattern"
			],

			"'Drkn'":
			[
				"darken",
				"darkness"
			],

			"'Dstr'":
			[
				"distort",
				"distortion",
				"distribute",
				"distribution"
			],
			"'Dstt'":
			[
				"desaturate",
				"destWhiteMax"
			],
			"'FlIn'":
			[
				"fileInfo",
				"fillInverse"
			],

			"'Gd  '":
			[
				"good",
				"guide"
			],

			"'GnrP'":
			[
				"generalPreferences",
				"generalPrefs",
				"preferencesClass"
			],

			"'GrSt'":
			[
				"grainStippled",
				"graySetup"
			],

			"'Grdn'":
			[
				"gradientClassEvent",
				"gridMinor"
			],

			"'Grn '":
			[
				"grain",
				"green"
			],

			"'Grns'":
			[
				"graininess",
				"greens"
			],

			"'HstP'":
			[
				"historyPreferences",
				"historyPrefs"
			],
			"'HstS'":
			[
				"historyState",
				"historyStateSourceType"
			],

			"'ImgP'":
			[
				"imageCachePreferences",
				"imagePoint"
			],

			"'In  '":
			[
				"in",
				"stampIn"
			],

			"'IntW'":
			[
				"interfaceWhite",
				"intersectWith"
			],

			"'Intr'":
			[
				"interfaceIconFrameDimmed",
				"interlace",
				"interpolation",
				"intersect"
			],

			"'JPEG'":
			[
				"JPEG",
				"JPEGFormat"
			],

			"'LghD'":
			[
				"lightDirection",
				"lightDirectional"
			],

			"'LghO'":
			[
				"lightOmni",
				"lightenOnly"
			],
			"'LghS'":
			[
				"lightSource",
				"lightSpot"
			],

			"'Lns '":
			[
				"lens",
				"lines"
			],

			"'Mgnt'":
			[
				"magenta",
				"magentas"
			],

			"'Mxm '":
			[
				"maximum",
				"maximumQuality"
			],

			"'NTSC'":
			[
				"NTSC",
				"NTSCColors"
			],

			"'NmbL'":
			[
				"numberOfLayers",
				"numberOfLevels"
			],

			"'PlgP'":
			[
				"pluginPicker",
				"pluginPrefs"
			],

			"'Pncl'":
			[
				"pencilEraser",
				"pencilWidth"
			],

			"'Pnt '":
			[
				"paint",
				"point"
			],

			"'Prsp'":
			[
				"perspective",
				"perspectiveIndex"
			],

			"'PrvM'":
			[
				"previewMacThumbnail",
				"previewMagenta"
			],

			"'Pstr'":
			[
				"posterization",
				"posterize"
			],

			"'RGBS'":
			[
				"RGBSetup",
				"RGBSetupSource"
			],

			"'Rds '":
			[
				"radius",
				"reds"
			],

			"'ScrD'":
			[
				"scratchDisks",
				"screenDot"
			],

			"'ShdI'":
			[
				"shadingIntensity",
				"shadowIntensity"
			],

			"'ShpC'":
			[
				"shapeCurveType",
				"shapingCurve"
			],
			"'ShrE'":
			[
				"sharpenEdges",
				"shearEd"
			],

			"'Shrp'":
			[
				"sharpen",
				"sharpness"
			],

			"'SplC'":
			[
				"splitChannels",
				"supplementalCategories"
			],

			"'Spot'":
			[
				"spot",
				"spotColor"
			],

			"'SprS'":
			[
				"separationSetup",
				"sprayedStrokes"
			],

			"'StrL'":
			[
				"strokeLength",
				"strokeLocation"
			],

			"'Strt'":
			[
				"saturation",
				"start"
			],

			"'TEXT'":
			[
				"char",
				"textType"
			],
			"'TIFF'":
			[
				"TIFF",
				"TIFFFormat"
			],

			"'TglO'":
			[
				"toggleOptionsPalette",
				"toggleOthers"
			],

			"'TrnG'":
			[
				"transparencyGamutPreferences",
				"transparencyGrid",
				"transparencyGridSize"
			],

			"'TrnS'":
			[
				"transferSpec",
				"transparencyShape",
				"transparencyStop"
			],

			"'Trns'":
			[
				"transparency",
				"transparent"
			],

			"'TxtC'":
			[
				"textClickPoint",
				"textureCoverage"
			],
			"'TxtF'":
			[
				"textureFile",
				"textureFill"
			],

			"'UsrM'":
			[
				"userMaskEnabled",
				"userMaskOptions"
			],

			"'c@#^'":
			[
				"inherits",
				"pInherits"
			],
			"'comp'":
			[
				"comp",
				"sInt64"
			],
			"'doub'":
			[
				"floatType",
				"IEEE64BitFloatingPoint",
				"longFloat"
			],
			"'long'":
			[
				"integer",
				"longInteger",
				"sInt32"
			],
			"'magn'":
			[
				"magnitude",
				"uInt32"
			],
			"'null'":
			[
				"null",
				"target"
			],
			"'shor'":
			[
				"sInt16",
				"sMInt",
				"shortInteger"
			],
			"'sing'":
			[
				"IEEE32BitFloatingPoint",
				"sMFloat",
				"shortFloat"
			]
	}

Internal error (require failed) on Ps 22.4

The script does not work on Ps 22.4 anymore. Even the simplest ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") ); produces "Internal error (require failed)".

descStringID = typeIDToStringID( list.getClass(ii) ); is the line producing the error. Any advice?

Action Reference

this line:
descProperties.reference = executeActionGet( descProperties.value );
fails quite offten, but you can't see it because it is in try{} block.

There is some more info you can get from action reference no matter if problematic line works or not.

  • getDesiredClass()
  • getForm()
    and then depends on reference form
  • getEnumeratedType() + getEnumeratedValue()
  • or something else

I am using your tool for events analyzing. And structure is very similar to ScriptListener code except action references. The benefit is that I don't need read from disk and parse text file. And I also can access values like:
if(desc.to.fontCaps == "normal") {//do something}

And with extended info, I could run same event again with a bit different parameter value. If I could write code which can rebuild Action Descriptor like JAM framework.

Non-extended for arguments[0]

{
    "null": {
        "typename": "ActionReference"
    },
    "to": {
        "textOverrideFeatureName": 808465713,
        "typeStyleOperationType": 3,
        "fontCaps": "normal"
    }
}

arguments[1] contains eventID "setD"

Extended

{
    "null": {
        "stringID": "null",
        "charID": "null",
        "id": 1853189228,
        "key": 0,
        "type": "DescValueType.REFERENCETYPE",
        "value": {
            "typename": "ActionReference"
        }
    },
    "to": {
        "stringID": "to",
        "charID": "T   ",
        "id": 1411391520,
        "key": 1,
        "type": "DescValueType.OBJECTTYPE",
        "value": {
            "count": 3,
            "typename": "ActionDescriptor"
        },
        "object": {
            "textOverrideFeatureName": {
                "stringID": "textOverrideFeatureName",
                "charID": "",
                "id": 3837,
                "key": 0,
                "type": "DescValueType.INTEGERTYPE",
                "value": 808465713
            },
            "typeStyleOperationType": {
                "stringID": "typeStyleOperationType",
                "charID": "",
                "id": 1366,
                "key": 1,
                "type": "DescValueType.INTEGERTYPE",
                "value": 3
            },
            "fontCaps": {
                "stringID": "fontCaps",
                "charID": "",
                "id": 1329,
                "key": 2,
                "type": "DescValueType.ENUMERATEDTYPE",
                "value": "allCaps",
                "enumerationType": "fontCaps"
            }
        }
    }
}

Script Listener

var idsetd = charIDToTypeID( "setd" );
    var desc1952 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref582 = new ActionReference();
        var idPrpr = charIDToTypeID( "Prpr" );
        var idTxtS = charIDToTypeID( "TxtS" );
        ref582.putProperty( idPrpr, idTxtS );
        var idTxLr = charIDToTypeID( "TxLr" );
        var idOrdn = charIDToTypeID( "Ordn" );
        var idTrgt = charIDToTypeID( "Trgt" );
        ref582.putEnumerated( idTxLr, idOrdn, idTrgt );
    desc1952.putReference( idnull, ref582 );
    var idT = charIDToTypeID( "T   " );
        var desc1953 = new ActionDescriptor();
        var idtextOverrideFeatureName = stringIDToTypeID( "textOverrideFeatureName" );
        desc1953.putInteger( idtextOverrideFeatureName, 808465713 );
        var idtypeStyleOperationType = stringIDToTypeID( "typeStyleOperationType" );
        desc1953.putInteger( idtypeStyleOperationType, 3 );
        var idfontCaps = stringIDToTypeID( "fontCaps" );
        var idfontCaps = stringIDToTypeID( "fontCaps" );
        var idallCaps = stringIDToTypeID( "allCaps" );
        desc1953.putEnumerated( idfontCaps, idfontCaps, idallCaps );
    var idTxtS = charIDToTypeID( "TxtS" );
    desc1952.putObject( idT, idTxtS, desc1953 );
executeAction( idsetd, desc1952, DialogModes.NO );

error in _getDescList

This line creates error in DescriptorInfo.prototype._getDescList:

typeIDToStringID( list.getClass(ii) )

My temporary fix

try{
descStringID = typeIDToStringID( list.getClass(ii) );
}catch(e){
descStringID = "error_descriptor-info";
}

Problem occurs if you apply wrap/deformation on smart object

  "customEnvelopeWarp": {
                "meshPoints": [
                    {
                        "error_descriptor-info": {
                            "horizontal": 0,
                            "vertical": 0
                        }
                    },
                    {
                        "error_descriptor-info": {
                            "horizontal": 319,
                            "vertical": 0
                        }
                    },
                    {
                        "error_descriptor-info": {
                            "horizontal": 638,
                            "vertical": 0
                        }
                    },
                    {
                        "error_descriptor-info": {
                            "horizontal": 957,
                            "vertical": 0
                        }
                    },
                    {
                        "error_descriptor-info": {
                            "horizontal": 0,
                            "vertical": 214.333333333333
                        }
                    },
                    {
                        "error_descriptor-info": {
                            "horizontal": 319,
                            "vertical": 214.333333333333
                        }
                    },
                    {
                        "error_descriptor-info": {
                            "horizontal": 638,
                            "vertical": 214.333333333333
                        }
                    },
                    {
                        "error_descriptor-info": {
                            "horizontal": 957,
                            "vertical": 214.333333333333
                        }
                    },
                    {
                        "error_descriptor-info": {
                            "horizontal": 0,
                            "vertical": 428.666666666667
                        }
                    },
                    {
                        "error_descriptor-info": {
                            "horizontal": 319,
                            "vertical": 428.666666666667
                        }
                    },
                    {
                        "error_descriptor-info": {
                            "horizontal": 638,
                            "vertical": 428.666666666667
                        }
                    },
                    {
                        "error_descriptor-info": {
                            "horizontal": 957,
                            "vertical": 428.666666666667
                        }
                    },
                    {
                        "error_descriptor-info": {
                            "horizontal": 0,
                            "vertical": 643
                        }
                    },
                    {
                        "error_descriptor-info": {
                            "horizontal": 319,
                            "vertical": 643
                        }
                    },
                    {
                        "error_descriptor-info": {
                            "horizontal": 638,
                            "vertical": 643
                        }
                    },
                    {
                        "error_descriptor-info": {
                            "horizontal": 957,
                            "vertical": 643
                        }
                    }
                ]
            }

In JAM action manager from TonTon it looks like this:

"customEnvelopeWarp":
                            {
                                "<object>":
                                {
                                    "customEnvelopeWarp":
                                    {
                                        "meshPoints":
                                        {
                                            "<list>":
                                            [
                                                {
                                                    "<object>":
                                                    {
                                                        "rationalPoint":
                                                        {
                                                            "horizontal":
                                                            {
                                                                "<unitDouble>":
                                                                {
                                                                    "pixelsUnit": 980
                                                                }
                                                            },
                                                            "vertical":
                                                            {
                                                                "<unitDouble>":
                                                                {
                                                                    "pixelsUnit": 373
                                                                }
                                                            }
                                                        }
                                                    }
                                                },
                                                {
                                                    "<object>":
                                                    {
                                                        "rationalPoint":
                                                        {
                                                            "horizontal":
                                                            {
                                                                "<unitDouble>":
                                                                {
                                                                    "pixelsUnit": 1106.66666666667
                                                                }
                                                            },
                                                            "vertical":
                                                            {
                                                                "<unitDouble>":
                                                                {
                                                                    "pixelsUnit": 373
                                                                }
                                                            }
                                                        }
                                                    }
                                                },
                                                {
                                                    "<object>":
                                                    {
                                                        "rationalPoint":
                                                        {
                                                            "horizontal":
                                                            {
                                                                "<unitDouble>":
                                                                {
                                                                    "pixelsUnit": 1233.33333333333
                                                                }
                                                            },
                                                            "vertical":
                                                            {
                                                                "<unitDouble>":
                                                                {
                                                                    "pixelsUnit": 373
                                                                }
                                                            }
                                                        }
                                                    }
                                                },
                                                {
                                                    "<object>":
                                                    {
                                                        "rationalPoint":
                                                        {
                                                            "horizontal":
                                                            {
                                                                "<unitDouble>":
                                                                {
                                                                    "pixelsUnit": 1360
                                                                }
                                                            },
                                                            "vertical":
                                                            {
                                                                "<unitDouble>":
                                                                {
                                                                    "pixelsUnit": 373
                                                                }
                                                            }
                                                        }
                                                    }
                                                },
                                                {
                                                    "<object>":
                                                    {
                                                        "rationalPoint":
                                                        {
                                                            "horizontal":
                                                            {
                                                                "<unitDouble>":
                                                                {
                                                                    "pixelsUnit": 980
                                                                }
                                                            },
                                                            "vertical":
                                                            {
                                                                "<unitDouble>":
                                                                {
                                                                    "pixelsUnit": 437
                                                                }
                                                            }
                                                        }
                                                    }
                                                },
                                                {
                                                    "<object>":
                                                    {
                                                        "rationalPoint":
                                                        {
                                                            "horizontal":
                                                            {
                                                                "<unitDouble>":
                                                                {
                                                                    "pixelsUnit": 1106.66666666667
                                                                }
                                                            },
                                                            "vertical":
                                                            {
                                                                "<unitDouble>":
                                                                {
                                                                    "pixelsUnit": 437
                                                                }
                                                            }
                                                        }
                                                    }
                                                },
                                                {
                                                    "<object>":
                                                    {
                                                        "rationalPoint":
                                                        {
                                                            "horizontal":
                                                            {
                                                                "<unitDouble>":
                                                                {
                                                                    "pixelsUnit": 1233.33333333333
                                                                }
                                                            },
                                                            "vertical":
                                                            {
                                                                "<unitDouble>":
                                                                {
                                                                    "pixelsUnit": 437
                                                                }
                                                            }
                                                        }
                                                    }
                                                },
                                                {
                                                    "<object>":
                                                    {
                                                        "rationalPoint":
                                                        {
                                                            "horizontal":
                                                            {
                                                                "<unitDouble>":
                                                                {
                                                                    "pixelsUnit": 1360
                                                                }
                                                            },
                                                            "vertical":
                                                            {
                                                                "<unitDouble>":
                                                                {
                                                                    "pixelsUnit": 437
                                                                }
                                                            }
                                                        }
                                                    }
                                                },
                                                {
                                                    "<object>":
                                                    {
                                                        "rationalPoint":
                                                        {
                                                            "horizontal":
                                                            {
                                                                "<unitDouble>":
                                                                {
                                                                    "pixelsUnit": 980
                                                                }
                                                            },
                                                            "vertical":
                                                            {
                                                                "<unitDouble>":
                                                                {
                                                                    "pixelsUnit": 501
                                                                }
                                                            }
                                                        }
                                                    }
                                                },
                                                {
                                                    "<object>":
                                                    {
                                                        "rationalPoint":
                                                        {
                                                            "horizontal":
                                                            {
                                                                "<unitDouble>":
                                                                {
                                                                    "pixelsUnit": 1106.66666666667
                                                                }
                                                            },
                                                            "vertical":
                                                            {
                                                                "<unitDouble>":
                                                                {
                                                                    "pixelsUnit": 501
                                                                }
                                                            }
                                                        }
                                                    }
                                                },
                                                {
                                                    "<object>":
                                                    {
                                                        "rationalPoint":
                                                        {
                                                            "horizontal":
                                                            {
                                                                "<unitDouble>":
                                                                {
                                                                    "pixelsUnit": 1233.33333333333
                                                                }
                                                            },
                                                            "vertical":
                                                            {
                                                                "<unitDouble>":
                                                                {
                                                                    "pixelsUnit": 501
                                                                }
                                                            }
                                                        }
                                                    }
                                                },
                                                {
                                                    "<object>":
                                                    {
                                                        "rationalPoint":
                                                        {
                                                            "horizontal":
                                                            {
                                                                "<unitDouble>":
                                                                {
                                                                    "pixelsUnit": 1360
                                                                }
                                                            },
                                                            "vertical":
                                                            {
                                                                "<unitDouble>":
                                                                {
                                                                    "pixelsUnit": 501
                                                                }
                                                            }
                                                        }
                                                    }
                                                },
                                                {
                                                    "<object>":
                                                    {
                                                        "rationalPoint":
                                                        {
                                                            "horizontal":
                                                            {
                                                                "<unitDouble>":
                                                                {
                                                                    "pixelsUnit": 980
                                                                }
                                                            },
                                                            "vertical":
                                                            {
                                                                "<unitDouble>":
                                                                {
                                                                    "pixelsUnit": 565
                                                                }
                                                            }
                                                        }
                                                    }
                                                },
                                                {
                                                    "<object>":
                                                    {
                                                        "rationalPoint":
                                                        {
                                                            "horizontal":
                                                            {
                                                                "<unitDouble>":
                                                                {
                                                                    "pixelsUnit": 1106.66666666667
                                                                }
                                                            },
                                                            "vertical":
                                                            {
                                                                "<unitDouble>":
                                                                {
                                                                    "pixelsUnit": 565
                                                                }
                                                            }
                                                        }
                                                    }
                                                },
                                                {
                                                    "<object>":
                                                    {
                                                        "rationalPoint":
                                                        {
                                                            "horizontal":
                                                            {
                                                                "<unitDouble>":
                                                                {
                                                                    "pixelsUnit": 1233.33333333333
                                                                }
                                                            },
                                                            "vertical":
                                                            {
                                                                "<unitDouble>":
                                                                {
                                                                    "pixelsUnit": 565
                                                                }
                                                            }
                                                        }
                                                    }
                                                },
                                                {
                                                    "<object>":
                                                    {
                                                        "rationalPoint":
                                                        {
                                                            "horizontal":
                                                            {
                                                                "<unitDouble>":
                                                                {
                                                                    "pixelsUnit": 1360
                                                                }
                                                            },
                                                            "vertical":
                                                            {
                                                                "<unitDouble>":
                                                                {
                                                                    "pixelsUnit": 565
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            ]
                                        }
                                    }
                                }
                            }

Missing info about unit in UnitDoubleType

There are two double(decimal) types:

  1. DOUBLETYPE - only number
  2. UNITDOUBLE - this data type has extra information about which unit is there, but we don't have this info in output

Example: var strokeDoubleType = desc.getUnitDoubleType(stringIDToTypeID('strokeStyleLineWidth'));

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.