-
Notifications
You must be signed in to change notification settings - Fork 203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EMSUSD-1196 material scope as default prim #3801
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -562,6 +562,18 @@ bool _MergeJobContexts(bool isExport, const VtDictionary& userArgs, VtDictionary | |
return canMergeContexts; | ||
} | ||
|
||
bool _GetEncodedArg(const MString& option, std::string& argName, MString& argValue) | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Refactored common code shared between import and export job args. |
||
MStringArray theOption; | ||
option.split('=', theOption); | ||
if (theOption.length() < 1) | ||
return false; | ||
|
||
argName = theOption[0].asChar(); | ||
argValue = theOption.length() > 1 ? theOption[1] : MString(); | ||
return true; | ||
} | ||
|
||
} // namespace | ||
UsdMayaJobExportArgs::UsdMayaJobExportArgs( | ||
const VtDictionary& userArgs, | ||
|
@@ -760,6 +772,7 @@ std::ostream& operator<<(std::ostream& out, const UsdMayaJobExportArgs& exportAr | |
<< "writeDefaults: " << TfStringify(exportArgs.writeDefaults) << std::endl | ||
<< "parentScope: " << exportArgs.parentScope << std::endl // Deprecated | ||
<< "rootPrim: " << exportArgs.parentScope << std::endl | ||
<< "defaultPrim: " << TfStringify(exportArgs.defaultPrim) << std::endl | ||
<< "renderLayerMode: " << exportArgs.renderLayerMode << std::endl | ||
<< "rootKind: " << exportArgs.rootKind << std::endl | ||
<< "disableModelKindProcessor: " << exportArgs.disableModelKindProcessor << std::endl | ||
|
@@ -859,27 +872,27 @@ MStatus UsdMayaJobExportArgs::GetDictionaryFromEncodedOptions( | |
// Get the options | ||
if (optionsString.length() > 0) { | ||
MStringArray optionList; | ||
MStringArray theOption; | ||
std::string argName; | ||
MString argValue; | ||
optionsString.split(';', optionList); | ||
for (unsigned int i = 0; i < optionList.length(); ++i) { | ||
theOption.clear(); | ||
optionList[i].split('=', theOption); | ||
if (theOption.length() != 2) { | ||
// We allow an empty string to be passed to exportRoots. We must process it here. | ||
if (theOption.length() == 1 | ||
&& theOption[0] == UsdMayaJobExportArgsTokens->exportRoots.GetText()) { | ||
if (!_GetEncodedArg(optionList[i], argName, argValue)) | ||
continue; | ||
|
||
// We allow an empty string to be passed to exportRoots. We must process it here. | ||
if (argName == UsdMayaJobExportArgsTokens->exportRoots.GetText()) { | ||
if (argValue.length() == 0) { | ||
std::vector<VtValue> userArgVals; | ||
userArgVals.push_back(VtValue("")); | ||
userArgs[UsdMayaJobExportArgsTokens->exportRoots] = userArgVals; | ||
continue; | ||
} | ||
continue; | ||
} | ||
|
||
std::string argName(theOption[0].asChar()); | ||
if (argName == "filterTypes") { | ||
std::vector<VtValue> userArgVals; | ||
MStringArray filteredTypes; | ||
theOption[1].split(',', filteredTypes); | ||
argValue.split(',', filteredTypes); | ||
unsigned int nbTypes = filteredTypes.length(); | ||
for (unsigned int idxType = 0; idxType < nbTypes; ++idxType) { | ||
const std::string filteredType = filteredTypes[idxType].asChar(); | ||
|
@@ -889,7 +902,7 @@ MStatus UsdMayaJobExportArgs::GetDictionaryFromEncodedOptions( | |
} else if (argName == "frameSample") { | ||
std::vector<double> samples; | ||
MStringArray samplesStrings; | ||
theOption[1].split(' ', samplesStrings); | ||
argValue.split(' ', samplesStrings); | ||
unsigned int nbSams = samplesStrings.length(); | ||
for (unsigned int sam = 0; sam < nbSams; ++sam) { | ||
if (samplesStrings[sam].isDouble()) { | ||
|
@@ -900,7 +913,7 @@ MStatus UsdMayaJobExportArgs::GetDictionaryFromEncodedOptions( | |
userArgs[argName] = samples; | ||
} else if (argName == UsdMayaJobExportArgsTokens->exportRoots.GetText()) { | ||
MStringArray exportRootStrings; | ||
theOption[1].split(',', exportRootStrings); | ||
argValue.split(',', exportRootStrings); | ||
|
||
std::vector<VtValue> userArgVals; | ||
|
||
|
@@ -924,7 +937,7 @@ MStatus UsdMayaJobExportArgs::GetDictionaryFromEncodedOptions( | |
userArgs[argName] = userArgVals; | ||
} else { | ||
if (argName == "shadingMode") { | ||
TfToken shadingMode(theOption[1].asChar()); | ||
TfToken shadingMode(argValue.asChar()); | ||
if (!shadingMode.IsEmpty() | ||
&& UsdMayaShadingModeRegistry::GetInstance().GetExporter(shadingMode) | ||
== nullptr | ||
|
@@ -942,7 +955,7 @@ MStatus UsdMayaJobExportArgs::GetDictionaryFromEncodedOptions( | |
const static bool reportError = false; | ||
userArgs[argName] = UsdMayaUtil::ParseArgumentValue( | ||
argName, | ||
theOption[1].asChar(), | ||
argValue.asChar(), | ||
UsdMayaJobExportArgs::GetGuideDictionary(), | ||
reportError); | ||
} | ||
|
@@ -1301,25 +1314,19 @@ MStatus UsdMayaJobImportArgs::GetDictionaryFromEncodedOptions( | |
// Get the options | ||
if (optionsString.length() > 0) { | ||
MStringArray optionList; | ||
MStringArray theOption; | ||
std::string argName; | ||
MString argValue; | ||
optionsString.split(';', optionList); | ||
for (unsigned int i = 0; i < optionList.length(); ++i) { | ||
theOption.clear(); | ||
optionList[i].split('=', theOption); | ||
if (theOption.length() != 2) { | ||
if (!_GetEncodedArg(optionList[i], argName, argValue)) | ||
continue; | ||
} | ||
|
||
// Note: if some argument needs special handling, do like in the | ||
// same function in the export version in UsdMayaJobExportArgs | ||
std::string argName(theOption[0].asChar()); | ||
|
||
// Note: when round-tripping settings, some extra settings are not part | ||
// of the guiding dictionary. Ignore them. | ||
const static bool reportError = false; | ||
userArgs[argName] = UsdMayaUtil::ParseArgumentValue( | ||
argName, | ||
theOption[1].asChar(), | ||
argValue.asChar(), | ||
UsdMayaJobImportArgs::GetGuideDictionary(), | ||
reportError); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,8 +41,7 @@ class UsdMayaPrimWriterArgs | |
UsdMayaPrimWriterArgs( | ||
const MDagPath& dagPath, | ||
const bool exportRefsAsInstanceable, | ||
const TfToken::Set& excludeExportTypes, | ||
const std::string& defaultPrim); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The default prim was not used anywhere so I removed it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also checked and the _defaultPrim is private and isn't being used from anywhere. Good catch! |
||
const TfToken::Set& excludeExportTypes); | ||
|
||
/// \brief returns the MObject that should be exported. | ||
MAYAUSD_CORE_PUBLIC | ||
|
@@ -71,7 +70,6 @@ class UsdMayaPrimWriterArgs | |
MDagPath _dagPath; | ||
bool _exportRefsAsInstanceable; | ||
TfToken::Set _excludeExportTypes; | ||
std::string _defaultPrim; | ||
}; | ||
|
||
PXR_NAMESPACE_CLOSE_SCOPE | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The doc was in the import section instead of the export section.