Adobe 65007312 Programming Guide - Page 49

Stage 1: Deciding how the photos should be rendered, Stage 3: Requesting renditions, The service's

Page 49 highlights

CHAPTER 3: Creating Export and Publish Services Adding an export post-process action 49 It then calls exportSession:doExportOnCurrentTask(), which performs the following operations. (If you wish to start an export without using the export dialog, you can make the same calls yourself.) In this discussion, an Export Service Provider is called a service, and an Export Filter Provider is called a filter. Stage 1: Deciding how the photos should be rendered If the service has defined an updateExportSettings() function, it is called. This function takes one argument, the export-settings table, and allows the service to force certain render settings to its preferred or required settings. For example, to force a specific size for the exported photos, you could use this definition: updateExportSettings = function( exportSettings ) exportSettings.LR_size_maxHeight = 400 exportSettings.LR_size_maxWidth = 400 end The filters, if any, are not involved at this stage. Stage 2: Deciding what photos should be rendered The filters are invoked from top-to-bottom. For each filter: X If it is defined, the shouldRenderPhotos() function is called for each photo. If it returns false, the photo is removed from the list of photos to export (and thus does not get passed to the downstream consumer). If it returns true, the photo remains in the list and is passed to the downstream consumer. X If shouldRenderPhotos() is not defined for the filter, all photos are passed to the downstream consumer. Stage 3: Requesting renditions 1. The export session (LrExportSession) generates rendition request objects (LrExportRendition) for every photo that was not removed in Stage 2. (The actual rendering of the photos does not start yet.) During this stage, Lightroom can show a dialog message if a photo already exists at the proposed destination location. You can control this behavior using the LR_collisionHandling setting in the export settings table. 2. The service's processRenderedPhotos() function is called. If no such function exists, a default one is provided that performs the steps described below. IMPORTANT: Each of the providers (the export service, filters, and Lightroom's built-in rendering engine) runs in its own task (using LrTasks), so these loops operate in parallel. It is likely that each provider will be running simultaneously. Several photos can be in process simultaneously by different providers. This allows the overall export operation to complete much more quickly than it would if every photo had to go through all of the steps before the processing of the next photo could begin. 3. The processRenderedPhotos() function calls exportContext:renditions() and then waits for each rendition to be completed by calling rendition:waitForRender(). (We will discuss the completion of this loop in Stage 4.) 4. The service's rendition requests are sent to its upstream provider (that is, the bottom-most filter, or if there are no filters, Lightroom's built-in render engine).

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204

C
HAPTER
3: Creating Export and Publish Services
Adding an export post-process action
49
It then calls
exportSession:doExportOnCurrentTask()
, which performs the following operations. (If
you wish to start an export without using the export dialog, you can make the same calls yourself.)
In this discussion, an Export Service Provider is called a
service
, and an Export Filter Provider is called a
filter
.
Stage 1: Deciding how the photos should be rendered
If the service has defined an
updateExportSettings()
function, it is called. This function takes one
argument, the export-settings table, and allows the service to force certain render settings to its preferred
or required settings. For example, to force a specific size for the exported photos, you could use this
definition:
updateExportSettings = function( exportSettings )
exportSettings.LR_size_maxHeight = 400
exportSettings.LR_size_maxWidth = 400
end
The filters, if any, are not involved at this stage.
Stage 2: Deciding what photos should be rendered
The filters are invoked from top-to-bottom. For each filter:
X
If it is defined, the
shouldRenderPhotos()
function is called for each photo. If it returns false, the
photo is removed from the list of photos to export (and thus does not get passed to the downstream
consumer). If it returns true, the photo remains in the list and is passed to the downstream consumer.
X
If
shouldRenderPhotos()
is not defined for the filter, all photos are passed to the downstream
consumer.
Stage 3: Requesting renditions
1.
The export session (
LrExportSession
) generates rendition request objects (
LrExportRendition
) for
every photo that was not removed in Stage 2. (The actual rendering of the photos does not start yet.)
During this stage, Lightroom can show a dialog message if a photo already exists at the proposed
destination location. You can control this behavior using the
LR_collisionHandling
setting in the
export settings table.
2.
The service's
processRenderedPhotos()
function is called. If no such function exists, a default one is
provided that performs the steps described below.
I
MPORTANT
:
Each of the providers (the export service, filters, and Lightroom's built-in rendering engine)
runs in its own task (using
LrTasks
), so these loops operate in parallel. It is likely that each provider will be
running simultaneously. Several photos can be in process simultaneously by different providers. This
allows the overall export operation to complete much more quickly than it would if every photo had to go
through all of the steps before the processing of the next photo could begin.
3.
The
processRenderedPhotos()
function calls
exportContext:renditions()
and then waits for
each rendition to be completed by calling
rendition:waitForRender()
. (We will discuss the
completion of this loop in Stage 4.)
4.
The service's rendition requests are sent to its upstream provider (that is, the bottom-most filter, or if
there are no filters, Lightroom's built-in render engine).