AkPortalComponentDetailsCustomization.cpp 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*******************************************************************************
  2. The content of this file includes portions of the proprietary AUDIOKINETIC Wwise
  3. Technology released in source code form as part of the game integration package.
  4. The content of this file may not be used without valid licenses to the
  5. AUDIOKINETIC Wwise Technology.
  6. Note that the use of the game engine is subject to the Unreal(R) Engine End User
  7. License Agreement at https://www.unrealengine.com/en-US/eula/unreal
  8. License Usage
  9. Licensees holding valid licenses to the AUDIOKINETIC Wwise Technology may use
  10. this file in accordance with the end user license agreement provided with the
  11. software or, alternatively, in accordance with the terms contained
  12. in a written agreement between you and Audiokinetic Inc.
  13. Copyright (c) 2023 Audiokinetic Inc.
  14. *******************************************************************************/
  15. #include "AkPortalComponentDetailsCustomization.h"
  16. #include "AkAcousticPortal.h"
  17. #include "DetailLayoutBuilder.h"
  18. #include "DetailCategoryBuilder.h"
  19. #define LOCTEXT_NAMESPACE "AudiokineticTools"
  20. //////////////////////////////////////////////////////////////////////////
  21. // FAkPortalComponentDetailsCustomization
  22. FAkPortalComponentDetailsCustomization::FAkPortalComponentDetailsCustomization()
  23. {
  24. }
  25. TSharedRef<IDetailCustomization> FAkPortalComponentDetailsCustomization::MakeInstance()
  26. {
  27. return MakeShareable(new FAkPortalComponentDetailsCustomization());
  28. }
  29. void FAkPortalComponentDetailsCustomization::CustomizeDetails(IDetailLayoutBuilder& DetailLayout)
  30. {
  31. TArray<TWeakObjectPtr<UObject>> ObjectsBeingCustomized;
  32. DetailLayout.GetObjectsBeingCustomized(ObjectsBeingCustomized);
  33. DetailLayout.EditCategory("Fit to Geometry", FText::GetEmpty(), ECategoryPriority::Important);
  34. DetailLayout.EditCategory("AkPortalComponent", FText::GetEmpty(), ECategoryPriority::TypeSpecific);
  35. for (TWeakObjectPtr<UObject>& Object : ObjectsBeingCustomized)
  36. {
  37. UAkPortalComponent* PortalBeingCustomized = Cast<UAkPortalComponent>(Object.Get());
  38. if (PortalBeingCustomized)
  39. {
  40. UObject* OuterObj = PortalBeingCustomized->GetOuter();
  41. UActorComponent* OuterComponent = Cast<UActorComponent>(OuterObj);
  42. AActor* OuterActor = Cast<AActor>(OuterObj);
  43. // Do not hide the transform if the component has been created from within a component or actor, as this will hide the transform for that component / actor as well
  44. // (i.e. - only hide the transform if the component has been added to the hierarchy of a blueprint class or actor instance from the editor)
  45. if (OuterComponent == nullptr && OuterActor == nullptr)
  46. {
  47. IDetailCategoryBuilder& TransformCategory = DetailLayout.EditCategory("TransformCommon", LOCTEXT("TransformCommonCategory", "Transform"), ECategoryPriority::Transform);
  48. TransformCategory.SetCategoryVisibility(false);
  49. break;
  50. }
  51. }
  52. }
  53. }
  54. //////////////////////////////////////////////////////////////////////////
  55. #undef LOCTEXT_NAMESPACE