Skip to content

Commit

Permalink
Ps docs update for hybrid and action re-recording (#444)
Browse files Browse the repository at this point in the history
* Add documentation for Record Again support for UXP plugin Action steps.

* Add notes and sample code for Ps SDK access for hybrid addons.

* Update changelog

* Changelog tweaks, restore quote formatting to UXP Integrations

Add Document.zoom property
Tweak action recording copy.

* Changelog for document zoom.

* Update yarn.lock

* Fix grammar.
  • Loading branch information
samgannawayA authored Sep 29, 2023
1 parent 90d9c4c commit e60556e
Show file tree
Hide file tree
Showing 7 changed files with 918 additions and 816 deletions.
53 changes: 52 additions & 1 deletion src/pages/guides/hybrid-plugins/getting-started/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The concept of a hybrid plugin is very similar to Node.js C++ Addons. The dynami

Try the ready-to-use `template-plugin` provided within the SDK to say a quick ‘Hello world!’. Load the template via UDT, and find it under the Plugins menu.

![Pluign menu](./plugin-menu.png)
![Plugins menu](./plugin-menu.png)

<InlineAlert variant="info" slots="text"/>

Expand Down Expand Up @@ -55,3 +55,54 @@ This is opposed to a standard UXP plugin’s method of accessing the file system
let entry = await require('uxp').storage.localFileSystem.getFileForSaving("target.psd");
document.saveAs.psd(entry);
```


## Photoshop C++ SDK

Photoshop offers a number of C based plugin APIs. These are documented in the [downloadable package](https://console.adobe.io/servicesandapis).
A hybrid plugin can get access to these APIs by exposing an additional function entry point.
```cpp
export SPErr PSDLLMain(const char* selector, SPBasicSuite* basicSuite, PIActionDescriptor descriptor);
```
After Photoshop loads a hybrid addOn, it will invoke this method. The basicSuite argument can be used to obtain Photoshop API suites. See the C++ SDK for information about how to acquire Photoshop suites.
### Sample code:
To test this, you can add the following to module.cpp from the hybrid plugin sample:
```C++
// Photoshop SDK includes (add path to project)
#include "SPBasic.h"
#include "PIColorSpaceSuite.h"
. . .
// ----------------------------------------------------------------------------------------------------
static const SPBasicSuite* gBasicSuite = nullptr;
static const PSColorSpaceSuite2* gColorSpaceSuite = nullptr;
extern "C" UXP_EXTERN_API_STDCALL(SPErr) PSDLLMain(const char* selector, SPBasicSuite* spBasic, void*)
try {
do {
if (spBasic == nullptr)
break;
// cache the basic suite so we can use at any time
gBasicSuite = spBasic;
SPErr spErr = gBasicSuite->AcquireSuite(kPSColorSpaceSuite, kPSColorSpaceSuiteVersion, reinterpret_cast<const void**>(&gColorSpaceSuite));
if (spErr != kSPNoError)
break;
if (gColorSpaceSuite == nullptr)
break;
Color8 colorArray[1] = {11, 30, 201, 0};
spErr = gColorSpaceSuite->Convert8(plugIncolorServicesRGBSpace, plugIncolorServicesCMYKSpace, colorArray, 1);
if (spErr != kSPNoError) break;
} while (false);
return kSPNoError;
}
catch(...) {
return -1;
}
```
4 changes: 2 additions & 2 deletions src/pages/guides/hybrid-plugins/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ In order to write a Hybrid plugin, you must be proficient in C++. Consider this

## UXP Hybrid plugin vs Photoshop C++ plugins

A UXP hybrid plugin should not be confused with a Photoshop C++ plugin [built using CSDK](../../ps_reference/media/cpp-pluginsdk/).
A UXP hybrid plugin should not be confused with a Photoshop C++ plugin [built using the C++ SDK](../../ps_reference/media/cpp-pluginsdk/).

What you choose depends upon your use case. For example, if you wish to build a Photoshop filter that appears under the Filter menu or implement a new file type, you probably should create a C++ plugin using PS CSDK. But opt for UXP Hybrid plugins if you want to write generic C++ code alongside JavaScript.

We are exploring ways to integrate the two types in the future. Lookout for updates in our [forums](https://forums.creativeclouddeveloper.com/) and [newsletters](https://www.adobe.com/subscription/ccdevnewsletter.html)
We have opened the pathway to allow a .uxpaddon to [utilize the Photoshop C++ SDK](./getting-started/index.md#photoshop-c-sdk). In this way, you create a compiled filter and bundle it with a UXP dialog to control it. Bear in mind that the filter in this example would only be known to the UXP hybrid plugin.

## Minimum Version Requirements

Expand Down
Loading

0 comments on commit e60556e

Please sign in to comment.