3ds Max USD API Reference
Loading...
Searching...
No Matches
USDSceneBuilderOptions.h
1
2//**************************************************************************/
3// Copyright (c) 1998-2019 Autodesk, Inc.
4// All rights reserved.
5//
6// Use of this software is subject to the terms of the Autodesk license
7// agreement provided at the time of installation or download, or which
8// otherwise accompanies this software in either electronic or hard copy form.
9//**************************************************************************/
10// DESCRIPTION: USD Scene Builder options.
11// AUTHOR: Autodesk Inc.
12//***************************************************************************/
13
14#pragma once
15
16#include <pxr/base/tf/staticTokens.h>
17#include <pxr/base/tf/token.h>
18#include <pxr/usd/usd/usdFileFormat.h>
19#include <pxr/usd/usd/usdaFileFormat.h>
20#include <pxr/usd/usd/usdcFileFormat.h>
21
22#include "MaxUsd/MaxUSDAPI.h"
23#include "MaxUsd/Builders/SceneBuilderOptions.h"
24#include "MaxUsd/MeshConversion/MaxMeshConversionOptions.h"
25#include "MaxUsd/Utilities/TranslationUtils.h"
26
27PXR_NAMESPACE_OPEN_SCOPE
28
29// clang-format off
30#define PXR_MAXUSD_USD_SCENE_BUILDER_OPTIONS_TOKENS \
31 /* Dictionary keys */ \
32 (convertMaterialsTo) \
33 (jobContext) \
34 (chaser) \
35 (chaserArgs)
36// clang-format on
37
38TF_DECLARE_PUBLIC_TOKENS(
39 MaxUsdUsdSceneBuilderOptionsTokens,
40 MaxUSDAPI,
41 PXR_MAXUSD_USD_SCENE_BUILDER_OPTIONS_TOKENS);
42
43PXR_NAMESPACE_CLOSE_SCOPE
44
48class USDSceneBuilderOptions : public maxUsd::SceneBuilderOptions
49{
50public:
51
55 enum class MaxUSDAPI ContentSource
56 {
57 RootNode,
58 Selection,
59 NodeList
60 };
61
66 enum class MaxUSDAPI UpAxis
67 {
68 Z = 0,
69 Y = 1
70 };
71
75 enum class MaxUSDAPI FileFormat
76 {
77 ASCII,
78 Binary,
79 USDZ
80 };
81
85 enum class MaxUSDAPI TimeMode
86 {
87 CurrentFrame,
88 ExplicitFrame,
89 AnimationRange,
90 FrameRange
91 };
92
93 static MaxUSDAPI const double MIN_SAMPLES_PER_FRAME;
94 static MaxUSDAPI const double MAX_SAMPLES_PER_FRAME;
95
96public:
97
101 MaxUSDAPI explicit USDSceneBuilderOptions() noexcept;
102
106 MaxUSDAPI void SetOptions(const USDSceneBuilderOptions& options);
107
111 MaxUSDAPI void SetDefaults();
112
118
123 MaxUSDAPI void SetContentSource(const ContentSource& contentSource);
124
129 MaxUSDAPI ContentSource GetContentSource() const;
130
136
141 MaxUSDAPI bool GetTranslateMeshes() const;
142
148
153 MaxUSDAPI bool GetTranslateShapes() const;
154
160
165 MaxUSDAPI bool GetTranslateLights() const;
166
172
177 MaxUSDAPI bool GetTranslateCameras() const;
178
184
189 MaxUSDAPI bool GetTranslateMaterials() const;
190
195 MaxUSDAPI void SetTranslateSkin(bool trasnlateSkin);
196
201 MaxUSDAPI bool GetTranslateSkin() const;
202
207 MaxUSDAPI void SetShadingMode(const pxr::TfToken& shadingMode);
208
213 MaxUSDAPI pxr::TfToken GetShadingMode() const;
214
219 MaxUSDAPI void SetAllMaterialConversions(const pxr::TfToken::Set& materialConversions);
220
225 MaxUSDAPI const pxr::TfToken::Set& GetAllMaterialConversions() const;
226
231 MaxUSDAPI void SetConvertMaterialsTo(pxr::TfToken shader)
232 {
233 convertMaterialsTo = shader;
234 }
235
240 MaxUSDAPI pxr::TfToken GetConvertMaterialsTo() const
241 {
242 return convertMaterialsTo;
243 }
244
250
255 MaxUSDAPI bool GetUsdStagesAsReferences() const;
256
261 MaxUSDAPI void SetTranslateHidden(bool translateHiddenObjects);
262
267 MaxUSDAPI bool GetTranslateHidden() const;
268
273 MaxUSDAPI void SetUseUSDVisibility(bool useUSDVibility);
274
279 MaxUSDAPI bool GetUseUSDVisibility() const;
280
285 MaxUSDAPI void SetFileFormat(const FileFormat& format);
286
291 MaxUSDAPI FileFormat GetFileFormat() const;
292
297 MaxUSDAPI void SetNormalsMode(const MaxMeshConversionOptions::NormalsMode& normalsMode);
298
303 MaxUSDAPI MaxMeshConversionOptions::NormalsMode GetNormalsMode() const;
304
309 MaxUSDAPI void SetMeshFormat(const MaxMeshConversionOptions::MeshFormat& meshFormat);
310
315 MaxUSDAPI MaxMeshConversionOptions::MeshFormat GetMeshFormat() const;
316
321 MaxUSDAPI void SetUpAxis(const UpAxis& upAxis);
322
327 MaxUSDAPI UpAxis GetUpAxis() const;
328
334 // Const version.
335 MaxUSDAPI const MaxMeshConversionOptions& GetMeshConversionOptions() const;
336
341 MaxUSDAPI void SetNodesToExport(const Tab<INode*>& nodes);
342
347 MaxUSDAPI const Tab<INode*>& GetNodesToExport() const;
348
349
355 MaxUSDAPI void SetTimeMode(const TimeMode& timeMode);
356
361 MaxUSDAPI TimeMode GetTimeMode() const;
362
367 MaxUSDAPI void SetStartFrame(double startFrame);
368
374 MaxUSDAPI double GetStartFrame() const;
375
380 MaxUSDAPI void SetEndFrame(double endFrame);
381
386 MaxUSDAPI double GetEndFrame() const;
387
392 MaxUSDAPI void SetSamplesPerFrame(double samplesPerFrame);
393
398 MaxUSDAPI double GetSamplesPerFrame() const;
399
407 MaxUSDAPI const maxUsd::TimeConfig GetResolvedTimeConfig() const;
408
413 MaxUSDAPI void SetRootPrimPath(const std::wstring& rootPrimPath);
414
419 MaxUSDAPI const std::wstring& GetRootPrimPath() const;
420
425 MaxUSDAPI const pxr::TfToken& GetBonesPrimName() const;
426
431 MaxUSDAPI void SetBonesPrimName(const pxr::TfToken& bonesPrimName);
432
437 MaxUSDAPI const pxr::TfToken& GetAnimationsPrimName() const;
438
443 MaxUSDAPI void SetAnimationsPrimName(const pxr::TfToken& animationsPrimName);
444
450 MaxUSDAPI void SetOpenInUsdview(bool openInUsdview);
451
457 MaxUSDAPI bool GetOpenInUsdview() const;
458
463 MaxUSDAPI const std::vector<std::string>& GetChaserNames() const;
464
469 MaxUSDAPI void SetChaserNames(const std::vector<std::string>& chasers);
470
475 typedef std::map<std::string, std::string> ChaserArgs;
476 MaxUSDAPI const std::map<std::string, ChaserArgs>& GetAllChaserArgs() const;
477
482 MaxUSDAPI void SetAllChaserArgs(const std::map<std::string, ChaserArgs>& chaserArgs) const;
483
493
502 MaxUSDAPI bool GetAllowNestedGprims() const;
503
508 MaxUSDAPI void SetContextNames(const std::set<std::string> contexts);
509
514 MaxUSDAPI const std::set<std::string>& GetContextNames() const;
515
516protected:
517
518 // Defaults values are set from SetDefaults().
519
521 ContentSource contentSource{ ContentSource::RootNode};
523 bool translateMeshes{ false };
525 bool translateShapes{ false };
527 bool translateLights{ false };
529 bool translateCameras { false };
531 bool translateMaterials{ false };
533 bool translateSkin{ false };
534
536 pxr::TfToken shadingMode;
538 pxr::TfToken::Set allMaterialConversions;
541 pxr::TfToken convertMaterialsTo;
543 bool translateHidden { false };
547 bool useUSDVisibility{ false };
549 bool allowNestedGprims{ false };
551 FileFormat saveFormat{FileFormat::ASCII};
553 UpAxis upAxis{UpAxis::Y};
558 Tab<INode*> nodesToExport;
560 TimeMode timeMode;
562 maxUsd::TimeConfig timeConfig;
564 std::wstring rootPrimPath;
566 pxr::TfToken bonesPrimName;
568 pxr::TfToken skelAnimPrimName;
572 std::vector<std::string> chaserNames;
573 std::map<std::string, ChaserArgs> allChaserArgs;
575 std::set<std::string> contextNames;
576};
Definition: MaxMeshConversionOptions.h:13
USD Scene Build configuration options.
Definition: USDSceneBuilderOptions.h:49
MaxUSDAPI void SetMeshFormat(const MaxMeshConversionOptions::MeshFormat &meshFormat)
Sets how meshes should be exported.
MaxUSDAPI void SetDefaults()
Set the the default option values.
MaxUSDAPI MaxMeshConversionOptions::MeshFormat GetMeshFormat() const
Return how meshes should be exported.
MaxUSDAPI bool GetUseUSDVisibility() const
Check if we should attempt to match the Hidden state in Max with the USD visibility attribute.
MaxUSDAPI void SetTranslateShapes(bool translateShapes)
Translate 3ds Max shapes into USD meshes.
pxr::TfToken convertMaterialsTo
Definition: USDSceneBuilderOptions.h:541
MaxUSDAPI void SetTranslateHidden(bool translateHiddenObjects)
Sets whether hidden objects should be translated.
pxr::TfToken bonesPrimName
Prim to be created to put the bones on.
Definition: USDSceneBuilderOptions.h:566
std::set< std::string > contextNames
Contexts (plugin config) names.
Definition: USDSceneBuilderOptions.h:575
MaxUSDAPI bool GetAllowNestedGprims() const
Gets whether or not the exporter should allow nested Gprims. Nested gprims are technically illegal in...
bool translateMaterials
Flag indicating if the materials should be translated between 3dsMax and USD:
Definition: USDSceneBuilderOptions.h:531
MaxUSDAPI void SetOpenInUsdview(bool openInUsdview)
Whether or not the produced USD file should be opened in Usdview at the end of the export.
Tab< INode * > nodesToExport
Definition: USDSceneBuilderOptions.h:558
MaxUSDAPI bool GetTranslateLights() const
Check if 3ds Max lights should be translated into USD lights.
MaxUSDAPI USDSceneBuilderOptions OptionsWithAppliedContexts() const
Returns a copy of the current USDSceneBuilderOptions with the JobContext option overrides applied on ...
MaxUSDAPI MaxMeshConversionOptions::NormalsMode GetNormalsMode() const
Return how normals should be exported.
std::map< std::string, std::string > ChaserArgs
Gets the map of export chasers with their specified arguments.
Definition: USDSceneBuilderOptions.h:475
MaxUSDAPI void SetUsdStagesAsReferences(bool usdStagesAsReferences)
Sets whether USD Stage Objects should be exported as USD References.
UpAxis upAxis
Up axis of the USD Stage produced from the translation of the 3ds Max content:
Definition: USDSceneBuilderOptions.h:553
MaxUSDAPI bool GetTranslateCameras() const
Check if 3ds Max cameras should be translated into USD cameras.
MaxUSDAPI void SetTranslateMaterials(bool translateMaterials)
Translate 3ds Max materials into USD.
MaxUSDAPI void SetNormalsMode(const MaxMeshConversionOptions::NormalsMode &normalsMode)
Sets how normals should be exported.
pxr::TfToken::Set allMaterialConversions
Specifies the set of targeted materials for material conversion on export.
Definition: USDSceneBuilderOptions.h:538
MaxUSDAPI void SetUseUSDVisibility(bool useUSDVibility)
Sets whether we should attempt to match the Hidden state in Max with the USD visibility attribute.
maxUsd::TimeConfig timeConfig
Time configuration for the export to USD.
Definition: USDSceneBuilderOptions.h:562
MaxUSDAPI const Tab< INode * > & GetNodesToExport() const
Gets the nodes to convert to USD.
MaxUSDAPI void SetContentSource(const ContentSource &contentSource)
Build USD content from the given 3ds Max content source.
std::vector< std::string > chaserNames
Chasers and their arguments.
Definition: USDSceneBuilderOptions.h:572
MaxUSDAPI void SetBonesPrimName(const pxr::TfToken &bonesPrimName)
Set the the name to be used for the bone prim.
MaxUSDAPI bool GetTranslateMaterials() const
Check if materials should be translated.
MaxUSDAPI FileFormat GetFileFormat() const
Return the format of the file to export.
MaxUSDAPI void SetNodesToExport(const Tab< INode * > &nodes)
Sets the nodes to convert to USD.
MaxUSDAPI MaxMeshConversionOptions & GetMeshConversionOptions()
Gets the mesh conversion options.
MaxUSDAPI bool GetTranslateHidden() const
Check if hidden objects should be translated.
MaxUSDAPI void SetAnimationsPrimName(const pxr::TfToken &animationsPrimName)
Set the the name to be used for the Animation prim.
MaxUSDAPI double GetSamplesPerFrame() const
Gets the number of samples to be exported to USD, per frame.
bool translateLights
Flag indicating if the lights should be translated between 3dsMax and USD:
Definition: USDSceneBuilderOptions.h:527
MaxMeshConversionOptions meshConversionOptions
Mesh conversion options.
Definition: USDSceneBuilderOptions.h:555
MaxUSDAPI bool GetOpenInUsdview() const
Check if the produced USD file should be opened in Usdview at the end of the export.
MaxUSDAPI void SetChaserNames(const std::vector< std::string > &chasers)
Sets the chaser list to use at export.
FileFormat saveFormat
Internal format of the USD file to export:
Definition: USDSceneBuilderOptions.h:551
MaxUSDAPI void SetAllowNestedGprims(bool allowNestedGprims)
Sets whether or not the exporter should allow nested Gprims. Nested gprims are technically illegal in...
pxr::TfToken skelAnimPrimName
Prim to be created to put the skeleton animation on.
Definition: USDSceneBuilderOptions.h:568
MaxUSDAPI void SetTranslateSkin(bool trasnlateSkin)
Translate 3ds Max skin and skeleton into USD.
MaxUSDAPI void SetStartFrame(double startFrame)
Sets the first frame from which to export, only used if the time mode is EXPLICIT or FRAME_RANGE.
MaxUSDAPI const std::vector< std::string > & GetChaserNames() const
Gets the list of export chasers to be called at USD export.
MaxUSDAPI TimeMode GetTimeMode() const
Gets the time mode to be used for export.
MaxUSDAPI double GetStartFrame() const
Gets the first frame from which to export, only used if the time mode is configured as EXPLICIT or FR...
MaxUSDAPI void SetShadingMode(const pxr::TfToken &shadingMode)
Sets the shading schema (mode) to use for material export.
bool openInUsdview
Whether or not to open the exported file in Usdview.
Definition: USDSceneBuilderOptions.h:570
bool translateShapes
Flag indicating if the shapes should be translated between 3dsMax and USD:
Definition: USDSceneBuilderOptions.h:525
MaxUSDAPI bool GetTranslateSkin() const
Check if skin and skeleton should be translated.
MaxUSDAPI pxr::TfToken GetShadingMode() const
Gets the shading schema (mode) to use for material export.
MaxUSDAPI UpAxis GetUpAxis() const
Return the "up axis" of the USD Stage produced from the translation of the 3ds Max content.
MaxUSDAPI void SetEndFrame(double endFrame)
Sets the last frame from which to export, only used if the time mode is FRAME_RANGE.
bool translateSkin
Flag indicating if skin and bones should be translated between 3dsMax and USD:
Definition: USDSceneBuilderOptions.h:533
MaxUSDAPI void SetAllChaserArgs(const std::map< std::string, ChaserArgs > &chaserArgs) const
Sets the export chasers' arguments map.
MaxUSDAPI bool GetUsdStagesAsReferences() const
Checks if USD Stage Objects should be exported as USD References.
MaxUSDAPI void SetAllMaterialConversions(const pxr::TfToken::Set &materialConversions)
Sets the set of targeted materials for material conversion.
bool translateCameras
Flag indicating if the cameras should be translated between 3dsMax and USD:
Definition: USDSceneBuilderOptions.h:529
MaxUSDAPI void SetConvertMaterialsTo(pxr::TfToken shader)
Sets the USD material type targeted to convert the 3ds Max materials.
Definition: USDSceneBuilderOptions.h:231
MaxUSDAPI void SetTranslateCameras(bool translateCameras)
Translate 3ds Max cameras into USD cameras.
MaxUSDAPI bool GetTranslateMeshes() const
Check if 3ds Max meshes should be translated into USD meshes.
MaxUSDAPI double GetEndFrame() const
Gets the last frame from which to export, only used if the time mode is configured as FRAME_RANGE.
MaxUSDAPI void SetRootPrimPath(const std::wstring &rootPrimPath)
Sets the root prim path to export to.
MaxUSDAPI void SetUpAxis(const UpAxis &upAxis)
Set the "up axis" of the USD Stage produced from the translation of the 3ds Max content.
MaxUSDAPI const pxr::TfToken::Set & GetAllMaterialConversions() const
Gets the set of targeted materials for material conversion.
bool useUSDVisibility
Flag indicating if we should use the USD visibility attribute to match the Max hidden state.
Definition: USDSceneBuilderOptions.h:547
MaxUSDAPI const pxr::TfToken & GetAnimationsPrimName() const
Gets the configured animation prim name.
pxr::TfToken shadingMode
Specifies the shading schema to use for material export.
Definition: USDSceneBuilderOptions.h:536
MaxUSDAPI bool GetTranslateShapes() const
Check if 3ds Max shapes should be translated into USD meshes.
MaxUSDAPI const std::set< std::string > & GetContextNames() const
Gets the list of contexts (plug-in configurations) to be applied on USD export.
MaxUSDAPI USDSceneBuilderOptions() noexcept
Constructor.
bool translateHidden
Flag indicating if hidden objects should be translated between 3dsMax and USD:
Definition: USDSceneBuilderOptions.h:543
MaxUSDAPI ContentSource GetContentSource() const
Return the 3ds Max content source from which to build the USD scene.
MaxUSDAPI const pxr::TfToken & GetBonesPrimName() const
Gets the configured bone prim name.
MaxUSDAPI void SetOptions(const USDSceneBuilderOptions &options)
Copies the values from an existing options object.
MaxUSDAPI const maxUsd::TimeConfig GetResolvedTimeConfig() const
Resolves the actual time configuration from the selected TimeMode, the set values for startFrame and ...
bool translateMeshes
Flag indicating if the meshes should be translated between 3dsMax and USD:
Definition: USDSceneBuilderOptions.h:523
MaxUSDAPI const std::wstring & GetRootPrimPath() const
Gets the configured root prim path.
bool allowNestedGprims
Flag indicating if the exporter is allowed to nest Gprims.
Definition: USDSceneBuilderOptions.h:549
TimeMode timeMode
Describes what frames to export.
Definition: USDSceneBuilderOptions.h:560
MaxUSDAPI void SetFileFormat(const FileFormat &format)
Set the internal format of the USD file to export.
std::wstring rootPrimPath
Root prim path to export to.
Definition: USDSceneBuilderOptions.h:564
MaxUSDAPI void SetTranslateMeshes(bool translateMeshes)
Translate 3ds Max meshes into USD meshes.
ContentSource contentSource
Source of the 3ds Max content from which to build the USD scene:
Definition: USDSceneBuilderOptions.h:521
MaxUSDAPI void SetContextNames(const std::set< std::string > contexts)
Sets the context list to use at export.
MaxUSDAPI void SetTimeMode(const TimeMode &timeMode)
Sets the time mode for export, either CURRENT or EXPLICIT. If explicit, export from the time specifie...
bool usdStagesAsReferences
Flag indicating if USD Stage objects should be exported as USD references.
Definition: USDSceneBuilderOptions.h:545
MaxUSDAPI void SetTranslateLights(bool translateLights)
Translate 3ds Max lights into USD lights.
MaxUSDAPI void SetSamplesPerFrame(double samplesPerFrame)
Sets the number of samples to be exported to USD, per frame.
MaxUSDAPI pxr::TfToken GetConvertMaterialsTo() const
Token identifier of the USD material type targeted to convert the 3ds Max materials.
Definition: USDSceneBuilderOptions.h:240