3
0

MaterialDocumentRequestBus.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 <Atom/RPI.Public/Material/Material.h>
  10. #include <Atom/RPI.Reflect/Material/MaterialAsset.h>
  11. namespace AZ
  12. {
  13. namespace RPI
  14. {
  15. class MaterialSourceData;
  16. class MaterialTypeSourceData;
  17. } // namespace RPI
  18. } // namespace AZ
  19. namespace MaterialEditor
  20. {
  21. //! UVs are processed in a property group but will be handled differently.
  22. static constexpr const char UvGroupName[] = "uvSets";
  23. class MaterialDocumentRequests : public AZ::EBusTraits
  24. {
  25. public:
  26. static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
  27. static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::ById;
  28. typedef AZ::Uuid BusIdType;
  29. //! Get material asset created by MaterialDocument
  30. virtual AZ::Data::Asset<AZ::RPI::MaterialAsset> GetAsset() const = 0;
  31. //! Get material instance created from asset loaded by MaterialDocument
  32. virtual AZ::Data::Instance<AZ::RPI::Material> GetInstance() const = 0;
  33. //! Get the internal material source data
  34. virtual const AZ::RPI::MaterialSourceData* GetMaterialSourceData() const = 0;
  35. //! Get the internal material type source data
  36. virtual const AZ::RPI::MaterialTypeSourceData* GetMaterialTypeSourceData() const = 0;
  37. //! Modify property value
  38. virtual void SetPropertyValue(const AZStd::string& propertyFullName, const AZStd::any& value) = 0;
  39. //! Return property value
  40. //! If the document is not open or the id can't be found, an invalid value is returned instead.
  41. virtual const AZStd::any& GetPropertyValue(const AZStd::string& propertyFullName) const = 0;
  42. };
  43. using MaterialDocumentRequestBus = AZ::EBus<MaterialDocumentRequests>;
  44. } // namespace MaterialEditor