Skip to content

Commit 2c1390d

Browse files
authored
Merge pull request #185 from AcademySoftwareFoundation/doc-fixes
Doc fixes: clipGetRegionOfDefinition, Interacts
2 parents 74d7f48 + 56ba303 commit 2c1390d

File tree

6 files changed

+262
-151
lines changed

6 files changed

+262
-151
lines changed

Documentation/README.md

Lines changed: 156 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,27 @@
22

33
This is the documentation directory for OFX, the open visual effects standard.
44

5-
# Building Docs
5+
## Documentation Architecture
6+
7+
The OpenFX documentation system combines several tools:
8+
9+
1. **Doxygen** - Parses C/C++ header files in the `include` directory to extract API documentation from comments
10+
2. **Breathe** - A Sphinx extension that bridges Doxygen XML output with Sphinx
11+
3. **Sphinx** - Processes ReStructured Text (.rst) files and Doxygen output to generate the final HTML documentation
12+
4. **Python scripts** - Custom scripts like `genPropertiesReference.py` extract property definitions from source files
13+
14+
The documentation is organized into:
15+
- **Reference manual** - API documentation generated from Doxygen comments in the header files
16+
- **Guide** - Tutorial content with examples in ReStructured Text
17+
- **Release notes** - Version-specific information
18+
19+
## Building Docs
620

721
Buildthedocs.io will auto-build whenever changes are pushed to master.
822
But to build the docs yourself, e.g. to check that your updates look
923
right, you can do your own doc build.
1024

11-
Right now building the docs is somewhat manual. The below assumes
12-
Linux, but Mac is similar.
13-
14-
## Prerequisites
25+
### Prerequisites
1526

1627
* Install doxygen (Linux: `sudo apt install doxygen`)
1728
* Create a python3 virtualenv: `python -mvenv ofx-docgen` (may need to do `apt install python3.8-venv` first)
@@ -21,47 +32,143 @@ Linux, but Mac is similar.
2132
(Virtualenv is recommended, but not required; you could install the reqs into your
2233
system python if you like.)
2334

24-
## Build:
25-
26-
* Make sure your virtualenv above is activated: `source ofx-docgen/bin/activate`
27-
* Generate references:
28-
`python Documentation/genPropertiesReference.py -i include -o Documentation/sources/Reference/ofxPropertiesReference.rst -r`
29-
* Build the doxygen docs: `cd include; doxygen ofx.doxy; cd -` (you'll see
30-
some warnings)
31-
* Build the sphinx docs:
32-
`cd Documentation; sphinx-build -b html sources build`
33-
* Note that you can do all the above using the build script in `Documentation/build.sh`.
34-
* Now open
35-
file:///path/to/your/ofx/openfx/Documentation/build/index.html in
36-
your browser; your changes should be there.
37-
38-
# Doxygen notes:
39-
40-
Doxygen is used in the source and headers. The doc build process
41-
parses the doxygen comments to build docs, then breathe to merge them
42-
with the `.rst` sphinx docs. See the [Doxygen docs](https://www.doxygen.nl/manual/docblocks.html)
43-
44-
* Params/Actions/etc. should be added to groups using `\defgroup`, `\ingroup` and `\addtogroup`. Use `@{` / `@}` to add multiple items.
45-
* Use `\ref` to refer to entities in doxygen.
46-
47-
48-
# RST Notes:
49-
50-
RST (ReStructured Text) is used for the prose documentation in the `/Documentation` subtree, using Sphinx and Breathe.
51-
52-
* Internal links:
53-
- Define: `.. _target-name:` (must be *globally unique*!)
54-
- Reference: ``:ref:`target-name` ``
55-
- Good to put these just before section headers; the link will refer to the header in that case.
56-
- See [Sphinx Docs](https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#role-ref)
57-
- Links to structs/etc.:
58-
- ``:ref:`OfxHost<OfxHost>` ``
59-
- Links to documents:
60-
- ``:doc:`docname` `` (if docname starts with `/` it's absolute, otherwise rel to current file)
61-
- C macros: `` :c:macro:`kOfxParamPropChoiceOrder` `` (struct/var/func/member/enum/type/... work too),
62-
see the [Doc](https://www.sphinx-doc.org/en/master/usage/domains/c.html#c-roles)
63-
- You can also reference `#define`s using this syntax: ``.. doxygendefine:: kOfxImageEffectRenderUnsafe`` on its own line,
64-
which pulls in the whole doxygen block for that `#define`.
65-
* Useful macros:
66-
- `` .. literalinclude:: README.txt ``
67-
35+
### Build Process
36+
37+
The simplest way to build the documentation is to run the build script:
38+
39+
```bash
40+
cd Documentation
41+
./build.sh
42+
```
43+
44+
This script performs the following steps:
45+
46+
1. Generates property references using `genPropertiesReference.py`
47+
2. Builds Doxygen documentation from the header files
48+
3. Uses Breathe to collect Doxygen API docs
49+
4. Builds the final HTML documentation with Sphinx
50+
51+
After building, you can view the documentation at:
52+
`file:///path/to/your/ofx/openfx/Documentation/build/index.html`
53+
54+
If you want to run the steps manually, you can follow the steps in `build.sh`.
55+
56+
## Documentation Writing Guide
57+
58+
### Doxygen Documentation
59+
60+
Doxygen is used to document C/C++ code in the source and headers. The main Doxygen configuration is in `include/ofx.doxy`.
61+
62+
#### Key Doxygen Features Used in OpenFX
63+
64+
* **Groups** - Organize related items together
65+
```c
66+
/** \defgroup PropertiesAll Property Suite */
67+
/** \ingroup PropertiesAll */
68+
/** \addtogroup PropertiesAll @{ ... @} */
69+
```
70+
71+
* **Documentation Comments** - Document functions, structs, defines, etc.
72+
```c
73+
/**
74+
* \brief Brief description
75+
*
76+
* Detailed description that can span
77+
* multiple lines
78+
*
79+
* \param paramName Description of parameter
80+
* \return Description of return value
81+
*/
82+
```
83+
84+
* **Cross-references** - Link to other documentation elements
85+
```c
86+
/** See \ref kOfxImageEffectPropSupportedPixelDepths */
87+
```
88+
89+
### ReStructured Text (RST) Documentation
90+
91+
RST files are used for the prose documentation in the `/Documentation/sources` directory.
92+
93+
#### Key RST Features Used in OpenFX
94+
95+
* **Section Headers** - Create hierarchy with underlines
96+
```rst
97+
Section Title
98+
============
99+
100+
Subsection Title
101+
---------------
102+
```
103+
104+
* **Internal Links** - Create references between sections
105+
```rst
106+
.. _target-name:
107+
108+
Section Title
109+
============
110+
111+
See :ref:`target-name` for more information.
112+
```
113+
114+
* **Code Blocks** - Display code examples
115+
```rst
116+
.. code-block:: c
117+
118+
#define kOfxImageEffectPluginRenderThreadSafety "OfxImageEffectPluginRenderThreadSafety"
119+
```
120+
121+
* **Including Files** - Embed external file content
122+
```rst
123+
.. literalinclude:: ../examples/basic.cpp
124+
:language: cpp
125+
:lines: 10-20
126+
```
127+
128+
* **Doxygen Integration** - Include Doxygen-documented items
129+
```rst
130+
.. doxygendefine:: kOfxImageEffectPropSupportsMultiResolution
131+
132+
.. doxygenfunction:: OfxGetPropertySet
133+
134+
.. doxygenstruct:: OfxRectD
135+
:members:
136+
```
137+
138+
* **Cross-domain References** - Link to C/C++ elements
139+
```rst
140+
:c:macro:`kOfxImageEffectPropSupportsOverlays`
141+
:cpp:class:`OfxImageEffectStruct`
142+
:c:struct:`OfxRectD`
143+
:c:func:`OfxGetPropertySet`
144+
```
145+
146+
### Breathe Integration
147+
148+
The Breathe extension bridges Doxygen and Sphinx, enabling:
149+
150+
* Automatic generation of API documentation pages
151+
* Full cross-referencing between RST and Doxygen content
152+
* Consistent styling across all documentation
153+
154+
## Documentation Maintenance Tips
155+
156+
1. **Common Issues**
157+
- Missing cross-references - Check spelling of target names
158+
- Doxygen parse errors - Check comment formatting
159+
- Breathe integration issues - Check Doxygen XML output
160+
161+
2. **Adding New Documentation**
162+
- For new API elements: Add Doxygen comments to header files
163+
- For new concepts/guides: Create new RST files in `sources/Guide`
164+
- For property references: They're automatically generated from headers
165+
166+
3. **Property Documentation**
167+
- Property definitions are extracted automatically by `genPropertiesReference.py`
168+
- Format should be: `#define kOfxPropName "OfxPropName"`
169+
- Add Doxygen comments above property definitions
170+
171+
4. **Testing Changes**
172+
- Always build documentation locally before submitting changes
173+
- Check for warning messages during the build process
174+
- Review the HTML output to ensure proper formatting and cross-references

Documentation/sources/Guide/ofxExample5_Circle.rst

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -360,11 +360,12 @@ where we set the **gHostSupportsMultiRes** global variable.
360360
Get Region Of Definition Action
361361
===============================
362362

363-
What is this region of definition action? Easy, an effect and a clip
364-
have a region of definition (RoD). This is the maximum rectangle for
365-
which an effect or clip can produce pixels. You can ask for RoD of a
366-
clip via the :cpp:func:`OfxImageEffectSuiteV1::clipGetRegionOfDefinition` function in the image
367-
effect suite. The RoD is currently defined in canonical coordinates [4]_.
363+
An effect and a clip each have a region of definition (RoD). This is
364+
the maximum rectangle for which an effect or clip can produce pixels.
365+
You can ask for the RoD of a clip via the
366+
:cpp:func:`OfxImageEffectSuiteV1::clipGetRegionOfDefinition` function
367+
in the image effect suite. The RoD is defined in canonical coordinates
368+
[4]_.
368369

369370
Note that the RoD is independent of the **bounds** of a image, an
370371
image’s bounds may be less than, more than or equal to the RoD. It is up
@@ -378,9 +379,9 @@ drawing. Whether we do that or not is controlled by the "growRoD"
378379
parameter which is conditionally defined in the describe in context
379380
action.
380381

381-
To set the output rod, we need to trap the
382-
:c:macro:`kOfxImageEffectActionGetRegionOfDefinition` action. Our MainEntry
383-
function now has an extra conditional in there….
382+
To set the plugin's output RoD, the plugin must to handle the
383+
:c:macro:`kOfxImageEffectActionGetRegionOfDefinition` action. The
384+
MainEntry function now has an extra conditional in there….
384385

385386
`circle.cpp <https://github.com/AcademySoftwareFoundation/openfx/blob/doc/Documentation/sources/Guide/Code/Example5/circle.cpp#L978>`__
386387

0 commit comments

Comments
 (0)