Adobe 65007312 Programming Guide - Page 168

Getting Started: A Tutorial Example, Creating an export plug-in, Create the information file

Page 168 highlights

9 Getting Started: A Tutorial Example This chapter will help you get started with extending Lightroom's Export behavior by walking through the creation of the simple Hello World plug-in. This plug-in adds menu items to the File and Library menus, and defines dialog boxes that are displayed when the menu items are selected. The plug-in also demonstrates how to output and view trace information for debugging and development. This chapter shows how to build plug-ins that extend the Export functionality of Lightroom. The concepts and techniques are explained in more detail in Chapter 3, "Creating Export and Publish Services." X Additional features you can add using the same framework are demonstrated in Chapter 10, "Defining Metadata: A Walkthrough." X Web Gallery plug-ins, which use a different framework, are demonstrated in Chapter 11, "Web Gallery Plug-ins: A Tutorial Example." Creating an export plug-in You can place a plug-in folder anywhere, and notify Lightroom of its location using the Plug-in Manager. A plug-in must be packaged for delivery within a single folder, with the suffix .lrplugin. For development, you can use the suffix .lrdevplugin. Thus, the Hello World plug-in will be placed in the folder helloworld.lrdevplugin. Create the information file 1. Create a text file and save it as helloworld.lrdevplugin/Info.lua. You must describe your plug-in to Lightroom by creating an Info.lua file and placing it in your plug-in folder. This script must return a table that describes the plug-in to Lightroom. 2. Edit the script in the information file to return a table. This table must contain the version number for the SDK and a unique string to identify the plug-in. Add the following code to the Info.lua file: return { LrSdkVersion = 3.0, LrToolkitIdentifier = 'com.adobe.lightroom.sdk.helloworld', } 3. Add another entry to the returned table to create a menu item in the Lightroom File menu. Place the following code after the LrToolkitIdentifier entry: LrExportMenuItems = { title = "Hello World Dialog", -- The display text for the menu item file = "ExportMenuItem.lua", -- The script that runs when the item is selected }, (This entry adds only one menu item, so it defines a single table, rather than a table of tables.) 4. Add another entry to the returned table to create a menu item in the Lightroom Library menu. 168

  • 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

168
9
Getting Started: A Tutorial Example
This chapter will help you get started with extending Lightroom’s Export behavior by walking through the
creation of the simple Hello World plug-in. This plug-in adds menu items to the File and Library menus,
and defines dialog boxes that are displayed when the menu items are selected. The plug-in also
demonstrates how to output and view trace information for debugging and development.
This chapter shows how to build plug-ins that extend the Export functionality of Lightroom. The concepts
and techniques are explained in more detail in
Chapter 3, “Creating Export and Publish Services
.”
X
Additional features you can add using the same framework are demonstrated in
Chapter 10, “Defining
Metadata: A Walkthrough
.”
X
Web Gallery plug-ins, which use a different framework, are demonstrated in
Chapter 11, “Web Gallery
Plug-ins: A Tutorial Example
.”
Creating an export plug-in
You can place a plug-in folder anywhere, and notify Lightroom of its location using the Plug-in Manager. A
plug-in must be packaged for delivery within a single folder, with the suffix
.lrplugin
. For development,
you can use the suffix
.lrdevplugin
. Thus, the Hello World plug-in will be placed in the folder
helloworld.lrdevplugin
.
Create the information file
1.
Create a text file and save it as
helloworld.lrdevplugin/Info.lua.
You must describe your plug-in to Lightroom by creating an
Info.lua
file and placing it in your
plug-in folder. This script must return a table that describes the plug-in to Lightroom.
2.
Edit the script in the information file to return a table. This table must contain the version number for
the SDK and a unique string to identify the plug-in.
Add the following code to the
Info.lua
file:
return {
LrSdkVersion = 3.0,
LrToolkitIdentifier = 'com.adobe.lightroom.sdk.helloworld',
}
3.
Add another entry to the returned table to create a menu item in the Lightroom File menu.
Place the following code after the
LrToolkitIdentifier
entry:
LrExportMenuItems = {
title = "Hello World Dialog", -- The display text for the menu item
file = "ExportMenuItem.lua", -- The script that runs when the item is selected
},
(This entry adds only one menu item, so it defines a single table, rather than a table of tables.)
4.
Add another entry to the returned table to create a menu item in the Lightroom Library menu.