Copy link to clipboard
Copied
I am iterating through comp layers and layer properties and saving them in an object. I then call JSON.stringify() on the object created put in JSON valid format. Unfortunately I am getting an error:
Unable to execute script at line 230. After effects error: This property has no maximum value.
This is the function and line that the debugger points to. This is just a small piece of code.
function storeAVLayerData(avLayer){
var layer = new Object();
var layerTypeData = determineLayerType(avLayer);
alert("layername: "+avLayer.name);
layer.name = avLayer.name;
layer.type = layerTypeData.type;
layer.index = avLayer.index;
layer.height = avLayer.height;
layer.width = avLayer.width;
layer.motionBlur = avLayer.motionBlur;
layer.effectsActive = avLayer.effectsActive;
layer.adjustmentLayer = avLayer.adjustmentLayer;
layer.guideLayer = avLayer.guideLayer;
layer.threeDLayer = avLayer.threeDLayer;
layer.threeDPerChar = avLayer.threeDPerChar;
layer.environmentLayer = avLayer.environmentLayer;
layer.canSetCollapseTransformation = avLayer.canSetCollapseTransformation;
layer.collapseTransformation = avLayer.collapseTransformation;
layer.frameBlending = avLayer.frameBlending;
layer.frameBlendingType = avLayer.frameBlendingType;
layer.canSetTimeRemapEnabled = avLayer.canSetTimeRemapEnabled;
layer.timeRemapEnabled = avLayer.timeRemapEnabled;
layer.autoOrient = avLayer.autoOrient;
layer.hasTrackMatte = avLayer.hasTrackMatte;
layer.trackMatteType = avLayer.trackMatteType;
layer.isTrackMatte = avLayer.isTrackMatte;
layer.preserveTransparency = avLayer.preserveTransparency;
layer.quality = avLayer.quality;
layer.preserveTransparency = avLayer.preserveTransparency;
layer.parent = avLayer.parent;
layer.startTime = avLayer.startTime;
layer.stretch = avLayer.stretch;
layer.inPoint = avLayer.inPoint;
layer.outPoint = avLayer.outPoint;
layer.enabled = avLayer.enabled;
layer.solo = avLayer.solo;
layer.shy = avLayer.shy;
layer.locked = avLayer.locked;
return layer; //this is line 230
}
If I don't call the JSON.stringify() on an object, then the error is never thrown. This seems like an error in structure of object. This code works for a lot of projects, but some issue an error. How can I debug this and what does the error actually mean? It is kinda vague and google seems to be clueless.
Copy link to clipboard
Copied
You get this kind off error when you query prop.maxValue while the property 'prop' does not have a max value
Examples:
theLayer.transform.postion.maxValue; // error
theLayer.transform.opacity.maxValue; // 100
so that querying maxValue should be preceeded by: if (prop.hasMax) (prop.maxValue etc...).
Therefore it is strange that your function generates this error, because layers dont have the maxValue attribute, only properties do.
Xavier.
Copy link to clipboard
Copied
Thanks for stopping by. Nowhere in my code I query for maxValue of anything. Strange indeed.
Copy link to clipboard
Copied
Actually some long time ago I tried writing objectToSource() function that would parse AE properties. I remember I was getting those maxValue errors as well. Since this function wasn't that essential, I simply skipped maxValue. But guess what? Then AE complained about minValue. After ignoring minValue it complained about lightType, separationDimension, separationLeader ![]()
Anyways, if you want to take a look, there it is - AE Script: AE Object to Source — Bitbucket
That snippet would produce such result for a layer:
{
"active": true,
"audioEnabled": true,
"autoOrient": 4212,
"blendingMode": 5212,
"canSetCollapseTransformation": true,
"canSetEnabled": true,
"containingComp": {
"bgColor": [0.84705882352941, 0.25098039215686, 0.25098039215686],
"duration": 1,
"dynamicLinkGUID": "00000001-0000-0000-0000-000000000000",
"frameDuration": 0.04,
"frameRate": 25,
"hasVideo": true,
"height": 500,
"id": 1,
"label": 3,
"layers": {},
"markerProperty": {
"active": true,
"canVaryOverTime": true,
"enabled": true,
"matchName": "ADBE Marker",
"name": "Marker",
"parentProperty": {
"active": true,
"audioEnabled": true,
"autoOrient": 4212,
"blendingMode": 5212,
"canSetEnabled": true,
"collapseTransformation": true,
"containingComp": {},
"effectsActive": true,
"enabled": true,
"frameBlendingType": 4012,
"hasVideo": true,
"height": 500,
"index": -2147483647,
"isModified": true,
"isNameSet": true,
"label": 10,
"matchName": "ADBE Vector Layer",
"name": "Markers",
"numProperties": 9,
"outPoint": 29,
"propertyType": 6213,
"quality": 4614,
"samplingQuality": 4812,
"selectedProperties": [],
"stretch": 100,
"trackMatteType": 5012,
"width": 500
},
"propertyDepth": 1,
"propertyIndex": 1,
"propertyType": 6212,
"propertyValueType": 6420,
"selectedKeys": [],
"value": {
"eventCuePoint": true
}
},
"motionBlurAdaptiveSampleLimit": 128,
"motionBlurSamplesPerFrame": 16,
"name": "Comp 1",
"numLayers": 1,
"parentFolder": {
"dynamicLinkGUID": "00000000-0000-0000-0000-000000000000",
"items": {},
"name": "Root",
"numItems": 2,
"typeName": "Folder"
},
"pixelAspect": 1,
"renderer": "ADBE Advanced 3d",
"renderers": ["ADBE Advanced 3d", "ADBE Ernst", "ADBE Picasso", "ADBE Standard 3d"],
"resolutionFactor": [1, 1],
"selected": true,
"selectedLayers": [({})],
"selectedProperties": [],
"shutterAngle": 180,
"shutterPhase": -90,
"typeName": "Composition",
"usedIn": [],
"width": 500,
"workAreaDuration": 1
},
"effectsActive": true,
"enabled": true,
"frameBlendingType": 4012,
"hasVideo": true,
"height": 500,
"index": 1,
"isModified": true,
"isNameFromSource": true,
"label": 1,
"matchName": "ADBE AV Layer",
"name": "Red Solid 1",
"numProperties": 11,
"outPoint": 1,
"propertyType": 6213,
"quality": 4614,
"samplingQuality": 4812,
"selected": true,
"selectedProperties": [],
"source": {
"dynamicLinkGUID": "00000090-0000-0000-0000-000000000000",
"frameDuration": 1,
"hasVideo": true,
"height": 500,
"id": 144,
"label": 1,
"mainSource": {
"alphaMode": 5412,
"color": [0.77772700786591, 0.18244600296021, 0.33126199245453],
"fieldSeparationType": 5613,
"isStill": true,
"loop": 1,
"premulColor": [0, 0, 0],
"removePulldown": 5813
},
"name": "Red Solid 1",
"parentFolder": {
"dynamicLinkGUID": "0000008f-0000-0000-0000-000000000000",
"id": 143,
"items": {},
"name": "Solids",
"numItems": 1,
"parentFolder": {
"dynamicLinkGUID": "00000000-0000-0000-0000-000000000000",
"items": {},
"name": "Root",
"numItems": 2,
"typeName": "Folder"
},
"typeName": "Folder"
},
"pixelAspect": 1,
"typeName": "Footage",
"usedIn": [({})],
"width": 500
},
"stretch": 100,
"trackMatteType": 5012,
"width": 500
}
Copy link to clipboard
Copied
haha, looks like ae has a brain of its own. I am actually writing the same thing. I guess i will be adding new properties and waiting for code to break.
Copy link to clipboard
Copied
Are you using some includes ? Because it is very unlikely that the function you posted at the top of this thread is causing the issue.
Copy link to clipboard
Copied
It actually does, just not at line 230. I am assigning a layer.parent with avLayer.parent. I've come across project with actual parent set. In that case layer.parent gets a AE object (another AVLayer) assigned. You can't JSON.stringify AE objects. That was the reason for this error. It had nothing to do with maxValue. AE scripting needs a book with this gotchas. I may write it in the future ![]()
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more