MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/xstudio / create_default_seq

Function create_default_seq

src/utility/src/sequence.cpp:249–287  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

247
248
249std::optional<DefaultSequenceHelper> create_default_seq(const Entry &entry) {
250 std::cmatch m;
251 try {
252 static const std::regex bare_number(R"(()([-]?\d+)())", std::regex::optimize);
253 static const std::regex number_and_ext(R"(()([-]?\d+)(\.[^.]+))", std::regex::optimize);
254 static const std::regex body_dot_number_and_double_ext(
255 R"((.+\.)([-]?\d+)(\.[^.\d]{1,4}\.[^.]{1,3}))", std::regex::optimize);
256 static const std::regex body_dot_number_and_ext(
257 R"((.+\.)([-]?\d+)(\.[^.]+))", std::regex::optimize);
258 static const std::regex body_no_dot_number_and_ext(
259 R"((.+[^0-9])(\d+)(\.[^.]+))", std::regex::optimize);
260
261 if (std::regex_match(entry.name_.c_str(), m, bare_number) or
262 std::regex_match(entry.name_.c_str(), m, number_and_ext) or
263 std::regex_match(entry.name_.c_str(), m, body_dot_number_and_double_ext) or
264 std::regex_match(entry.name_.c_str(), m, body_dot_number_and_ext) or
265 std::regex_match(entry.name_.c_str(), m, body_no_dot_number_and_ext)) {
266
267 // skip versions..
268 if (ends_with(m[1].str(), "_v"))
269 return {};
270 DefaultSequenceHelper seq;
271 seq.head_ = escape_percentage(m[1].str());
272 seq.tail_ = escape_percentage(m[3].str());
273 seq.name_ = seq.head_ + "#" + seq.tail_;
274 seq.frames_.insert(std::atoi(m[2].str().c_str()));
275 seq.frame_str_ = m[2].str();
276 seq.pad_ = pad_size(m[2].str());
277 seq.pad_str_ = pad_spec(seq.pad_);
278 seq.entries_.push_back(entry);
279 return seq;
280 }
281
282 return {};
283 } catch (const std::exception &err) {
284 spdlog::warn("{} {}", __PRETTY_FUNCTION__, err.what());
285 }
286 return {};
287}
288
289std::vector<Sequence> default_collapse_sequences(const std::vector<Entry> &entries) {
290 // collapse sequences that are part of a collection.

Callers 1

Calls 7

ends_withFunction · 0.85
escape_percentageFunction · 0.85
pad_sizeFunction · 0.85
pad_specFunction · 0.85
push_backMethod · 0.80
whatMethod · 0.80
insertMethod · 0.45

Tested by

no test coverage detected