Skip to content

Commit 220d18b

Browse files
Merge branch 'main' into ms2-block-annotation-button
2 parents 26a36e3 + 912df13 commit 220d18b

File tree

4 files changed

+136
-109
lines changed

4 files changed

+136
-109
lines changed

cmake/dependencies/python3.cmake

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,12 @@ SET(RV_DEPS_PYTHON_VERSION_SHORT
3333
"${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}"
3434
)
3535

36+
# This version is used for:
37+
# 1. Building OpenTimelineIO from source for Windows debug builds
38+
# 2. Generating src/build/requirements.txt from requirements.txt.in template
39+
# (used by all other platforms/builds to install from PyPI)
3640
SET(_opentimelineio_version
37-
"0.16.0"
41+
"0.18.1"
3842
)
3943

4044
RV_VFX_SET_VARIABLE(_pyside_version CY2023 "5.15.10" CY2024 "6.5.3")
@@ -249,8 +253,18 @@ ELSE() # Not WINDOWS
249253
)
250254
ENDIF()
251255

252-
SET(_requirements_file
253-
"${PROJECT_SOURCE_DIR}/src/build/requirements.txt"
256+
# Generate requirements.txt from template with the OpenTimelineIO version substituted
257+
SET(_requirements_input_file
258+
"${PROJECT_SOURCE_DIR}/src/build/requirements.txt.in"
259+
)
260+
SET(_requirements_output_file
261+
"${CMAKE_BINARY_DIR}/requirements.txt"
262+
)
263+
264+
CONFIGURE_FILE(
265+
${_requirements_input_file}
266+
${_requirements_output_file}
267+
@ONLY
254268
)
255269

256270
IF(RV_TARGET_WINDOWS)
@@ -269,18 +283,18 @@ IF(RV_TARGET_WINDOWS)
269283
${CMAKE_COMMAND} -E env
270284
"OTIO_CXX_DEBUG_BUILD=1"
271285
"CMAKE_ARGS=-DPYTHON_LIBRARY=${_python3_implib} -DPYTHON_INCLUDE_DIR=${_include_dir} -DPYTHON_EXECUTABLE=${_python3_executable}"
272-
"${_python3_executable}" -m pip install --upgrade -r "${_requirements_file}"
286+
"${_python3_executable}" -m pip install --upgrade -r "${_requirements_output_file}"
273287
)
274288
ELSE()
275289
SET(_requirements_install_command
276290
${CMAKE_COMMAND} -E env
277291
"CMAKE_ARGS=-DPYTHON_LIBRARY=${_python3_implib} -DPYTHON_INCLUDE_DIR=${_include_dir} -DPYTHON_EXECUTABLE=${_python3_executable}"
278-
"${_python3_executable}" -m pip install --upgrade -r "${_requirements_file}"
292+
"${_python3_executable}" -m pip install --upgrade -r "${_requirements_output_file}"
279293
)
280294
ENDIF()
281295
ELSE()
282296
SET(_requirements_install_command
283-
"${_python3_executable}" -m pip install --upgrade -r "${_requirements_file}"
297+
"${_python3_executable}" -m pip install --upgrade -r "${_requirements_output_file}"
284298
)
285299
ENDIF()
286300

@@ -359,11 +373,11 @@ SET(${_python3_target}-requirements-flag
359373
)
360374

361375
ADD_CUSTOM_COMMAND(
362-
COMMENT "Installing requirements from ${_requirements_file}"
376+
COMMENT "Installing requirements from ${_requirements_output_file}"
363377
OUTPUT ${${_python3_target}-requirements-flag}
364378
COMMAND ${_requirements_install_command}
365379
COMMAND cmake -E touch ${${_python3_target}-requirements-flag}
366-
DEPENDS ${_python3_target} ${_requirements_file}
380+
DEPENDS ${_python3_target} ${_requirements_output_file} ${_requirements_input_file}
367381
)
368382

369383
IF(RV_TARGET_WINDOWS
@@ -375,7 +389,7 @@ IF(RV_TARGET_WINDOWS
375389
POST_BUILD
376390
COMMENT "Copying Debug Python lib as a unversionned file for Debug"
377391
COMMAND cmake -E copy_if_different ${_python3_implib} ${_python_release_libpath}
378-
COMMAND cmake -E copy_if_different ${_python3_implib} ${_python_release_in_bin_libpath} DEPENDS ${_python3_target} ${_requirements_file}
392+
COMMAND cmake -E copy_if_different ${_python3_implib} ${_python_release_in_bin_libpath} DEPENDS ${_python3_target} ${_requirements_output_file} ${_requirements_input_file}
379393
)
380394
ENDIF()
381395

src/build/requirements.txt renamed to src/build/requirements.txt.in

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# This file contains all the packages that will be packaged with RV. Please add the license next to the package.
2+
# NOTE: This is a CMake template file. The actual requirements.txt is generated during CMake configuration.
3+
# To update OpenTimelineIO version, edit _opentimelineio_version in cmake/dependencies/python3.cmake
24

35
pip # License: MIT License (MIT)
46
setuptools # License: MIT License
5-
# We need to use the main branch of the OTIO Github repo since the latest release available as a Pypi package is missing some features we need for Live Review
6-
# Using the latest from main branch.
7-
git+https://github.com/AcademySoftwareFoundation/OpenTimelineIO@main#egg=OpenTimelineIO # License: Other/Proprietary License (Modified Apache 2.0 License)
7+
OpenTimelineIO==@_opentimelineio_version@ # License: Other/Proprietary License (Modified Apache 2.0 License)
88
PyOpenGL # License: BSD License (BSD)
99

1010
# MacOS only - PyOpenGL_accelerate is built from source in python3.cmake as a workaround until the fix
@@ -24,3 +24,4 @@ packaging # License: Apache Software License, BSD License
2424
requests # License: Apache Software License (Apache 2.0)
2525
cryptography # License: Apache Software License, BSD License ((Apache-2.0 OR BSD-3-Clause) AND PSF-2.0)
2626
pydantic # License: MIT License (MIT)
27+

src/lib/ip/IPBaseNodes/SequenceIPNode.cpp

Lines changed: 66 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ namespace IPCore
199199
// Finally if our asssumption was too low then we use the first index.
200200
//
201201

202-
else if (index < 0)
202+
if (index < 0)
203203
{
204204
index = 0;
205205
}
@@ -215,7 +215,7 @@ namespace IPCore
215215
if (index >= m_edlSource->size() - 1 || index >= m_edlSourceIn->size() - 1 || index >= m_edlSourceOut->size() - 1
216216
|| index >= m_edlGlobalIn->size() - 1 || index < 0)
217217
{
218-
TWK_THROW_STREAM(SequenceOutOfBoundsExc, "Out-of-bounds EDL data");
218+
return -1;
219219
}
220220
}
221221

@@ -241,6 +241,8 @@ namespace IPCore
241241
const int globalOffset = m_edlGlobalIn->front();
242242
int seekFrame = int(samplesToTime(seekSample, sampleRate) * fps + 0.49);
243243
int index = indexAtFrame(seekFrame + globalOffset);
244+
if (index < 0)
245+
return -1;
244246

245247
int inputFrame = (*m_edlGlobalIn)[index];
246248
SampleTime inputStart = frameToSample(inputFrame - globalOffset, fps, sampleRate);
@@ -267,30 +269,50 @@ namespace IPCore
267269
{
268270
const IPNodes& ins = inputs();
269271

270-
if (ins.size() > 0)
272+
if (!ins.size()
273+
|| m_edlSource->size() < 1
274+
|| m_edlSourceIn->size() < 1
275+
|| m_edlSourceOut->size() < 1
276+
|| m_edlGlobalIn->size() < 1)
271277
{
272-
const int index = (forceIndex == -1) ? indexAtFrame(frame) : forceIndex;
278+
return EvalPoint(-1, 0, -1);
279+
}
273280

274-
const int source = (*m_edlSource)[index];
275-
const int in = (*m_edlSourceIn)[index];
276-
const int out = (*m_edlSourceOut)[index];
277-
const int iframe = (*m_edlGlobalIn)[index];
281+
const int index =
282+
(forceIndex == -1) ? indexAtFrame(frame) : forceIndex;
278283

279-
const int f0 = (frame - iframe) + in;
284+
if (index >= (m_edlSource->size() - 1)
285+
|| index >= (m_edlSourceIn->size() - 1)
286+
|| index >= (m_edlSourceOut->size() - 1)
287+
|| index >= (m_edlGlobalIn->size() - 1)
288+
|| index < 0 )
289+
{
290+
return EvalPoint(-1, 0, -1);
291+
}
280292

281-
if (forceIndex == -1)
282-
{
283-
const int f1 = min(f0, out);
284-
const int f = max(f1, in);
293+
const int source = (*m_edlSource)[index];
285294

286-
return EvalPoint(source, f, index);
287-
}
288-
else
289-
return EvalPoint(source, f0, index);
295+
if (source < 0 || source > ins.size())
296+
{
297+
return EvalPoint(-1, 0, -1);
298+
}
299+
300+
const int in = (*m_edlSourceIn)[index];
301+
const int out = (*m_edlSourceOut)[index];
302+
const int iframe = (*m_edlGlobalIn)[index];
303+
304+
const int f0 = (frame - iframe) + in;
305+
306+
if (forceIndex == -1)
307+
{
308+
const int f1 = min(f0, out);
309+
const int f = max(f1, in);
310+
311+
return EvalPoint(source, f, index);
290312
}
291313
else
292314
{
293-
return EvalPoint(-1, 0, -1);
315+
return EvalPoint(source, f0, index);
294316
}
295317
}
296318

@@ -319,8 +341,10 @@ namespace IPCore
319341

320342
if (source < 0 || source >= ins.size())
321343
{
322-
TWK_THROW_STREAM(SequenceOutOfBoundsExc,
323-
"Bad Sequence EDL source number " << source << " is not in range [0," << ins.size() - 1 << "]");
344+
stringstream msg;
345+
msg << "Bad Sequence EDL source number " << source << " is not in range [0," << ins.size() - 1 << "]";
346+
347+
return IPImage::newNoImage(this, msg.str());
324348
}
325349

326350
IPImage* root = new IPImage(this, IPImage::BlendRenderType, vw, vh, 1.0);
@@ -762,7 +786,7 @@ namespace IPCore
762786
{
763787
lazyBuildState();
764788

765-
if (inputs().size() >= 1)
789+
if (inputs().size() >= 1 && m_edlGlobalIn->size() >= 1)
766790
{
767791
ImageRangeInfo info;
768792
info.inc = 1;
@@ -782,19 +806,26 @@ namespace IPCore
782806
lazyBuildState();
783807

784808
const bool interactive = interactiveSize(context);
809+
const IPNodes& ins = inputs();
785810
const float vw = interactive ? context.viewWidth : float(m_structInfo.width);
786811
const float vh = interactive ? context.viewHeight : float(m_structInfo.height);
787812

788-
if (inputs().empty() || interactive)
813+
814+
if (ins.empty() || interactive)
789815
{
790816
return ImageStructureInfo(vw, vh);
791817
}
792818
else
793819
{
794820
const float aspect = vw / vh;
795821
EvalPoint ep = evaluationPoint(context.frame);
822+
if (ep.sourceIndex < 0 || ep.sourceIndex >= ins.size())
823+
{
824+
return ImageStructureInfo(vw, vh);
825+
}
826+
796827
Context context = graph()->contextForFrame(ep.sourceFrame);
797-
ImageStructureInfo ininfo = inputs()[ep.sourceIndex]->imageStructureInfo(context);
828+
ImageStructureInfo ininfo = ins[ep.sourceIndex]->imageStructureInfo(context);
798829

799830
//
800831
// We may have an input that has no media "behind it" (IE a
@@ -895,6 +926,12 @@ namespace IPCore
895926
//
896927

897928
int index = indexAtSample(readSample, rate, context.fps);
929+
if (index < 0)
930+
{
931+
cerr << "ERROR: no samples read from input node" << endl;
932+
break;
933+
}
934+
898935
int sourceIndex = (*m_edlSource)[index];
899936

900937
//
@@ -1028,31 +1065,15 @@ namespace IPCore
10281065

10291066
int frame = context.frame;
10301067
const IPNodes& ins = inputs();
1068+
EvalPoint ep = evaluationPoint(frame);
1069+
const int source = ep.sourceIndex;
10311070

1032-
if (ins.size() > 1)
1071+
if (source > 0 && source < ins.size())
10331072
{
1034-
EvalPoint ep = evaluationPoint(frame);
1035-
const int source = ep.sourceIndex;
1036-
1037-
if (source < 0 || source >= ins.size())
1038-
{
1039-
outputProp(m_edlSource);
1040-
outputProp(m_edlGlobalIn);
1041-
outputProp(m_edlSourceIn);
1042-
outputProp(m_edlSourceOut);
1043-
1044-
TWK_THROW_STREAM(SequenceOutOfBoundsExc,
1045-
"Bad Sequence EDL source number " << source << " is not in range [0," << ins.size() - 1 << "]");
1046-
}
1047-
10481073
Context newContext = context;
10491074
newContext.frame = ep.sourceFrame;
10501075
ins[source]->testEvaluate(newContext, result);
10511076
}
1052-
else if (ins.size() == 1)
1053-
{
1054-
ins[0]->testEvaluate(context, result);
1055-
}
10561077
}
10571078

10581079
void SequenceIPNode::metaEvaluate(const Context& context, MetaEvalVisitor& visitor)
@@ -1061,18 +1082,11 @@ namespace IPCore
10611082

10621083
visitor.enter(context, this);
10631084
const IPNodes& ins = inputs();
1085+
EvalPoint ep = evaluationPoint(context.frame);
1086+
const int source = ep.sourceIndex;
10641087

1065-
if (ins.size() >= 1)
1088+
if (source >= 0 && source < ins.size())
10661089
{
1067-
EvalPoint ep = evaluationPoint(context.frame);
1068-
const int source = ep.sourceIndex;
1069-
1070-
if (source < 0 || source >= ins.size())
1071-
{
1072-
TWK_THROW_STREAM(SequenceOutOfBoundsExc,
1073-
"Bad Sequence EDL source number " << source << " is not in range [0," << ins.size() - 1 << "]");
1074-
}
1075-
10761090
Context c = context;
10771091
c.frame = ep.sourceFrame;
10781092

@@ -1081,13 +1095,6 @@ namespace IPCore
10811095
ins[source]->metaEvaluate(c, visitor);
10821096
}
10831097
}
1084-
else if (ins.size() == 1)
1085-
{
1086-
if (visitor.traverseChild(context, 0, this, ins[0]))
1087-
{
1088-
ins[0]->metaEvaluate(context, visitor);
1089-
}
1090-
}
10911098

10921099
visitor.leave(context, this);
10931100
}

0 commit comments

Comments
 (0)