Plasma Engine  2.0
Loading...
Searching...
No Matches
PropertyAttributes.h
1#pragma once
2
4
5#include <Foundation/Basics.h>
6#include <Foundation/Math/ColorScheme.h>
7#include <Foundation/Reflection/Reflection.h>
8
10class PL_FOUNDATION_DLL plPropertyAttribute : public plReflectedClass
11{
12 PL_ADD_DYNAMIC_REFLECTION(plPropertyAttribute, plReflectedClass);
13};
14
16class PL_FOUNDATION_DLL plReadOnlyAttribute : public plPropertyAttribute
17{
18 PL_ADD_DYNAMIC_REFLECTION(plReadOnlyAttribute, plPropertyAttribute);
19};
20
22class PL_FOUNDATION_DLL plHiddenAttribute : public plPropertyAttribute
23{
24 PL_ADD_DYNAMIC_REFLECTION(plHiddenAttribute, plPropertyAttribute);
25};
26
29class PL_FOUNDATION_DLL plTemporaryAttribute : public plPropertyAttribute
30{
31 PL_ADD_DYNAMIC_REFLECTION(plTemporaryAttribute, plPropertyAttribute);
32};
33
35class PL_FOUNDATION_DLL plCategoryAttribute : public plPropertyAttribute
36{
37 PL_ADD_DYNAMIC_REFLECTION(plCategoryAttribute, plPropertyAttribute);
38
39public:
40 plCategoryAttribute() = default;
41 plCategoryAttribute(const char* szCategory)
42 : m_sCategory(szCategory)
43 {
44 }
45
46 const char* GetCategory() const { return m_sCategory; }
47
48private:
49 plUntrackedString m_sCategory;
50};
51
53class PL_FOUNDATION_DLL plInDevelopmentAttribute : public plPropertyAttribute
54{
55 PL_ADD_DYNAMIC_REFLECTION(plInDevelopmentAttribute, plPropertyAttribute);
56
57public:
58 enum Phase
59 {
60 Alpha,
61 Beta
62 };
63
64 plInDevelopmentAttribute() = default;
65 plInDevelopmentAttribute(plInt32 iPhase) { m_Phase = iPhase; }
66
67 const char* GetString() const;
68
69 plInt32 m_Phase = Phase::Beta;
70};
71
72
76class PL_FOUNDATION_DLL plTitleAttribute : public plPropertyAttribute
77{
78 PL_ADD_DYNAMIC_REFLECTION(plTitleAttribute, plPropertyAttribute);
79
80public:
81 plTitleAttribute() = default;
82 plTitleAttribute(const char* szTitle)
83 : m_sTitle(szTitle)
84 {
85 }
86
87 const char* GetTitle() const { return m_sTitle; }
88
89private:
90 plUntrackedString m_sTitle;
91};
92
93class PL_FOUNDATION_DLL plIconAttribute : public plPropertyAttribute
94{
95 PL_ADD_DYNAMIC_REFLECTION(plIconAttribute, plPropertyAttribute);
96
97public:
98 plIconAttribute() = default;
99 plIconAttribute(const char* szIcon)
100 : m_sIcon(szIcon)
101 {
102 }
103
104 const char* GetIcon() const { return m_sIcon; }
105
106private:
107 plUntrackedString m_sIcon;
108};
109
111class PL_FOUNDATION_DLL plColorAttribute : public plPropertyAttribute
112{
113 PL_ADD_DYNAMIC_REFLECTION(plColorAttribute, plPropertyAttribute);
114
115public:
116 plColorAttribute() = default;
117 plColorAttribute(const plColor& color)
118 : m_Color(color)
119 {
120 }
121 const plColor& GetColor() const { return m_Color; }
122
123private:
124 plColor m_Color;
125};
126
128class PL_FOUNDATION_DLL plExposeColorAlphaAttribute : public plPropertyAttribute
129{
130 PL_ADD_DYNAMIC_REFLECTION(plExposeColorAlphaAttribute, plPropertyAttribute);
131};
132
134class PL_FOUNDATION_DLL plSuffixAttribute : public plPropertyAttribute
135{
136 PL_ADD_DYNAMIC_REFLECTION(plSuffixAttribute, plPropertyAttribute);
137
138public:
139 plSuffixAttribute() = default;
140 plSuffixAttribute(const char* szSuffix)
141 : m_sSuffix(szSuffix)
142 {
143 }
144
145 const char* GetSuffix() const { return m_sSuffix; }
146
147private:
148 plUntrackedString m_sSuffix;
149};
150
152class PL_FOUNDATION_DLL plMinValueTextAttribute : public plPropertyAttribute
153{
154 PL_ADD_DYNAMIC_REFLECTION(plMinValueTextAttribute, plPropertyAttribute);
155
156public:
157 plMinValueTextAttribute() = default;
158 plMinValueTextAttribute(const char* szText)
159 : m_sText(szText)
160 {
161 }
162
163 const char* GetText() const { return m_sText; }
164
165private:
166 plUntrackedString m_sText;
167};
168
170class PL_FOUNDATION_DLL plDefaultValueAttribute : public plPropertyAttribute
171{
172 PL_ADD_DYNAMIC_REFLECTION(plDefaultValueAttribute, plPropertyAttribute);
173
174public:
175 plDefaultValueAttribute() = default;
176
178 : m_Value(value)
179 {
180 }
181
182 plDefaultValueAttribute(plInt32 value)
183 : m_Value(value)
184 {
185 }
186
187 plDefaultValueAttribute(float value)
188 : m_Value(value)
189 {
190 }
191
192 plDefaultValueAttribute(double value)
193 : m_Value(value)
194 {
195 }
196
198 : m_Value(plVariant(value, false))
199 {
200 }
201
202 plDefaultValueAttribute(const char* value)
203 : m_Value(plVariant(plStringView(value), false))
204 {
205 }
206
207 const plVariant& GetValue() const { return m_Value; }
208
209private:
210 plVariant m_Value;
211};
212
215class PL_FOUNDATION_DLL plClampValueAttribute : public plPropertyAttribute
216{
217 PL_ADD_DYNAMIC_REFLECTION(plClampValueAttribute, plPropertyAttribute);
218
219public:
220 plClampValueAttribute() = default;
221 plClampValueAttribute(const plVariant& min, const plVariant& max)
222 : m_MinValue(min)
223 , m_MaxValue(max)
224 {
225 }
226
227 const plVariant& GetMinValue() const { return m_MinValue; }
228 const plVariant& GetMaxValue() const { return m_MaxValue; }
229
230protected:
231 plVariant m_MinValue;
232 plVariant m_MaxValue;
233};
234
236class PL_FOUNDATION_DLL plGroupAttribute : public plPropertyAttribute
237{
238 PL_ADD_DYNAMIC_REFLECTION(plGroupAttribute, plPropertyAttribute);
239
240public:
242 plGroupAttribute(const char* szGroup, float fOrder = -1.0f);
243 plGroupAttribute(const char* szGroup, const char* szIconName, float fOrder = -1.0f);
244
245 const char* GetGroup() const { return m_sGroup; }
246 const char* GetIconName() const { return m_sIconName; }
247 float GetOrder() const { return m_fOrder; }
248
249private:
250 plUntrackedString m_sGroup;
251 plUntrackedString m_sIconName;
252 float m_fOrder = -1.0f;
253};
254
262class PL_FOUNDATION_DLL plTypeWidgetAttribute : public plPropertyAttribute
263{
264 PL_ADD_DYNAMIC_REFLECTION(plTypeWidgetAttribute, plPropertyAttribute);
265};
266
272class PL_FOUNDATION_DLL plContainerWidgetAttribute : public plPropertyAttribute
273{
274 PL_ADD_DYNAMIC_REFLECTION(plContainerWidgetAttribute, plPropertyAttribute);
275};
276
282{
283 PL_ADD_DYNAMIC_REFLECTION(plTagSetWidgetAttribute, plContainerWidgetAttribute);
284
285public:
286 plTagSetWidgetAttribute() = default;
287 plTagSetWidgetAttribute(const char* szTagFilter)
288 : m_sTagFilter(szTagFilter)
289 {
290 }
291
292 const char* GetTagFilter() const { return m_sTagFilter; }
293
294private:
295 plUntrackedString m_sTagFilter;
296};
297
300{
302};
303
312{
314
315public:
317 plExposedParametersAttribute(const char* szParametersSource)
318 : m_sParametersSource(szParametersSource)
319 {
320 }
321
322 const char* GetParametersSource() const { return m_sParametersSource; }
323
324private:
325 plUntrackedString m_sParametersSource;
326};
327
341{
342 PL_ADD_DYNAMIC_REFLECTION(plDynamicDefaultValueAttribute, plTypeWidgetAttribute);
343
344public:
346 plDynamicDefaultValueAttribute(const char* szClassSource,
347 const char* szClassType, const char* szClassProperty = nullptr)
348 : m_sClassSource(szClassSource)
349 , m_sClassType(szClassType)
350 , m_sClassProperty(szClassProperty)
351 {
352 }
353
354 const char* GetClassSource() const { return m_sClassSource; }
355 const char* GetClassType() const { return m_sClassType; }
356 const char* GetClassProperty() const { return m_sClassProperty; }
357
358private:
359 plUntrackedString m_sClassSource;
360 plUntrackedString m_sClassType;
361 plUntrackedString m_sClassProperty;
362};
363
364
366class PL_FOUNDATION_DLL plContainerAttribute : public plPropertyAttribute
367{
368 PL_ADD_DYNAMIC_REFLECTION(plContainerAttribute, plPropertyAttribute);
369
370public:
371 plContainerAttribute() = default;
372 plContainerAttribute(bool bCanAdd, bool bCanDelete, bool bCanMove)
373 {
374 m_bCanAdd = bCanAdd;
375 m_bCanDelete = bCanDelete;
376 m_bCanMove = bCanMove;
377 }
378
379 bool CanAdd() const { return m_bCanAdd; }
380 bool CanDelete() const { return m_bCanDelete; }
381 bool CanMove() const { return m_bCanMove; }
382
383private:
384 bool m_bCanAdd = false;
385 bool m_bCanDelete = false;
386 bool m_bCanMove = false;
387};
388
411{
412 using StorageType = plUInt8;
413
414 enum Enum
415 {
416 None = 0,
417 Thumbnail = PL_BIT(0),
418 Transform = PL_BIT(1),
419 Package = PL_BIT(2),
420 Default = 0
421 };
422
423 struct Bits
424 {
425 StorageType Thumbnail : 1;
426 StorageType Transform : 1;
427 StorageType Package : 1;
428 };
429};
430
431PL_DECLARE_FLAGS_OPERATORS(plDependencyFlags);
432PL_DECLARE_REFLECTABLE_TYPE(PL_FOUNDATION_DLL, plDependencyFlags);
433
438class PL_FOUNDATION_DLL plFileBrowserAttribute : public plTypeWidgetAttribute
439{
440 PL_ADD_DYNAMIC_REFLECTION(plFileBrowserAttribute, plTypeWidgetAttribute);
441
442public:
443 // Predefined common type filters
444 static constexpr plStringView Meshes = "*.obj;*.fbx;*.gltf;*.glb"_plsv;
445 static constexpr plStringView MeshesWithAnimations = "*.fbx;*.gltf;*.glb"_plsv;
446 static constexpr plStringView ImagesLdrOnly = "*.dds;*.tga;*.png;*.jpg;*.jpeg"_plsv;
447 static constexpr plStringView ImagesHdrOnly = "*.hdr;*.exr"_plsv;
448 static constexpr plStringView ImagesLdrAndHdr = "*.dds;*.tga;*.png;*.jpg;*.jpeg;*.hdr;*.exr"_plsv;
449 static constexpr plStringView CubemapsLdrAndHdr = "*.dds;*.hdr"_plsv;
450
451 plFileBrowserAttribute() = default;
453 : m_sDialogTitle(sDialogTitle)
454 , m_sTypeFilter(sTypeFilter)
455 , m_sCustomAction(sCustomAction)
456 , m_DependencyFlags(depencyFlags)
457 {
458 }
459
460 plStringView GetDialogTitle() const { return m_sDialogTitle; }
461 plStringView GetTypeFilter() const { return m_sTypeFilter; }
462 plStringView GetCustomAction() const { return m_sCustomAction; }
463 plBitflags<plDependencyFlags> GetDependencyFlags() const { return m_DependencyFlags; }
464
465private:
466 plUntrackedString m_sDialogTitle;
467 plUntrackedString m_sTypeFilter;
468 plUntrackedString m_sCustomAction;
469 plBitflags<plDependencyFlags> m_DependencyFlags;
470};
471
477{
478 PL_ADD_DYNAMIC_REFLECTION(plExternalFileBrowserAttribute, plTypeWidgetAttribute);
479
480public:
483 : m_sDialogTitle(sDialogTitle)
484 , m_sTypeFilter(sTypeFilter)
485 {
486 }
487
488 plStringView GetDialogTitle() const { return m_sDialogTitle; }
489 plStringView GetTypeFilter() const { return m_sTypeFilter; }
490
491private:
492 plUntrackedString m_sDialogTitle;
493 plUntrackedString m_sTypeFilter;
494};
495
500class PL_FOUNDATION_DLL plAssetBrowserAttribute : public plTypeWidgetAttribute
501{
502 PL_ADD_DYNAMIC_REFLECTION(plAssetBrowserAttribute, plTypeWidgetAttribute);
503
504public:
505 plAssetBrowserAttribute() = default;
507 : m_DependencyFlags(depencyFlags)
508 {
509 SetTypeFilter(szTypeFilter);
510 }
511
512 plAssetBrowserAttribute(const char* szTypeFilter, const char* szRequiredTag, plBitflags<plDependencyFlags> depencyFlags = plDependencyFlags::Thumbnail | plDependencyFlags::Package)
513 : m_DependencyFlags(depencyFlags)
514 {
515 SetTypeFilter(szTypeFilter);
516 m_sRequiredTag = szRequiredTag;
517 }
518
519 void SetTypeFilter(const char* szTypeFilter)
520 {
521 plStringBuilder sTemp(";", szTypeFilter, ";");
522 m_sTypeFilter = sTemp;
523 }
524
525 const char* GetTypeFilter() const { return m_sTypeFilter; }
526 plBitflags<plDependencyFlags> GetDependencyFlags() const { return m_DependencyFlags; }
527
528 const char* GetRequiredTag() const { return m_sRequiredTag; }
529
530private:
531 plUntrackedString m_sTypeFilter;
532 plUntrackedString m_sRequiredTag;
533 plBitflags<plDependencyFlags> m_DependencyFlags;
534};
535
539class PL_FOUNDATION_DLL plDynamicEnumAttribute : public plTypeWidgetAttribute
540{
541 PL_ADD_DYNAMIC_REFLECTION(plDynamicEnumAttribute, plTypeWidgetAttribute);
542
543public:
544 plDynamicEnumAttribute() = default;
545 plDynamicEnumAttribute(const char* szDynamicEnumName)
546 : m_sDynamicEnumName(szDynamicEnumName)
547 {
548 }
549
550 const char* GetDynamicEnumName() const { return m_sDynamicEnumName; }
551
552private:
553 plUntrackedString m_sDynamicEnumName;
554};
555
560{
561 PL_ADD_DYNAMIC_REFLECTION(plDynamicStringEnumAttribute, plTypeWidgetAttribute);
562
563public:
565 plDynamicStringEnumAttribute(const char* szDynamicEnumName)
566 : m_sDynamicEnumName(szDynamicEnumName)
567 {
568 }
569
570 const char* GetDynamicEnumName() const { return m_sDynamicEnumName; }
571
572private:
573 plUntrackedString m_sDynamicEnumName;
574};
575
577class PL_FOUNDATION_DLL plDynamicBitflagsAttribute : public plTypeWidgetAttribute
578{
579 PL_ADD_DYNAMIC_REFLECTION(plDynamicBitflagsAttribute, plTypeWidgetAttribute);
580
581public:
582 plDynamicBitflagsAttribute() = default;
584 : m_sDynamicBitflagsName(sDynamicName)
585 {
586 }
587
588 plStringView GetDynamicBitflagsName() const { return m_sDynamicBitflagsName; }
589
590private:
591 plUntrackedString m_sDynamicBitflagsName;
592};
593
595
596class PL_FOUNDATION_DLL plManipulatorAttribute : public plPropertyAttribute
597{
598 PL_ADD_DYNAMIC_REFLECTION(plManipulatorAttribute, plPropertyAttribute);
599
600public:
601 plManipulatorAttribute(const char* szProperty1, const char* szProperty2 = nullptr, const char* szProperty3 = nullptr,
602 const char* szProperty4 = nullptr, const char* szProperty5 = nullptr, const char* szProperty6 = nullptr);
603
604 plUntrackedString m_sProperty1;
605 plUntrackedString m_sProperty2;
606 plUntrackedString m_sProperty3;
607 plUntrackedString m_sProperty4;
608 plUntrackedString m_sProperty5;
609 plUntrackedString m_sProperty6;
610};
611
613
615{
616 PL_ADD_DYNAMIC_REFLECTION(plSphereManipulatorAttribute, plManipulatorAttribute);
617
618public:
620 plSphereManipulatorAttribute(const char* szOuterRadiusProperty, const char* szInnerRadiusProperty = nullptr);
621
622 const plUntrackedString& GetOuterRadiusProperty() const { return m_sProperty1; }
623 const plUntrackedString& GetInnerRadiusProperty() const { return m_sProperty2; }
624};
625
626
628
630{
631 PL_ADD_DYNAMIC_REFLECTION(plCapsuleManipulatorAttribute, plManipulatorAttribute);
632
633public:
635 plCapsuleManipulatorAttribute(const char* szHeightProperty, const char* szRadiusProperty);
636
637 const plUntrackedString& GetLengthProperty() const { return m_sProperty1; }
638 const plUntrackedString& GetRadiusProperty() const { return m_sProperty2; }
639};
640
641
643
644class PL_FOUNDATION_DLL plBoxManipulatorAttribute : public plManipulatorAttribute
645{
646 PL_ADD_DYNAMIC_REFLECTION(plBoxManipulatorAttribute, plManipulatorAttribute);
647
648public:
650 plBoxManipulatorAttribute(const char* szSizeProperty, float fSizeScale, bool bRecenterParent, const char* szOffsetProperty = nullptr, const char* szRotationProperty = nullptr);
651
652 bool m_bRecenterParent = false;
653 float m_fSizeScale = 1.0f;
654
655 const plUntrackedString& GetSizeProperty() const { return m_sProperty1; }
656 const plUntrackedString& GetOffsetProperty() const { return m_sProperty2; }
657 const plUntrackedString& GetRotationProperty() const { return m_sProperty3; }
658};
659
661
663{
665
666public:
669 const char* szNegXProp, const char* szPosXProp, const char* szNegYProp, const char* szPosYProp, const char* szNegZProp, const char* szPosZProp);
670 plNonUniformBoxManipulatorAttribute(const char* szSizeX, const char* szSizeY, const char* szSizeZ);
671
672 bool HasSixAxis() const { return !m_sProperty4.IsEmpty(); }
673
674 const plUntrackedString& GetNegXProperty() const { return m_sProperty1; }
675 const plUntrackedString& GetPosXProperty() const { return m_sProperty2; }
676 const plUntrackedString& GetNegYProperty() const { return m_sProperty3; }
677 const plUntrackedString& GetPosYProperty() const { return m_sProperty4; }
678 const plUntrackedString& GetNegZProperty() const { return m_sProperty5; }
679 const plUntrackedString& GetPosZProperty() const { return m_sProperty6; }
680
681 const plUntrackedString& GetSizeXProperty() const { return m_sProperty1; }
682 const plUntrackedString& GetSizeYProperty() const { return m_sProperty2; }
683 const plUntrackedString& GetSizeZProperty() const { return m_sProperty3; }
684};
685
687
689{
691
692public:
694 plConeLengthManipulatorAttribute(const char* szRadiusProperty);
695
696 const plUntrackedString& GetRadiusProperty() const { return m_sProperty1; }
697};
698
700
702{
704
705public:
707 plConeAngleManipulatorAttribute(const char* szAngleProperty, float fScale = 1.0f, const char* szRadiusProperty = nullptr);
708
709 const plUntrackedString& GetAngleProperty() const { return m_sProperty1; }
710 const plUntrackedString& GetRadiusProperty() const { return m_sProperty2; }
711
712 float m_fScale;
713};
714
716
718{
720
721public:
723 plTransformManipulatorAttribute(const char* szTranslateProperty, const char* szRotateProperty = nullptr, const char* szScaleProperty = nullptr, const char* szOffsetTranslation = nullptr, const char* szOffsetRotation = nullptr);
724
725 const plUntrackedString& GetTranslateProperty() const { return m_sProperty1; }
726 const plUntrackedString& GetRotateProperty() const { return m_sProperty2; }
727 const plUntrackedString& GetScaleProperty() const { return m_sProperty3; }
728 const plUntrackedString& GetGetOffsetTranslationProperty() const { return m_sProperty4; }
729 const plUntrackedString& GetGetOffsetRotationProperty() const { return m_sProperty5; }
730};
731
733
735{
736 PL_ADD_DYNAMIC_REFLECTION(plBoneManipulatorAttribute, plManipulatorAttribute);
737
738public:
740 plBoneManipulatorAttribute(const char* szTransformProperty, const char* szBindTo);
741
742 const plUntrackedString& GetTransformProperty() const { return m_sProperty1; }
743};
744
746
748{
749 using StorageType = plUInt8;
750
751 enum Enum
752 {
753 Center = 0,
754 PosX = PL_BIT(0),
755 NegX = PL_BIT(1),
756 PosY = PL_BIT(2),
757 NegY = PL_BIT(3),
758 PosZ = PL_BIT(4),
759 NegZ = PL_BIT(5),
760
761 Default = Center
762 };
763
764 struct Bits
765 {
766 StorageType PosX : 1;
767 StorageType NegX : 1;
768 StorageType PosY : 1;
769 StorageType NegY : 1;
770 StorageType PosZ : 1;
771 StorageType NegZ : 1;
772 };
773};
774
775PL_DECLARE_REFLECTABLE_TYPE(PL_FOUNDATION_DLL, plVisualizerAnchor);
776
778
779class PL_FOUNDATION_DLL plVisualizerAttribute : public plPropertyAttribute
780{
781 PL_ADD_DYNAMIC_REFLECTION(plVisualizerAttribute, plPropertyAttribute);
782
783public:
784 plVisualizerAttribute(const char* szProperty1, const char* szProperty2 = nullptr, const char* szProperty3 = nullptr,
785 const char* szProperty4 = nullptr, const char* szProperty5 = nullptr);
786
787 plUntrackedString m_sProperty1;
788 plUntrackedString m_sProperty2;
789 plUntrackedString m_sProperty3;
790 plUntrackedString m_sProperty4;
791 plUntrackedString m_sProperty5;
793};
794
796
797class PL_FOUNDATION_DLL plBoxVisualizerAttribute : public plVisualizerAttribute
798{
799 PL_ADD_DYNAMIC_REFLECTION(plBoxVisualizerAttribute, plVisualizerAttribute);
800
801public:
803 plBoxVisualizerAttribute(const char* szSizeProperty, float fSizeScale = 1.0f, const plColor& fixedColor = plColorScheme::LightUI(plColorScheme::Grape), const char* szColorProperty = nullptr, plBitflags<plVisualizerAnchor> anchor = plVisualizerAnchor::Center, plVec3 vOffsetOrScale = plVec3::MakeZero(), const char* szOffsetProperty = nullptr, const char* szRotationProperty = nullptr);
804
805 const plUntrackedString& GetSizeProperty() const { return m_sProperty1; }
806 const plUntrackedString& GetColorProperty() const { return m_sProperty2; }
807 const plUntrackedString& GetOffsetProperty() const { return m_sProperty3; }
808 const plUntrackedString& GetRotationProperty() const { return m_sProperty4; }
809
810 float m_fSizeScale = 1.0f;
811 plColor m_Color;
812 plVec3 m_vOffsetOrScale;
813};
814
816
818{
819 PL_ADD_DYNAMIC_REFLECTION(plSphereVisualizerAttribute, plVisualizerAttribute);
820
821public:
823 plSphereVisualizerAttribute(const char* szRadiusProperty, const plColor& fixedColor = plColorScheme::LightUI(plColorScheme::Grape), const char* szColorProperty = nullptr, plBitflags<plVisualizerAnchor> anchor = plVisualizerAnchor::Center, plVec3 vOffsetOrScale = plVec3::MakeZero(), const char* szOffsetProperty = nullptr);
824
825 const plUntrackedString& GetRadiusProperty() const { return m_sProperty1; }
826 const plUntrackedString& GetColorProperty() const { return m_sProperty2; }
827 const plUntrackedString& GetOffsetProperty() const { return m_sProperty3; }
828
829 plColor m_Color;
830 plVec3 m_vOffsetOrScale;
831};
832
833
835
837{
838 PL_ADD_DYNAMIC_REFLECTION(plCapsuleVisualizerAttribute, plVisualizerAttribute);
839
840public:
842 plCapsuleVisualizerAttribute(const char* szHeightProperty, const char* szRadiusProperty, const plColor& fixedColor = plColorScheme::LightUI(plColorScheme::Grape), const char* szColorProperty = nullptr, plBitflags<plVisualizerAnchor> anchor = plVisualizerAnchor::Center);
843
844 const plUntrackedString& GetHeightProperty() const { return m_sProperty1; }
845 const plUntrackedString& GetRadiusProperty() const { return m_sProperty2; }
846 const plUntrackedString& GetColorProperty() const { return m_sProperty3; }
847
848 plColor m_Color;
849};
850
852
854{
855 PL_ADD_DYNAMIC_REFLECTION(plCylinderVisualizerAttribute, plVisualizerAttribute);
856
857public:
859 plCylinderVisualizerAttribute(plEnum<plBasisAxis> axis, const char* szHeightProperty, const char* szRadiusProperty, const plColor& fixedColor = plColorScheme::LightUI(plColorScheme::Grape), const char* szColorProperty = nullptr, plBitflags<plVisualizerAnchor> anchor = plVisualizerAnchor::Center, plVec3 vOffsetOrScale = plVec3::MakeZero(), const char* szOffsetProperty = nullptr);
860 plCylinderVisualizerAttribute(const char* szAxisProperty, const char* szHeightProperty, const char* szRadiusProperty, const plColor& fixedColor = plColorScheme::LightUI(plColorScheme::Grape), const char* szColorProperty = nullptr, plBitflags<plVisualizerAnchor> anchor = plVisualizerAnchor::Center, plVec3 vOffsetOrScale = plVec3::MakeZero(), const char* szOffsetProperty = nullptr);
861
862 const plUntrackedString& GetAxisProperty() const { return m_sProperty5; }
863 const plUntrackedString& GetHeightProperty() const { return m_sProperty1; }
864 const plUntrackedString& GetRadiusProperty() const { return m_sProperty2; }
865 const plUntrackedString& GetColorProperty() const { return m_sProperty3; }
866 const plUntrackedString& GetOffsetProperty() const { return m_sProperty4; }
867
868 plColor m_Color;
869 plVec3 m_vOffsetOrScale;
870 plEnum<plBasisAxis> m_Axis;
871};
872
874
876{
877 PL_ADD_DYNAMIC_REFLECTION(plDirectionVisualizerAttribute, plVisualizerAttribute);
878
879public:
881 plDirectionVisualizerAttribute(plEnum<plBasisAxis> axis, float fScale, const plColor& fixedColor = plColorScheme::LightUI(plColorScheme::Grape), const char* szColorProperty = nullptr, const char* szLengthProperty = nullptr);
882 plDirectionVisualizerAttribute(const char* szAxisProperty, float fScale, const plColor& fixedColor = plColorScheme::LightUI(plColorScheme::Grape), const char* szColorProperty = nullptr, const char* szLengthProperty = nullptr);
883
884 const plUntrackedString& GetColorProperty() const { return m_sProperty1; }
885 const plUntrackedString& GetLengthProperty() const { return m_sProperty2; }
886 const plUntrackedString& GetAxisProperty() const { return m_sProperty3; }
887
888 plEnum<plBasisAxis> m_Axis;
889 plColor m_Color;
890 float m_fScale;
891};
892
894
895class PL_FOUNDATION_DLL plConeVisualizerAttribute : public plVisualizerAttribute
896{
897 PL_ADD_DYNAMIC_REFLECTION(plConeVisualizerAttribute, plVisualizerAttribute);
898
899public:
901
908 plConeVisualizerAttribute(plEnum<plBasisAxis> axis, const char* szAngleProperty, float fScale, const char* szRadiusProperty, const plColor& fixedColor = plColorScheme::LightUI(plColorScheme::Grape), const char* szColorProperty = nullptr);
909
910 const plUntrackedString& GetAngleProperty() const { return m_sProperty1; }
911 const plUntrackedString& GetRadiusProperty() const { return m_sProperty2; }
912 const plUntrackedString& GetColorProperty() const { return m_sProperty3; }
913
914 plEnum<plBasisAxis> m_Axis;
915 plColor m_Color;
916 float m_fScale;
917};
918
920
922{
923 PL_ADD_DYNAMIC_REFLECTION(plCameraVisualizerAttribute, plVisualizerAttribute);
924
925public:
927
929 plCameraVisualizerAttribute(const char* szModeProperty, const char* szFovProperty, const char* szOrthoDimProperty, const char* szNearPlaneProperty, const char* szFarPlaneProperty);
930
931 const plUntrackedString& GetModeProperty() const { return m_sProperty1; }
932 const plUntrackedString& GetFovProperty() const { return m_sProperty2; }
933 const plUntrackedString& GetOrthoDimProperty() const { return m_sProperty3; }
934 const plUntrackedString& GetNearPlaneProperty() const { return m_sProperty4; }
935 const plUntrackedString& GetFarPlaneProperty() const { return m_sProperty5; }
936};
937
939
940// Implementation moved here as it requires plPropertyAttribute to be fully defined.
941template <typename Type>
942const Type* plRTTI::GetAttributeByType() const
943{
944 for (const auto* pAttr : m_Attributes)
945 {
946 if (pAttr->GetDynamicRTTI()->IsDerivedFrom<Type>())
947 return static_cast<const Type*>(pAttr);
948 }
949 if (GetParentType() != nullptr)
950 return GetParentType()->GetAttributeByType<Type>();
951 else
952 return nullptr;
953}
954
955template <typename Type>
957{
958 for (const auto* pAttr : m_Attributes)
959 {
960 if (pAttr->GetDynamicRTTI()->IsDerivedFrom<Type>())
961 return static_cast<const Type*>(pAttr);
962 }
963 return nullptr;
964}
965
967
969class PL_FOUNDATION_DLL plMaxArraySizeAttribute : public plPropertyAttribute
970{
971 PL_ADD_DYNAMIC_REFLECTION(plMaxArraySizeAttribute, plPropertyAttribute);
972
973public:
974 plMaxArraySizeAttribute() = default;
975 plMaxArraySizeAttribute(plUInt32 uiMaxSize) { m_uiMaxSize = uiMaxSize; }
976
977 const plUInt32& GetMaxSize() const { return m_uiMaxSize; }
978
979private:
980 plUInt32 m_uiMaxSize = 0;
981};
982
984
988class PL_FOUNDATION_DLL plPreventDuplicatesAttribute : public plPropertyAttribute
989{
990 PL_ADD_DYNAMIC_REFLECTION(plPreventDuplicatesAttribute, plPropertyAttribute);
991
992public:
994};
995
997
999class PL_FOUNDATION_DLL plExcludeFromScript : public plPropertyAttribute
1000{
1001 PL_ADD_DYNAMIC_REFLECTION(plExcludeFromScript, plPropertyAttribute);
1002};
1003
1006{
1007 PL_ADD_DYNAMIC_REFLECTION(plScriptableFunctionAttribute, plPropertyAttribute);
1008
1009 enum ArgType : plUInt8
1010 {
1011 In,
1012 Out,
1013 Inout
1014 };
1015
1016 plScriptableFunctionAttribute(ArgType argType1 = In, const char* szArg1 = nullptr, ArgType argType2 = In, const char* szArg2 = nullptr,
1017 ArgType argType3 = In, const char* szArg3 = nullptr, ArgType argType4 = In, const char* szArg4 = nullptr, ArgType argType5 = In,
1018 const char* szArg5 = nullptr, ArgType argType6 = In, const char* szArg6 = nullptr);
1019
1020 plUInt32 GetArgumentCount() const { return m_ArgNames.GetCount(); }
1021 const char* GetArgumentName(plUInt32 uiIndex) const { return m_ArgNames[uiIndex]; }
1022
1023 ArgType GetArgumentType(plUInt32 uiIndex) const { return static_cast<ArgType>(m_ArgTypes[uiIndex]); }
1024
1025private:
1027 plHybridArray<plUInt8, 6> m_ArgTypes;
1028};
1029
1032{
1033 PL_ADD_DYNAMIC_REFLECTION(plFunctionArgumentAttributes, plPropertyAttribute);
1034
1035 plFunctionArgumentAttributes() = default;
1036 plFunctionArgumentAttributes(plUInt32 uiArgIndex, const plPropertyAttribute* pAttribute1, const plPropertyAttribute* pAttribute2 = nullptr, const plPropertyAttribute* pAttribute3 = nullptr, const plPropertyAttribute* pAttribute4 = nullptr);
1038
1039 plUInt32 GetArgumentIndex() const { return m_uiArgIndex; }
1040 plArrayPtr<const plPropertyAttribute* const> GetArgumentAttributes() const { return m_ArgAttributes; }
1041
1042private:
1043 plUInt32 m_uiArgIndex = 0;
1045};
1046
1048class PL_FOUNDATION_DLL plDynamicPinAttribute : public plPropertyAttribute
1049{
1050 PL_ADD_DYNAMIC_REFLECTION(plDynamicPinAttribute, plPropertyAttribute);
1051
1052public:
1053 plDynamicPinAttribute() = default;
1054 plDynamicPinAttribute(const char* szProperty);
1055
1056 const plUntrackedString& GetProperty() const { return m_sProperty; }
1057
1058private:
1059 plUntrackedString m_sProperty;
1060};
1061
1063
1070class PL_FOUNDATION_DLL plLongOpAttribute : public plPropertyAttribute
1071{
1072 PL_ADD_DYNAMIC_REFLECTION(plLongOpAttribute, plPropertyAttribute);
1073
1074public:
1075 plLongOpAttribute() = default;
1076 plLongOpAttribute(const char* szOpTypeName)
1077 : m_sOpTypeName(szOpTypeName)
1078 {
1079 }
1080
1081 plUntrackedString m_sOpTypeName;
1082};
1083
1085
1088{
1089 PL_ADD_DYNAMIC_REFLECTION(plGameObjectReferenceAttribute, plTypeWidgetAttribute);
1090
1091public:
1093};
1094
1096
1105class PL_FOUNDATION_DLL plImageSliderUiAttribute : public plTypeWidgetAttribute
1106{
1107 PL_ADD_DYNAMIC_REFLECTION(plImageSliderUiAttribute, plTypeWidgetAttribute);
1108
1109public:
1110 plImageSliderUiAttribute() = default;
1111 plImageSliderUiAttribute(const char* szImageGenerator)
1112 {
1113 m_sImageGenerator = szImageGenerator;
1114 }
1115
1116 plUntrackedString m_sImageGenerator;
1117};
const Type * GetAttributeByType() const
Returns the first attribute that derives from the given type, or nullptr if nothing is found.
Definition PropertyAttributes.h:956
This class encapsulates an array and it's size. It is recommended to use this class instead of plain ...
Definition ArrayPtr.h:37
A property attribute that indicates that the string property is actually an asset reference.
Definition PropertyAttributes.h:501
Definition PropertyAttributes.h:735
Definition PropertyAttributes.h:645
Definition PropertyAttributes.h:798
Definition PropertyAttributes.h:922
Definition PropertyAttributes.h:630
Definition PropertyAttributes.h:837
Used to categorize types (e.g. add component menu)
Definition PropertyAttributes.h:36
A property attribute that allows to define min and max values for the UI. Min or max may be set to an...
Definition PropertyAttributes.h:216
Used to colorize types.
Definition PropertyAttributes.h:112
plColor represents an RGBA color in linear color space. Values are stored as float,...
Definition Color.h:44
static PL_ALWAYS_INLINE plColor LightUI(Enum schemeColor)
Get a scheme color with predefined brightness and saturation to look good as highlight color in PL to...
Definition ColorScheme.h:66
Definition PropertyAttributes.h:702
Definition PropertyAttributes.h:689
Definition PropertyAttributes.h:896
Sets the allowed actions on a container.
Definition PropertyAttributes.h:367
Derive from this class if you want to define an attribute that replaces the property widget of contai...
Definition PropertyAttributes.h:273
Definition PropertyAttributes.h:854
Sets the default value of the property.
Definition PropertyAttributes.h:171
Definition PropertyAttributes.h:876
Can be used on integer properties to display them as bitflags. The valid bitflags and their names may...
Definition PropertyAttributes.h:578
Add this attribute to an embedded class or container property to make it retrieve its default values ...
Definition PropertyAttributes.h:341
Can be used on integer properties to display them as enums. The valid enum values and their names may...
Definition PropertyAttributes.h:540
Used to mark an array or (unsigned)int property as source for dynamic pin generation on nodes.
Definition PropertyAttributes.h:1049
Can be used on string properties to display them as enums. The valid enum values and their names may ...
Definition PropertyAttributes.h:560
Attribute for types that should not be exposed to the scripting framework.
Definition PropertyAttributes.h:1000
A property attribute that indicates that the alpha channel of an plColorGammaUB or plColor should be ...
Definition PropertyAttributes.h:129
Add this attribute to a variant map property to make it map to the exposed parameters of an asset....
Definition PropertyAttributes.h:312
Indicates that the string property should allow to browse for an file (or programs) outside the proje...
Definition PropertyAttributes.h:477
A property attribute that indicates that the string property should display a file browsing button.
Definition PropertyAttributes.h:439
Wrapper Attribute to add an attribute to a function argument.
Definition PropertyAttributes.h:1032
A property attribute that indicates that the string property is actually a game object reference.
Definition PropertyAttributes.h:1088
Used to categorize properties into groups.
Definition PropertyAttributes.h:237
A property attribute that indicates that the property is not to be shown in the UI.
Definition PropertyAttributes.h:23
A hybrid array uses in-place storage to handle the first few elements without any allocation....
Definition HybridArray.h:12
Definition PropertyAttributes.h:94
Displays the value range as an image, allowing users to pick a value like on a slider.
Definition PropertyAttributes.h:1106
A property attribute that indicates that this feature is still in development and should not be shown...
Definition PropertyAttributes.h:54
Used to mark that a component provides functionality that is executed with a long operation in the ed...
Definition PropertyAttributes.h:1071
Definition PropertyAttributes.h:597
A property attribute that specifies the max size of an array. If it is reached, no further elemets ar...
Definition PropertyAttributes.h:970
Used to show a text instead of the minimum value of a property.
Definition PropertyAttributes.h:153
This attribute indicates that a widget should not use temporary transactions when changing the value.
Definition PropertyAttributes.h:300
Definition PropertyAttributes.h:663
If this attribute is set, the UI is encouraged to prevent the user from creating duplicates of the sa...
Definition PropertyAttributes.h:989
Base class of all attributes can be used to decorate a RTTI property.
Definition PropertyAttributes.h:11
PL_ALWAYS_INLINE const plRTTI * GetParentType() const
Returns the type that is the base class of this type. May be nullptr if this type has no base class.
Definition RTTI.h:54
const Type * GetAttributeByType() const
Returns the first attribute that derives from the given type, or nullptr if nothing is found.
Definition PropertyAttributes.h:942
A property attribute that indicates that the property may not be modified through the UI.
Definition PropertyAttributes.h:17
All classes that should be dynamically reflectable, need to be derived from this base class.
Definition DynamicRTTI.h:86
Attribute to mark a function up to be exposed to the scripting system. Arguments specify the names of...
Definition PropertyAttributes.h:1006
Definition PropertyAttributes.h:615
Definition PropertyAttributes.h:818
plStringBuilder is a class that is meant for creating and modifying strings.
Definition StringBuilder.h:35
plStringView represent a read-only sub-string of a larger string, as it can store a dedicated string ...
Definition StringView.h:34
Used for any property shown as a line edit (int, float, vector etc).
Definition PropertyAttributes.h:135
Add this attribute to a tag set member property to make it use the tag set editor and define the cate...
Definition PropertyAttributes.h:282
A property attribute that indicates that the property is not to be serialized and whatever it points ...
Definition PropertyAttributes.h:30
Used for dynamic titles of visual script nodes. E.g. "Set Bool Property '{Name}'" will allow the titl...
Definition PropertyAttributes.h:77
Definition PropertyAttributes.h:718
Derive from this class if you want to define an attribute that replaces the property type widget.
Definition PropertyAttributes.h:263
plVariant is a class that can store different types of variables, which is useful in situations where...
Definition Variant.h:44
static plVec3Template< float > MakeZero()
Definition Vec3.h:38
Definition PropertyAttributes.h:780
The plBitflags class allows you to work with type-safe bitflags.
Definition Bitflags.h:82
Definition PropertyAttributes.h:424
Defines how a reference set by plFileBrowserAttribute and plAssetBrowserAttribute is treated.
Definition PropertyAttributes.h:411
Enum
Definition PropertyAttributes.h:415
@ Transform
This reference is a dependency to transforming this asset. The input model of a mesh for example.
Definition PropertyAttributes.h:418
@ None
The reference is not needed for anything in production. An example of this is editor references that ...
Definition PropertyAttributes.h:416
@ Thumbnail
This reference is a dependency to generating a thumbnail. The material references of a mesh for examp...
Definition PropertyAttributes.h:417
@ Package
This reference needs to be packaged as it is used at runtime by this asset. All sounds or debris gene...
Definition PropertyAttributes.h:419
A custom enum implementation that allows to define the underlying storage type to control its memory ...
Definition Enum.h:37
Definition PropertyAttributes.h:765
Definition PropertyAttributes.h:748