Skip to content

Commit cfed154

Browse files
Add layerByID method to Project object
1 parent 691bfc4 commit cfed154

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

docs/general/project.rst

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -921,6 +921,42 @@ Retrieves an item by its :ref:`Item ID <Item.id>`
921921
922922
:ref:`Item`.
923923
924+
----
925+
926+
.. _Project.layerByID:
927+
928+
Project.layerByID()
929+
*********************************************
930+
931+
``app.project.layerByID(id)``
932+
933+
**Description**
934+
935+
Instance method on Project which, when given a valid ID value, returns the Layer object in the Project with that given ID.
936+
937+
**Parameters**
938+
939+
=========== ======================
940+
``id`` A non-negative integer representing the ID of the Layer to be retrieved from the Project.
941+
=========== ======================
942+
943+
**Returns**
944+
945+
:ref:`Layer` with the given ID if it exists on the project; otherwise null. Non-valid IDs will throw an exception stating that the input parameter is not an unsigned integer.
946+
947+
**Example**
948+
949+
.. code:: javascript
950+
951+
var firstComp = app.project.item(1);
952+
var firstLayer = firstComp.layer(1);
953+
var layerID = firstLayer.id;
954+
955+
if (app.project.layerByID(layerID) === firstLayer) {
956+
alert("You can get the Layer from the ID!");
957+
}
958+
959+
924960
----
925961
926962
.. _Project.reduceProject:

0 commit comments

Comments
 (0)