AcademySoftwareFoundation / AcademySoftwareFoundation/xstudio
Incorrectly Detects Sequence Padding During Drag-and-Drop
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 773
- Forks
- 129
- Avg merge
- 9d 1m
- Merged PRs (30d)
- 10
Description
Describe the bug
When dragging and dropping sequence files (e.g., 024_SSD_0130_scan_v0002.1000.exr), xSTUDIO was incorrectly detecting the padding as {:00d} instead of the correct {:04d}. This caused sequences to show the correct frame count but fail to load the media files. The issue is only when drag and dropping a sequence; it works fine when using the command line.
To Reproduce
Drop a a sequence folder in xStudio with the same pattern (filename_vXXXX.####.format)
** Tested quick fix (should be done probably better; tested locally) **
_int pad_size(const std::string &frame) {
// -01 == pad 3
// 0 pad means unknown padding
return (std::to_string(std::atoi(frame.c_str())).size() == frame.size() ? 0 : frame.size());
}_
to
int pad_size(const std::string &frame) {
// -01 == pad 3
// 0 pad means unknown padding
// Check if the frame string has leading zeros
if (frame.empty()) {
return 0;
}
// Count leading zeros
size_t leading_zeros = 0;
for (char c : frame) {
if (c == '0') {
leading_zeros++;
} else if (c == '-' && leading_zeros == 0) {
// Handle negative numbers, continue counting
continue;
} else {
break;
}
}
// If we have leading zeros, use the full length
if (leading_zeros > 0) {
return frame.size();
}
// For negative numbers, check if the absolute value has leading zeros
if (frame[0] == '-') {
std::string abs_frame = frame.substr(1);
size_t abs_leading_zeros = 0;
for (char c : abs_frame) {
if (c == '0') {
abs_leading_zeros++;
} else {
break;
}
}
if (abs_leading_zeros > 0) {
return frame.size();
}
}
// For numbers without leading zeros, check if they look like they should be padded
// If the number is >= 100, assume it should have at least 4-digit padding
int num = std::atoi(frame.c_str());
if (num >= 100) {
return frame.size();
}
// Original logic for small numbers
return (std::to_string(num).size() == frame.size() ? 0 : frame.size());
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the pad_size implementation and trace how sequence filenames are parsed during drag-and-drop versus the command-line path. Reproduce the issue with a filename matching filename_vXXXX.####.format, then verify that the detected padding is correct and the dropped sequence loads its media files.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100