· 6 years ago · Feb 21, 2020, 10:38 AM
1 Class
2 {
3 kExtendScriptEngineBoss,
4 kInvalidClass,
5 {
6 /** Handles client-specific script invocation */
7 IID_ISCRIPTRUNNER, kJavaScriptRunnerImpl,
8 /** Used by CScriptRunner to signal responders that a script is executing */
9 IID_ISIGNALMGR, kSignalMgrImpl,
10 /** Implements support for a multiple engines on this client */
11 IID_ISCRIPTENGINE, kJavaScriptEngineImpl,
12 /** Implements support for script preferences that are shared with other scripting languages */
13 IID_ISCRIPTPREFERENCES, kScriptPreferencesImpl,
14 /** Converts data between the core and client-specific formats */
15 IID_ISCRIPTDATACONVERTER, kJavaScriptDataConverterImpl,
16 /** Manages the connection to the ExtendScript engine */
17 IID_IEXTENDSCRIPTENGINE, kExtendScriptEngineImpl,
18 }
19 },
20
21
22
23Initialization of ExtendScriptEngine
24ExtendScriptEngine::Startup()
25 This method does a lot of work that we need to mimic in order to get the script calls the way it works right now.
26 ScScript::Engine::createEngine( ScScript::Engine::kJavaScript )
27
28
29Objects that we are registering :
30 1. ES Engine
31 2. Dispatcher
32 3. FileDisp
33 4. Socket Dispatcher
34 5. LiveObject API
35 6. GlobalDialogs
36
37
38
39There are certain things that we register on the global objects. This is what we are going to add to n-api as well. This may include cdoHost or app object later.
40
41
42Things from Ai Scripting Investigation
43 Initialize a few things :
44 InitHostAdapter()
45 dvauxp::host::Initialize()
46 Alpaca_uxp_loader_host_delegate_impl::init() === This is a template class. something like alpaca_uxp_loader_host_delegate_impl<T>::init().
47 Something about the traits of T
48 a. This implements torq::ref_counted<T>
49 b. ISealContextHolder
50 c. std::enable_shared_from_this<T> ()
51
52 Create UXP Params()
53 a. uxp_initialize_param_ref()
54 Enable GDI interop
55 enable debugging for debug builds
56 set a logging folder and max log size folder
57
58 Install V8 resources : Something like icudtl.dat file
59 Install Adobe Clean and Source San fonts : done using a folder registration to uxp.
60 Read and load UXP extensions:
61 torq::initializer_ptr::Instance()
62 initializer_ptr.initialize( use the initialize params that you created ealier );
63
64 There is a notion of UXP Extension Loader that is obtained using torq::uxp::loader_ref()
65 ReadExtension()
66 LoadExtension()
67
68 How to load an extension:
69 Iterate over the extensions folder
70 Register their manifests. We need to filter here as some of these extensions may not be UXP supported.
71 Iterate over the extensions
72 Each extension needs an UXPLoaderHostDelegate. Remember this class?? We created this somewhere above to pass to alpaca_uxp_loader_host_delegate_impl<T> ??
73 Cache the delegate for extension.
74 Create torq uxp loader using the delegate we got for this extension.
75 Get the storage provider Factory.
76 ask the extension loader to load using the storage and loader delegate.
77
78 OS_TopLevelViewContainer is needed to create the start screen dashboard This is what hosts the content from extension.
79
80 Some more things to look into :
81 AiSealContext
82 HostContextDelegate
83
84Questions that need answer:
85 1. What are the dependencies?
86 a. What comes from Drover? dvauxp /dvauxphost ???
87 b. What comes from uxp team ?
88 alpaca / uxp / dynamic_torqnative.dlll ? Am I doing a source code integration ?
89
90/=========================================== Drover code details Section =======================================================/
91Whatever Ai implemented in their side, is now part of drover and we can choose to implement / enhance current drover copy to
92add support for the customizations that the apps need. This seems right to me because as a client we will be able to leverage a lot of shared work and
93will be able to contribute back as well for once.
94The idea is to have a unified interface in drover side. That will be augmented by a set of callbacks that the client app will register and drover interface will
95rely on these to get client specific work done on main thread.
96
97
98
99
100/============================================ Implementation Section ===========================================================/
101
1021. Some build steps have been added in order to build the code and copy files to our binaries. There are some To-Dos there for Mac OS so that is something that we will
103have to resolve if we are targeting mac first. IMO, we can do that a bit later also so no pressure.
104
105IHostAPIProvider and ILicensingAPIProvider are two interfaces that are needed in order to load home screen
106I have provided the js_bindings in drover code directly so that any one using drover may opt in and get these
107out of the box. These are similar to what Illustrator has done. Its just that we moved it to drover.
108I have added structures that hold callbacks so any client will need to provide these structures and they will be copied. These callbacks will be called
109from main thread and the client is not supposed to block in the implementation of these calls because that is the anti-christ of performance.
110These are kept quite straight forward and easy to understand what that does.
111
112
113Next steps: Initializing the dvaxup module, dvauxphost module and then attempt to load sample extension.
114
115To do this, My plan is to use one of the existing project in such a way that later, w e can take one perticular folder / file structure and make it a separate project.
116This will help us speed up initial development.
117IUXPController is the interface in AppUI that will deal with Initialization of UXP and providing callbacks. Key responsibility is to init and terminate uxp correctly.
118IUXPClientHelper is the one that is supposed to do the client side work such as calling dvauxp apis for initializing the callbacks and all. Key role is to provide client side impls expected by uxp (callback struct filling. Implementing the callbacks etc)