@@ -148,6 +148,7 @@ namespace mrv
148
148
std::string audioFileName;
149
149
std::string compareFileName;
150
150
#ifdef MRV2_PYBIND11
151
+ bool noPython = false ;
151
152
std::string pythonScript;
152
153
std::string pythonArgs;
153
154
#endif
@@ -407,6 +408,9 @@ namespace mrv
407
408
string::Format (" {0}" ).arg (p.options .lutOptions .order ),
408
409
string::join (timeline::getLUTOrderLabels (), " , " )),
409
410
#ifdef MRV2_PYBIND11
411
+ app::CmdLineFlagOption::create (
412
+ p.options .noPython , {" -noPython" , " -np" },
413
+ _ (" Don't load python for faster startup." )),
410
414
app::CmdLineValueOption<std::string>::create (
411
415
p.options .pythonScript , {" -pythonScript" , " -ps" },
412
416
_ (" Python Script to run and exit." )),
@@ -1092,85 +1096,85 @@ namespace mrv
1092
1096
}
1093
1097
1094
1098
#ifdef MRV2_PYBIND11
1095
- DBG;
1096
- // Import the mrv2 python module so we read all python
1097
- // plug-ins.
1098
- py::module::import ( " mrv2 " );
1099
- DBG ;
1099
+ if (!p. options . noPython )
1100
+ {
1101
+ // Import the mrv2 python module so we read all python
1102
+ // plug-ins.
1103
+ py::module::import ( " mrv2 " ) ;
1100
1104
1101
- // Discover Python plugins
1102
- mrv2_discover_python_plugins ();
1103
- DBG;
1105
+ // Discover Python plugins
1106
+ mrv2_discover_python_plugins ();
1104
1107
1105
- //
1106
- // Run command-line python script.
1107
- //
1108
- if (!p.options .pythonScript .empty ())
1109
- {
1110
- std::string script = p.options .pythonScript ;
1111
- if (!file::isReadable (script))
1108
+ //
1109
+ // Run command-line python script.
1110
+ //
1111
+ if (!p.options .pythonScript .empty ())
1112
1112
{
1113
- // Search for script in $STUDIOPATH/python/ directory
1114
- std::string studio_script = studiopath () + " /python/" + script;
1115
- if (file::isReadable (studio_script))
1116
- {
1117
- script = studio_script;
1118
- }
1119
- else
1113
+ std::string script = p.options .pythonScript ;
1114
+ if (!file::isReadable (script))
1120
1115
{
1121
- // Search for script in mrv2's python demos directory.
1122
- script = pythonpath () + script;
1123
- if (! file::isReadable (script ))
1116
+ // Search for script in $STUDIOPATH/ python/ directory
1117
+ std::string studio_script = studiopath () + " /python/ " + script;
1118
+ if (file::isReadable (studio_script ))
1124
1119
{
1125
- std::cerr
1126
- << std::string (
1127
- string::Format (
1128
- _ (" Could not read python script '{0}'" ))
1129
- .arg (p.options .pythonScript ))
1130
- << std::endl;
1131
- _exit = 1 ;
1132
- return ;
1120
+ script = studio_script;
1121
+ }
1122
+ else
1123
+ {
1124
+ // Search for script in mrv2's python demos directory.
1125
+ script = pythonpath () + script;
1126
+ if (!file::isReadable (script))
1127
+ {
1128
+ std::cerr
1129
+ << std::string (
1130
+ string::Format (
1131
+ _ (" Could not read python script '{0}'" ))
1132
+ .arg (p.options .pythonScript ))
1133
+ << std::endl;
1134
+ _exit = 1 ;
1135
+ return ;
1136
+ }
1133
1137
}
1134
1138
}
1135
- }
1136
1139
1137
- p.pythonArgs = std::make_unique<PythonArgs>(p.options .pythonArgs );
1140
+ p.pythonArgs = std::make_unique<PythonArgs>(p.options .pythonArgs );
1138
1141
1139
- LOG_STATUS (std::string (
1140
- string::Format (_ (" Running python script '{0}'" )).arg (script)));
1141
- const auto & args = p.pythonArgs ->getArguments ();
1142
+ LOG_STATUS (std::string (
1143
+ string::Format (_ (" Running python script '{0}'" )).arg (script)));
1144
+ const auto & args = p.pythonArgs ->getArguments ();
1142
1145
1143
- if (!args.empty ())
1144
- {
1145
- LOG_STATUS (_ (" with Arguments:" ));
1146
- std::string out = " [" ;
1147
- out += tl::string::join (args, ' ,' );
1148
- out += " ]" ;
1149
- LOG_STATUS (out);
1150
- }
1146
+ if (!args.empty ())
1147
+ {
1148
+ LOG_STATUS (_ (" with Arguments:" ));
1149
+ std::string out = " [" ;
1150
+ out += tl::string::join (args, ' ,' );
1151
+ out += " ]" ;
1152
+ LOG_STATUS (out);
1153
+ }
1151
1154
1152
- std::ifstream is (script);
1153
- std::stringstream s;
1154
- s << is.rdbuf ();
1155
- try
1156
- {
1157
- py::exec (s.str ());
1158
- }
1159
- catch (const std::exception& e)
1160
- {
1161
- std::cerr << _ (" Python Error: " ) << std::endl
1162
- << e.what () << std::endl;
1163
- _exit = 1 ;
1155
+ std::ifstream is (script);
1156
+ std::stringstream s;
1157
+ s << is.rdbuf ();
1158
+ try
1159
+ {
1160
+ py::exec (s.str ());
1161
+ }
1162
+ catch (const std::exception& e)
1163
+ {
1164
+ std::cerr << _ (" Python Error: " ) << std::endl
1165
+ << e.what () << std::endl;
1166
+ _exit = 1 ;
1167
+ return ;
1168
+ }
1169
+ delete ui;
1170
+ ui = nullptr ;
1164
1171
return ;
1165
1172
}
1166
- delete ui;
1167
- ui = nullptr ;
1168
- return ;
1169
- }
1170
1173
1171
- DBG;
1172
- // Redirect Python's stdout/stderr to my own class
1173
- p.pythonStdErrOutRedirect .reset (new PyStdErrOutStreamRedirect);
1174
+ DBG;
1175
+ // Redirect Python's stdout/stderr to my own class
1176
+ p.pythonStdErrOutRedirect .reset (new PyStdErrOutStreamRedirect);
1177
+ }
1174
1178
#endif
1175
1179
1176
1180
// Open Panel Windows if not loading a session file.
@@ -1330,6 +1334,7 @@ namespace mrv
1330
1334
void App::startPlayback ()
1331
1335
{
1332
1336
TLRENDER_P ();
1337
+
1333
1338
1334
1339
p.player ->setPlayback (timeline::Playback::Stop);
1335
1340
@@ -1366,6 +1371,9 @@ namespace mrv
1366
1371
endTime = endTime.floor ();
1367
1372
startTime = startTime.ceil ();
1368
1373
1374
+ // Keep UI responsive
1375
+ Fl::check ();
1376
+
1369
1377
for (const auto & t : value.videoFrames )
1370
1378
{
1371
1379
if (t.start_time () <= startTime &&
@@ -1424,6 +1432,9 @@ namespace mrv
1424
1432
endTime = endTime.floor ();
1425
1433
startTime = startTime.ceil ();
1426
1434
1435
+ // Keep UI responsive
1436
+ Fl::check ();
1437
+
1427
1438
for (const auto & t : value.videoFrames )
1428
1439
{
1429
1440
if (t.start_time () <= startTime &&
@@ -1460,12 +1471,13 @@ namespace mrv
1460
1471
// make sure to show all frames
1461
1472
if (p.options .playback == timeline::Playback::Count)
1462
1473
p.options .playback = timeline::Playback::Forward;
1463
-
1474
+
1464
1475
Fl::add_timeout (
1465
1476
0.0 , (Fl_Timeout_Handler)start_playback_cb, this );
1466
1477
}
1467
1478
}
1468
1479
p.running = true ;
1480
+
1469
1481
return Fl::run ();
1470
1482
}
1471
1483
@@ -1941,7 +1953,8 @@ namespace mrv
1941
1953
if (file::isUSD (item->path ))
1942
1954
{
1943
1955
#ifdef MRV2_PYBIND11
1944
- py::gil_scoped_release release;
1956
+ if (!p.options .noPython )
1957
+ py::gil_scoped_release release;
1945
1958
#endif
1946
1959
otioTimeline = item->audioPath .isEmpty ()
1947
1960
? timeline::create (
@@ -2054,7 +2067,7 @@ namespace mrv
2054
2067
{
2055
2068
player->setPlayback (
2056
2069
timeline::Playback::Forward);
2057
-
2070
+
2058
2071
// If we have autoplayback on and auto hide
2059
2072
// pixel bar, do so here.
2060
2073
const int autoHide =
@@ -2216,13 +2229,10 @@ namespace mrv
2216
2229
}
2217
2230
}
2218
2231
2219
- DBG;
2220
2232
cacheUpdate ();
2221
-
2222
- DBG;
2233
+
2223
2234
_audioUpdate ();
2224
-
2225
- DBG;
2235
+
2226
2236
}
2227
2237
2228
2238
otime::RationalTime App::_cacheReadAhead () const
0 commit comments