Skip to content

Commit

Permalink
EMSUSD-533 - Incremental naming doesn't take zero into consideration
Browse files Browse the repository at this point in the history
* clang-format
  • Loading branch information
seando-adsk committed Sep 6, 2023
1 parent 639a949 commit 2dad1ff
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions lib/mayaUsd/ufe/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,17 +154,15 @@ std::string uniqueChildNameMayaStandard(const PXR_NS::UsdPrim& usdParent, const
// Example: with siblings Capsule001 & Capsule006, duplicating Capsule001
// will set new unique name to Capsule007.
std::string childName { name };
if (allChildrenNames.find(TfToken(childName)) != allChildrenNames.end())
{
if (allChildrenNames.find(TfToken(childName)) != allChildrenNames.end()) {
// Get the base name (removing the numerical suffix) so that we can compare
// that to all the sibling names.
std::string baseName, suffix;
splitNumericalSuffix(childName, baseName, suffix);

std::string childBaseName;
std::pair<TfToken, int> largestMatching("", -1);
for (const auto child : allChildrenNames)
{
for (const auto child : allChildrenNames) {
// While iterating thru all the children look for ones that match
// the base name of the input. When we find one check its numerical
// suffix and store the greatest one.
Expand Down
2 changes: 1 addition & 1 deletion lib/usdUfe/python/wrapUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
#include <boost/python.hpp>
#include <boost/python/def.hpp>

#include <vector>
#include <string>
#include <vector>

using namespace boost::python;

Expand Down
2 changes: 1 addition & 1 deletion lib/usdUfe/ufe/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ bool splitNumericalSuffix(const std::string srcName, std::string& base, std::str
// Compiled regular expression to find a numerical suffix to a path component.
// It searches for any number of characters followed by a single non-numeric,
// then one or more digits at end of string.
std::regex re("(.*)([^0-9])([0-9]+)$");
std::regex re("(.*)([^0-9])([0-9]+)$");
base = srcName;
std::smatch match;
if (std::regex_match(srcName, match, re)) {
Expand Down

0 comments on commit 2dad1ff

Please sign in to comment.