From 068062f3772bd9b7c0fd21bd0773a784ff8d4060 Mon Sep 17 00:00:00 2001 From: Pierre Baillargeon Date: Fri, 11 Oct 2024 12:43:47 -0400 Subject: [PATCH 1/3] EMSUSD-1504 prevent warnings when reloading the plugin - Move all resource to a Python dictionary. - This allows unregistering resources when unloaded. --- .../fileio/doc/How-to-add-new-option.md | 2 +- lib/mayaUsd/resources/scripts/CMakeLists.txt | 1 - .../scripts/mayaUsdLibRegisterStrings.mel | 58 --- .../scripts/mayaUsdLibRegisterStrings.py | 246 +++++++---- plugin/adsk/plugin/plugin.cpp | 2 + .../adsk/scripts/mayaUSDRegisterStrings.mel | 359 +--------------- plugin/adsk/scripts/mayaUSDRegisterStrings.py | 399 +++++++++++++++++- 7 files changed, 540 insertions(+), 527 deletions(-) delete mode 100644 lib/mayaUsd/resources/scripts/mayaUsdLibRegisterStrings.mel diff --git a/lib/mayaUsd/fileio/doc/How-to-add-new-option.md b/lib/mayaUsd/fileio/doc/How-to-add-new-option.md index 023d08fcda..6522a1b918 100644 --- a/lib/mayaUsd/fileio/doc/How-to-add-new-option.md +++ b/lib/mayaUsd/fileio/doc/How-to-add-new-option.md @@ -30,7 +30,7 @@ Usually, you will need to modify these places: - wrapPrimReader.cpp: - Expose the option to Python -- mayaUSDRegisterStrings.mel: +- mayaUSDRegisterStrings.py: Add the new UI labels - mayaUsdTranslatorImport.mel: (or mayaUsdTranslatorExport.mel) diff --git a/lib/mayaUsd/resources/scripts/CMakeLists.txt b/lib/mayaUsd/resources/scripts/CMakeLists.txt index 89d0905156..62dd9df118 100644 --- a/lib/mayaUsd/resources/scripts/CMakeLists.txt +++ b/lib/mayaUsd/resources/scripts/CMakeLists.txt @@ -1,5 +1,4 @@ list(APPEND scripts_src - mayaUsdLibRegisterStrings.mel mayaUsdLibRegisterStrings.py mayaUsdAddMayaReference.mel mayaUsdAddMayaReference.py diff --git a/lib/mayaUsd/resources/scripts/mayaUsdLibRegisterStrings.mel b/lib/mayaUsd/resources/scripts/mayaUsdLibRegisterStrings.mel deleted file mode 100644 index 78d7d873b3..0000000000 --- a/lib/mayaUsd/resources/scripts/mayaUsdLibRegisterStrings.mel +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2022 Autodesk -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -proc register(string $key, string $value) -{ - registerPluginResource("mayaUsdLib", $key, $value); -} - -global proc string getMayaUsdLibString(string $key) -{ - return getPluginResource("mayaUsdLib", $key); -} - -global proc mayaUsdLibRegisterStrings() -{ - // mayaUsdAddMayaReference.mel - register("kMayaRefDescription", "Description"); - register("kMayaRefCacheToUSDDescription1", "

Export your Maya Reference to a USD cache file on disk. This workflow enables you to work with Maya data in USD scenes and then export them to a USD cache and author it back into your current USD hierarchy. Use the Cache Options section to build out the scope of your output.

"); - register("kMayaRefCacheToUSDDescription2", "

Note: When authoring the exported USD cache back into a current USD hierarchy, an edit will be made on the targeted layer. The cache file will be added as a USD reference, defined either in a variant or prim.

"); - register("kMayaRefAddToUSDDescription1", "

Add a Maya reference to a USD prim to enable working with original Maya data in your USD scene. Select a Maya scene file to add as a reference. Once a Maya reference file is added, a Maya transform node will appear in the Outliner at your selected prim, containing your newly added Maya reference. Use this dialog to build out the scope of your Maya reference.

"); - register("kMayaRefAddToUSDDescription2", "

Tip: Define your Maya Reference in a USD variant. This will enable your prim to have 2 variants you can switch between in the Outliner; the Maya reference and its USD cache.

"); - register("kMayaRefUsdOptions", "Author Maya Reference File to USD"); - register("kMayaRefMayaRefPrimName", "Maya Reference Prim Name:"); - register("kMayaRefGroup", "Group"); - register("kMayaRefPrimName", "Prim Name:"); - register("kMayaRefPrimType", "Prim Type:"); - register("kMayaRefPrimKind", "Prim Kind:"); - register("kMayaRefDefineInVariant", "Define in Variant"); - register("kMayaRefDefineInVariantAnn", "Select this checkbox to define the Maya Reference in a USD variant. This will enable your prim to have 2 variants you can switch between in the Outliner; the Maya reference and its USD cache."); - register("kMayaRefVariantSetName", "Variant Set Name:"); - register("kMayaRefVariantName", "Variant Name:"); - register("kMayaRefVariantOnPrim", "Variant will be on prim:"); - register("kMayaRefEditAsMayaData", "Edit as Maya Data"); - register("kMayaRefEditAsMayaDataAnn", "Select this checkbox to enable editing the MayaReference prim as a Maya Reference."); - register("kMayaRefOptions", "Maya Reference Options"); - register("kMayaRefCreateNew", "Create New"); - register("kMayaRefAddToPrim", "Add Maya Reference to Prim"); - register("kMayaRefReference", "Reference"); - - // Used in multiple places. - register("kAllUsdFiles", "All USD Files"); - register("kUsdFiles", "USD Files"); - register("kUsdASCIIFiles", "USD ASCII Files"); - register("kUsdBinaryFiles", "USD Binary Files"); - register("kUsdCompressedFiles", "USD Compressed Files"); -} diff --git a/lib/mayaUsd/resources/scripts/mayaUsdLibRegisterStrings.py b/lib/mayaUsd/resources/scripts/mayaUsdLibRegisterStrings.py index bcc6f71a8b..657cbca14c 100644 --- a/lib/mayaUsd/resources/scripts/mayaUsdLibRegisterStrings.py +++ b/lib/mayaUsd/resources/scripts/mayaUsdLibRegisterStrings.py @@ -16,129 +16,191 @@ import maya.cmds as cmds import maya.mel as mel -def register(key, value): - registerPluginResource('mayaUsdLib', key, value) - def getMayaUsdLibString(key): return getPluginResource('mayaUsdLib', key) def mayaUsdLibRegisterStrings(): - # This function is called from the equivalent MEL proc - # with the same name. The strings registered here and all the - # ones registered from the MEL proc can be used in either - # MEL or python. + # This function is called from mayaUSDRegisterStrings. + registerPluginResources('mayaUsdLib', __mayaUsdLibStringResources) +def mayaUsdLibUnregisterStrings(): + # This function is called from mayaUSDUnregisterStrings. # Any python strings from MayaUsd lib go here. + unregisterPluginResources('mayaUsdLib', __mayaUsdLibStringResources) + +# Any MEL or Python strings from MayaUsd lib go here. +__mayaUsdLibStringResources = { # ae_template.py - register('kKindMetadataAnn', 'Kind is a type of metadata (a pre-loaded string value) used to classify prims in USD. Set the classification value from the dropdown to assign a kind category to a prim. Set a kind value to activate selection by kind.') - register('kActiveMetadataAnn', "If selected, the prim is set to active and contributes to the composition of a stage. If a prim is set to inactive, it doesn't contribute to the composition of a stage (it gets striked out in the Outliner and is deactivated from the Viewport).") - register('kInstanceableMetadataAnn', 'If selected, instanceable is set to true for the prim and the prim is considered a candidate for instancing. If deselected, instanceable is set to false.') - register('kErrorAttributeMustBeArray', '"^1s" must be an array!') - register('kMenuCopyValue', 'Copy Attribute Value') - register('kMenuPrintValue', 'Print to Script Editor') - register('kLabelUnusedTransformAttrs', 'Unused') - register('kLabelMetadata', 'Metadata') - register('kLabelAppliedSchemas', 'Applied Schemas') - register('kOpenImage', 'Open') - register('kLabelMaterial', 'Material') - register('kLabelAssignedMaterial', 'Assigned Material') - register('kAnnShowMaterialInLookdevx', 'Show in LookdevX') - register('kLabelInheritedMaterial', 'Inherited Material') - register('kLabelInheritedFromPrim', 'Inherited from Prim') - register('kLabelInheriting', 'inheriting') - register('kTooltipInheritingOverDirect', 'This material is being over-ridden due to the strength setting on an ancestor') - register('kTooltipInheriting', 'This material is inherited from an ancestor') - register('kLabelMaterialStrength', 'Strength') - register('kLabelWeakerMaterial', 'Weaker than descendants') - register('kLabelStrongerMaterial', 'Stronger than descendants') - register('kTooltipInheritedStrength', 'This setting cannot be changed on this prim due to the strength setting on an ancestor') - register('kLabelMaterialNewTab', 'New Tab...') - register('kUseOutlinerColorAnn', 'Apply the Outliner color to the display of the prim name in the Outliner.') - register('kOutlinerColorAnn', 'The color of the text displayed in the Outliner.') + 'kKindMetadataAnn': 'Kind is a type of metadata (a pre-loaded string value) used to classify prims in USD. Set the classification value from the dropdown to assign a kind category to a prim. Set a kind value to activate selection by kind.', + 'kActiveMetadataAnn': "If selected, the prim is set to active and contributes to the composition of a stage. If a prim is set to inactive, it doesn't contribute to the composition of a stage (it gets striked out in the Outliner and is deactivated from the Viewport).", + 'kInstanceableMetadataAnn': 'If selected, instanceable is set to true for the prim and the prim is considered a candidate for instancing. If deselected, instanceable is set to false.', + 'kErrorAttributeMustBeArray': '"^1s" must be an array!', + 'kMenuCopyValue': 'Copy Attribute Value', + 'kMenuPrintValue': 'Print to Script Editor', + 'kLabelUnusedTransformAttrs': 'Unused', + 'kLabelMetadata': 'Metadata', + 'kLabelAppliedSchemas': 'Applied Schemas', + 'kOpenImage': 'Open', + 'kLabelMaterial': 'Material', + 'kLabelAssignedMaterial': 'Assigned Material', + 'kAnnShowMaterialInLookdevx': 'Show in LookdevX', + 'kLabelInheritedMaterial': 'Inherited Material', + 'kLabelInheritedFromPrim': 'Inherited from Prim', + 'kLabelInheriting': 'inheriting', + 'kTooltipInheritingOverDirect': 'This material is being over-ridden due to the strength setting on an ancestor', + 'kTooltipInheriting': 'This material is inherited from an ancestor', + 'kLabelMaterialStrength': 'Strength', + 'kLabelWeakerMaterial': 'Weaker than descendants', + 'kLabelStrongerMaterial': 'Stronger than descendants', + 'kTooltipInheritedStrength': 'This setting cannot be changed on this prim due to the strength setting on an ancestor', + 'kLabelMaterialNewTab': 'New Tab...', + 'kUseOutlinerColorAnn': 'Apply the Outliner color to the display of the prim name in the Outliner.', + 'kOutlinerColorAnn': 'The color of the text displayed in the Outliner.', # mayaUsdAddMayaReference.py - register('kErrorGroupPrimExists', 'Group prim "^1s" already exists under "^2s". Choose prim name other than "^1s" to proceed.') - register('kErrorCannotAddToProxyShape', 'Cannot add Maya Reference node to ProxyShape with Variant Set unless grouped. Enable Group checkbox to proceed.') - register('kErrorMayaRefPrimExists', 'Maya Reference prim "^1s" already exists under "^2s". Choose Maya Reference prim name other than "^1s" to proceed.') - register('kErrorCreatingGroupPrim', 'Cannot create group prim under "^1s". Ensure target layer is editable and "^2s" can be added to "^1s".') - register('kErrorCreatingMayaRefPrim', 'Cannot create MayaReference prim under "^1s". Ensure target layer is editable and "^2s" can be added to "^1s".') - register('kErrorCreateVariantSet', 'Cannot create Variant Set on prim at path "^1s". Ensure target layer is editable and "^2s" can be added to "^3s".') + 'kErrorGroupPrimExists': 'Group prim "^1s" already exists under "^2s". Choose prim name other than "^1s" to proceed.', + 'kErrorCannotAddToProxyShape': 'Cannot add Maya Reference node to ProxyShape with Variant Set unless grouped. Enable Group checkbox to proceed.', + 'kErrorMayaRefPrimExists': 'Maya Reference prim "^1s" already exists under "^2s". Choose Maya Reference prim name other than "^1s" to proceed.', + 'kErrorCreatingGroupPrim': 'Cannot create group prim under "^1s". Ensure target layer is editable and "^2s" can be added to "^1s".', + 'kErrorCreatingMayaRefPrim': 'Cannot create MayaReference prim under "^1s". Ensure target layer is editable and "^2s" can be added to "^1s".', + 'kErrorCreateVariantSet': 'Cannot create Variant Set on prim at path "^1s". Ensure target layer is editable and "^2s" can be added to "^3s".', # mayaUsdCacheMayaReference.py - register('kButtonNewChildPrim', 'New Child Prim') - register('kButtonNewChildPrimToolTip', 'If selected, your Maya reference will be defined in a new child prim. This will enable\nyou to work with your Maya reference and its USD cache side-by-side.') - register('kCacheFileWillAppear', 'Cache file will\nappear on parent\nprim:') - register('kCacheMayaRefCache', 'Cache') - register('kCacheMayaRefOptions', 'Cache File Options') - register('kCacheMayaRefUsdHierarchy', 'Author Cache File to USD') - register('kCaptionCacheToUsd', 'Cache to USD') - register('kErrorCacheToUsdFailed', 'Cache to USD failed for "^1s".') - register('kMenuPrepend', 'Prepend') - register('kMenuAppend', 'Append') - register('kMenuPayload', 'Payload') - register('kMenuReference', 'Reference') - register('kOptionAsUSDReference', 'Composition Arc:') - register('kOptionAsUSDReferenceToolTip', '

Choose the type of USD Reference composition arc for your Maya Reference:

Payloads are a type of reference. They are recorded, but not traversed in the scene hierarchy. Select this arc if your goal is to manually construct
a "working set" that is a subset of an entire scene, in which only parts of the scene are required/loaded. Note: payloads are
weaker than direct references in any given LayerStack.

References are general and can be used to compose smaller units of scene description into larger aggregates, building up a namespace that
includes the "encapsulated" result of composing the scene description targeted by a reference. Select this arc if your goal is not to unload your
references.

') - register('kOptionAsUSDReferenceStatusMsg', 'Choose the type of USD Reference composition arc for your Maya Reference.') - register('kOptionListEditedAs', 'List Edited As') - register('kOptionLoadPayload', 'Load Payload:') - register('kLoadPayloadAnnotation', 'If selected, all existing payloads on the prim will be unchanged and new payloads will be loaded as well. When deselected, all payloads on the prim will be unloaded.') - register('kTextDefineIn', 'Define in:') - register('kTextVariant', 'Variant') - register('kTextVariantToolTip','If selected, your Maya reference will be defined in a variant. This will enable your prim to\nhave 2 variants you can switch between in the Outliner; the Maya reference and its USD cache.') - - register('kAddRefOrPayloadPrimPathToolTip', + 'kButtonNewChildPrim': 'New Child Prim', + 'kButtonNewChildPrimToolTip': 'If selected, your Maya reference will be defined in a new child prim. This will enable\nyou to work with your Maya reference and its USD cache side-by-side.', + 'kCacheFileWillAppear': 'Cache file will\nappear on parent\nprim:', + 'kCacheMayaRefCache': 'Cache', + 'kCacheMayaRefOptions': 'Cache File Options', + 'kCacheMayaRefUsdHierarchy': 'Author Cache File to USD', + 'kCaptionCacheToUsd': 'Cache to USD', + 'kErrorCacheToUsdFailed': 'Cache to USD failed for "^1s".', + 'kMenuPrepend': 'Prepend', + 'kMenuAppend': 'Append', + 'kMenuPayload': 'Payload', + 'kMenuReference': 'Reference', + 'kOptionAsUSDReference': 'Composition Arc:', + 'kOptionAsUSDReferenceToolTip': '

Choose the type of USD Reference composition arc for your Maya Reference:

Payloads are a type of reference. They are recorded, but not traversed in the scene hierarchy. Select this arc if your goal is to manually construct
a "working set" that is a subset of an entire scene, in which only parts of the scene are required/loaded. Note: payloads are
weaker than direct references in any given LayerStack.

References are general and can be used to compose smaller units of scene description into larger aggregates, building up a namespace that
includes the "encapsulated" result of composing the scene description targeted by a reference. Select this arc if your goal is not to unload your
references.

', + 'kOptionAsUSDReferenceStatusMsg': 'Choose the type of USD Reference composition arc for your Maya Reference.', + 'kOptionListEditedAs': 'List Edited As', + 'kOptionLoadPayload': 'Load Payload:', + 'kLoadPayloadAnnotation': 'If selected, all existing payloads on the prim will be unchanged and new payloads will be loaded as well. When deselected, all payloads on the prim will be unloaded.', + 'kTextDefineIn': 'Define in:', + 'kTextVariant': 'Variant', + 'kTextVariantToolTip': 'If selected, your Maya reference will be defined in a variant. This will enable your prim to\nhave 2 variants you can switch between in the Outliner; the Maya reference and its USD cache.', + + 'kAddRefOrPayloadPrimPathToolTip': 'Leave this field blank to use the default prim as your prim path (only viable if your file has a default prim).\n' + 'Specifying a prim path will make an explicit reference to a prim.\n' + - 'If there is no default prim and no prim path is specified, no prim will be referenced.') + 'If there is no default prim and no prim path is specified, no prim will be referenced.', - register('kAddRefOrPayloadPrimPathLabel', 'Prim Path') - register('kAddRefOrPayloadPrimPathPlaceHolder', ' (Default Prim)') - register('kAddRefOrPayloadPrimPathHelpLabel', 'Help on Select a Prim for Reference') - register('kAddRefOrPayloadPrimPathTitle', 'Select a Prim to Reference') - register('kAddRefOrPayloadSelectLabel', 'Select') + 'kAddRefOrPayloadPrimPathLabel': 'Prim Path', + 'kAddRefOrPayloadPrimPathPlaceHolder': ' (Default Prim)', + 'kAddRefOrPayloadPrimPathHelpLabel': 'Help on Select a Prim for Reference', + 'kAddRefOrPayloadPrimPathTitle': 'Select a Prim to Reference', + 'kAddRefOrPayloadSelectLabel': 'Select', # mayaUsdClearRefsOrPayloadsOptions.py - register('kClearRefsOrPayloadsOptionsTitle', 'Clear All USD References/Payloads') - register('kClearRefsOrPayloadsOptionsMessage', 'Clear all references/payloads on %s?') - register('kClearButton', 'Clear') - register('kCancelButton', 'Cancel') - register('kAllRefsLabel', 'All References') - register('kAllRefsTooltip', 'Clear all references on the prim.') - register('kAllPayloadsLabel', 'All Payloads') - register('kAllPayloadsTooltip', 'Clear all payloads on the prim.') + 'kClearRefsOrPayloadsOptionsTitle': 'Clear All USD References/Payloads', + 'kClearRefsOrPayloadsOptionsMessage': 'Clear all references/payloads on %s?', + 'kClearButton': 'Clear', + 'kCancelButton': 'Cancel', + 'kAllRefsLabel': 'All References', + 'kAllRefsTooltip': 'Clear all references on the prim.', + 'kAllPayloadsLabel': 'All Payloads', + 'kAllPayloadsTooltip': 'Clear all payloads on the prim.', # mayaUsdMergeToUSDOptions.py - register('kMergeToUSDOptionsTitle', 'Merge Maya Edits to USD Options') - register('kMergeButton', 'Merge') - register('kApplyButton', 'Apply') - register('kCloseButton', 'Close') - register('kEditMenu', 'Edit') - register('kSaveSettingsMenuItem', 'Save Settings') - register('kResetSettingsMenuItem', 'Reset Settings') - register('kHelpMenu', 'Help') - register('kHelpMergeToUSDOptionsMenuItem', 'Help on Merge Maya Edits to USD Options') + 'kMergeToUSDOptionsTitle': 'Merge Maya Edits to USD Options', + 'kMergeButton': 'Merge', + 'kApplyButton': 'Apply', + 'kCloseButton': 'Close', + 'kEditMenu': 'Edit', + 'kSaveSettingsMenuItem': 'Save Settings', + 'kResetSettingsMenuItem': 'Reset Settings', + 'kHelpMenu': 'Help', + 'kHelpMergeToUSDOptionsMenuItem': 'Help on Merge Maya Edits to USD Options', # mayaUsdDuplicateAsUsdDataOptions.py - register('kDuplicateAsUsdDataOptionsTitle', 'Duplicate As USD Data Options') - register('kHelpDuplicateAsUsdDataOptionsMenuItem', 'Help on Duplicate As USD Data Options') + 'kDuplicateAsUsdDataOptionsTitle': 'Duplicate As USD Data Options', + 'kHelpDuplicateAsUsdDataOptionsMenuItem': 'Help on Duplicate As USD Data Options', # mayaUsdMergeToUsd.py - register('kErrorMergeToUsdMenuItem', 'Could not create menu item for merge to USD') - register('kMenuCacheToUsd', 'Cache to USD...') - register('kMenuMergeMayaEdits', 'Merge Maya Edits to USD'); + 'kErrorMergeToUsdMenuItem': 'Could not create menu item for merge to USD', + 'kMenuCacheToUsd': 'Cache to USD...', + 'kMenuMergeMayaEdits': 'Merge Maya Edits to USD', # mayaUsdStageConversion.py - register("kStageConversionUnknownMethod", "Unknown stage conversion method: %s") - register("kStageConversionSuccessful", "Mismatching axis/unit have been converted for accurate scale.") + "kStageConversionUnknownMethod": "Unknown stage conversion method: %s", + "kStageConversionSuccessful": "Mismatching axis/unit have been converted for accurate scale.", + + # mayaUsdAddMayaReference.mel + "kMayaRefDescription": "Description", + "kMayaRefCacheToUSDDescription1": "

Export your Maya Reference to a USD cache file on disk. This workflow enables you to work with Maya data in USD scenes and then export them to a USD cache and author it back into your current USD hierarchy. Use the Cache Options section to build out the scope of your output.

", + "kMayaRefCacheToUSDDescription2": "

Note: When authoring the exported USD cache back into a current USD hierarchy, an edit will be made on the targeted layer. The cache file will be added as a USD reference, defined either in a variant or prim.

", + "kMayaRefAddToUSDDescription1": "

Add a Maya reference to a USD prim to enable working with original Maya data in your USD scene. Select a Maya scene file to add as a reference. Once a Maya reference file is added, a Maya transform node will appear in the Outliner at your selected prim, containing your newly added Maya reference. Use this dialog to build out the scope of your Maya reference.

", + "kMayaRefAddToUSDDescription2": "

Tip: Define your Maya Reference in a USD variant. This will enable your prim to have 2 variants you can switch between in the Outliner the Maya reference and its USD cache.

", + "kMayaRefUsdOptions": "Author Maya Reference File to USD", + "kMayaRefMayaRefPrimName": "Maya Reference Prim Name:", + "kMayaRefGroup": "Group", + "kMayaRefPrimName": "Prim Name:", + "kMayaRefPrimType": "Prim Type:", + "kMayaRefPrimKind": "Prim Kind:", + "kMayaRefDefineInVariant": "Define in Variant", + "kMayaRefDefineInVariantAnn": "Select this checkbox to define the Maya Reference in a USD variant. This will enable your prim to have 2 variants you can switch between in the Outliner the Maya reference and its USD cache.", + "kMayaRefVariantSetName": "Variant Set Name:", + "kMayaRefVariantName": "Variant Name:", + "kMayaRefVariantOnPrim": "Variant will be on prim:", + "kMayaRefEditAsMayaData": "Edit as Maya Data", + "kMayaRefEditAsMayaDataAnn": "Select this checkbox to enable editing the MayaReference prim as a Maya Reference.", + "kMayaRefOptions": "Maya Reference Options", + "kMayaRefCreateNew": "Create New", + "kMayaRefAddToPrim": "Add Maya Reference to Prim", + "kMayaRefReference": "Reference", + + # Used in multiple places. + "kAllUsdFiles": "All USD Files", + "kUsdFiles": "USD Files", + "kUsdASCIIFiles": "USD ASCII Files", + "kUsdBinaryFiles": "USD Binary Files", + "kUsdCompressedFiles": "USD Compressed Files", +} + + +def registerPluginResources(pluginId, resources): + ''' + Registers all the given resources for the given plugin ID. + ''' + for stringId, resourceStr in resources.items(): + registerPluginResource(pluginId, stringId, resourceStr) + + +def unregisterPluginResources(pluginId, resources): + ''' + Unregisters all the given resources for the given plugin ID. + ''' + for stringId, _ in resources.items(): + unregisterPluginResource(pluginId, stringId) + + +def unregisterPluginResource(pluginId, stringId): + ''' + Unregisters the given string ID for the given plugin ID. + ''' + fullId = 'p_%s.%s' % (pluginId, stringId) + if not cmds.displayString(fullId, exists=True): + return + cmds.displayString(fullId, delete=True) def registerPluginResource(pluginId, stringId, resourceStr): '''See registerPluginResource.mel in Maya. Unfortunately there is no equivalent python version of this MEL proc - so we created our own version of it here.''' + so we created our own version of it here. + + We also re-implement it here because we don't want warnings when registering + the same string again, which happens when re-loading the plugin.''' fullId = 'p_%s.%s' % (pluginId, stringId) if cmds.displayString(fullId, exists=True): diff --git a/plugin/adsk/plugin/plugin.cpp b/plugin/adsk/plugin/plugin.cpp index a2b2e2bb4a..80f03685a1 100644 --- a/plugin/adsk/plugin/plugin.cpp +++ b/plugin/adsk/plugin/plugin.cpp @@ -376,6 +376,8 @@ MStatus uninitializePlugin(MObject obj) "-typeLabel \"mayaUsdProxyShape.filePath\" -temporary"); CHECK_MSTATUS(status); + MGlobal::executeCommand("mayaUSDUnregisterStrings()"); + status = MayaUsd::ufe::finalize(); CHECK_MSTATUS(status); diff --git a/plugin/adsk/scripts/mayaUSDRegisterStrings.mel b/plugin/adsk/scripts/mayaUSDRegisterStrings.mel index e67f86073a..6ff000241b 100644 --- a/plugin/adsk/scripts/mayaUSDRegisterStrings.mel +++ b/plugin/adsk/scripts/mayaUSDRegisterStrings.mel @@ -13,11 +13,6 @@ // limitations under the License. // -proc register(string $key, string $value) -{ - registerPluginResource("mayaUsdPlugin", $key, $value); -} - global proc string getMayaUsdString(string $key) { return getPluginResource("mayaUsdPlugin", $key); @@ -25,362 +20,22 @@ global proc string getMayaUsdString(string $key) global proc mayaUSDRegisterStrings() { - register("kButtonSave", "Save"); - register("kButtonSet", "Set"); - register("kButtonCancel", "Cancel"); - register("kCreateUsdStageFromFile", "Create USD Stage from File"); - register("kCreateUsdStageFromFileOptions", "Create USD Stage from File Options"); - register("kEditAsMayaData", "Edit As Maya Data"); - register("kEditAsMayaDataOptions", "Edit As Maya Data Options"); - register("kHelpOnEditAsMayaDataOptions", "Help on Edit As Maya Data Options"); - register("kCreateStageFromFile", "Create Stage from File"); - register("kCreateStage", "Create"); - register("kDefaultPrim", "Default Prim"); - register("kDefaultPrimAnn", "As part of its metadata, each stage can identify a default prim. This is the primitive that is referenced in if you reference in a file. Right-click a root prim in a stage to set it as your default prim. Use the same method to clear a default prim once it has been set."); - register("kExcludePrimPaths", "Exclude Prim Paths:"); - register("kExcludePrimPathsAnn", "Specify the path of a prim to exclude it from the viewport display. Multiple prim paths must be separated by a comma."); - register("kExcludePrimPathsSbm", "Specify the path of a prim to exclude it from the viewport display."); - register("kFileAnn", "Load in a file as the stage source."); - register("kInvalidSelectionKind", "Invalid Maya Usd selection kind!"); - register("kKinds", "Kinds"); - register("kLabelStage", "Stage"); - register("kLabelStageSource", "Stage Source"); - register("kLabelStageDisplay", "Stage Display"); - register("kStageAdvancedLabel", "Advanced"); - register("kStageAxisUnitConversionLabel", "Axis & Unit Conversion"); - register("kStageUpAxisLabel", "Up Axis"); - register("kStageUpAxisAnn", "If selected, when an up axis mismatch is detected\n" + - "between the imported data and your scene preferences,\n" + - "an automatic correction will be performed."); - register("kStageUnitLabel", "Unit"); - register("kStageUnitAnn", "If selected, when a unit mismatch is detected\n" + - "between the imported data and your scene preferences,\n" + - "an automatic correction will be performed."); - register("kStageAxisAndUnitMethod", "Method"); - // Note: initial is used to force Qt to render the text as HTML. - register("kStageAxisAndUnitMethodAnn", "Select the method for axis/unit conversions.
" + - "
" + - "Rotate/Scale: Rotate/Scale the stage.
" + - "Overwrite Maya Preferences: Update Maya's axis/unit preferences based on the imported data."); - register("kStageAxisAndUnitRotateScale", "Rotate/Scale"); - register("kStageAxisAndUnitOverwritePrefs", "Overwrite Maya Preferences"); - register("kLoad", "Load"); - register("kLoadPayloads", "Load Payloads:"); - register("kLoadPayloadsAnn", "When on, loads all prims marked as payloads. When off, all prims marked as payloads and their children are not loaded."); - register("kLoadPayloadsSbm", "Loads prims marked as payloads"); - register("kMenuAddSublayer", "Add Sublayer"); - register("kMenuAddParentLayer", "Add Parent Layer"); - register("kMenuClear", "Clear"); - register("kMenuReload", "Reload"); - register("kMenuLayerEditor", "USD Layer Editor"); - register("kContextMenuLayerEditor", "USD Layer Editor..."); - register("kMenuLayerEditorAnn", "Organize and edit USD data in layers"); - register("kMenuLoadSublayers", "Load Sublayers..."); - register("kMenuLock", "Lock"); - register("kMenuLockLayerAndSublayers", "Lock Layer and Sublayers"); - register("kMenuMute", "Mute"); - register("kMenuPrintToScriptEditor", "Print to Script Editor"); - register("kMenuRemove", "Remove"); - register("kMenuSelectPrimsWithSpec", "Select Prims With Spec"); - register("kMenuStageCreateMenuError", "Could not create mayaUSD create menu"); - register("kMenuStageWithNewLayer", "Stage with New Layer"); - register("kMenuStageWithNewLayerAnn", "Create a new, empty USD Stage"); - register("kMenuStageFromFile", "Stage From File..."); - register("kMenuStageFromFileAnn", "Create a USD Stage from an existing USD file"); - register("kMenuStageFromFileOptionsAnn", "Create a USD Stage from an existing USD file options"); - register("kMenuStageSubMenu", "Universal Scene Description (USD)"); - register("kMenuStageSubMenuAnn", "Create a USD stage"); - register("kMenuSaveAs", "Save As..."); - register("kMenuSetAs", "Set As..."); - register("kMenuSaveEdits", "Save Edits"); - register("kMenuUnlock", "Unlock"); - register("kMenuUnlockLayerAndSublayers", "Unlock Layer and Sublayers"); - register("kMenuUnmute", "Unmute"); - register("kPointInstances", "Point Instances"); - register("kPurposeAnn", "Toggle purpose categories on and off to change their visibility in the viewport."); - register("kPurposeLabel", "Purpose"); - register("kPurposeOption1", "Guide"); - register("kPurposeOption2", "Proxy"); - register("kPurposeOption3", "Render"); - register("kPrimPath", "Prim Path:"); - register("kPrimPathAnn", "Specify the path of a prim to display it alone in the viewport. If a prim path is not specified or a matching prim path is not found, all prims in the stage are displayed."); - register("kPrimPathSbm", "Specify the path of a prim to display it alone in the viewport."); - register("kRootLayer", "Root Layer"); - register("kRootLayerAnn", "Identifies the root layer of a stage. If a file path is shown in this field, the root layer is a file on disk. If a layerName is shown in this field, the root layer is an anonymous layer."); - register("kSaveAndClose", "Save and Close"); - register("kSaveOption1", "Save the Maya scene file and USD files."); - register("kSaveOption2", "Save all edits (including USD) to the Maya scene file."); - register("kSaveOption3", "Save the Maya scene file only (USD edits will not be saved)."); - register("kSaveOptionAnn1", "Select this option to save your Maya scene file (.ma, .mb) and your USD files (.usd, .usda, .usdc) to disk respectively."); - register("kSaveOptionAnn2", "Select this option to save your current Maya session with in-memory USD edits into a Maya scene file on disk (.ma, .mb). Important: any files exceeding the limit of 2 GB cannot be saved."); - register("kSaveOptionAnn3", "Select this option to ignore all USD edits and save only your Maya scene file (.ma, .mb)."); - register("kSaveOptionAsk", "Ask me"); - register("kSaveOptionAskAnn", "If disabled, the selected USD save operation will always proceed."); - register("kSaveOptionNoPrompt", "Don't ask me again"); - register("kSaveOptionNoPromptAnn", "You can re-enable this prompt under File|Save Scene Options."); - register("kSaveOptionTitle", "Save USD Options"); - register("kSaveOptionUnsavedEdits", "You have unsaved USD edits. How would you like to proceed?"); - register("kShareStageShareable", "Shareable"); - register("kShareStageAnn", "Toggle sharable on and off to sandbox your changes and create a new stage"); - register("kShowArrayAttributes", "Show Array Attributes"); - register("kUSDPointInstancesPickMode_PointInstancer", "Point Instancer"); - register("kUSDPointInstancesPickMode_PointInstancerAnn", "Selection mode for all prims set as point instances."); - register("kUSDPointInstancesPickMode_Instances", "Instances"); - register("kUSDPointInstancesPickMode_InstancesAnn", "Selection mode for prims set as instanceable only."); - register("kUSDPointInstancesPickMode_Prototypes", "Prototypes"); - register("kUSDPointInstancesPickMode_PrototypesAnn", "Selection mode for prims set as prototypes only."); - register("kUSDSelectionMode", "USD Selection Mode"); - register("kUSDSelectionModeAnn", "Choose a selection mode to reflect changes when you select prims in the Viewport and Outliner. Note: Default fallback selection mode is by prim."); - register("kUSDSelectionModeAssemblyAnn", "Selection mode for prims set to assembly kind. Tip: Set assembly kind in the Attribute Editor > Metadata to prims that are part of an important group."); - register("kUSDSelectionModeComponentAnn", "Selection mode for prims set to component kind. Tip: Set component kind in the Attribute Editor > Metadata to prims that are a collection of assets."); - register("kUSDSelectionModeCustom", "Selection mode for prims set to ^1s kind."); - register("kUSDSelectionModeGroupAnn", "Selection mode for prims set to group kind (including prims set to assembly kind). Tip: Set group kind in the Attribute Editor > Metadata to prims that are grouped."); - register("kUSDSelectionModeModelAnn", "Selection mode for prims in the model hierarchy (including prims set to group, assembly and component kind)."); - register("kUSDSelectionModeNone", "(None)"); - register("kUSDSelectionModeNoneAnn", "Selection mode for prims that have no kind set."); - register("kUSDSelectionModeSubComponentAnn", "Selection mode for prims set to subcomponent kind. Tip: Set subcomponent kind in the Attribute Editor > Metadata to prims that are an individual asset."); - register("kTimeAnn", "Edits the current time value of a stage, which corresponds to the animation frame drawn in the viewport. By default, this value connects to Maya's global time node."); - register("kTipYouCanChooseMultipleFiles", "Tip: You can choose multiple files."); - register("kUniversalSceneDescription", "Universal Scene Description"); - register("kUsdOptionsFrameLabel", "Universal Scene Description (USD) Options"); - register("kSaveOption2GBWarning", "Important: 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("kExportMaterialsCBAnn", "If selected, material/shading data is included as part of the export."); - register("kExportMaterialsCBLbl", "Materials"); - register("kExportAssignedMaterialsAnn", "If selected, only materials assigned to geometry will be exported."); - register("kExportAssignedMaterialsLbl", "Assigned Materials Only"); - register("kExportMeshesLbl", "Meshes"); - register("kExportMeshesAnn", "If selected, mesh geometry is extracted for USD export."); - register("kExportCamerasLbl", "Cameras"); - register("kExportCamerasAnn", "If selected, cameras are extracted for USD export."); - register("kExportLightsLbl", "Lights"); - register("kExportLightsAnn", "If selected, lights are extracted for USD export."); - register("kExportComponentTagsAnn", "If selected, component tags get exported as USDGeomSubsets. Note: Edges and vertices are unsupported in USD."); - register("kExportComponentTagsLbl", "Component Tags"); - register("kExportStagesAsRefsAnn", "If selected, USD stages created from file will export as USD references."); - register("kExportStagesAsRefsLbl", "USD Stages as USD References"); - register("kExportCurvesAnn", "If selected, curves get exported to USD primTypes NurbsCurves or BasisCurves."); - register("kExportCurvesLbl", "NURBS Curves"); - 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("kExportPluginConfigLbl", "Plug-in Configurations"); - register("kExportPluginConfigAnn", "Turn on the plug-ins you wish to include for this process.\n" + - "When turned on, plug-ins (like Arnold) can modify or create data to ensure compatibility.\n" + - "Plug-ins may have extra settings you can adjust."); - register("kExportPluginConfigButtonAnn", "Options"); - register("kExportMaterialsAnn", "Select the material(s) to bind to prims for export. With USD, you can bind multiple materials to prims."); - register("kExportMaterialsDefaultScopeName", "mtl"); - register("kExportMergeShapesAnn", "Merges Maya transform and shape nodes into a single USD prim."); - register("kExportMergeShapesLbl", "Merge Transform and Shape Nodes"); - register("kExportIncludeEmptyTransformsAnn", "If selected, transforms that don't contain objects other\n" + - "than transforms will be included as part of the export\n" + - "(ex: empty groups, or groups that contain empty groups,\n" + - "and so on)."); - register("kExportIncludeEmptyTransformsLbl", "Include Empty Transforms"); - register("kExportNamespacesAnn", "By default, namespaces are exported to the USD file in the following format: nameSpaceExample_pPlatonic1"); - register("kExportNamespacesLbl", "Include Namespaces"); - register("kExportWorldspaceAnn", "Exports the root prims with their worldspace transform instead of their local transform."); - register("kExportWorldspaceLbl", "Worldspace Roots"); - register("kExportRootPrimAnn", "Name the root/parent prim for your exported data."); - register("kExportRootPrimLbl", "Create Root Prim:"); - register("kExportRootPrimPht", "USD Prim Name"); - register("kExportRootPrimTypeLbl", "Root Prim Type:"); - register("kExportScopeLbl", "Scope"); - register("kExportXformLbl", "Xform"); - register("kExportScopeAnn", "scope"); - register("kExportXformAnn", "xform"); - 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("kExportRelativeTexturesAnn", - "Choose whether your texture files are written as relative\n" + - "or absolute paths as you export them to USD. If you select\n" + - "Automatic, it will be chosen for you in the exported USD file\n" + - "based on what they currently are as Maya data."); - register("kExportRelativeTexturesAutomaticLbl", "Automatic"); - register("kExportRelativeTexturesAbsoluteLbl", "Absolute"); - register("kExportRelativeTexturesRelativeLbl", "Relative"); - register("kExportRelativeTexturesLbl", "Texture File Paths:"); - register("kExportVisibilityAnn", "Exports Maya visibility attributes as USD metadata."); - register("kExportVisibilityLbl", "Visibility"); - register("kExportDefaultPrimLbl", "Default Prim"); - register("kExportDefaultPrimNoneLbl", "None"); - register("kExportDefaultPrimAnn", "As part of its metadata, each USD stage can identify a default prim.\nThis is the primitive that is referenced in if you reference in a file."); - - register("kExportAxisAndUnitLbl", "Axis & Unit Conversion"); - register("kExportUpAxisLbl", "Up Axis"); - register("kExportUpAxisAnn", "Select the up axis for the export file.
" + - "Rotation will be applied if converting to a different axis.
" + - "None: do not author upAxis.
" + - "Use Maya Preferences: use the axis of the current scene."); - register("kExportUpAxisNoneLbl", "None"); - register("kExportUpAxisMayaPrefsLbl", "Use Maya Preferences"); - register("kExportUpAxisYLbl", "Y"); - register("kExportUpAxisZLbl", "Z"); - - register("kExportUnitLbl", "Unit"); - register("kExportUnitAnn", "Select the unit for the export file." + - " Scaling will be applied if converting to a different unit.
" + - "None: Do not scale or write out unit metadata.
" + - "Use Maya Preferences: Use the unit of the current scene.
"); - register("kExportUnitNoneLbl", "None"); - register("kExportUnitMayaPrefsLbl", "Use Maya Preferences"); - register("kExportUnitMillimeterLbl", "Millimeter"); - register("kExportUnitCentimeterLbl", "Centimeter"); - register("kExportUnitMeterLbl", "Meter"); - register("kExportUnitKilometerLbl", "Kilometer"); - register("kExportUnitInchLbl", "Inch"); - register("kExportUnitFootLbl", "Foot"); - register("kExportUnitYardLbl", "Yard"); - register("kExportUnitMileLbl", "Mile"); - - // 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", "Automatic"); - register("kImportMaterialConvSSLbl","Standard Surface"); - register("kImportMaterialConvLamLbl", "Lambert"); - register("kImportMaterialConvPSLbl", "USD Preview Surface"); - register("kImportMaterialConvBlnLbl", "Blinn"); - register("kImportMaterialConvPhgLbl", "Phong"); - register("kImportRelativeTexturesLbl", "Texture File Paths:"); - register("kImportRelativeTexturesAnn", "Choose whether your texture files are written as relative or absolute paths\n" + - "as you import them to Maya. If you select Automatic, it will be chosen for you\n" + - "in the import based on what they currently are as USD data."); - register("kImportRelativeTexturesAutomaticLbl", "Automatic"); - register("kImportRelativeTexturesAbsoluteLbl", "Absolute"); - register("kImportRelativeTexturesRelativeLbl", "Relative"); - 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 Hierarchy View to build the scope of your import and switch variants.

Scope: 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 Hierarchy View to select and deselect prims to build the scope of your import.

Variant: 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", "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("kImportVariantsInScopeNumLbl", "Variants Switched in Scope:"); - register("kImportPluginConfigLbl", "Plug-in Configurations"); - register("kImportPluginConfigAnn", "Turn on the plug-ins you wish to include for this process.\n" + - "When turned on, plug-ins (like Arnold) can modify or create data to ensure compatibility.\n" + - "Plug-ins may have extra settings you can adjust."); - register("kImportPluginConfigButtonAnn", "Options"); - - register("kImportAxisAndUnit", "Axis & Unit Conversion"); - register("kImportUpAxis", "Up Axis"); - register("kImportUpAxisAnn", "If selected, when an up axis mismatch is detected\n" + - "between the imported data and your scene preferences,\n" + - "an automatic correction will be performed."); - register("kImportUnit", "Unit"); - register("kImportUnitAnn", "If selected, when a unit mismatch is detected\n" + - "between the imported data and your scene preferences,\n" + - "an automatic correction will be performed."); - register("kImportAxisAndUnitMethod", "Method"); - // Note: initial is used to force Qt to render the text as HTML. - register("kImportAxisAndUnitMethodAnn", "Select the method for axis/unit conversions.
" + - "
" + - "Rotate/Scale: Rotate/Scale the stage.
" + - "Add Parent Transform: Rotate/Scale all objects within the imported data as a group
" + - "Overwrite Maya Preferences: Update Maya's axis/unit preferences based on the imported data."); - register("kImportAxisAndUnitRotateScale", "Rotate/Scale"); - register("kImportAxisAndUnitAddTransform", "Add Parent Transform"); - register("kImportAxisAndUnitOverwritePrefs", "Overwrite Maya Preferences"); - - register("kMayaDiscardEdits", "Discard Maya Edits"); - register("kMayaRefDiscardEdits", "Cancel Editing as Maya Data"); - register("kMayaRefDuplicateAsUsdData", "Duplicate As USD Data"); - register("kMayaRefDuplicateAsUsdDataDiv", "Stages"); - register("kMayaRefDuplicateAsUsdDataOptions", "Options..."); - - // All strings for the USD Global Preferences: - register("kUSDPreferences", "USD: USD Preferences"); - register("KSavingUSDFiles", "Save USD Files"); - register("kdotusdFileFormat", ".usd File Format:"); - register("kAscii", "ASCII"); - register("kBinary", "Binary"); - register("KViewport", "Viewport"); - register("KUntexturedMode", "Untextured mode"); - register("KMaterialColors", "Material Colors"); - register("KDisplayColors", "Display Colors"); - register("KUntexturedModeAnn", "Choose what your colors should display as in the viewport. Select from default material colors or USD display colors. Select display colors when working in USD as material colors may be inaccurate from the endless types available."); - register("kSaveLayerUsdFileFormatAnn", "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 preference."); - register("kSaveLayerUsdFileFormatSbm", "Select whether the .usd file is written out in binary or ASCII"); - register("kConfirmExistFileSave", "Confirm Save of Existing Files"); - register("kSavingMayaSceneFiles", "Save Maya Scene Files"); - register("kRelativePathing", "Relative Pathing"); - register("kAllRelativeToggle", "All files"); - register("kAllRelativeToggleAnn", "When on, all of your files will be written as relative paths."); - register("kRootLayersRelativeToSceneFile", "Root layers"); - register("kRootLayersRelativeToSceneFileAnn", "When on, your USD root layer file will be written as relative paths to your Maya scene file."); - register("kSubLayersRelativeToParentLayer", "Sublayers"); - register("kSubLayersRelativeToParentLayerAnn", "When on, all sublayers will be written as relative paths to their parent layers."); - register("kReferencesRelativeToEditTargetLayer", "USD References/payloads"); - register("kReferencesRelativeToEditTargetLayerAnn", "When on, any USD references or payloads will be written as relative paths to their respective edit target layer."); - register("kFileDependenciesRelativeToEditTargetLayer", "File dependencies"); - register("kFileDependenciesRelativeToEditTargetLayerAnn", "When on, any file dependencies, such as textures or Maya references will be written as relative paths to their respective edit target layer."); - // 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 // the 'mayaUsdPlugin' plugin. python("import mayaUSDRegisterStrings; mayaUSDRegisterStrings.mayaUSDRegisterStrings()"); // Register the strings from the MayaUsd Lib. - mayaUsdLibRegisterStrings(); python("import mayaUsdLibRegisterStrings; mayaUsdLibRegisterStrings.mayaUsdLibRegisterStrings()"); // load any localized resources loadPluginLanguageResources("mayaUsdPlugin", "mayaUsdPlugin.pres.mel"); } + +global proc mayaUSDUnregisterStrings() +{ + python("import mayaUSDRegisterStrings; mayaUSDRegisterStrings.mayaUSDUnregisterStrings()"); + python("import mayaUsdLibRegisterStrings; mayaUsdLibRegisterStrings.mayaUsdLibUnregisterStrings()"); +} diff --git a/plugin/adsk/scripts/mayaUSDRegisterStrings.py b/plugin/adsk/scripts/mayaUSDRegisterStrings.py index 4a205b1915..7a33c80d10 100644 --- a/plugin/adsk/scripts/mayaUSDRegisterStrings.py +++ b/plugin/adsk/scripts/mayaUSDRegisterStrings.py @@ -15,10 +15,375 @@ import maya.cmds as cmds import maya.mel as mel -from mayaUsdLibRegisterStrings import registerPluginResource, getPluginResource +from mayaUsdLibRegisterStrings import registerPluginResources, unregisterPluginResources, getPluginResource -def register(key, value): - registerPluginResource('mayaUsdPlugin', key, value) +__mayaUSDStringResources = { + "kButtonYes": "Yes", + "kButtonNo": "No", + "kDiscardStageEditsTitle": "Discard Edits on ^1s's Layers", + "kDiscardStageEditsLoadMsg": "Are you sure you want to load in a new file as the stage source?\n\nAll edits on your layers in ^1s will be discarded.", + "kDiscardStageEditsReloadMsg": "Are you sure you want to reload ^1s as the stage source?\n\nAll edits on your layers (except the session layer) in ^2s will be discarded.", + "kLoadUSDFile": "Load USD File", + "kFileOptions": "File Options", + "kRelativePathOptions": "Relative Pathing", + "kMakePathRelativeToSceneFile": "Make Path Relative to Scene File", + "kMakePathRelativeToSceneFileAnn": "Path will be relative to your Maya scene file.", + "kMakePathRelativeToEditTargetLayer": "Make Path Relative to Edit Target Layer Directory", + "kMakePathRelativeToEditTargetLayerAnn": "Enable to activate relative pathing to your current edit target layer's directory.", + "kMakePathRelativeToImageEditTargetLayer": "Make Path Relative to Edit Target Layer Directory", + "kMakePathRelativeToImageEditTargetLayerAnn": "Enable to activate relative pathing to your current edit target layer's directory.", + "kMakePathRelativeToParentLayer": "Make Path Relative to Parent Layer Directory", + "kMakePathRelativeToParentLayerAnn": "Enable to activate relative pathing to your current parent layer's directory.", + "kUnresolvedPath": "Path Preview:", + "kUnresolvedPathAnn": "This field indicates the path with the file name currently chosen in your text input. Note: This is the string that will be written out to the file in the chosen directory in order to enable portability.", + "kCompositionArcOptions": "Composition Arc Options", + "kPreview": "Preview", + + "kButtonSave": "Save", + "kButtonSet": "Set", + "kButtonCancel": "Cancel", + "kCreateUsdStageFromFile": "Create USD Stage from File", + "kCreateUsdStageFromFileOptions": "Create USD Stage from File Options", + "kEditAsMayaData": "Edit As Maya Data", + "kEditAsMayaDataOptions": "Edit As Maya Data Options", + "kHelpOnEditAsMayaDataOptions": "Help on Edit As Maya Data Options", + "kCreateStageFromFile": "Create Stage from File", + "kCreateStage": "Create", + "kDefaultPrim": "Default Prim", + "kDefaultPrimAnn": "As part of its metadata, each stage can identify a default prim. This is the primitive that is referenced in if you reference in a file. Right-click a root prim in a stage to set it as your default prim. Use the same method to clear a default prim once it has been set.", + "kExcludePrimPaths": "Exclude Prim Paths:", + "kExcludePrimPathsAnn": "Specify the path of a prim to exclude it from the viewport display. Multiple prim paths must be separated by a comma.", + "kExcludePrimPathsSbm": "Specify the path of a prim to exclude it from the viewport display.", + "kFileAnn": "Load in a file as the stage source.", + "kInvalidSelectionKind": "Invalid Maya Usd selection kind!", + "kKinds": "Kinds", + "kLabelStage": "Stage", + "kLabelStageSource": "Stage Source", + "kLabelStageDisplay": "Stage Display", + "kStageAdvancedLabel": "Advanced", + "kStageAxisUnitConversionLabel": "Axis & Unit Conversion", + "kStageUpAxisLabel": "Up Axis", + "kStageUpAxisAnn": "If selected, when an up axis mismatch is detected\n" + + "between the imported data and your scene preferences,\n" + + "an automatic correction will be performed.", + "kStageUnitLabel": "Unit", + "kStageUnitAnn": "If selected, when a unit mismatch is detected\n" + + "between the imported data and your scene preferences,\n" + + "an automatic correction will be performed.", + "kStageAxisAndUnitMethod": "Method", + # Note: initial is used to force Qt to render the text as HTML. + "kStageAxisAndUnitMethodAnn": "Select the method for axis/unit conversions.
" + + "
" + + "Rotate/Scale: Rotate/Scale the stage.
" + + "Overwrite Maya Preferences: Update Maya's axis/unit preferences based on the imported data.", + "kStageAxisAndUnitRotateScale": "Rotate/Scale", + "kStageAxisAndUnitOverwritePrefs": "Overwrite Maya Preferences", + "kLoad": "Load", + "kLoadPayloads": "Load Payloads:", + "kLoadPayloadsAnn": "When on, loads all prims marked as payloads. When off, all prims marked as payloads and their children are not loaded.", + "kLoadPayloadsSbm": "Loads prims marked as payloads", + "kMenuAddSublayer": "Add Sublayer", + "kMenuAddParentLayer": "Add Parent Layer", + "kMenuClear": "Clear", + "kMenuReload": "Reload", + "kMenuLayerEditor": "USD Layer Editor", + "kContextMenuLayerEditor": "USD Layer Editor...", + "kMenuLayerEditorAnn": "Organize and edit USD data in layers", + "kMenuLoadSublayers": "Load Sublayers...", + "kMenuLock": "Lock", + "kMenuLockLayerAndSublayers": "Lock Layer and Sublayers", + "kMenuMute": "Mute", + "kMenuPrintToScriptEditor": "Print to Script Editor", + "kMenuRemove": "Remove", + "kMenuSelectPrimsWithSpec": "Select Prims With Spec", + "kMenuStageCreateMenuError": "Could not create mayaUSD create menu", + "kMenuStageWithNewLayer": "Stage with New Layer", + "kMenuStageWithNewLayerAnn": "Create a new, empty USD Stage", + "kMenuStageFromFile": "Stage From File...", + "kMenuStageFromFileAnn": "Create a USD Stage from an existing USD file", + "kMenuStageFromFileOptionsAnn": "Create a USD Stage from an existing USD file options", + "kMenuStageSubMenu": "Universal Scene Description (USD)", + "kMenuStageSubMenuAnn": "Create a USD stage", + "kMenuSaveAs": "Save As...", + "kMenuSetAs": "Set As...", + "kMenuSaveEdits": "Save Edits", + "kMenuUnlock": "Unlock", + "kMenuUnlockLayerAndSublayers": "Unlock Layer and Sublayers", + "kMenuUnmute": "Unmute", + "kPointInstances": "Point Instances", + "kPurposeAnn": "Toggle purpose categories on and off to change their visibility in the viewport.", + "kPurposeLabel": "Purpose", + "kPurposeOption1": "Guide", + "kPurposeOption2": "Proxy", + "kPurposeOption3": "Render", + "kPrimPath": "Prim Path:", + "kPrimPathAnn": "Specify the path of a prim to display it alone in the viewport. If a prim path is not specified or a matching prim path is not found, all prims in the stage are displayed.", + "kPrimPathSbm": "Specify the path of a prim to display it alone in the viewport.", + "kRootLayer": "Root Layer", + "kRootLayerAnn": "Identifies the root layer of a stage. If a file path is shown in this field, the root layer is a file on disk. If a layerName is shown in this field, the root layer is an anonymous layer.", + "kSaveAndClose": "Save and Close", + "kSaveOption1": "Save the Maya scene file and USD files.", + "kSaveOption2": "Save all edits (including USD) to the Maya scene file.", + "kSaveOption3": "Save the Maya scene file only (USD edits will not be saved).", + "kSaveOptionAnn1": "Select this option to save your Maya scene file (.ma, .mb) and your USD files (.usd, .usda, .usdc) to disk respectively.", + "kSaveOptionAnn2": "Select this option to save your current Maya session with in-memory USD edits into a Maya scene file on disk (.ma, .mb). Important: any files exceeding the limit of 2 GB cannot be saved.", + "kSaveOptionAnn3": "Select this option to ignore all USD edits and save only your Maya scene file (.ma, .mb).", + "kSaveOptionAsk": "Ask me", + "kSaveOptionAskAnn": "If disabled, the selected USD save operation will always proceed.", + "kSaveOptionNoPrompt": "Don't ask me again", + "kSaveOptionNoPromptAnn": "You can re-enable this prompt under File|Save Scene Options.", + "kSaveOptionTitle": "Save USD Options", + "kSaveOptionUnsavedEdits": "You have unsaved USD edits. How would you like to proceed?", + "kShareStageShareable": "Shareable", + "kShareStageAnn": "Toggle sharable on and off to sandbox your changes and create a new stage", + "kShowArrayAttributes": "Show Array Attributes", + "kUSDPointInstancesPickMode_PointInstancer": "Point Instancer", + "kUSDPointInstancesPickMode_PointInstancerAnn": "Selection mode for all prims set as point instances.", + "kUSDPointInstancesPickMode_Instances": "Instances", + "kUSDPointInstancesPickMode_InstancesAnn": "Selection mode for prims set as instanceable only.", + "kUSDPointInstancesPickMode_Prototypes": "Prototypes", + "kUSDPointInstancesPickMode_PrototypesAnn": "Selection mode for prims set as prototypes only.", + "kUSDSelectionMode": "USD Selection Mode", + "kUSDSelectionModeAnn": "Choose a selection mode to reflect changes when you select prims in the Viewport and Outliner. Note: Default fallback selection mode is by prim.", + "kUSDSelectionModeAssemblyAnn": "Selection mode for prims set to assembly kind. Tip: Set assembly kind in the Attribute Editor > Metadata to prims that are part of an important group.", + "kUSDSelectionModeComponentAnn": "Selection mode for prims set to component kind. Tip: Set component kind in the Attribute Editor > Metadata to prims that are a collection of assets.", + "kUSDSelectionModeCustom": "Selection mode for prims set to ^1s kind.", + "kUSDSelectionModeGroupAnn": "Selection mode for prims set to group kind (including prims set to assembly kind). Tip: Set group kind in the Attribute Editor > Metadata to prims that are grouped.", + "kUSDSelectionModeModelAnn": "Selection mode for prims in the model hierarchy (including prims set to group, assembly and component kind).", + "kUSDSelectionModeNone": "(None)", + "kUSDSelectionModeNoneAnn": "Selection mode for prims that have no kind set.", + "kUSDSelectionModeSubComponentAnn": "Selection mode for prims set to subcomponent kind. Tip: Set subcomponent kind in the Attribute Editor > Metadata to prims that are an individual asset.", + "kTimeAnn": "Edits the current time value of a stage, which corresponds to the animation frame drawn in the viewport. By default, this value connects to Maya's global time node.", + "kTipYouCanChooseMultipleFiles": "Tip: You can choose multiple files.", + "kUniversalSceneDescription": "Universal Scene Description", + "kUsdOptionsFrameLabel": "Universal Scene Description (USD) Options", + "kSaveOption2GBWarning": "Important: per layer, any data exceeding the limit of 2GB will not be saved.", + + # All strings for export dialog: + "kExportAnimDataAnn": "Exports Maya animation data as USD time samples.", + "kExportAnimDataLbl": "Animation Data", + "kExportBlendShapesAnn": "Exports Maya Blend Shapes as USD blendshapes. Requires skeletons to be exported as well.", + "kExportBlendShapesLbl": "Blend Shapes", + "kExportColorSetsAnn": "Exports Maya Color Sets as USD primvars.", + "kExportColorSetsLbl": "Color Sets", + "kExportMaterialsCBAnn": "If selected, material/shading data is included as part of the export.", + "kExportMaterialsCBLbl": "Materials", + "kExportAssignedMaterialsAnn": "If selected, only materials assigned to geometry will be exported.", + "kExportAssignedMaterialsLbl": "Assigned Materials Only", + "kExportMeshesLbl": "Meshes", + "kExportMeshesAnn": "If selected, mesh geometry is extracted for USD export.", + "kExportCamerasLbl": "Cameras", + "kExportCamerasAnn": "If selected, cameras are extracted for USD export.", + "kExportLightsLbl": "Lights", + "kExportLightsAnn": "If selected, lights are extracted for USD export.", + "kExportComponentTagsAnn": "If selected, component tags get exported as USDGeomSubsets. Note: Edges and vertices are unsupported in USD.", + "kExportComponentTagsLbl": "Component Tags", + "kExportStagesAsRefsAnn": "If selected, USD stages created from file will export as USD references.", + "kExportStagesAsRefsLbl": "USD Stages as USD References", + "kExportCurvesAnn": "If selected, curves get exported to USD primTypes NurbsCurves or BasisCurves.", + "kExportCurvesLbl": "NURBS Curves", + "kExportDefaultFormatAnn": "Select whether the .usd file is written out in binary or ASCII", + "kExportDefaultFormatLbl": ".usd File Format:", + "kExportDefaultFormatBinLbl": "Binary", + "kExportDefaultFormatAscLbl": "ASCII", + "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.", + "kExportDisplayColorAnn": "If selected, exports the diffuse color of the geometry's bound shader as a displayColor primvar on the USD mesh.", + "kExportDisplayColorLbl": "Display Colors", + "kExportEulerFilterAnn": "Exports the euler angle filtering that was performed in Maya.", + "kExportEulerFilterLbl": "Euler Filter", + "kExportFrameAdvancedLbl": "Advanced", + "kExportFrameAnimationLbl": "Animation", + "kExportFrameGeometryLbl": "Geometry", + "kExportFrameMaterialsLbl": "Materials", + "kExportFrameOutputLbl": "Output", + "kExportFrameRangeBtn": "Use Animation Range", + "kExportFrameRangeLbl": "Frame Range Start/End:", + "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.", + "kExportFrameSamplesLbl": "Frame Sample:", + "kExportFrameStepAnn": "Specifies the increment between USD time sample frames during animation export", + "kExportFrameStepLbl": "Frame Step:", + "kExportInstancesAnn": "Exports Maya instances as USD instanceable references.", + "kExportInstancesLbl": "Instances:", + "kExportInstancesFlatLbl": "Flatten", + "kExportInstancesRefLbl": "Convert to USD Instanceable References", + "kExportPluginConfigLbl": "Plug-in Configurations", + "kExportPluginConfigAnn": "Turn on the plug-ins you wish to include for this process.\n" + + "When turned on, plug-ins (like Arnold) can modify or create data to ensure compatibility.\n" + + "Plug-ins may have extra settings you can adjust.", + "kExportPluginConfigButtonAnn": "Options", + "kExportMaterialsAnn": "Select the material(s) to bind to prims for export. With USD, you can bind multiple materials to prims.", + "kExportMaterialsDefaultScopeName": "mtl", + "kExportMergeShapesAnn": "Merges Maya transform and shape nodes into a single USD prim.", + "kExportMergeShapesLbl": "Merge Transform and Shape Nodes", + "kExportIncludeEmptyTransformsAnn": "If selected, transforms that don't contain objects other\n" + + "than transforms will be included as part of the export\n" + + "(ex: empty groups, or groups that contain empty groups,\n" + + "and so on).", + "kExportIncludeEmptyTransformsLbl": "Include Empty Transforms", + "kExportNamespacesAnn": "By default, namespaces are exported to the USD file in the following format: nameSpaceExample_pPlatonic1", + "kExportNamespacesLbl": "Include Namespaces", + "kExportWorldspaceAnn": "Exports the root prims with their worldspace transform instead of their local transform.", + "kExportWorldspaceLbl": "Worldspace Roots", + "kExportRootPrimAnn": "Name the root/parent prim for your exported data.", + "kExportRootPrimLbl": "Create Root Prim:", + "kExportRootPrimPht": "USD Prim Name", + "kExportRootPrimTypeLbl": "Root Prim Type:", + "kExportScopeLbl": "Scope", + "kExportXformLbl": "Xform", + "kExportScopeAnn": "scope", + "kExportXformAnn": "xform", + "kExportSkelsAnn": "Exports Maya joints as part of a USD skeleton.", + "kExportSkelsLbl": "Skeletons:", + "kExportSkelsNoneLbl": "None", + "kExportSkelsAllLbl": "All (Automatically Create SkelRoots)", + "kExportSkelsRootLbl": "Only under SkelRoots", + "kExportSkinClustersAnn": "Exports Maya skin clusters as part of a USD skeleton.", + "kExportSkinClustersLbl": "Skin Clusters", + "kExportStaticSingleSampleAnn": "Converts animated values with a single time sample to be static instead.", + "kExportStaticSingleSampleLbl": "Static Single Sample", + "kExportSubdMethodAnn": "Exports the selected subdivision method as a USD uniform attribute.", + "kExportSubdMethodLbl": "Subdivision Method:", + "kExportSubdMethodCCLbl": "Catmull-Clark", + "kExportSubdMethodBiLbl": "Bilinear", + "kExportSubdMethodLoLbl": "Loop", + "kExportSubdMethodNoLbl": "None (Polygonal Mesh)", + "kExportUVSetsAnn": "Exports Maya UV Sets as USD primvars.", + "kExportUVSetsLbl": "UV Sets", + "kExportRelativeTexturesAnn": "Choose whether your texture files are written as relative\n" + + "or absolute paths as you export them to USD. If you select\n" + + "Automatic, it will be chosen for you in the exported USD file\n" + + "based on what they currently are as Maya data.", + "kExportRelativeTexturesAutomaticLbl": "Automatic", + "kExportRelativeTexturesAbsoluteLbl": "Absolute", + "kExportRelativeTexturesRelativeLbl": "Relative", + "kExportRelativeTexturesLbl": "Texture File Paths:", + "kExportVisibilityAnn": "Exports Maya visibility attributes as USD metadata.", + "kExportVisibilityLbl": "Visibility", + "kExportDefaultPrimLbl": "Default Prim", + "kExportDefaultPrimNoneLbl": "None", + "kExportDefaultPrimAnn": "As part of its metadata, each USD stage can identify a default prim.\nThis is the primitive that is referenced in if you reference in a file.", + + "kExportAxisAndUnitLbl": "Axis & Unit Conversion", + "kExportUpAxisLbl": "Up Axis", + "kExportUpAxisAnn": "Select the up axis for the export file.
" + + "Rotation will be applied if converting to a different axis.
" + + "None: do not author upAxis.
" + + "Use Maya Preferences: use the axis of the current scene.", + "kExportUpAxisNoneLbl": "None", + "kExportUpAxisMayaPrefsLbl": "Use Maya Preferences", + "kExportUpAxisYLbl": "Y", + "kExportUpAxisZLbl": "Z", + + "kExportUnitLbl": "Unit", + "kExportUnitAnn": "Select the unit for the export file." + + " Scaling will be applied if converting to a different unit.
" + + "None: Do not scale or write out unit metadata.
" + + "Use Maya Preferences: Use the unit of the current scene.
", + "kExportUnitNoneLbl": "None", + "kExportUnitMayaPrefsLbl": "Use Maya Preferences", + "kExportUnitMillimeterLbl": "Millimeter", + "kExportUnitCentimeterLbl": "Centimeter", + "kExportUnitMeterLbl": "Meter", + "kExportUnitKilometerLbl": "Kilometer", + "kExportUnitInchLbl": "Inch", + "kExportUnitFootLbl": "Foot", + "kExportUnitYardLbl": "Yard", + "kExportUnitMileLbl": "Mile", + + # All strings for import dialog: + "kImportAnimationDataLbl": "Animation Data", + "kImportCustomFrameRangeLbl": "Custom Frame Range", + "kImportFrameRangeLbl": "Frame Range Start/End: ", + "kImportHierarchyViewLbl": "Hierarchy View", + "kImportJobContextAnn": "Select a loaded plug-in configuration to modify import options", + "kImportJobContextLbl": "Plug-in Configuration:", + "kImportJobContextNoneLbl": "None", + "kImportMaterialConvAnn": "Select the preferred conversion method for inbound USD shading data to bind with Maya geometry", + "kImportMaterialConvLbl": "Convert to:", + "kImportMaterialConvNoneLbl": "Automatic", + "kImportMaterialConvSSLbl": "Standard Surface", + "kImportMaterialConvLamLbl": "Lambert", + "kImportMaterialConvPSLbl": "USD Preview Surface", + "kImportMaterialConvBlnLbl": "Blinn", + "kImportMaterialConvPhgLbl": "Phong", + "kImportRelativeTexturesLbl": "Texture File Paths:", + "kImportRelativeTexturesAnn": "Choose whether your texture files are written as relative or absolute paths\n" + + "as you import them to Maya. If you select Automatic, it will be chosen for you\n" + + "in the import based on what they currently are as USD data.", + "kImportRelativeTexturesAutomaticLbl": "Automatic", + "kImportRelativeTexturesAbsoluteLbl": "Absolute", + "kImportRelativeTexturesRelativeLbl": "Relative", + "kImportMaterialsAnn": "If selected, shading data is extracted from the USD file for import", + "kImportMaterialsLbl": "Materials", + "kImportPrimsInScopeNumLbl": "Total Number of Prims in Scope:", + "kImportSelectFileTxt": "Please select a file to enable this option", + "kImportScopeVariantsAnn": "Select a USD file and click Hierarchy View to build the scope of your import and switch variants.

Scope: 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 Hierarchy View to select and deselect prims to build the scope of your import.

Variant: 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.", + "kImportScopeVariantsLbl": "Scope and Variants: ", + "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.", + "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.", + "kImportToInstanceOpt": "Convert Instance Proxies to Instances", + "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.", + "kImportUSDZTxtLbl": "USDZ Texture Import", + "kImportVariantsInScopeNumLbl": "Variants Switched in Scope:", + "kImportPluginConfigLbl": "Plug-in Configurations", + "kImportPluginConfigAnn": "Turn on the plug-ins you wish to include for this process.\n" + + "When turned on, plug-ins (like Arnold) can modify or create data to ensure compatibility.\n" + + "Plug-ins may have extra settings you can adjust.", + "kImportPluginConfigButtonAnn": "Options", + + "kImportAxisAndUnit": "Axis & Unit Conversion", + "kImportUpAxis": "Up Axis", + "kImportUpAxisAnn": "If selected, when an up axis mismatch is detected\n" + + "between the imported data and your scene preferences,\n" + + "an automatic correction will be performed.", + "kImportUnit": "Unit", + "kImportUnitAnn": "If selected, when a unit mismatch is detected\n" + + "between the imported data and your scene preferences,\n" + + "an automatic correction will be performed.", + "kImportAxisAndUnitMethod": "Method", + # Note: initial is used to force Qt to render the text as HTML. + "kImportAxisAndUnitMethodAnn": "Select the method for axis/unit conversions.
" + + "
" + + "Rotate/Scale: Rotate/Scale the stage.
" + + "Add Parent Transform: Rotate/Scale all objects within the imported data as a group
" + + "Overwrite Maya Preferences: Update Maya's axis/unit preferences based on the imported data.", + "kImportAxisAndUnitRotateScale": "Rotate/Scale", + "kImportAxisAndUnitAddTransform": "Add Parent Transform", + "kImportAxisAndUnitOverwritePrefs": "Overwrite Maya Preferences", + + "kMayaDiscardEdits": "Discard Maya Edits", + "kMayaRefDiscardEdits": "Cancel Editing as Maya Data", + "kMayaRefDuplicateAsUsdData": "Duplicate As USD Data", + "kMayaRefDuplicateAsUsdDataDiv": "Stages", + "kMayaRefDuplicateAsUsdDataOptions": "Options...", + + # All strings for the USD Global Preferences: + "kUSDPreferences": "USD: USD Preferences", + "KSavingUSDFiles": "Save USD Files", + "kdotusdFileFormat": ".usd File Format:", + "kAscii": "ASCII", + "kBinary": "Binary", + "KViewport": "Viewport", + "KUntexturedMode": "Untextured mode", + "KMaterialColors": "Material Colors", + "KDisplayColors": "Display Colors", + "KUntexturedModeAnn": "Choose what your colors should display as in the viewport. Select from default material colors or USD display colors. Select display colors when working in USD as material colors may be inaccurate from the endless types available.", + "kSaveLayerUsdFileFormatAnn": "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 preference.", + "kSaveLayerUsdFileFormatSbm": "Select whether the .usd file is written out in binary or ASCII", + "kConfirmExistFileSave": "Confirm Save of Existing Files", + "kSavingMayaSceneFiles": "Save Maya Scene Files", + "kRelativePathing": "Relative Pathing", + "kAllRelativeToggle": "All files", + "kAllRelativeToggleAnn": "When on, all of your files will be written as relative paths.", + "kRootLayersRelativeToSceneFile": "Root layers", + "kRootLayersRelativeToSceneFileAnn": "When on, your USD root layer file will be written as relative paths to your Maya scene file.", + "kSubLayersRelativeToParentLayer": "Sublayers", + "kSubLayersRelativeToParentLayerAnn": "When on, all sublayers will be written as relative paths to their parent layers.", + "kReferencesRelativeToEditTargetLayer": "USD References/payloads", + "kReferencesRelativeToEditTargetLayerAnn": "When on, any USD references or payloads will be written as relative paths to their respective edit target layer.", + "kFileDependenciesRelativeToEditTargetLayer": "File dependencies", + "kFileDependenciesRelativeToEditTargetLayerAnn": "When on, any file dependencies, such as textures or Maya references will be written as relative paths to their respective edit target layer.", +} def getMayaUsdString(key): return getPluginResource('mayaUsdPlugin', key) @@ -28,23 +393,11 @@ def mayaUSDRegisterStrings(): # with the same name. The strings registered here and all the # ones registered from the MEL proc can be used in either # MEL or python. - register("kButtonYes", "Yes") - register("kButtonNo", "No") - register("kDiscardStageEditsTitle", "Discard Edits on ^1s's Layers") - register("kDiscardStageEditsLoadMsg", "Are you sure you want to load in a new file as the stage source?\n\nAll edits on your layers in ^1s will be discarded.") - register("kDiscardStageEditsReloadMsg", "Are you sure you want to reload ^1s as the stage source?\n\nAll edits on your layers (except the session layer) in ^2s will be discarded.") - register("kLoadUSDFile", "Load USD File") - register("kFileOptions", "File Options") - register("kRelativePathOptions", "Relative Pathing") - register("kMakePathRelativeToSceneFile", "Make Path Relative to Scene File") - register("kMakePathRelativeToSceneFileAnn", "Path will be relative to your Maya scene file.") - register("kMakePathRelativeToEditTargetLayer", "Make Path Relative to Edit Target Layer Directory") - register("kMakePathRelativeToEditTargetLayerAnn", "Enable to activate relative pathing to your current edit target layer's directory.") - register("kMakePathRelativeToImageEditTargetLayer", "Make Path Relative to Edit Target Layer Directory") - register("kMakePathRelativeToImageEditTargetLayerAnn", "Enable to activate relative pathing to your current edit target layer's directory.") - register("kMakePathRelativeToParentLayer", "Make Path Relative to Parent Layer Directory") - register("kMakePathRelativeToParentLayerAnn", "Enable to activate relative pathing to your current parent layer's directory.") - register("kUnresolvedPath", "Path Preview:") - register("kUnresolvedPathAnn", "This field indicates the path with the file name currently chosen in your text input. Note: This is the string that will be written out to the file in the chosen directory in order to enable portability.") - register("kCompositionArcOptions", "Composition Arc Options") - register("kPreview", "Preview") + registerPluginResources('mayaUsdPlugin', __mayaUSDStringResources) + +def mayaUSDUnregisterStrings(): + # This function is called from the equivalent MEL proc + # with the same name. The strings registered here and all the + # ones registered from the MEL proc can be used in either + # MEL or python. + unregisterPluginResources('mayaUsdPlugin', __mayaUSDStringResources) From a2a820709f12819c6bdb704709cff8249a1ccbce Mon Sep 17 00:00:00 2001 From: Pierre Baillargeon Date: Tue, 15 Oct 2024 15:57:45 -0400 Subject: [PATCH 2/3] EMSUSD-1504 add back missing MayaUSD localization The MEl version of localized strings for MayaUSdLib was lost. It is only used in the "Add Maya Reference" dialog and was not noticed during testing. --- lib/mayaUsd/resources/scripts/CMakeLists.txt | 1 + .../scripts/mayaUsdLibRegisterStrings.mel | 20 +++++++++++++++++++ .../scripts/mayaUsdLibRegisterStrings.py | 5 +---- .../adsk/scripts/mayaUSDRegisterStrings.mel | 1 + 4 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 lib/mayaUsd/resources/scripts/mayaUsdLibRegisterStrings.mel diff --git a/lib/mayaUsd/resources/scripts/CMakeLists.txt b/lib/mayaUsd/resources/scripts/CMakeLists.txt index 62dd9df118..89d0905156 100644 --- a/lib/mayaUsd/resources/scripts/CMakeLists.txt +++ b/lib/mayaUsd/resources/scripts/CMakeLists.txt @@ -1,4 +1,5 @@ list(APPEND scripts_src + mayaUsdLibRegisterStrings.mel mayaUsdLibRegisterStrings.py mayaUsdAddMayaReference.mel mayaUsdAddMayaReference.py diff --git a/lib/mayaUsd/resources/scripts/mayaUsdLibRegisterStrings.mel b/lib/mayaUsd/resources/scripts/mayaUsdLibRegisterStrings.mel new file mode 100644 index 0000000000..a39afc8f7f --- /dev/null +++ b/lib/mayaUsd/resources/scripts/mayaUsdLibRegisterStrings.mel @@ -0,0 +1,20 @@ +// Copyright 2022 Autodesk +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +global proc string getMayaUsdLibString(string $key) +{ + return getPluginResource("mayaUsdLib", $key); +} + diff --git a/lib/mayaUsd/resources/scripts/mayaUsdLibRegisterStrings.py b/lib/mayaUsd/resources/scripts/mayaUsdLibRegisterStrings.py index 657cbca14c..73487df1bd 100644 --- a/lib/mayaUsd/resources/scripts/mayaUsdLibRegisterStrings.py +++ b/lib/mayaUsd/resources/scripts/mayaUsdLibRegisterStrings.py @@ -197,10 +197,7 @@ def registerPluginResource(pluginId, stringId, resourceStr): '''See registerPluginResource.mel in Maya. Unfortunately there is no equivalent python version of this MEL proc - so we created our own version of it here. - - We also re-implement it here because we don't want warnings when registering - the same string again, which happens when re-loading the plugin.''' + so we created our own version of it here.''' fullId = 'p_%s.%s' % (pluginId, stringId) if cmds.displayString(fullId, exists=True): diff --git a/plugin/adsk/scripts/mayaUSDRegisterStrings.mel b/plugin/adsk/scripts/mayaUSDRegisterStrings.mel index 6ff000241b..8dd766858f 100644 --- a/plugin/adsk/scripts/mayaUSDRegisterStrings.mel +++ b/plugin/adsk/scripts/mayaUSDRegisterStrings.mel @@ -28,6 +28,7 @@ global proc mayaUSDRegisterStrings() python("import mayaUSDRegisterStrings; mayaUSDRegisterStrings.mayaUSDRegisterStrings()"); // Register the strings from the MayaUsd Lib. + source "mayaUSDLibRegisterStrings.mel"; python("import mayaUsdLibRegisterStrings; mayaUsdLibRegisterStrings.mayaUsdLibRegisterStrings()"); // load any localized resources From a4af8c75afe8acc94b41e69daf02e766b1ae4d1e Mon Sep 17 00:00:00 2001 From: Pierre Baillargeon Date: Wed, 16 Oct 2024 09:26:34 -0400 Subject: [PATCH 3/3] EMSUSD-1504 fix case of filename when sourcing resource strings. Also, reduce spam in one test due to trying to set-up up-axis when alredy the same axis. --- plugin/adsk/scripts/mayaUSDRegisterStrings.mel | 2 +- test/lib/mayaUsd/nodes/testProxyShapeConversion.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/plugin/adsk/scripts/mayaUSDRegisterStrings.mel b/plugin/adsk/scripts/mayaUSDRegisterStrings.mel index 8dd766858f..3153652072 100644 --- a/plugin/adsk/scripts/mayaUSDRegisterStrings.mel +++ b/plugin/adsk/scripts/mayaUSDRegisterStrings.mel @@ -28,7 +28,7 @@ global proc mayaUSDRegisterStrings() python("import mayaUSDRegisterStrings; mayaUSDRegisterStrings.mayaUSDRegisterStrings()"); // Register the strings from the MayaUsd Lib. - source "mayaUSDLibRegisterStrings.mel"; + source "mayaUsdLibRegisterStrings.mel"; python("import mayaUsdLibRegisterStrings; mayaUsdLibRegisterStrings.mayaUsdLibRegisterStrings()"); // load any localized resources diff --git a/test/lib/mayaUsd/nodes/testProxyShapeConversion.py b/test/lib/mayaUsd/nodes/testProxyShapeConversion.py index 53a1f2fca9..6292cfdc16 100644 --- a/test/lib/mayaUsd/nodes/testProxyShapeConversion.py +++ b/test/lib/mayaUsd/nodes/testProxyShapeConversion.py @@ -50,9 +50,11 @@ def setUp(self): """Clear the scene and setup the Maya preferences.""" cmds.file(f=True, new=True) # Make sure up-axis is Z. - cmds.upAxis(axis='z') + if cmds.upAxis(query=True, axis=True).lower() != 'z': + cmds.upAxis(axis='z') # Make sure the units are centimeters. - cmds.currentUnit(linear='cm') + if cmds.currentUnit(query=True, linear=True).lower() != 'cm': + cmds.currentUnit(linear='cm') def testCreateStageChangeUpAxisMayaPrefs(self): """Test creating a stage and changing the Maya up-axis preference."""