Skip to content

Commit

Permalink
Merge pull request #1842 from Autodesk/t_gamaj/MAYA-114300/job_contex…
Browse files Browse the repository at this point in the history
…t_ui

MAYA-114297 MAYA-114300 Job context UI
  • Loading branch information
Krystian Ligenza authored Dec 3, 2021
2 parents eb04883 + 9d5912c commit 2bf98c7
Show file tree
Hide file tree
Showing 14 changed files with 596 additions and 220 deletions.
4 changes: 2 additions & 2 deletions lib/mayaUsd/commands/baseExportCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ MSyntax MayaUSDExportCommand::createSyntax()
MSyntax syntax;

// These flags correspond to entries in
// UsdMayaJobExportArgs::GetDefaultDictionary.
// UsdMayaJobExportArgs::GetGuideDictionary.
syntax.addFlag(
kMergeTransformAndShapeFlag,
UsdMayaJobExportArgsTokens->mergeTransformAndShape.GetText(),
Expand Down Expand Up @@ -245,7 +245,7 @@ MStatus MayaUSDExportCommand::doIt(const MArgList& args)

// Read all of the dictionary args first.
const VtDictionary userArgs = UsdMayaUtil::GetDictionaryFromArgDatabase(
argData, UsdMayaJobExportArgs::GetDefaultDictionary());
argData, UsdMayaJobExportArgs::GetGuideDictionary());

// Now read all of the other args that are specific to this command.
bool append = false;
Expand Down
4 changes: 2 additions & 2 deletions lib/mayaUsd/commands/baseImportCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ MSyntax MayaUSDImportCommand::createSyntax()
MSyntax syntax;

// These flags correspond to entries in
// UsdMayaJobImportArgs::GetDefaultDictionary.
// UsdMayaJobImportArgs::GetGuideDictionary.
syntax.addFlag(
kShadingModeFlag,
UsdMayaJobImportArgsTokens->shadingMode.GetText(),
Expand Down Expand Up @@ -136,7 +136,7 @@ MStatus MayaUSDImportCommand::doIt(const MArgList& args)

// Get dictionary values.
const VtDictionary userArgs = UsdMayaUtil::GetDictionaryFromArgDatabase(
argData, UsdMayaJobImportArgs::GetDefaultDictionary());
argData, UsdMayaJobImportArgs::GetGuideDictionary());

std::string mFileName;
if (argData.isFlagSet(kFileFlag)) {
Expand Down
97 changes: 97 additions & 0 deletions lib/mayaUsd/fileio/jobs/jobArgs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,69 @@ const VtDictionary& UsdMayaJobExportArgs::GetDefaultDictionary()
return d;
}

const VtDictionary& UsdMayaJobExportArgs::GetGuideDictionary()
{
static VtDictionary d;
static std::once_flag once;

std::call_once(once, []() {
// Common types:
const auto _boolean = VtValue(false);
const auto _string = VtValue(std::string());
const auto _stringVector = VtValue(std::vector<VtValue>({ _string }));
const auto _stringTriplet = VtValue(std::vector<VtValue>({ _string, _string, _string }));
const auto _stringTripletVector = VtValue(std::vector<VtValue>({ _stringTriplet }));

// Provide guide types for the parser:
d[UsdMayaJobExportArgsTokens->chaser] = _stringVector;
d[UsdMayaJobExportArgsTokens->chaserArgs] = _stringTripletVector;
d[UsdMayaJobExportArgsTokens->compatibility] = _string;
d[UsdMayaJobExportArgsTokens->defaultCameras] = _boolean;
d[UsdMayaJobExportArgsTokens->defaultMeshScheme] = _string;
d[UsdMayaJobExportArgsTokens->defaultUSDFormat] = _string;
d[UsdMayaJobExportArgsTokens->eulerFilter] = _boolean;
d[UsdMayaJobExportArgsTokens->exportCollectionBasedBindings] = _boolean;
d[UsdMayaJobExportArgsTokens->exportColorSets] = _boolean;
d[UsdMayaJobExportArgsTokens->exportDisplayColor] = _boolean;
d[UsdMayaJobExportArgsTokens->exportInstances] = _boolean;
d[UsdMayaJobExportArgsTokens->exportMaterialCollections] = _boolean;
d[UsdMayaJobExportArgsTokens->exportReferenceObjects] = _boolean;
d[UsdMayaJobExportArgsTokens->exportRefsAsInstanceable] = _boolean;
d[UsdMayaJobExportArgsTokens->exportRoots] = _stringVector;
d[UsdMayaJobExportArgsTokens->exportSkin] = _string;
d[UsdMayaJobExportArgsTokens->exportSkels] = _string;
d[UsdMayaJobExportArgsTokens->exportBlendShapes] = _boolean;
d[UsdMayaJobExportArgsTokens->exportUVs] = _boolean;
d[UsdMayaJobExportArgsTokens->exportVisibility] = _boolean;
d[UsdMayaJobExportArgsTokens->exportComponentTags] = _boolean;
d[UsdMayaJobExportArgsTokens->file] = _string;
d[UsdMayaJobExportArgsTokens->filterTypes] = _stringVector;
d[UsdMayaJobExportArgsTokens->ignoreWarnings] = _boolean;
d[UsdMayaJobExportArgsTokens->kind] = _string;
d[UsdMayaJobExportArgsTokens->materialCollectionsPath] = _string;
d[UsdMayaJobExportArgsTokens->materialsScopeName] = _string;
d[UsdMayaJobExportArgsTokens->melPerFrameCallback] = _string;
d[UsdMayaJobExportArgsTokens->melPostCallback] = _string;
d[UsdMayaJobExportArgsTokens->mergeTransformAndShape] = _boolean;
d[UsdMayaJobExportArgsTokens->normalizeNurbs] = _boolean;
d[UsdMayaJobExportArgsTokens->parentScope] = _string;
d[UsdMayaJobExportArgsTokens->pythonPerFrameCallback] = _string;
d[UsdMayaJobExportArgsTokens->pythonPostCallback] = _string;
d[UsdMayaJobExportArgsTokens->renderableOnly] = _boolean;
d[UsdMayaJobExportArgsTokens->renderLayerMode] = _string;
d[UsdMayaJobExportArgsTokens->shadingMode] = _string;
d[UsdMayaJobExportArgsTokens->convertMaterialsTo] = _stringVector;
d[UsdMayaJobExportArgsTokens->apiSchema] = _stringVector;
d[UsdMayaJobExportArgsTokens->jobContext] = _stringVector;
d[UsdMayaJobExportArgsTokens->stripNamespaces] = _boolean;
d[UsdMayaJobExportArgsTokens->verbose] = _boolean;
d[UsdMayaJobExportArgsTokens->staticSingleSample] = _boolean;
d[UsdMayaJobExportArgsTokens->geomSidedness] = _string;
});

return d;
}

std::string UsdMayaJobExportArgs::GetResolvedFileName() const
{
MFileObject fileObj;
Expand Down Expand Up @@ -896,6 +959,40 @@ const VtDictionary& UsdMayaJobImportArgs::GetDefaultDictionary()
return d;
}

/* static */
const VtDictionary& UsdMayaJobImportArgs::GetGuideDictionary()
{
static VtDictionary d;
static std::once_flag once;
std::call_once(once, []() {
// Common types:
const auto _boolean = VtValue(false);
const auto _string = VtValue(std::string());
const auto _stringVector = VtValue(std::vector<VtValue>({ _string }));
const auto _stringTuplet = VtValue(std::vector<VtValue>({ _string, _string, _string }));
const auto _stringTriplet = VtValue(std::vector<VtValue>({ _string, _string, _string }));
const auto _stringTupletVector = VtValue(std::vector<VtValue>({ _stringTuplet }));
const auto _stringTripletVector = VtValue(std::vector<VtValue>({ _stringTriplet }));

// Provide guide types for the parser:
d[UsdMayaJobImportArgsTokens->assemblyRep] = _string;
d[UsdMayaJobImportArgsTokens->apiSchema] = _stringVector;
d[UsdMayaJobImportArgsTokens->excludePrimvar] = _stringVector;
d[UsdMayaJobImportArgsTokens->jobContext] = _stringVector;
d[UsdMayaJobImportArgsTokens->metadata] = _stringVector;
d[UsdMayaJobImportArgsTokens->shadingMode] = _stringTupletVector;
d[UsdMayaJobImportArgsTokens->preferredMaterial] = _string;
d[UsdMayaJobImportArgsTokens->importInstances] = _boolean;
d[UsdMayaJobImportArgsTokens->importUSDZTextures] = _boolean;
d[UsdMayaJobImportArgsTokens->importUSDZTexturesFilePath] = _string;
d[UsdMayaJobImportArgsTokens->useAsAnimationCache] = _boolean;
d[UsdMayaJobExportArgsTokens->chaser] = _stringVector;
d[UsdMayaJobExportArgsTokens->chaserArgs] = _stringTripletVector;
});

return d;
}

const std::string UsdMayaJobImportArgs::GetImportUSDZTexturesFilePath(const VtDictionary& userArgs)
{
if (!_Boolean(userArgs, UsdMayaJobImportArgsTokens->importUSDZTextures))
Expand Down
12 changes: 12 additions & 0 deletions lib/mayaUsd/fileio/jobs/jobArgs.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,12 @@ struct UsdMayaJobExportArgs
MAYAUSD_CORE_PUBLIC
static const VtDictionary& GetDefaultDictionary();

/// Gets the guide dictionary for UsdMayaJobExportArgs.
///
/// Used in GetDictionaryFromArgDatabase() to deduce the type of an argument.
MAYAUSD_CORE_PUBLIC
static const VtDictionary& GetGuideDictionary();

/// Returns the resolved file name of the final export location
MAYAUSD_CORE_PUBLIC
std::string GetResolvedFileName() const;
Expand Down Expand Up @@ -321,6 +327,12 @@ struct UsdMayaJobImportArgs
MAYAUSD_CORE_PUBLIC
static const VtDictionary& GetDefaultDictionary();

/// Gets the guide dictionary for UsdMayaJobImportArgs.
///
/// Used in GetDictionaryFromArgDatabase() to deduce the type of an argument.
MAYAUSD_CORE_PUBLIC
static const VtDictionary& GetGuideDictionary();

MAYAUSD_CORE_PUBLIC
static const std::string GetImportUSDZTexturesFilePath(const VtDictionary& userArgs);

Expand Down
4 changes: 4 additions & 0 deletions lib/mayaUsd/utils/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1937,6 +1937,10 @@ std::pair<bool, std::string> UsdMayaUtil::ValueToArgument(const VtValue& value)
{
if (value.IsHolding<bool>()) {
return std::make_pair(true, std::string(value.Get<bool>() ? "1" : "0"));
} else if (value.IsHolding<int>()) {
return std::make_pair(true, std::to_string(value.Get<int>()));
} else if (value.IsHolding<float>()) {
return std::make_pair(true, std::to_string(value.Get<float>()));
} else if (value.IsHolding<std::string>()) {
return std::make_pair(true, value.Get<std::string>());
} else if (value.IsHolding<std::vector<VtValue>>()) {
Expand Down
2 changes: 1 addition & 1 deletion plugin/adsk/plugin/exportTranslator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ MStatus UsdMayaExportTranslator::writer(
userArgs[argName] = UsdMayaUtil::ParseArgumentValue(
argName,
theOption[1].asChar(),
PXR_NS::UsdMayaJobExportArgs::GetDefaultDictionary());
PXR_NS::UsdMayaJobExportArgs::GetGuideDictionary());
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion plugin/adsk/plugin/importTranslator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ MStatus UsdMayaImportTranslator::reader(
importData.setRootPrimPath(theOption[1].asChar());
} else {
userArgs[argName] = UsdMayaUtil::ParseArgumentValue(
argName, theOption[1].asChar(), UsdMayaJobImportArgs::GetDefaultDictionary());
argName, theOption[1].asChar(), UsdMayaJobImportArgs::GetGuideDictionary());
}
}
}
Expand Down
92 changes: 92 additions & 0 deletions plugin/adsk/scripts/mayaUSDRegisterStrings.mel
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,98 @@ global proc mayaUSDRegisterStrings() {
register("kUsdOptionsFrameLabel", "Universal Scene Description (USD) Options");
register("kSaveOption2GBWarning", "<b>Important</b>: per layer, any data exceeding the limit of 2GB will not be saved.");

// All strings for export dialog:
register("kExportAnimDataAnn", "Exports Maya animation data as USD time samples.");
register("kExportAnimDataLbl", "Animation Data: ");
register("kExportBlendShapesAnn", "Exports Maya Blend Shapes as USD blendshapes. Requires skeletons to be exported as well.");
register("kExportBlendShapesLbl", "Blend Shapes:");
register("kExportColorSetsAnn", "Exports Maya Color Sets as USD primvars.");
register("kExportColorSetsLbl", "Color Sets:");
register("kExportDefaultFormatAnn", "Select whether the .usd file is written out in binary or ASCII");
register("kExportDefaultFormatLbl", ".usd File Format:");
register("kExportDefaultFormatBinLbl", "Binary");
register("kExportDefaultFormatAscLbl", "ASCII");
register("kExportDefaultFormatStatus", "Select whether the .usd file is written out in binary or ASCII. You can save a file in .usdc (binary), or .usda (ASCII) format. Manually entering a file name with an extension overrides the selection in this drop-down menu.");
register("kExportDisplayColorAnn", "If selected, exports the diffuse color of the geometry's bound shader as a displayColor primvar on the USD mesh.");
register("kExportDisplayColorLbl", "Display Colors:");
register("kExportEulerFilterAnn", "Exports the euler angle filtering that was performed in Maya.");
register("kExportEulerFilterLbl", "Euler Filter:");
register("kExportFrameAdvancedLbl", "Advanced");
register("kExportFrameAnimationLbl", "Animation");
register("kExportFrameGeometryLbl", "Geometry");
register("kExportFrameMaterialsLbl", "Materials");
register("kExportFrameOutputLbl", "Output");
register("kExportFrameRangeBtn", "Use Animation Range");
register("kExportFrameRangeLbl", "Frame Range Start/End:");
register("kExportFrameSamplesAnn", "Specifies the value(s) used to multi-sample time frames during animation export. Multiple values separated by a space (-0.1 0.2) are supported.");
register("kExportFrameSamplesLbl", "Frame Sample:");
register("kExportFrameStepAnn", "Specifies the increment between USD time sample frames during animation export");
register("kExportFrameStepLbl", "Frame Step:");
register("kExportInstancesAnn", "Exports Maya instances as USD instanceable references.");
register("kExportInstancesLbl", "Instances:");
register("kExportInstancesFlatLbl", "Flatten");
register("kExportInstancesRefLbl", "Convert to USD Instanceable References");
register("kExportJobContextAnn", "Select a loaded plug-in configuration to modify export options");
register("kExportJobContextLbl", "Plug-in Configuration:");
register("kExportJobContextNoneLbl", "None");
register("kExportMaterialsAnn", "Select the material(s) to bind to prims for export. With USD, you can bind multiple materials to prims.");
register("kExportMergeShapesAnn", "Merges Maya transform and shape nodes into a single USD prim.");
register("kExportMergeShapesLbl", "Merge Transform and\nShape Nodes:");
register("kExportNamespacesAnn", "By default, namespaces are exported to the USD file in the following format: nameSpaceExample_pPlatonic1");
register("kExportNamespacesLbl", "Include Namespaces:");
register("kExportParentScopAnn", "Name of the USD scope that is the parent of the exported data.");
register("kExportParentScopLbl", "Create USD Parent Scope:");
register("kExportParentScopPht", "USD Prim Name");
register("kExportSkelsAnn", "Exports Maya joints as part of a USD skeleton.");
register("kExportSkelsLbl", "Skeletons:");
register("kExportSkelsNoneLbl", "None");
register("kExportSkelsAllLbl", "All (Automatically Create SkelRoots)");
register("kExportSkelsRootLbl", "Only under SkelRoots");
register("kExportSkinClustersAnn", "Exports Maya skin clusters as part of a USD skeleton.");
register("kExportSkinClustersLbl", "Skin Clusters");
register("kExportStaticSingleSampleAnn", "Converts animated values with a single time sample to be static instead.");
register("kExportStaticSingleSampleLbl", "Static Single Sample:");
register("kExportSubdMethodAnn", "Exports the selected subdivision method as a USD uniform attribute.");
register("kExportSubdMethodLbl", "Subdivision Method:");
register("kExportSubdMethodCCLbl", "Catmull-Clark");
register("kExportSubdMethodBiLbl", "Bilinear");
register("kExportSubdMethodLoLbl", "Loop");
register("kExportSubdMethodNoLbl", "None (Polygonal Mesh)");
register("kExportUVSetsAnn", "Exports Maya UV Sets as USD primvars.");
register("kExportUVSetsLbl", "UV Sets:");
register("kExportVisibilityAnn", "Exports Maya visibility attributes as USD metadata.");
register("kExportVisibilityLbl", "Visibility:");

// All strings for import dialog:
register("kImportAnimationDataLbl", "Animation Data: ");
register("kImportCustomFrameRangeLbl", "Custom Frame Range: ");
register("kImportFrameRangeLbl", "Frame Range Start/End: ");
register("kImportHierarchyViewLbl", "Hierarchy View");
register("kImportJobContextAnn", "Select a loaded plug-in configuration to modify import options");
register("kImportJobContextLbl", "Plug-in Configuration:");
register("kImportJobContextNoneLbl", "None");
register("kImportMaterialConvAnn", "Select the preferred conversion method for inbound USD shading data to bind with Maya geometry");
register("kImportMaterialConvLbl", "Convert to:");
register("kImportMaterialConvNoneLbl", "No Conversion");
register("kImportMaterialConvSSLbl","Standard Surface");
register("kImportMaterialConvLamLbl", "Lambert");
register("kImportMaterialConvPSLbl", "USD Preview Surface");
register("kImportMaterialConvBlnLbl", "Blinn");
register("kImportMaterialConvPhgLbl", "Phong");
register("kImportMaterialsAnn", "If selected, shading data is extracted from the USD file for import");
register("kImportMaterialsLbl", "Materials: ");
register("kImportPrimsInScopeNumLbl", "Total Number of Prims in Scope:");
register("kImportSelectFileTxt", "Please select a file to enable this option");
register("kImportScopeVariantsAnn", "Select a USD file and click <strong>Hierarchy View</strong> to build the scope of your import and switch variants.<br><br><strong>Scope</strong>: A USD file consists of prims, the primary container object in USD. Prims can contain any scene element, like meshes, lights, cameras, etc. Use the checkboxes in the <strong>Hierarchy View</strong> to select and deselect prims to build the scope of your import.<br><br><strong>Variant</strong>: A variant is a single, named variation of a variant set. Each variant set is a package of alternatives that users can switch between non-destructively. A variant set has no limits to what it can store. Variants can be used to swap out a material or change the entire hierarchy of an asset. A single prim can have many variants and variant sets, but only one variant from each variant set can be selected for import into Maya.");
register("kImportScopeVariantsLbl", "Scope and Variants: ");
register("kImportScopeVariantsSbm", "Select a USD file and click Hierarchy View to open the Hierarchy View window. This window lets you toggle prim checkboxes and non-destructively switch between variants to build the scope of your import.");
register("kImportToInstanceAnn", "Converts instanced prims to Maya instances. Instanced prims share parts of\nthe USD scenegraph through instancing. Each instanced prim is associated\nwith a master prim that serves as the root of the scenegraph. This hierarchy\nreduces the time needed to load the file. Instanced prims must be manually\ntagged.");
register("kImportToInstanceLbl", "Instanced Prims: ");
register("kImportToInstanceOpt", "Convert to Instances");
register("kImportUSDZTxtAnn", "When a .usdz file is chosen and this is selected, .usdz texture files are imported and copied to new files on disk. To locate these files, navigate to the current Maya workspace /sourceimages directory.");
register("kImportUSDZTxtLbl", "USDZ Texture Import: ");
register("kImportVariantsInScopeNumLbl", "Variants Switched in Scope:");

// Register the strings from the python equivalent register function.
// Note: the strings from both the MEL and python register can be loaded
// by either MEL or python. They all get registered together under
Expand Down
Loading

0 comments on commit 2bf98c7

Please sign in to comment.