Copy link to clipboard
Copied
Hi.
The only way I see now, how to work with plugin development is to find a working fragment of code that does something I need and copy paste it to my code. I have no idea how to work things out by myself. One example: how to get the size of the active page? I have layoutControlData->GetPage() which returns UIDRef. Good luck with that. No idea what the object type is, what interfaces it has. I tried to work out the getting started section of html documentation but it doesn't really address these issues, and it looks incomplete/out of date. One example:
"Open the API reference documentation (in <SDK>/docs/references), click the Boss Classes link at the top of the page, and navigate to the "kDialogBoss Class Reference" page."
Except there is no "<SDK>/docs/references" path in the SDK, there is no "Boss Classes link" (there is Bosses) and there is no kDialogBoss on the list of bosses.
Is there any straight forward objects/classes hierarchy documentation?
How do I find what object's type is?
How do I find what interfaces each object/class have?
peter-petrowicz2 wrote
UIDRef. Good luck with that...
UIDRef gives you the IDataBase. IDataBase::GetClass() will then accept the UID in the scope of that database and return the associated ClassID.
To translate the ClassID into its symbolic name, you'd use DebugClassUtils of the debug build which is sugarcoating on top of IObjectModel. In the release build you decode the ClassID value into the prefix ID and last byte offset, then search the SDK's ID.h files for that prefix (RezLong ...) and offset
...Copy link to clipboard
Copied
Hi,
In the documentation there are .chm files, I find these are more useful for locating information on the bosses, although most bosses are well names, page boss is called kPageBoss, so finding them is not too hard, but the chm has this included which makes it easier.
So the above leads you to the classes and each page gives you a list of the interfaces.
As to how to work with them, the best plan is to look through the source code of the samples and find a working example, as there are often many ways to the same solution, depending on a number of factors.
Using your example of page size we could get it using
(i foung this by searching for GetPage )
// spread is an ISpread* and returns the bounds of all pages
PMRect pagesBounds = spread->GetPagesBounds( Transform::PasteboardCoordinates());
OR
(I found this by searching for GetItemBounds - I found that function by looking at kPageBoss, which lead me to IGeometry )
// this gets a specific page
InterfacePtr<IGeometry> pageGeometry(spread->QueryNthPage(p));
PMRect pageBounds = Utils<Facade::IGeometryFacade>()->GetItemBounds( ::GetUIDRef(pageGeometry), Transform::PasteboardCoordinates(), Geometry::OuterStrokeBounds());
Hope this helps a little, and please ask more questions and we will try to aid you.
Regards
Malcolm
Copy link to clipboard
Copied
Thank you for Your comment.
I found one of the bigger problems I had. I used html documentation from SDK 2017, it contains just a small fraction of boss references (there is no kPageBoss for example, I searched for it before, couldn't find it), I guess that's some kind of a bug in the package. SDK 2018 docs look a lot better in that aspect.
Copy link to clipboard
Copied
HI,
Indeed it looks like there was some kind of issue with the 2017 build as it appears to be missing a lot of documentation
CC SDK docs 2017 ~ 238.6MB
CC SDK docs 2018 ~ 850 MB
Quite a difference there.
Regards
Malcolm
Copy link to clipboard
Copied
peter-petrowicz2 wrote
UIDRef. Good luck with that...
UIDRef gives you the IDataBase. IDataBase::GetClass() will then accept the UID in the scope of that database and return the associated ClassID.
To translate the ClassID into its symbolic name, you'd use DebugClassUtils of the debug build which is sugarcoating on top of IObjectModel. In the release build you decode the ClassID value into the prefix ID and last byte offset, then search the SDK's ID.h files for that prefix (RezLong ...) and offset (DECLARE_PMID ...).
Edit: To get the list of associated interfaces, you'd also use IObjectModel which is available from the session boss (GetExecutionContextSession()). Unlike the SDK docs it also considers modifications (new classes, addin interfaces) from your plugins.
Hth,
Dirk