Skip to content

Commit 93f5e36

Browse files
Documentation fixes (#914)
1 parent 458db39 commit 93f5e36

File tree

9 files changed

+62
-60
lines changed

9 files changed

+62
-60
lines changed

docs/cxx/cxx.rst

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ already defines properties ``name`` and ``metadata``: ::
5454
class Marker : public SerializableObjectWithMetadata {
5555
public:
5656
struct Schema {
57-
static auto constexpr name = "Marker";
57+
static std::string constexpr name = "Marker";
5858
static int constexpr version = 1;
5959
};
6060

@@ -72,7 +72,7 @@ already defines properties ``name`` and ``metadata``: ::
7272
void set_color(std::string const& color);
7373

7474
protected:
75-
virtual ~Marker;
75+
virtual ~Marker();
7676

7777
virtual bool read_from(Reader&);
7878
virtual void write_to(Writer&) const;
@@ -93,7 +93,7 @@ binding code will allow users to define their own schemas in Python exactly as
9393
they do today, with no changes required.
9494

9595
The ``Schema`` structure exists so that this type can be added to the OTIO type
96-
registry with a simple call ::
96+
registry with a simple call: ::
9797
9898
TypeRegistry::instance()::register_type<Marker>();
9999

@@ -127,16 +127,16 @@ When an error is encountered in reading, ``read_from`` should set the error
127127
on the ``Reader`` instance and return ``false``: ::
128128

129129
bool Marker::read_from(Reader& reader) {
130-
if (!reader.read(“color”, &_color)) {
131-
return false;
132-
}
133-
if (_color == “invalid_value”) {
134-
reader.error( ErrorStatus(ErrorStatus::JSON_PARSE_ERROR,
135-
“invalid_value not allowed for color”));
136-
return false;
130+
if (!reader.read(“color”, &_color)) {
131+
return false;
132+
}
133+
if (_color == “invalid_value”) {
134+
reader.error( ErrorStatus(ErrorStatus::JSON_PARSE_ERROR,
135+
“invalid_value not allowed for color”));
136+
return false;
137137
}
138-
return reader.read(“marked_range”, &_marked_range) &&
139-
Parent::read_from(reader);
138+
return reader.read(“marked_range”, &_marked_range) &&
139+
Parent::read_from(reader);
140140
}
141141

142142
This is a contrived example but it describes the basic mechanics. Adjust the
@@ -154,7 +154,7 @@ details above as appropriate for your case.
154154

155155
.. Note::
156156
Also note that the order of properties within a JSON file for data
157-
that is essentially an ``std::map<>`` (see ``AnyDictionary`` below)
157+
that is essentially a ``std::map<>`` (see ``AnyDictionary`` below)
158158
is always alphebetical by key. This ensures deterministic JSON file
159159
writing which is important for comparison and testing.
160160

@@ -228,7 +228,7 @@ will be as simple as always, from an untyped language like Python, while in
228228
C++/Swift, the typical and necessary querying and casting would need to be
229229
written.
230230

231-
As we saw above, declaring and and handling read/writing for "atomic" property
231+
As we saw above, declaring and handling reading/writing for "atomic" property
232232
types (e.g. ``std::string``, ``TimeRange``) is straightforward and requires
233233
little effort. Additionally, reading/writing support is automatically provided
234234
for the (recursively defined) types ``std::vector<P>``, ``std::list<P>`` and
@@ -254,15 +254,15 @@ automatically: ::
254254
};
255255

256256
In this case, the derived schema could choose to store extra media references.
257-
The reading/writing code would simply call ::
257+
The reading/writing code would simply call: ::
258258

259259
reader.read("extra_references", &_extra_references)
260260

261-
and ::
261+
To read the property, and: ::
262262

263263
writer.write("extra_references", _extra_references)
264264

265-
to read/write the property.
265+
To write the property.
266266

267267
.. Note::
268268
The comment "don't actually do this" will be explained in the next section;
@@ -300,7 +300,7 @@ speaking, even need to be a DAG: ::
300300
clip1->metadata()["other_clip"] = clip2;
301301
clip2->metadata()["other_clip"] = clip1;
302302

303-
will work just fine: writing/reading or simply cloning ``clip1`` would yield a
303+
This will work just fine: writing/reading or simply cloning ``clip1`` would yield a
304304
new ``clip1`` that pointed to a new ``clip2`` and vice versa.
305305

306306
.. Note::
@@ -335,16 +335,16 @@ route, coupled with the ``pybind`` binding system (or even with the older
335335
experience in Python. (And we would expect similar difficulties in Swift.)
336336

337337
Consider the following requirements from the perspective of an OTIO user in a
338-
Python framework. In Python, a user types ::
338+
Python framework. In Python, a user types: ::
339339

340340
clip = otio.schema.Clip()
341341

342342
Behind the scenes, in C++, an actual ``Clip`` instance has been created. From
343-
the user's perspective, they "own" this clip, and if they immediately type ::
343+
the user's perspective, they "own" this clip, and if they immediately type: ::
344344

345345
del clip
346346

347-
then they would expect the Python clip object to be destroyed (and the actual
347+
Then they would expect the Python clip object to be destroyed (and the actual
348348
C++ ``Clip`` instance to be deleted). Anything less than this is a memory
349349
leak.
350350

@@ -369,12 +369,12 @@ in Swift.) Ensuring a system that does not leak memory, and that also keeps
369369
both objects alive as long as either side (C++ or the bridged language) is,
370370
simply put, challenging.
371371

372-
With all that as a preamble, here is our proposed solution for C++.
372+
With all that as a preamble, here is our proposed solution for C++:
373373

374374
- A new instance of a schema object is created by a call to ``new``. - All
375375
schema objects have protected destructors. Given a raw pointer to a schema
376376
object, client code may not directly invoke the ``delete`` operator, but may
377-
write ::
377+
write: ::
378378

379379
Clip* c = new Clip();
380380
...
@@ -485,7 +485,7 @@ To illustrate the above point in a less contrived fashion, consider this incorre
485485
c->remove_child(index);
486486

487487
#if DEBUG
488-
std::cout << "Debug: removed item named" << item->name();
488+
std::cout << "Debug: removed item named " << item->name();
489489
#endif
490490
}
491491

@@ -499,7 +499,7 @@ A correct version of this code would be: ::
499499
c->remove_child(index);
500500

501501
#if DEBUG
502-
std::cout << "Debug: removed item named" << item.value->name();
502+
std::cout << "Debug: removed item named " << item.value->name();
503503
#endif
504504
}
505505

@@ -513,7 +513,7 @@ A correct version of this code would be: ::
513513
auto& children = c->children();
514514
for (size_t i = 0; i < children.size(); ++i) {
515515
if (children[i].value->name() == name) {
516-
SerializableObject::Retainer<Item> r_item(kids[i]);
516+
SerializableObject::Retainer<Item> r_item(children[i]);
517517
c->remove_child(i);
518518
return r_item.take_value();
519519
}
@@ -681,7 +681,7 @@ What makes this complicated is the following set of rules/constraints:
681681
is passed to C++ in some way, then X will exist only as long as P does.
682682

683683
How can we satisfy all these contraints, while ensuring we don't create retain
684-
cycles (which might be fixable with Python garbage collection, but might also
684+
cycles (which might be fixable with Python garbage collection, but also
685685
might not)? Here is the solution we came up with; if you have an alternate
686686
suggestion, we would be happy to hear it.
687687

@@ -696,7 +696,7 @@ Our scheme works as follows:
696696
``Retainer<>`` object in addition to the one in P, a "keep-alive" reference to P is created
697697
and held by X. This ensures that P won’t be destroyed even if the Python interpreter appears
698698
to lose all references to P, because we've hidden one away. (Remember, the C++ object X could
699-
always be passed back to Python, and we can’t/don’t want to regenerate a new P corresponding to X)
699+
always be passed back to Python, and we can’t/don’t want to regenerate a new P corresponding to X.)
700700

701701
- However, when X's C++ count reference count drops back to one, then we know that P is now
702702
the only reason we are keeping X alive. At this point, the keep-alive reference to P is destroyed.
@@ -707,10 +707,10 @@ Our scheme works as follows:
707707
The tricky part here is the interaction of watching the reference count of C++
708708
objects oscillate from 1 to greater than one, and vice versa. (There is no way
709709
of watching the Python reference count change, and even if we could, the
710-
performance constraints this would be entail would be likely untenable).
710+
performance constraints this would be entail would be likely untenable.)
711711

712712
Essentially, we are monitoring changes in whether or not there is a single
713-
unique ``Retainer<>`` instance pointing to a given C++ objects, or multiple
713+
unique ``Retainer<>`` instance pointing to a given C++ object, or multiple
714714
such retainers. We’ve verified with some extremely processor intensive
715715
multi-threading/multi-core tests that our coding of the mutation of the C++
716716
reference count, coupled with creating/destroying the Python keep-alive

docs/tutorials/architecture.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ for each_seq in tl.tracks:
5252
print each_item.media_reference
5353
```
5454

55-
or, in the case of any nested composition, like this:
55+
Or, in the case of a nested composition, like this:
5656

5757
```python
5858
import opentimelineio as otio
@@ -72,7 +72,7 @@ A clip may set its timing information (which is used to compute its `duration()`
7272
- `source_range`
7373
The range of media that is cut into the sequence, in the space of the available range (if it is set). In other words, it further truncates the available_range.
7474

75-
A clip must have at least one set or else its duration is not computable.
75+
A clip must have at least one set or else its duration is not computable:
7676

7777
```python
7878
cl.duration()

docs/tutorials/contributing.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Now you fetch the latest changes from Pixar's OpenTimelineIO repo like this:
3939

4040
```bash
4141
git fetch upstream
42+
git merge upstream/master
4243
```
4344

4445
All the development should happen against the `master` branch. We recommend you create a new branch for each feature or fix that you'd like to make and give it a descriptive name so that you can remember it later. You can checkout a new branch and create it simultaneously like this:

docs/tutorials/otio-timeline-structure.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ media file contains media that starts at 4 seconds and 4 frames (timecode
4040
In many cases you might not know the available_range because the media is
4141
missing, or points to a file path or URL which might be expensive to query.
4242
If that’s the case, then the available_range of a media_reference will be
43-
None.
43+
`None`.
4444

4545
Above the media references, we see that each `Clip` has a source_range, which
4646
specifies a trimmed segment of media. In cases where we only want a portion
4747
of the available media, the source_range will start at a higher start_time,
4848
and/or have a shorter duration. The colored segments of "Media-001", "Media-002"
4949
and "Media-003" show the portion that each clip’s source_range references.
5050

51-
In the case of "Clip-004", the source_range is None, so it exposes its entire
51+
In the case of "Clip-004", the source_range is `None`, so it exposes its entire
5252
media reference. In the OTIO API, you can query the trimmed_range() of a
5353
clip to get the range of media used regardless of whether it has a
5454
source_range, available_range or both - but it needs at least one of the
@@ -150,7 +150,7 @@ If a source_range is specified, then only a trimmed segment of the inner
150150
available_range of the nested composition is computed and included in
151151
the outer composition.
152152

153-
"Nested Stack" contains two tracks, with some clips, gaps, a track-level
153+
"Nested Stack" contains two tracks, with some clips, gaps, and a track-level
154154
source_range on the lower track. This illustrates how the content of
155155
"Nested Stack" is composed upwards into "Track-001" so that a trimmed portion
156156
of "Clip-005" and "Clip-003" appear in the flattened composition.

docs/tutorials/time-ranges.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ The `source_range` is specified in the Clip time frame.
4040

4141
Note that `source_range` may be `None` indicating that the Clip should use
4242
the full `available_range()` whatever that may be. If both `source_range`
43-
and `available_range()` are None, then the Clip is invalid. You need at
43+
and `available_range()` are `None`, then the Clip is invalid. You need at
4444
least one of those.
4545

4646
Usually this will be a shorter segment than the `available_range()` but this
@@ -82,16 +82,15 @@ code when you are asking for a different duration.
8282

8383
#### `Clip.range_in_parent()`
8484

85-
The answer to this depends on what type of the Clip's parent. In the
85+
The answer to this depends on what type is the Clip's parent. In the
8686
typical case, the Clip is inside a Track, so the `Clip.range_in_parent()`
8787
will give you the range within that Track where this Clip is visible.
8888
Each clip within the Track will have a start time that is directly after
8989
the previous clip's end. So, given a Track with clipA and clipB in it,
9090
this is always true:
9191

92-
The `range_in_parent()` is specified in the parent time frame.
93-
94-
`clipA.range_in_parent().end_time_exclusive() == clipB.range_in_parent().start_time`
92+
- The `range_in_parent()` is specified in the parent time frame.
93+
- `clipA.range_in_parent().end_time_exclusive() == clipB.range_in_parent().start_time`
9594

9695
If the parent is a Stack, then `range_in_parent()` is less interesting. The
9796
start time will always have `.value == 0` and the duration is the Clip's
@@ -103,11 +102,11 @@ Track around.
103102
#### `Clip.trimmed_range_in_parent()`
104103

105104
This is the same as `Clip.range_in_parent()` but trimmed to the *parent*
106-
`source_range`. In most cases the parent has a `source_range` of None, so
105+
`source_range`. In most cases the parent has a `source_range` of `None`, so
107106
there is no trimming, but in cases where the parent is trimmed, you may
108107
want to ask where a Clip is relative to the trimmed parent. In cases where
109108
the Clip is completely trimmed by the parent, the
110-
`Clip.trimmed_range_in_parent()` will be None.
109+
`Clip.trimmed_range_in_parent()` will be `None`.
111110

112111
The `trimmed_range_in_parent()` is specified in the parent time frame.
113112

docs/tutorials/write-a-hookscript.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@
33
OpenTimelineIO Hook Scripts are plugins that run at predefined points during the execution of various OTIO functions, for example after an adapter has read a file into memory but before the media linker has run.
44

55
To write a new hook script, you create a python source file that defines a
6-
a function named ``hook_function`` with signature:
6+
function named ``hook_function`` with signature:
77
``hook_function :: otio.schema.Timeline, Dict => otio.schema.Timeline``
88

99
The first argument is the timeline to process, and the second one is a dictionary of arguments that can be passed to it by the adapter or media linker. Only one hook function can be defined per python file.
1010

1111
For example:
1212
```python
13-
1413
def hook_function(tl, argument_map=None):
1514
for cl in tl.each_clip():
1615
cl.metadata['example_hook_function_was_here'] = True
@@ -47,13 +46,15 @@ To create a new OTIO hook script, you need to create a file myhooks.py. Then add
4746

4847
The ``hook_scripts`` section will register the plugin with the system, and the ``hooks`` section will attach the scripts to hooks.
4948

50-
Then you need to add this manifest to your `$OTIO_PLUGIN_MANIFEST_PATH` environment variable (which is "`:`" separated). You may also define media linkers and adapters via the same manifest.
49+
Then you need to add this manifest to your `$OTIO_PLUGIN_MANIFEST_PATH` environment variable (which is separated with `:` for POSIX or `;` for Windows). You may also define media linkers and adapters via the same manifest.
5150

5251
## Running a Hook Script
5352

54-
If you would like to call a hook script from a plugin, the hooks need not be one of the ones that otio pre-defines. You can have a plugin adapter or media linker, for example, that defines its own hooks and calls your own custom studio specific hook scripts. To run a hook script from your custom code, you can call:
53+
If you would like to call a hook script from a plugin, the hooks need not be one of the ones that OTIO pre-defines. You can have a plugin adapter or media linker, for example, that defines its own hooks and calls your own custom studio specific hook scripts. To run a hook script from your custom code, you can call:
5554

56-
``otio.hooks.run("some_hook", some_timeline, optional_argument_dict)``
55+
```python
56+
otio.hooks.run("some_hook", some_timeline, optional_argument_dict)
57+
```
5758

5859
This will call the ``some_hook`` hook script and pass in ``some_timeline`` and ``optional_argument_dict``.
5960

@@ -76,7 +77,7 @@ print hook_list # ['c','b','a']
7677

7778
Now c will run, then b, then a.
7879

79-
To delete a function the list:
80+
To delete a function in the list:
8081
```python
8182
del hook_list[1]
8283
```
@@ -85,7 +86,7 @@ del hook_list[1]
8586

8687
### Replacing part of a path for drive mapping
8788

88-
An example use-case would be to create a pre-write adapter hook that checks the argument map for style being identified as nucoda and then preforms a path replacement on the reference url
89+
An example use-case would be to create a pre-write adapter hook that checks the argument map for a style being identified as nucoda and then preforms a path replacement on the reference url:
8990

9091
```python
9192
def hook_function(in_timeline,argument_map=None):
@@ -99,7 +100,7 @@ def hook_function(in_timeline,argument_map=None):
99100

100101
### Add an incremental copy of otio file to backup folder
101102

102-
Example of a post adapter write hook that creates a timestamped copy of newly written file in a hidden "incremental" folder
103+
Example of a post adapter write hook that creates a timestamped copy of newly written file in a hidden "incremental" folder:
103104

104105
```python
105106
import os

docs/tutorials/write-a-media-linker.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ To create a new OTIO Adapter, you need to create a file mymedialinker.py. Then a
3030
]
3131
}
3232
33-
Then you need to add this manifest to your `$OTIO_PLUGIN_MANIFEST_PATH` environment variable (which is "`:`" separated).
33+
Then you need to add this manifest to your `$OTIO_PLUGIN_MANIFEST_PATH` environment variable (which is separated with `:` for POSIX or `;` for Windows).
3434

3535
Finally, to specify this linker as the default media linker, set `OTIO_DEFAULT_MEDIA_LINKER` to the name of the media linker:
3636

docs/tutorials/write-a-schemadef.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ but your schema class could have any number of parameters as needed to
6060
contain the data fields you want to have in your class.
6161

6262
One or more class definitions like this one can be included in a plugin
63-
source file, which must then be added to the plugin manifest as shown below:
63+
source file, which must then be added to the plugin manifest as shown below.
6464

6565

6666
## Registering Your SchemaDef Plugin
@@ -85,7 +85,8 @@ Then you must add it to a plugin manifest:
8585

8686
The same plugin manifest may also include adapters and media linkers, if desired.
8787

88-
Then you need to add this manifest to your `$OTIO_PLUGIN_MANIFEST_PATH` environment variable (which is "`:`" separated).
88+
Then you need to add this manifest to your `$OTIO_PLUGIN_MANIFEST_PATH` environment
89+
variable (which is separated with `:` for POSIX or `;` for Windows).
8990

9091
## Using the New Schema in Your Code
9192

0 commit comments

Comments
 (0)