Skip to content
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-278 - Embed import options in subheadings #3249

Merged
merged 4 commits into from
Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions plugin/adsk/scripts/mayaUSDRegisterStrings.mel
Original file line number Diff line number Diff line change
Expand Up @@ -194,33 +194,32 @@ global proc mayaUSDRegisterStrings()
register("kExportVisibilityLbl", "Visibility:");

// All strings for import dialog:
register("kImportAnimationDataLbl", "Animation Data: ");
register("kImportCustomFrameRangeLbl", "Custom Frame Range: ");
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("kImportMaterialConvNoneLbl", "Automatic");
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("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("kImportToInstanceAnn", "If selected, instance proxies will be converted to Maya instances. Instance proxies enable parts of the USD scenegraph to share prims through instancing even though instances cannot have descendants in USD. Each instanced prim is associated with a master prim that serves as the root of the scenegraph. This hierarchy reduces the time needed to load the file. Instanced prims must be manually tagged in USD. Enabling this option will convert any USD instance proxies to Maya instances as you import them.");
register("kImportToInstanceOpt", "Convert Instance Proxies 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("kImportUSDZTxtLbl", "USDZ Texture Import");
register("kImportVariantsInScopeNumLbl", "Variants Switched in Scope:");
register("kMayaDiscardEdits", "Discard Maya Edits");
register("kMayaRefDiscardEdits", "Cancel Editing as Maya Data");
Expand Down
66 changes: 39 additions & 27 deletions plugin/adsk/scripts/mayaUsdTranslatorImport.mel
Original file line number Diff line number Diff line change
Expand Up @@ -229,24 +229,26 @@ global proc int mayaUsdTranslatorImport (string $parent,
// menuItem -label "Object space";
// menuItem -label "World space";
// optionMenuGrp -e -sl 1 mayaUsdTranslator_CoordSystemOptionMenu;
frameLayout -label `getMayaUsdString("kImportMaterialsLbl")` materialsFrameLayout;
separator -style "none";
checkBoxGrp -label "" -label1 `getMayaUsdString("kImportMaterialsLbl")` -cw 1 $cw1 -value1 1 -ann `getMayaUsdString("kImportMaterialsAnn")` -cc ("mayaUsdTranslatorImport_MaterialsCB") mayaUsdTranslator_MaterialsCheckBox;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what the default is, but I think you should pass the number of checkboxes with -ncb 1 and I don't think you need -label "" as that flag is optional. Same with all the ones below.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @seando-adsk , -label "" is actually needed to achieve the alignment. Without -label the option will be aligned to the left as shown below:
image

For -ncb I'm not sure it's necessary.. We didn't use that option before so I think that's more for the case that we have multiple checkboxes?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay for the empty label - I didn't realize that.
I checked the code for the checkBoxGrp command and it does indeed default to 1.


string $apiString = `about -q -apiVersion`;
$apiString = `substring $apiString 1 4`;
optionMenuGrp -l `getMayaUsdString("kImportMaterialConvLbl")` -cw 1 $cw1 -ann `getMayaUsdString("kImportMaterialConvAnn")` mayaUsdTranslator_MaterialsConversionMenu;
menuItem -l `getMayaUsdString("kImportMaterialConvNoneLbl")` -ann "none";
if ((int)$apiString >= 2020) {
menuItem -l `getMayaUsdString("kImportMaterialConvSSLbl")` -ann "standardSurface";
}
menuItem -l `getMayaUsdString("kImportMaterialConvLamLbl")` -ann "lambert";
menuItem -l `getMayaUsdString("kImportMaterialConvPSLbl")` -ann "usdPreviewSurface";
menuItem -l `getMayaUsdString("kImportMaterialConvBlnLbl")` -ann "blinn";
menuItem -l `getMayaUsdString("kImportMaterialConvPhgLbl")` -ann "phong";

checkBoxGrp -label `getMayaUsdString("kImportMaterialsLbl")` -cw 1 $cw1 -value1 1 -ann `getMayaUsdString("kImportMaterialsAnn")` -cc ("mayaUsdTranslatorImport_MaterialsCB") mayaUsdTranslator_MaterialsCheckBox;

string $apiString = `about -q -apiVersion`;
$apiString = `substring $apiString 1 4`;
optionMenuGrp -l `getMayaUsdString("kImportMaterialConvLbl")` -cw 1 $cw2 -ann `getMayaUsdString("kImportMaterialConvAnn")` mayaUsdTranslator_MaterialsConversionMenu;
menuItem -l `getMayaUsdString("kImportMaterialConvNoneLbl")` -ann "none";
if ((int)$apiString >= 2020) {
menuItem -l `getMayaUsdString("kImportMaterialConvSSLbl")` -ann "standardSurface";
}
menuItem -l `getMayaUsdString("kImportMaterialConvLamLbl")` -ann "lambert";
menuItem -l `getMayaUsdString("kImportMaterialConvPSLbl")` -ann "usdPreviewSurface";
menuItem -l `getMayaUsdString("kImportMaterialConvBlnLbl")` -ann "blinn";
menuItem -l `getMayaUsdString("kImportMaterialConvPhgLbl")` -ann "phong";

checkBoxGrp -label `getMayaUsdString("kImportUSDZTxtLbl")` -cw 1 $cw2 -ann `getMayaUsdString("kImportUSDZTxtAnn")` mayaUsdTranslator_ImportUSDZTexturesCheckBox;
checkBoxGrp -label "" -label1 `getMayaUsdString("kImportUSDZTxtLbl")` -cw 1 $cw1 -ann `getMayaUsdString("kImportUSDZTxtAnn")` mayaUsdTranslator_ImportUSDZTexturesCheckBox;

checkBoxGrp -label `getMayaUsdString("kImportToInstanceLbl")` -label1 `getMayaUsdString("kImportToInstanceOpt")` -cw 1 $cw1 -value1 1 -ann `getMayaUsdString("kImportToInstanceAnn")` mayaUsdTranslator_ImportInstancesCheckBox;
separator -style "none";
setParent ..;

// optionMenuGrp -label "Include Metadata: " -cw 1 $cw1 mayaUsdTranslator_IncludeMetadataOptionMenu;
// menuItem "All";
Expand All @@ -264,11 +266,21 @@ global proc int mayaUsdTranslatorImport (string $parent,
// menuItem "Custom";
// optionMenuGrp -e -sl 2 mayaUsdTranslator_IncludeCustomAttribOptionMenu;

checkBoxGrp -label `getMayaUsdString("kImportAnimationDataLbl")` -cw 1 $cw1 -cc ("mayaUsdTranslatorImport_AnimationCB") mayaUsdTranslator_AnimDataCheckBox;
frameLayout -label "Animation" animationFrameLayout;
separator -style "none";
checkBoxGrp -label "" -label1 `getMayaUsdString("kImportAnimationDataLbl")` -cw 1 $cw1 -cc ("mayaUsdTranslatorImport_AnimationCB") mayaUsdTranslator_AnimDataCheckBox;

checkBoxGrp -label "" -label1 `getMayaUsdString("kImportCustomFrameRangeLbl")` -cw 1 $cw1 -cc ("mayaUsdTranslatorImport_AnimationCB") mayaUsdTranslator_CustomFrameRangeCheckBox;

checkBoxGrp -label `getMayaUsdString("kImportCustomFrameRangeLbl")` -cw 1 $cw2 -cc ("mayaUsdTranslatorImport_AnimationCB") mayaUsdTranslator_CustomFrameRangeCheckBox;
intFieldGrp -label `getMayaUsdString("kImportFrameRangeLbl")` -nf 2 -cw 1 $cw1 mayaUsdTranslator_CustomFrameRange;
separator -style "none";
setParent ..;

intFieldGrp -label `getMayaUsdString("kImportFrameRangeLbl")` -nf 2 -cw 1 $cw2 mayaUsdTranslator_CustomFrameRange;
frameLayout -label "Advanced" advancedFrameLayout;
separator -style "none";
checkBoxGrp -label "" -label1 `getMayaUsdString("kImportToInstanceOpt")` -cw 1 $cw1 -value1 1 -ann `getMayaUsdString("kImportToInstanceAnn")` mayaUsdTranslator_ImportInstancesCheckBox;
separator -style "none";
setParent ..;

// Now set to current settings.
string $currentOptions = $initialSettings;
Expand Down Expand Up @@ -374,23 +386,23 @@ global proc mayaUsdTranslatorImport_AnimationCB()
{
int $forEditAsMaya = (`columnLayout -q -ann mayaUsdTranslator_OptsCol` == "EditAsMayaOptions") ? 1 : 0;
if ((`checkBoxGrp -q -value1 mayaUsdTranslator_AnimDataCheckBox` == 1) && !$forEditAsMaya) {
checkBoxGrp -e -vis true mayaUsdTranslator_CustomFrameRangeCheckBox;
checkBoxGrp -e -en true mayaUsdTranslator_CustomFrameRangeCheckBox;
int $vis = (`checkBoxGrp -q -value1 mayaUsdTranslator_CustomFrameRangeCheckBox` == 1);
intFieldGrp -e -vis $vis mayaUsdTranslator_CustomFrameRange;
intFieldGrp -e -en $vis mayaUsdTranslator_CustomFrameRange;
} else {
checkBoxGrp -e -vis false mayaUsdTranslator_CustomFrameRangeCheckBox;
intFieldGrp -e -vis false mayaUsdTranslator_CustomFrameRange;
checkBoxGrp -e -en false mayaUsdTranslator_CustomFrameRangeCheckBox;
intFieldGrp -e -en false mayaUsdTranslator_CustomFrameRange;
}
}

global proc mayaUsdTranslatorImport_MaterialsCB()
{
if (`checkBoxGrp -q -value1 mayaUsdTranslator_MaterialsCheckBox` == 1) {
optionMenuGrp -e -vis true mayaUsdTranslator_MaterialsConversionMenu;
checkBoxGrp -e -vis true mayaUsdTranslator_ImportUSDZTexturesCheckBox;
optionMenuGrp -e -en true mayaUsdTranslator_MaterialsConversionMenu;
checkBoxGrp -e -en true mayaUsdTranslator_ImportUSDZTexturesCheckBox;
} else {
optionMenuGrp -e -vis false mayaUsdTranslator_MaterialsConversionMenu;
checkBoxGrp -e -vis false mayaUsdTranslator_ImportUSDZTexturesCheckBox;
optionMenuGrp -e -en false mayaUsdTranslator_MaterialsConversionMenu;
checkBoxGrp -e -en false mayaUsdTranslator_ImportUSDZTexturesCheckBox;
}
}

Expand Down