ArticyXImporter
ArticyXImporter for Unreal Engine
Loading...
Searching...
No Matches
ArticyObjectWithAttachments.h
1//
2// Copyright (c) 2023 articy Software GmbH & Co. KG. All rights reserved.
3//
4
5#pragma once
6
7#include "ArticyBaseTypes.h"
8#include "ArticyPrimitive.h"
9#include "ArticyObjectWith_Base.h"
10#include "ArticyObjectWithAttachments.generated.h"
11
12UINTERFACE(MinimalAPI, BlueprintType, meta=(CannotImplementInterfaceInBlueprint))
13class UArticyObjectWithAttachments : public UArticyObjectWith_Base { GENERATED_BODY() };
14
19{
20 GENERATED_BODY()
21
22public:
23
24 UFUNCTION(BlueprintCallable, Category="ArticyObjectWithAttachments")
25 virtual TArray<FArticyId>& GetAttachmentIds()
26 {
27 static const auto& PropName = FName("Attachments");
28 return GetProperty<TArray<FArticyId>>(PropName);
29 }
30
31 virtual const TArray<FArticyId>& GetAttachmentIds() const
32 {
33 return const_cast<IArticyObjectWithAttachments*>(this)->GetAttachmentIds();
34 }
35
40 UFUNCTION(BlueprintCallable, Category="ArticyObjectWithAttachments")
41 virtual TArray<UArticyPrimitive*> GetAttachments() const
42 {
43 TArray<UArticyPrimitive*> attachments;
44
45 auto ids = GetAttachmentIds();
46 for(const auto& id : ids)
47 {
48 auto att = id.GetObject(_getUObject());
49 if(att)
50 attachments.Add(att);
51 }
52
53 return attachments;
54 }
55
56 //---------------------------------------------------------------------------//
57
58 UFUNCTION(BlueprintCallable, Category="ArticyObjectWithAttachments")
59 virtual TArray<FArticyId>& SetAttachmentIds(UPARAM(ref) const TArray<FArticyId>& IDs)
60 {
61 return GetAttachmentIds() = IDs;
62 }
63
68 UFUNCTION(BlueprintCallable, Category="ArticyObjectWithAttachments")
69 virtual TArray<UArticyPrimitive*> SetAttachments(UPARAM(ref) const TArray<UArticyPrimitive*>& Objects)
70 {
71 TArray<FArticyId> IDs;
72 for(const auto& obj : Objects)
73 IDs.Add(obj->GetId());
74
75 SetAttachmentIds(IDs);
76
77 return Objects;
78 }
79};
Definition ArticyObjectWithAttachments.h:19
virtual TArray< UArticyPrimitive * > SetAttachments(UPARAM(ref) const TArray< UArticyPrimitive * > &Objects)
Definition ArticyObjectWithAttachments.h:69
virtual TArray< UArticyPrimitive * > GetAttachments() const
Definition ArticyObjectWithAttachments.h:41
Definition ArticyObjectWith_Base.h:27
Definition ArticyObjectWithAttachments.h:13
Definition ArticyObjectWith_Base.h:12
Definition ArticyPrimitive.h:17
Definition ArticyBaseTypes.h:18