Skip to content

Commit 95b4231

Browse files
committed
Refactoring
1 parent 8958c49 commit 95b4231

17 files changed

+811
-35
lines changed

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ set(TOUCAN_PLUGINS
3131
toucan-draw
3232
toucan-filter
3333
toucan-generator
34-
toucan-transform)
34+
toucan-transform
35+
toucan-transition)
3536

3637
enable_testing()
3738

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Features
1818
* Drawing: Box, Line, Text
1919
* Filters: Blur, Color Map, Invert, Power, Saturate, Unsharp Mask
2020
* Transforms: Flip, Flop, Resize, Rotate
21-
* Transitions: Dissolve
21+
* Transitions: Dissolve, Horizontal Wipe, Vertical Wipe
2222
* Compositing: Over
2323

2424
Example Renders
@@ -49,18 +49,22 @@ Drawing; line, box, and text:
4949

5050
![Render](images/Draw.png)
5151

52-
Transition:
52+
Dissolve transition:
5353

5454
![Transition](images/Transition.png)
5555

5656
![Transition Graph](images/TransitionGraph.svg)
5757

58-
Transition with an invert effect on the clips:
58+
Dissolve transition with an invert effect on the clips:
5959

6060
![Transition 2](images/Transition2.png)
6161

6262
![Transition 2 Graph](images/Transition2Graph.svg)
6363

64+
Wipe transitions:
65+
66+
![Transition Wipe](images/TransitionWipe.png)
67+
6468
Transforms; resize, rotate, flip, and flop:
6569

6670
![Transforms](images/Transform.png)

data/TransitionWipe.otio

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
{
2+
"OTIO_SCHEMA": "Timeline.1",
3+
"metadata": {},
4+
"name": "Transition",
5+
"tracks": {
6+
"OTIO_SCHEMA": "Stack.1",
7+
"children": [
8+
{
9+
"OTIO_SCHEMA": "Track.1",
10+
"children": [
11+
{
12+
"OTIO_SCHEMA": "Clip.1",
13+
"media_reference": {
14+
"OTIO_SCHEMA": "GeneratorReference.1",
15+
"available_range": {
16+
"OTIO_SCHEMA": "TimeRange.1",
17+
"duration": {
18+
"OTIO_SCHEMA": "RationalTime.1",
19+
"rate": 24,
20+
"value": 5
21+
},
22+
"start_time": {
23+
"OTIO_SCHEMA": "RationalTime.1",
24+
"rate": 24,
25+
"value": 0
26+
}
27+
},
28+
"generator_kind": "Fill",
29+
"parameters": {
30+
"size": [ 1280, 720 ],
31+
"color": [ 1.0, 0.0, 0.0, 1.0 ]
32+
}
33+
},
34+
"source_range": {
35+
"OTIO_SCHEMA": "TimeRange.1",
36+
"duration": {
37+
"OTIO_SCHEMA": "RationalTime.1",
38+
"rate": 24,
39+
"value": 3
40+
},
41+
"start_time": {
42+
"OTIO_SCHEMA": "RationalTime.1",
43+
"rate": 24,
44+
"value": 0
45+
}
46+
},
47+
"name": "Counter"
48+
},
49+
{
50+
"OTIO_SCHEMA": "Transition.1",
51+
"name": "Dissolve",
52+
"transition_type": "HorizontalWipe",
53+
"in_offset": {
54+
"OTIO_SCHEMA": "RationalTime.1",
55+
"rate": 24,
56+
"value": 2
57+
},
58+
"out_offset": {
59+
"OTIO_SCHEMA": "RationalTime.1",
60+
"rate": 24,
61+
"value": 2
62+
}
63+
},
64+
{
65+
"OTIO_SCHEMA": "Clip.1",
66+
"media_reference": {
67+
"OTIO_SCHEMA": "GeneratorReference.1",
68+
"available_range": {
69+
"OTIO_SCHEMA": "TimeRange.1",
70+
"duration": {
71+
"OTIO_SCHEMA": "RationalTime.1",
72+
"rate": 24,
73+
"value": 9
74+
},
75+
"start_time": {
76+
"OTIO_SCHEMA": "RationalTime.1",
77+
"rate": 24,
78+
"value": 0
79+
}
80+
},
81+
"generator_kind": "Fill",
82+
"parameters": {
83+
"size": [ 1280, 720 ],
84+
"color": [ 0.0, 1.0, 0.0, 1.0 ]
85+
}
86+
},
87+
"source_range": {
88+
"OTIO_SCHEMA": "TimeRange.1",
89+
"duration": {
90+
"OTIO_SCHEMA": "RationalTime.1",
91+
"rate": 24,
92+
"value": 5
93+
},
94+
"start_time": {
95+
"OTIO_SCHEMA": "RationalTime.1",
96+
"rate": 24,
97+
"value": 0
98+
}
99+
},
100+
"name": "Color"
101+
},
102+
{
103+
"OTIO_SCHEMA": "Transition.1",
104+
"name": "Dissolve",
105+
"transition_type": "VerticalWipe",
106+
"in_offset": {
107+
"OTIO_SCHEMA": "RationalTime.1",
108+
"rate": 24,
109+
"value": 2
110+
},
111+
"out_offset": {
112+
"OTIO_SCHEMA": "RationalTime.1",
113+
"rate": 24,
114+
"value": 2
115+
}
116+
},
117+
{
118+
"OTIO_SCHEMA": "Clip.1",
119+
"media_reference": {
120+
"OTIO_SCHEMA": "GeneratorReference.1",
121+
"available_range": {
122+
"OTIO_SCHEMA": "TimeRange.1",
123+
"duration": {
124+
"OTIO_SCHEMA": "RationalTime.1",
125+
"rate": 24,
126+
"value": 5
127+
},
128+
"start_time": {
129+
"OTIO_SCHEMA": "RationalTime.1",
130+
"rate": 24,
131+
"value": 0
132+
}
133+
},
134+
"generator_kind": "Fill",
135+
"parameters": {
136+
"size": [ 1280, 720 ],
137+
"color": [ 0.0, 0.0, 1.0, 1.0 ]
138+
}
139+
},
140+
"source_range": {
141+
"OTIO_SCHEMA": "TimeRange.1",
142+
"duration": {
143+
"OTIO_SCHEMA": "RationalTime.1",
144+
"rate": 24,
145+
"value": 3
146+
},
147+
"start_time": {
148+
"OTIO_SCHEMA": "RationalTime.1",
149+
"rate": 24,
150+
"value": 0
151+
}
152+
},
153+
"name": "Color"
154+
}
155+
],
156+
"kind": "Video",
157+
"name": "Video"
158+
}
159+
],
160+
"name": "Stack"
161+
}
162+
}

images/TransitionWipe.png

923 Bytes
Loading

lib/toucan/Draw.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ namespace toucan
8181
public:
8282
LineNode(
8383
const LineData & = LineData(),
84-
const std::vector<std::shared_ptr<IImageNode> > & = {});
84+
const std::vector<std::shared_ptr<IImageNode> >& = {});
8585

8686
virtual ~LineNode();
8787

@@ -140,7 +140,7 @@ namespace toucan
140140
public:
141141
TextNode(
142142
const TextData & = TextData(),
143-
const std::vector<std::shared_ptr<IImageNode> > & = {});
143+
const std::vector<std::shared_ptr<IImageNode> >& = {});
144144

145145
virtual ~TextNode();
146146

lib/toucan/Filter.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ namespace toucan
7575
public:
7676
ColorMapNode(
7777
const ColorMapData & = ColorMapData(),
78-
const std::vector<std::shared_ptr<IImageNode> > & = {});
78+
const std::vector<std::shared_ptr<IImageNode> >& = {});
7979

8080
virtual ~ColorMapNode();
8181

@@ -122,7 +122,7 @@ namespace toucan
122122
class InvertNode : public IImageNode
123123
{
124124
public:
125-
InvertNode(const std::vector<std::shared_ptr<IImageNode> > & = {});
125+
InvertNode(const std::vector<std::shared_ptr<IImageNode> >& = {});
126126

127127
virtual ~InvertNode();
128128

@@ -165,7 +165,7 @@ namespace toucan
165165
public:
166166
PowNode(
167167
const PowData & = PowData(),
168-
const std::vector<std::shared_ptr<IImageNode> > & = {});
168+
const std::vector<std::shared_ptr<IImageNode> >& = {});
169169

170170
virtual ~PowNode();
171171

@@ -220,7 +220,7 @@ namespace toucan
220220
public:
221221
SaturateNode(
222222
const SaturateData & = SaturateData(),
223-
const std::vector<std::shared_ptr<IImageNode> > & = {});
223+
const std::vector<std::shared_ptr<IImageNode> >& = {});
224224

225225
virtual ~SaturateNode();
226226

@@ -278,7 +278,7 @@ namespace toucan
278278
public:
279279
UnsharpMaskNode(
280280
const UnsharpMaskData & = UnsharpMaskData(),
281-
const std::vector<std::shared_ptr<IImageNode> > & = {});
281+
const std::vector<std::shared_ptr<IImageNode> >& = {});
282282

283283
virtual ~UnsharpMaskNode();
284284

lib/toucan/Generator.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace toucan
2323
public:
2424
CheckersNode(
2525
const CheckersData & = CheckersData(),
26-
const std::vector<std::shared_ptr<IImageNode> > & = {});
26+
const std::vector<std::shared_ptr<IImageNode> >& = {});
2727

2828
virtual ~CheckersNode();
2929

@@ -83,7 +83,7 @@ namespace toucan
8383
public:
8484
NoiseNode(
8585
const NoiseData & = NoiseData(),
86-
const std::vector<std::shared_ptr<IImageNode> > & = {});
86+
const std::vector<std::shared_ptr<IImageNode> >& = {});
8787

8888
virtual ~NoiseNode();
8989

lib/toucan/ImageEffectHost.cpp

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,51 @@ namespace toucan
122122
}
123123
}
124124

125+
void ImageEffectHost::transition(
126+
const std::string& name,
127+
const OIIO::ImageBuf& sourceFrom,
128+
const OIIO::ImageBuf& sourceTo,
129+
OIIO::ImageBuf& output,
130+
const PropertySet& propSet)
131+
{
132+
for (auto& data : _pluginData)
133+
{
134+
if (name == data.ofxPlugin->pluginIdentifier)
135+
{
136+
OfxStatus ofxStatus = data.ofxPlugin->mainEntry(
137+
kOfxActionCreateInstance,
138+
&data,
139+
nullptr,
140+
nullptr);
141+
142+
data.images["SourceFrom"] = bufToPropSet(sourceFrom);
143+
data.images["SourceTo"] = bufToPropSet(sourceTo);
144+
data.images["Output"] = bufToPropSet(output);
145+
PropertySet args = propSet;
146+
args.setDouble(kOfxPropTime, 0, 0.0);
147+
const auto& spec = sourceFrom.spec();
148+
OfxRectI bounds;
149+
bounds.x1 = 0;
150+
bounds.x2 = spec.width;
151+
bounds.y1 = 0;
152+
bounds.y2 = spec.height;
153+
args.setIntN(kOfxImageEffectPropRenderWindow, 4, &bounds.x1);
154+
ofxStatus = data.ofxPlugin->mainEntry(
155+
kOfxImageEffectActionRender,
156+
&data,
157+
(OfxPropertySetHandle)&args,
158+
nullptr);
159+
160+
ofxStatus = data.ofxPlugin->mainEntry(
161+
kOfxActionDestroyInstance,
162+
&data,
163+
nullptr,
164+
nullptr);
165+
break;
166+
}
167+
}
168+
}
169+
125170
void ImageEffectHost::_suiteInit()
126171
{
127172
_propertySuite.propSetPointer = &PropertySet::setPointer;

lib/toucan/ImageEffectHost.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,20 @@ namespace toucan
3535
void generator(
3636
const std::string& name,
3737
OIIO::ImageBuf&,
38-
const PropertySet & = PropertySet());
38+
const PropertySet& = PropertySet());
3939

4040
void filter(
4141
const std::string& name,
4242
const OIIO::ImageBuf&,
4343
OIIO::ImageBuf&,
44-
const PropertySet & = PropertySet());
44+
const PropertySet& = PropertySet());
45+
46+
void transition(
47+
const std::string& name,
48+
const OIIO::ImageBuf&,
49+
const OIIO::ImageBuf&,
50+
OIIO::ImageBuf&,
51+
const PropertySet& = PropertySet());
4552

4653
private:
4754
void _suiteInit();

0 commit comments

Comments
 (0)