SceneProcessingConfigBus.h 4.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include <AzCore/std/containers/vector.h>
  10. #include <AzCore/EBus/EBus.h>
  11. #include <SceneAPI/SceneCore/Utilities/PatternMatcher.h>
  12. namespace AZ
  13. {
  14. namespace SceneProcessingConfig
  15. {
  16. class SoftNameSetting;
  17. class SceneProcessingConfigRequests
  18. : public EBusTraits
  19. {
  20. public:
  21. static const EBusHandlerPolicy HandlerPolicy = EBusHandlerPolicy::Single;
  22. static const EBusAddressPolicy AddressPolicy = EBusAddressPolicy::Single;
  23. virtual const AZStd::vector<AZStd::unique_ptr<SoftNameSetting>>* GetSoftNames() = 0;
  24. /**
  25. * @brief Adds a virtual type for matching against the name of scene nodes.
  26. * @pattern: The string pattern that will be used to match the name of nodes within asset files.
  27. * If \p approach == PreFix, then \p pattern looks like "name_". And a node named "name_abc" would match.
  28. * If \p approach == PostFix, then \p pattern looks like "_name". And a node named "abc_name" would match.
  29. * If \p approach == RegEx, the \p pattern is a regular expression.
  30. * @approach: See \p pattern.
  31. * @virtualType: This string will be internally CRC32'ed. For nodes that match \p pattern, this will be
  32. * the virtual type of the node.
  33. * @includeChildren: For each parent node, If true, it will do pattern matching across the children nodes,
  34. * otherwise the pattern matching will always stop at root nodes.
  35. * @returns: true if the new \p virtualType doesn't exist already (matched by Crc) AND
  36. * it is added to the end of the list.
  37. * @pre
  38. * Here is an example:
  39. AddNodeSoftName("_lod1", PatternMatcher::MatchApproach::PostFix, "LODMesh1", true)
  40. */
  41. virtual bool AddNodeSoftName(const char* pattern, SceneAPI::SceneCore::PatternMatcher::MatchApproach approach,
  42. const char* virtualType, bool includeChildren) = 0;
  43. /**
  44. * @brief Adds a virtual type for matching against the name of asset files.
  45. * @pattern See AddNodeSoftName(...)
  46. * @approach See AddNodeSoftName(...)
  47. * @virtualType See AddNodeSoftName(...)
  48. * @inclusive 1. If the asset file name doesn't match the pattern then the value
  49. * of this flag is irrelevant. No VirtualType will be assigned to any root node
  50. * within the asset file.
  51. * 2. If the asset file name MATCHES the pattern, then:
  52. * 2.1. If at least one root node of type \p graphObjectTypeName
  53. * is found in the scene then the Virtual Type is assigned or NOT
  54. * depending on the value of this parameter.
  55. * 2.2. If none of the root nodes are of type \p graphObjectTypeName
  56. * then the Virtual Type is assigned or NOT
  57. * depending on the NEGATED value of this parameter.
  58. * @graphObjectTypeName TYPEINFO_Name() of a SceneAPI::DataTypes::IGraphObject derived class.
  59. * e.g. SceneAPI::DataTypes::IAnimationData::TYPEINFO_Name().
  60. * @returns See AddNodeSoftName(...)
  61. * @pre
  62. * Example:
  63. * AddFileSoftName("_anim", PatternMatcher::MatchApproach::PostFix, "Ignore", false,
  64. * SceneAPI::DataTypes::IAnimationData::TYPEINFO_Name())
  65. * If the filename ends with "_anim" this will mark all nodes as "Ignore" unless they're derived from IAnimationData.
  66. * This will cause only animations to be exported from the source scene file even if there's other data available.
  67. */
  68. virtual bool AddFileSoftName(const char* pattern, SceneAPI::SceneCore::PatternMatcher::MatchApproach approach,
  69. const char* virtualType, bool inclusive, const AZStd::string& graphObjectTypeName) = 0;
  70. };
  71. using SceneProcessingConfigRequestBus = EBus<SceneProcessingConfigRequests>;
  72. } // namespace SceneProcessingConfig
  73. } // namespace AZ