Merge branch 'development' into Atom/guthadam/shared_preview_renderer_as_interface
commit
21c84fc47b
@ -0,0 +1,207 @@
|
||||
"""
|
||||
Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
|
||||
SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
"""
|
||||
|
||||
class Tests:
|
||||
creation_undo = (
|
||||
"UNDO Entity creation success",
|
||||
"UNDO Entity creation failed")
|
||||
creation_redo = (
|
||||
"REDO Entity creation success",
|
||||
"REDO Entity creation failed")
|
||||
postfx_shape_weight_creation = (
|
||||
"PostFx Shape Weight Modifier Entity successfully created",
|
||||
"PostFx Shape Weight Modifier Entity failed to be created")
|
||||
postfx_shape_weight_component = (
|
||||
"Entity has a PostFx Shape Weight Modifier component",
|
||||
"Entity failed to find PostFx Shape Weight Modifier component")
|
||||
postfx_shape_weight_disabled = (
|
||||
"PostFx Shape Weight Modifier component disabled",
|
||||
"PostFx Shape Weight Modifier component was not disabled.")
|
||||
postfx_layer_component = (
|
||||
"Entity has a PostFX Layer component",
|
||||
"Entity did not have an PostFX Layer component")
|
||||
tube_shape_component = (
|
||||
"Entity has a Tube Shape component",
|
||||
"Entity did not have a Tube Shape component")
|
||||
postfx_shape_weight_enabled = (
|
||||
"PostFx Shape Weight Modifier component enabled",
|
||||
"PostFx Shape Weight Modifier component was not enabled.")
|
||||
enter_game_mode = (
|
||||
"Entered game mode",
|
||||
"Failed to enter game mode")
|
||||
exit_game_mode = (
|
||||
"Exited game mode",
|
||||
"Couldn't exit game mode")
|
||||
is_visible = (
|
||||
"Entity is visible",
|
||||
"Entity was not visible")
|
||||
is_hidden = (
|
||||
"Entity is hidden",
|
||||
"Entity was not hidden")
|
||||
entity_deleted = (
|
||||
"Entity deleted",
|
||||
"Entity was not deleted")
|
||||
deletion_undo = (
|
||||
"UNDO deletion success",
|
||||
"UNDO deletion failed")
|
||||
deletion_redo = (
|
||||
"REDO deletion success",
|
||||
"REDO deletion failed")
|
||||
|
||||
|
||||
def AtomEditorComponents_postfx_shape_weight_AddedToEntity():
|
||||
"""
|
||||
Summary:
|
||||
Tests the PostFx Shape Weight Modifier component can be added to an entity and has the expected functionality.
|
||||
|
||||
Test setup:
|
||||
- Wait for Editor idle loop.
|
||||
- Open the "Base" level.
|
||||
|
||||
Expected Behavior:
|
||||
The component can be added, used in game mode, hidden/shown, deleted, and has accurate required components.
|
||||
Creation and deletion undo/redo should also work.
|
||||
|
||||
Test Steps:
|
||||
1) Create a PostFx Shape Weight Modifier entity with no components.
|
||||
2) Add a PostFx Shape Weight Modifier component to PostFx Shape Weight Modifier entity.
|
||||
3) UNDO the entity creation and component addition.
|
||||
4) REDO the entity creation and component addition.
|
||||
5) Verify PostFx Shape Weight Modifier component not enabled.
|
||||
6) Add PostFX Layer component since it is required by the PostFx Shape Weight Modifier component.
|
||||
7) Verify PostFx Shape Weight Modifier component is NOT enabled since it also requires a shape.
|
||||
8) Add a required shape looping over a list and checking if it enables PostFX Shape Weight Modifier.
|
||||
9) Undo to remove each added shape and verify PostFX Shape Weight Modifier is not enabled.
|
||||
10) Verify PostFx Shape Weight Modifier component is enabled by adding Spline and Tube Shape component.
|
||||
11) Enter/Exit game mode.
|
||||
12) Test IsHidden.
|
||||
13) Test IsVisible.
|
||||
14) Delete PostFx Shape Weight Modifier entity.
|
||||
15) UNDO deletion.
|
||||
16) REDO deletion.
|
||||
17) Look for errors.
|
||||
|
||||
:return: None
|
||||
"""
|
||||
|
||||
import azlmbr.legacy.general as general
|
||||
|
||||
from editor_python_test_tools.editor_entity_utils import EditorEntity
|
||||
from editor_python_test_tools.utils import Report, Tracer, TestHelper
|
||||
|
||||
with Tracer() as error_tracer:
|
||||
# Test setup begins.
|
||||
# Setup: Wait for Editor idle loop before executing Python hydra scripts then open "Base" level.
|
||||
TestHelper.init_idle()
|
||||
TestHelper.open_level("", "Base")
|
||||
|
||||
# Test steps begin.
|
||||
# 1. Create a PostFx Shape Weight Modifier entity with no components.
|
||||
postfx_shape_weight_name = "PostFX Shape Weight Modifier"
|
||||
postfx_shape_weight_entity = EditorEntity.create_editor_entity(postfx_shape_weight_name)
|
||||
Report.critical_result(Tests.postfx_shape_weight_creation, postfx_shape_weight_entity.exists())
|
||||
|
||||
# 2. Add a PostFx Shape Weight Modifier component to PostFx Shape Weight Modifier entity.
|
||||
postfx_shape_weight_component = postfx_shape_weight_entity.add_component(postfx_shape_weight_name)
|
||||
Report.critical_result(
|
||||
Tests.postfx_shape_weight_component,
|
||||
postfx_shape_weight_entity.has_component(postfx_shape_weight_name))
|
||||
|
||||
# 3. UNDO the entity creation and component addition.
|
||||
# -> UNDO component addition.
|
||||
general.undo()
|
||||
# -> UNDO naming entity.
|
||||
general.undo()
|
||||
# -> UNDO selecting entity.
|
||||
general.undo()
|
||||
# -> UNDO entity creation.
|
||||
general.undo()
|
||||
general.idle_wait_frames(1)
|
||||
Report.result(Tests.creation_undo, not postfx_shape_weight_entity.exists())
|
||||
|
||||
# 4. REDO the entity creation and component addition.
|
||||
# -> REDO entity creation.
|
||||
general.redo()
|
||||
# -> REDO selecting entity.
|
||||
general.redo()
|
||||
# -> REDO naming entity.
|
||||
general.redo()
|
||||
# -> REDO component addition.
|
||||
general.redo()
|
||||
general.idle_wait_frames(1)
|
||||
Report.result(Tests.creation_redo, postfx_shape_weight_entity.exists())
|
||||
|
||||
# 5. Verify PostFx Shape Weight Modifier component not enabled.
|
||||
Report.result(Tests.postfx_shape_weight_disabled, not postfx_shape_weight_component.is_enabled())
|
||||
|
||||
# 6. Add PostFX Layer component since it is required by the PostFx Shape Weight Modifier component.
|
||||
postfx_layer_name = "PostFX Layer"
|
||||
postfx_shape_weight_entity.add_component(postfx_layer_name)
|
||||
Report.result(Tests.postfx_layer_component, postfx_shape_weight_entity.has_component(postfx_layer_name))
|
||||
|
||||
# 7. Verify PostFx Shape Weight Modifier component is NOT enabled since it also requires a shape.
|
||||
Report.result(Tests.postfx_shape_weight_disabled, not postfx_shape_weight_component.is_enabled())
|
||||
|
||||
# 8. Add a required shape looping over a list and checking if it enables PostFX Shape Weight Modifier.
|
||||
for shape in ['Axis Aligned Box Shape', 'Box Shape', 'Capsule Shape', 'Compound Shape', 'Cylinder Shape',
|
||||
'Disk Shape', 'Polygon Prism Shape', 'Quad Shape', 'Sphere Shape', 'Vegetation Reference Shape']:
|
||||
postfx_shape_weight_entity.add_component(shape)
|
||||
test_shape = (
|
||||
f"Entity has a {shape} component",
|
||||
f"Entity did not have a {shape} component")
|
||||
Report.result(test_shape, postfx_shape_weight_entity.has_component(shape))
|
||||
|
||||
# Check if required shape allows PostFX Shape Weight Modifier to be enabled
|
||||
Report.result(Tests.postfx_shape_weight_enabled, postfx_shape_weight_component.is_enabled())
|
||||
|
||||
# 9. Undo to remove each added shape and verify PostFX Shape Weight Modifier is not enabled.
|
||||
general.undo()
|
||||
TestHelper.wait_for_condition(lambda: not postfx_shape_weight_entity.has_component(shape), 1.0)
|
||||
Report.result(Tests.postfx_shape_weight_disabled, not postfx_shape_weight_component.is_enabled())
|
||||
|
||||
# 10. Verify PostFx Shape Weight Modifier component is enabled by adding Spline and Tube Shape component.
|
||||
postfx_shape_weight_entity.add_components(['Spline', 'Tube Shape'])
|
||||
Report.result(Tests.tube_shape_component, postfx_shape_weight_entity.has_component('Tube Shape'))
|
||||
Report.result(Tests.postfx_shape_weight_enabled, postfx_shape_weight_component.is_enabled())
|
||||
|
||||
# 11. Enter/Exit game mode.
|
||||
TestHelper.enter_game_mode(Tests.enter_game_mode)
|
||||
general.idle_wait_frames(1)
|
||||
TestHelper.exit_game_mode(Tests.exit_game_mode)
|
||||
|
||||
# 12. Test IsHidden.
|
||||
postfx_shape_weight_entity.set_visibility_state(False)
|
||||
Report.result(Tests.is_hidden, postfx_shape_weight_entity.is_hidden() is True)
|
||||
|
||||
# 13. Test IsVisible.
|
||||
postfx_shape_weight_entity.set_visibility_state(True)
|
||||
general.idle_wait_frames(1)
|
||||
Report.result(Tests.is_visible, postfx_shape_weight_entity.is_visible() is True)
|
||||
|
||||
# 14. Delete PostFx Shape Weight Modifier entity.
|
||||
postfx_shape_weight_entity.delete()
|
||||
Report.result(Tests.entity_deleted, not postfx_shape_weight_entity.exists())
|
||||
|
||||
# 15. UNDO deletion.
|
||||
general.undo()
|
||||
Report.result(Tests.deletion_undo, postfx_shape_weight_entity.exists())
|
||||
|
||||
# 16. REDO deletion.
|
||||
general.redo()
|
||||
Report.result(Tests.deletion_redo, not postfx_shape_weight_entity.exists())
|
||||
|
||||
# 17. Look for errors or asserts.
|
||||
TestHelper.wait_for_condition(lambda: error_tracer.has_errors or error_tracer.has_asserts, 1.0)
|
||||
for error_info in error_tracer.errors:
|
||||
Report.info(f"Error: {error_info.filename} {error_info.function} | {error_info.message}")
|
||||
for assert_info in error_tracer.asserts:
|
||||
Report.info(f"Assert: {assert_info.filename} {assert_info.function} | {assert_info.message}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from editor_python_test_tools.utils import Report
|
||||
Report.start_test(AtomEditorComponents_postfx_shape_weight_AddedToEntity)
|
||||
@ -0,0 +1,13 @@
|
||||
{
|
||||
"description": "",
|
||||
"materialType": "Materials/Types/Skin.materialtype",
|
||||
"parentMaterial": "",
|
||||
"propertyLayoutVersion": 3,
|
||||
"properties": {
|
||||
"wrinkleLayers": {
|
||||
"count": 3,
|
||||
"enable": true,
|
||||
"showBlendValues": true
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:53e17ec8155911c8b42e85436130f600bd6dddd8931a8ccb1b2f8a9f8674cc85
|
||||
size 45104
|
||||
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:0da56a05daa0ec1c476cfe25ca6d3b65267c98886cf33408f6e852fb325a8e2c
|
||||
size 198084
|
||||
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e3537fbe9205731a242251c525a67bbb5f3b8f5307537f1dc0c318b5b885ce52
|
||||
size 198112
|
||||
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:bd794d5dd4b749c3275bfab79b9b5ae3f8e007d3e6741c0566c9c2d3931123bf
|
||||
size 198112
|
||||
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:45ded862987a64061deffd8e4c9aa1dff4eec3bcff5f7b505679f1959e8ae137
|
||||
size 51440
|
||||
@ -0,0 +1,101 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace Intersect
|
||||
{
|
||||
AZ_MATH_INLINE bool ClipRayWithAabb(const Aabb& aabb, Vector3& rayStart, Vector3& rayEnd, float& tClipStart, float& tClipEnd)
|
||||
{
|
||||
Vector3 startNormal;
|
||||
float tStart, tEnd;
|
||||
Vector3 dirLen = rayEnd - rayStart;
|
||||
if (IntersectRayAABB(rayStart, dirLen, dirLen.GetReciprocal(), aabb, tStart, tEnd, startNormal) != ISECT_RAY_AABB_NONE)
|
||||
{
|
||||
// clip the ray with the box
|
||||
if (tStart > 0.0f)
|
||||
{
|
||||
rayStart = rayStart + tStart * dirLen;
|
||||
tClipStart = tStart;
|
||||
}
|
||||
if (tEnd < 1.0f)
|
||||
{
|
||||
rayEnd = rayStart + tEnd * dirLen;
|
||||
tClipEnd = tEnd;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
AZ_MATH_INLINE SphereIsectTypes
|
||||
IntersectRaySphereOrigin(const Vector3& rayStart, const Vector3& rayDirNormalized, const float sphereRadius, float& t)
|
||||
{
|
||||
Vector3 m = rayStart;
|
||||
float b = m.Dot(rayDirNormalized);
|
||||
float c = m.Dot(m) - sphereRadius * sphereRadius;
|
||||
|
||||
// Exit if r's origin outside s (c > 0)and r pointing away from s (b > 0)
|
||||
if (c > 0.0f && b > 0.0f)
|
||||
{
|
||||
return ISECT_RAY_SPHERE_NONE;
|
||||
}
|
||||
float discr = b * b - c;
|
||||
// A negative discriminant corresponds to ray missing sphere
|
||||
if (discr < 0.0f)
|
||||
{
|
||||
return ISECT_RAY_SPHERE_NONE;
|
||||
}
|
||||
|
||||
// Ray now found to intersect sphere, compute smallest t value of intersection
|
||||
t = -b - Sqrt(discr);
|
||||
|
||||
// If t is negative, ray started inside sphere so clamp t to zero
|
||||
if (t < 0.0f)
|
||||
{
|
||||
// t = 0.0f;
|
||||
return ISECT_RAY_SPHERE_SA_INSIDE; // no hit if inside
|
||||
}
|
||||
// q = p + t * d;
|
||||
return ISECT_RAY_SPHERE_ISECT;
|
||||
}
|
||||
|
||||
AZ_MATH_INLINE SphereIsectTypes IntersectRaySphere(const Vector3& rayStart, const Vector3& rayDirNormalized, const Vector3& sphereCenter, const float sphereRadius, float& t)
|
||||
{
|
||||
return IntersectRaySphereOrigin(rayStart - sphereCenter, rayDirNormalized, sphereRadius, t);
|
||||
}
|
||||
|
||||
AZ_MATH_INLINE Vector3 LineToPointDistance(const Vector3& s1, const Vector3& s2, const Vector3& p, float& u)
|
||||
{
|
||||
const Vector3 s21 = s2 - s1;
|
||||
// we assume seg1 and seg2 are NOT coincident
|
||||
AZ_MATH_ASSERT(!s21.IsClose(Vector3(0.0f), 1e-4f), "OK we agreed that we will pass valid segments! (s1 != s2)");
|
||||
|
||||
u = LineToPointDistanceTime(s1, s21, p);
|
||||
|
||||
return s1 + u * s21;
|
||||
}
|
||||
|
||||
AZ_MATH_INLINE float LineToPointDistanceTime(const Vector3& s1, const Vector3& s21, const Vector3& p)
|
||||
{
|
||||
// so u = (p.x - s1.x)*(s2.x - s1.x) + (p.y - s1.y)*(s2.y - s1.y) + (p.z-s1.z)*(s2.z-s1.z) / |s2-s1|^2
|
||||
return s21.Dot(p - s1) / s21.Dot(s21);
|
||||
}
|
||||
|
||||
AZ_MATH_INLINE bool TestSegmentAABB(const Vector3& p0, const Vector3& p1, const Aabb& aabb)
|
||||
{
|
||||
Vector3 e = aabb.GetExtents();
|
||||
Vector3 d = p1 - p0;
|
||||
Vector3 m = p0 + p1 - aabb.GetMin() - aabb.GetMax();
|
||||
|
||||
return TestSegmentAABBOrigin(m, d, e);
|
||||
}
|
||||
} // namespace Intersect
|
||||
} // namespace AZ
|
||||
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Settings/SettingsRegistry.h>
|
||||
#include <AzCore/UserSettings/UserSettingsComponent.h>
|
||||
#include <AzFramework/Application/Application.h>
|
||||
|
||||
namespace AzFramework
|
||||
{
|
||||
class XcbTestApplication
|
||||
: public Application
|
||||
{
|
||||
public:
|
||||
XcbTestApplication(AZ::u64 enabledGamepadsCount, bool keyboardEnabled, bool motionEnabled, bool mouseEnabled, bool touchEnabled, bool virtualKeyboardEnabled)
|
||||
{
|
||||
auto* settingsRegistry = AZ::SettingsRegistry::Get();
|
||||
settingsRegistry->Set("/O3DE/InputSystem/GamepadsEnabled", enabledGamepadsCount);
|
||||
settingsRegistry->Set("/O3DE/InputSystem/KeyboardEnabled", keyboardEnabled);
|
||||
settingsRegistry->Set("/O3DE/InputSystem/MotionEnabled", motionEnabled);
|
||||
settingsRegistry->Set("/O3DE/InputSystem/MouseEnabled", mouseEnabled);
|
||||
settingsRegistry->Set("/O3DE/InputSystem/TouchEnabled", touchEnabled);
|
||||
settingsRegistry->Set("/O3DE/InputSystem/VirtualKeyboardEnabled", virtualKeyboardEnabled);
|
||||
}
|
||||
|
||||
void Start(const Descriptor& descriptor = {}, const StartupParameters& startupParameters = {}) override
|
||||
{
|
||||
Application::Start(descriptor, startupParameters);
|
||||
AZ::UserSettingsComponentRequestBus::Broadcast(&AZ::UserSettingsComponentRequests::DisableSaveOnFinalize);
|
||||
}
|
||||
};
|
||||
} // namespace AzFramework
|
||||
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzQtComponents/Utilities/DesktopUtilities.h>
|
||||
|
||||
#include <QDir>
|
||||
#include <QProcess>
|
||||
|
||||
namespace AzQtComponents
|
||||
{
|
||||
void ShowFileOnDesktop(const QString& path)
|
||||
{
|
||||
const char* defaultNautilusPath = "/usr/bin/nautilus";
|
||||
const char* defaultXdgOpenPath = "/usr/bin/xdg-open";
|
||||
|
||||
// Determine if Nautilus (for Gnome Desktops) is available because it supports opening the file manager
|
||||
// and selecting a specific file
|
||||
bool nautilusAvailable = QFileInfo(defaultNautilusPath).exists();
|
||||
|
||||
QFileInfo pathInfo(path);
|
||||
if (pathInfo.isDir())
|
||||
{
|
||||
QProcess::startDetached(defaultXdgOpenPath, { path });
|
||||
}
|
||||
else
|
||||
{
|
||||
if (nautilusAvailable)
|
||||
{
|
||||
QProcess::startDetached(defaultNautilusPath, { "--select", path });
|
||||
}
|
||||
else
|
||||
{
|
||||
QDir parentDir { pathInfo.dir() };
|
||||
QProcess::startDetached(defaultXdgOpenPath, { parentDir.path() });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString fileBrowserActionName()
|
||||
{
|
||||
const char* exploreActionName = "Open in file browser";
|
||||
return QObject::tr(exploreActionName);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzQtComponents/Utilities/DesktopUtilities.h>
|
||||
|
||||
#include <QDir>
|
||||
#include <QProcess>
|
||||
|
||||
namespace AzQtComponents
|
||||
{
|
||||
void ShowFileOnDesktop(const QString& path)
|
||||
{
|
||||
// Launch explorer at the path provided
|
||||
QStringList args;
|
||||
if (!QFileInfo(path).isDir())
|
||||
{
|
||||
// Folders are just opened, files are selected
|
||||
args << "/select,";
|
||||
}
|
||||
args << QDir::toNativeSeparators(path);
|
||||
|
||||
QProcess::startDetached("explorer", args);
|
||||
}
|
||||
|
||||
QString fileBrowserActionName()
|
||||
{
|
||||
const char* exploreActionName = "Open in Explorer";
|
||||
return QObject::tr(exploreActionName);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <scenesrg.srgi>
|
||||
|
||||
ShaderResourceGroup ObjectSrg : SRG_PerObject
|
||||
{
|
||||
uint m_objectId;
|
||||
|
||||
//! Returns the matrix for transforming points from Object Space to World Space.
|
||||
float4x4 GetWorldMatrix()
|
||||
{
|
||||
return SceneSrg::GetObjectToWorldMatrix(m_objectId);
|
||||
}
|
||||
|
||||
//! Returns the inverse-transpose of the world matrix.
|
||||
//! Commonly used to transform normals while supporting non-uniform scale.
|
||||
float3x3 GetWorldMatrixInverseTranspose()
|
||||
{
|
||||
return SceneSrg::GetObjectToWorldInverseTransposeMatrix(m_objectId);
|
||||
}
|
||||
|
||||
uint m_wrinkle_mask_count;
|
||||
float4 m_wrinkle_mask_weights[4];
|
||||
Texture2D m_wrinkle_masks[16];
|
||||
|
||||
float GetWrinkleMaskWeight(uint index)
|
||||
{
|
||||
return m_wrinkle_mask_weights[index / 4][index % 4];
|
||||
}
|
||||
|
||||
//! Reflection Probe (smallest probe volume that overlaps the object position)
|
||||
struct ReflectionProbeData
|
||||
{
|
||||
row_major float3x4 m_modelToWorld;
|
||||
row_major float3x4 m_modelToWorldInverse; // does not include extents
|
||||
float3 m_outerObbHalfLengths;
|
||||
float3 m_innerObbHalfLengths;
|
||||
float m_padding;
|
||||
bool m_useReflectionProbe;
|
||||
bool m_useParallaxCorrection;
|
||||
};
|
||||
|
||||
ReflectionProbeData m_reflectionProbeData;
|
||||
TextureCube m_reflectionProbeCubeMap;
|
||||
|
||||
float4x4 GetReflectionProbeWorldMatrix()
|
||||
{
|
||||
float4x4 modelToWorld = float4x4(
|
||||
float4(1, 0, 0, 0),
|
||||
float4(0, 1, 0, 0),
|
||||
float4(0, 0, 1, 0),
|
||||
float4(0, 0, 0, 1));
|
||||
|
||||
modelToWorld[0] = m_reflectionProbeData.m_modelToWorld[0];
|
||||
modelToWorld[1] = m_reflectionProbeData.m_modelToWorld[1];
|
||||
modelToWorld[2] = m_reflectionProbeData.m_modelToWorld[2];
|
||||
return modelToWorld;
|
||||
}
|
||||
|
||||
float4x4 GetReflectionProbeWorldMatrixInverse()
|
||||
{
|
||||
float4x4 modelToWorldInverse = float4x4(
|
||||
float4(1, 0, 0, 0),
|
||||
float4(0, 1, 0, 0),
|
||||
float4(0, 0, 1, 0),
|
||||
float4(0, 0, 0, 1));
|
||||
|
||||
modelToWorldInverse[0] = m_reflectionProbeData.m_modelToWorldInverse[0];
|
||||
modelToWorldInverse[1] = m_reflectionProbeData.m_modelToWorldInverse[1];
|
||||
modelToWorldInverse[2] = m_reflectionProbeData.m_modelToWorldInverse[2];
|
||||
return modelToWorldInverse;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <viewsrg.srgi>
|
||||
|
||||
struct VSInput
|
||||
{
|
||||
float3 m_position : POSITION;
|
||||
};
|
||||
|
||||
struct VSDepthOutput
|
||||
{
|
||||
float4 m_position : SV_Position;
|
||||
};
|
||||
|
||||
VSDepthOutput DepthPassVS(VSInput IN)
|
||||
{
|
||||
VSDepthOutput OUT;
|
||||
|
||||
float4x4 objectToWorld = ObjectSrg::GetWorldMatrix();
|
||||
float4 worldPosition = mul(objectToWorld, float4(IN.m_position, 1.0));
|
||||
OUT.m_position = mul(ViewSrg::m_viewProjectionMatrix, worldPosition);
|
||||
|
||||
return OUT;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include <Atom/Features/Skin/SkinObjectSrg.azsli>
|
||||
#include <DepthPassCommon.azsli>
|
||||
|
||||
// Use the depth pass shader with the skin object srg
|
||||
@ -0,0 +1,24 @@
|
||||
{
|
||||
"Source" : "DepthPassSkin",
|
||||
|
||||
"DepthStencilState" : {
|
||||
"Depth" : { "Enable" : true, "CompareFunc" : "GreaterEqual" }
|
||||
},
|
||||
|
||||
"CompilerHints" : {
|
||||
"DisableOptimizations" : false
|
||||
},
|
||||
|
||||
"ProgramSettings" :
|
||||
{
|
||||
"EntryPoints":
|
||||
[
|
||||
{
|
||||
"name": "DepthPassVS",
|
||||
"type" : "Vertex"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"DrawList" : "depth"
|
||||
}
|
||||
@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <scenesrg.srgi>
|
||||
#include <viewsrg.srgi>
|
||||
|
||||
#include <Atom/RPI/ShaderResourceGroups/DefaultDrawSrg.azsli>
|
||||
|
||||
struct VSInput
|
||||
{
|
||||
float3 m_position : POSITION;
|
||||
|
||||
// This gets set automatically by the system at runtime only if it's available.
|
||||
// There is a soft naming convention that associates this with o_prevPosition_isBound, which will be set to true whenever m_optional_prevPosition is available.
|
||||
// (search "m_optional_" in ShaderVariantAssetBuilder for details on the naming convention).
|
||||
// [GFX TODO][ATOM-14475]: Come up with a more elegant way to associate the isBound flag with the input stream.
|
||||
// Vertex position of last frame to capture small scale motion due to vertex animation
|
||||
float3 m_optional_prevPosition : POSITIONT;
|
||||
};
|
||||
|
||||
struct VSOutput
|
||||
{
|
||||
float4 m_position : SV_Position;
|
||||
float3 m_worldPos : TEXCOORD0;
|
||||
float3 m_worldPosPrev: TEXCOORD1;
|
||||
};
|
||||
|
||||
struct PSOutput
|
||||
{
|
||||
float2 m_motion : SV_Target0;
|
||||
};
|
||||
|
||||
// Indicates whether the vertex input struct's "m_optional_prevPosition" is bound. If false, it is not safe to read from m_optional_prevPosition.
|
||||
// This option gets set automatically by the system at runtime; there is a soft naming convention that associates it with m_optional_prevPosition.
|
||||
// (search "m_optional_" in ShaderVariantAssetBuilder for details on the naming convention).
|
||||
// [GFX TODO][ATOM-14475]: Come up with a more elegant way to associate the isBound flag with the input stream.
|
||||
option bool o_prevPosition_isBound;
|
||||
|
||||
VSOutput MainVS(VSInput IN)
|
||||
{
|
||||
VSOutput OUT;
|
||||
|
||||
OUT.m_worldPos = mul(SceneSrg::GetObjectToWorldMatrix(ObjectSrg::m_objectId), float4(IN.m_position, 1.0)).xyz;
|
||||
OUT.m_position = mul(ViewSrg::m_viewProjectionMatrix, float4(OUT.m_worldPos, 1.0));
|
||||
|
||||
if (o_prevPosition_isBound)
|
||||
{
|
||||
OUT.m_worldPosPrev = mul(SceneSrg::GetObjectToWorldMatrixPrev(ObjectSrg::m_objectId), float4(IN.m_optional_prevPosition, 1.0)).xyz;
|
||||
}
|
||||
else
|
||||
{
|
||||
OUT.m_worldPosPrev = mul(SceneSrg::GetObjectToWorldMatrixPrev(ObjectSrg::m_objectId), float4(IN.m_position, 1.0)).xyz;
|
||||
}
|
||||
|
||||
return OUT;
|
||||
}
|
||||
|
||||
PSOutput MainPS(VSOutput IN)
|
||||
{
|
||||
PSOutput OUT;
|
||||
|
||||
// Current clip position
|
||||
float4 clipPos = mul(ViewSrg::m_viewProjectionMatrix, float4(IN.m_worldPos, 1.0));
|
||||
|
||||
// Reprojected last frame's clip position, for skinned mesh it also implies last key frame
|
||||
float4 clipPosPrev = mul(ViewSrg::m_viewProjectionPrevMatrix, float4(IN.m_worldPosPrev, 1.0));
|
||||
|
||||
float2 motion = (clipPos.xy / clipPos.w - clipPosPrev.xy / clipPosPrev.w) * 0.5;
|
||||
|
||||
OUT.m_motion = motion;
|
||||
|
||||
// Flip y to line up with uv coordinates
|
||||
OUT.m_motion.y = -OUT.m_motion.y;
|
||||
|
||||
return OUT;
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include <Atom/Features/Skin/SkinObjectSrg.azsli>
|
||||
#include <MeshMotionVectorCommon.azsli>
|
||||
|
||||
// Use the mesh motion vector with the skin object srg
|
||||
@ -0,0 +1,24 @@
|
||||
{
|
||||
"Source" : "MeshMotionVectorSkin",
|
||||
|
||||
"DepthStencilState" : {
|
||||
"Depth" : { "Enable" : true, "CompareFunc" : "GreaterEqual" }
|
||||
},
|
||||
|
||||
"DrawList" : "motion",
|
||||
|
||||
"ProgramSettings":
|
||||
{
|
||||
"EntryPoints":
|
||||
[
|
||||
{
|
||||
"name": "MainVS",
|
||||
"type": "Vertex"
|
||||
},
|
||||
{
|
||||
"name": "MainPS",
|
||||
"type": "Fragment"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <scenesrg.srgi>
|
||||
#include <viewsrg.srgi>
|
||||
|
||||
struct VertexInput
|
||||
{
|
||||
float3 m_position : POSITION;
|
||||
};
|
||||
|
||||
struct VertexOutput
|
||||
{
|
||||
float4 m_position : SV_Position;
|
||||
};
|
||||
|
||||
VertexOutput MainVS(VertexInput input)
|
||||
{
|
||||
const float4x4 worldMatrix = ObjectSrg::GetWorldMatrix();
|
||||
VertexOutput output;
|
||||
|
||||
const float3 worldPosition = mul(worldMatrix, float4(input.m_position, 1.0)).xyz;
|
||||
output.m_position = mul(ViewSrg::m_viewProjectionMatrix, float4(worldPosition, 1.0));
|
||||
|
||||
return output;
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include <Atom/Features/Skin/SkinObjectSrg.azsli>
|
||||
#include <ShadowmapCommon.azsli>
|
||||
|
||||
// Use the shadowmap shader with the skin object srg
|
||||
@ -0,0 +1,26 @@
|
||||
{
|
||||
"Source" : "ShadowmapSkin",
|
||||
|
||||
"DepthStencilState" : {
|
||||
"Depth" : { "Enable" : true, "CompareFunc" : "LessEqual" }
|
||||
},
|
||||
|
||||
"DrawList" : "shadow",
|
||||
|
||||
"RasterState" :
|
||||
{
|
||||
"depthBias" : "10",
|
||||
"depthBiasSlopeScale" : "4"
|
||||
},
|
||||
|
||||
"ProgramSettings":
|
||||
{
|
||||
"EntryPoints":
|
||||
[
|
||||
{
|
||||
"name": "MainVS",
|
||||
"type": "Vertex"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
# {BEGIN_LICENSE}
|
||||
# Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
#
|
||||
# {END_LICENSE}
|
||||
|
||||
set(o3de_gem_path ${CMAKE_CURRENT_LIST_DIR})
|
||||
set(o3de_gem_json ${o3de_gem_path}/gem.json)
|
||||
o3de_read_json_key(o3de_gem_name ${o3de_gem_json} "gem_name")
|
||||
o3de_restricted_path(${o3de_gem_json} o3de_gem_restricted_path)
|
||||
|
||||
ly_get_list_relative_pal_filename(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME} "${o3de_gem_restricted_path}" ${o3de_gem_path} ${o3de_gem_name})
|
||||
|
||||
# Now that we have the platform abstraction layer (PAL) folder for this folder, thats where we will find the
|
||||
# project cmake for this platform.
|
||||
include(${pal_dir}/${PAL_PLATFORM_NAME_LOWERCASE}_gem.cmake)
|
||||
|
||||
ly_add_external_target_path(${CMAKE_CURRENT_LIST_DIR}/3rdParty)
|
||||
|
||||
add_subdirectory(Code)
|
||||
@ -0,0 +1,15 @@
|
||||
# {BEGIN_LICENSE}
|
||||
# Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
#
|
||||
# {END_LICENSE}
|
||||
|
||||
set(FILES
|
||||
Source/${Name}EditorSystemComponent.cpp
|
||||
Source/${Name}EditorSystemComponent.h
|
||||
Source/${Name}Widget.cpp
|
||||
Source/${Name}Widget.h
|
||||
Source/${Name}.qrc
|
||||
)
|
||||
@ -0,0 +1,11 @@
|
||||
# {BEGIN_LICENSE}
|
||||
# Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
#
|
||||
# {END_LICENSE}
|
||||
|
||||
set(FILES
|
||||
Source/${Name}EditorModule.cpp
|
||||
)
|
||||
@ -0,0 +1,11 @@
|
||||
# {BEGIN_LICENSE}
|
||||
# Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
#
|
||||
# {END_LICENSE}
|
||||
|
||||
set(FILES
|
||||
Tests/${Name}EditorTest.cpp
|
||||
)
|
||||
@ -0,0 +1,14 @@
|
||||
# {BEGIN_LICENSE}
|
||||
# Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
#
|
||||
# {END_LICENSE}
|
||||
|
||||
set(FILES
|
||||
Include/${Name}/${Name}Bus.h
|
||||
Source/${Name}ModuleInterface.h
|
||||
Source/${Name}SystemComponent.cpp
|
||||
Source/${Name}SystemComponent.h
|
||||
)
|
||||
@ -0,0 +1,11 @@
|
||||
# {BEGIN_LICENSE}
|
||||
# Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
#
|
||||
# {END_LICENSE}
|
||||
|
||||
set(FILES
|
||||
Source/${Name}Module.cpp
|
||||
)
|
||||
@ -0,0 +1,11 @@
|
||||
# {BEGIN_LICENSE}
|
||||
# Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
#
|
||||
# {END_LICENSE}
|
||||
|
||||
set(FILES
|
||||
Tests/${Name}Test.cpp
|
||||
)
|
||||
@ -0,0 +1,168 @@
|
||||
# {BEGIN_LICENSE}
|
||||
# Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
#
|
||||
# {END_LICENSE}
|
||||
|
||||
# Currently we are in the Code folder: ${CMAKE_CURRENT_LIST_DIR}
|
||||
# Get the platform specific folder ${pal_dir} for the current folder: ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME}
|
||||
# Note: ly_get_list_relative_pal_filename will take care of the details for us, as this may be a restricted platform
|
||||
# in which case it will see if that platform is present here or in the restricted folder.
|
||||
# i.e. It could here in our gem : Gems/${Name}/Code/Platform/<platorm_name> or
|
||||
# <restricted_folder>/<platform_name>/Gems/${Name}/Code
|
||||
ly_get_list_relative_pal_filename(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME} ${o3de_gem_restricted_path} ${o3de_gem_path} ${o3de_gem_name})
|
||||
|
||||
# Now that we have the platform abstraction layer (PAL) folder for this folder, thats where we will find the
|
||||
# traits for this platform. Traits for a platform are defines for things like whether or not something in this gem
|
||||
# is supported by this platform.
|
||||
include(${pal_dir}/PAL_${PAL_PLATFORM_NAME_LOWERCASE}.cmake)
|
||||
|
||||
# Add the ${Name}.Static target
|
||||
# Note: We include the common files and the platform specific files which are set in ${NameLower}_common_files.cmake
|
||||
# and in ${pal_dir}/${NameLower}_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake
|
||||
ly_add_target(
|
||||
NAME ${Name}.Static STATIC
|
||||
NAMESPACE Gem
|
||||
FILES_CMAKE
|
||||
${NameLower}_files.cmake
|
||||
${pal_dir}/${NameLower}_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake
|
||||
INCLUDE_DIRECTORIES
|
||||
PUBLIC
|
||||
Include
|
||||
PRIVATE
|
||||
Source
|
||||
BUILD_DEPENDENCIES
|
||||
PUBLIC
|
||||
AZ::AzCore
|
||||
AZ::AzFramework
|
||||
)
|
||||
|
||||
# Here add ${Name} target, it depends on the ${Name}.Static
|
||||
ly_add_target(
|
||||
NAME ${Name} ${PAL_TRAIT_MONOLITHIC_DRIVEN_MODULE_TYPE}
|
||||
NAMESPACE Gem
|
||||
FILES_CMAKE
|
||||
${NameLower}_shared_files.cmake
|
||||
${pal_dir}/${NameLower}_shared_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake
|
||||
INCLUDE_DIRECTORIES
|
||||
PUBLIC
|
||||
Include
|
||||
PRIVATE
|
||||
Source
|
||||
BUILD_DEPENDENCIES
|
||||
PRIVATE
|
||||
Gem::${Name}.Static
|
||||
)
|
||||
|
||||
# By default, we will specify that the above target ${Name} would be used by
|
||||
# Client and Server type targets when this gem is enabled. If you don't want it
|
||||
# active in Clients or Servers by default, delete one of both of the following lines:
|
||||
ly_create_alias(NAME ${Name}.Clients NAMESPACE Gem TARGETS Gem::${Name})
|
||||
ly_create_alias(NAME ${Name}.Servers NAMESPACE Gem TARGETS Gem::${Name})
|
||||
|
||||
# If we are on a host platform, we want to add the host tools targets like the ${Name}.Editor target which
|
||||
# will also depend on ${Name}.Static
|
||||
if(PAL_TRAIT_BUILD_HOST_TOOLS)
|
||||
ly_add_target(
|
||||
NAME ${Name}.Editor.Static STATIC
|
||||
NAMESPACE Gem
|
||||
AUTOMOC
|
||||
AUTORCC
|
||||
FILES_CMAKE
|
||||
${NameLower}_editor_files.cmake
|
||||
INCLUDE_DIRECTORIES
|
||||
PRIVATE
|
||||
Source
|
||||
PUBLIC
|
||||
Include
|
||||
BUILD_DEPENDENCIES
|
||||
PUBLIC
|
||||
AZ::AzToolsFramework
|
||||
Gem::${Name}.Static
|
||||
)
|
||||
|
||||
ly_add_target(
|
||||
NAME ${Name}.Editor GEM_MODULE
|
||||
NAMESPACE Gem
|
||||
AUTOMOC
|
||||
FILES_CMAKE
|
||||
${NameLower}_editor_shared_files.cmake
|
||||
INCLUDE_DIRECTORIES
|
||||
PRIVATE
|
||||
Source
|
||||
PUBLIC
|
||||
Include
|
||||
BUILD_DEPENDENCIES
|
||||
PUBLIC
|
||||
Gem::${Name}.Editor.Static
|
||||
)
|
||||
|
||||
# By default, we will specify that the above target ${Name} would be used by
|
||||
# Tool and Builder type targets when this gem is enabled. If you don't want it
|
||||
# active in Tools or Builders by default, delete one of both of the following lines:
|
||||
ly_create_alias(NAME ${Name}.Tools NAMESPACE Gem TARGETS Gem::${Name}.Editor)
|
||||
ly_create_alias(NAME ${Name}.Builders NAMESPACE Gem TARGETS Gem::${Name}.Editor)
|
||||
|
||||
|
||||
endif()
|
||||
|
||||
################################################################################
|
||||
# Tests
|
||||
################################################################################
|
||||
# See if globally, tests are supported
|
||||
if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
|
||||
# We globally support tests, see if we support tests on this platform for ${Name}.Static
|
||||
if(PAL_TRAIT_${NameUpper}_TEST_SUPPORTED)
|
||||
# We support ${Name}.Tests on this platform, add ${Name}.Tests target which depends on ${Name}.Static
|
||||
ly_add_target(
|
||||
NAME ${Name}.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
|
||||
NAMESPACE Gem
|
||||
FILES_CMAKE
|
||||
${NameLower}_files.cmake
|
||||
${NameLower}_tests_files.cmake
|
||||
INCLUDE_DIRECTORIES
|
||||
PRIVATE
|
||||
Tests
|
||||
Source
|
||||
BUILD_DEPENDENCIES
|
||||
PRIVATE
|
||||
AZ::AzTest
|
||||
AZ::AzFramework
|
||||
Gem::${Name}.Static
|
||||
)
|
||||
|
||||
# Add ${Name}.Tests to googletest
|
||||
ly_add_googletest(
|
||||
NAME Gem::${Name}.Tests
|
||||
)
|
||||
endif()
|
||||
|
||||
# If we are a host platform we want to add tools test like editor tests here
|
||||
if(PAL_TRAIT_BUILD_HOST_TOOLS)
|
||||
# We are a host platform, see if Editor tests are supported on this platform
|
||||
if(PAL_TRAIT_${NameUpper}_EDITOR_TEST_SUPPORTED)
|
||||
# We support ${Name}.Editor.Tests on this platform, add ${Name}.Editor.Tests target which depends on ${Name}.Editor
|
||||
ly_add_target(
|
||||
NAME ${Name}.Editor.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
|
||||
NAMESPACE Gem
|
||||
FILES_CMAKE
|
||||
${NameLower}_editor_tests_files.cmake
|
||||
INCLUDE_DIRECTORIES
|
||||
PRIVATE
|
||||
Tests
|
||||
Source
|
||||
BUILD_DEPENDENCIES
|
||||
PRIVATE
|
||||
AZ::AzTest
|
||||
Gem::${Name}.Editor
|
||||
)
|
||||
|
||||
# Add ${Name}.Editor.Tests to googletest
|
||||
ly_add_googletest(
|
||||
NAME Gem::${Name}.Editor.Tests
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
@ -0,0 +1,40 @@
|
||||
// {BEGIN_LICENSE}
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
// {END_LICENSE}
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/EBus/EBus.h>
|
||||
#include <AzCore/Interface/Interface.h>
|
||||
|
||||
namespace ${SanitizedCppName}
|
||||
{
|
||||
class ${SanitizedCppName}Requests
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(${SanitizedCppName}Requests, "{${Random_Uuid}}");
|
||||
virtual ~${SanitizedCppName}Requests() = default;
|
||||
// Put your public methods here
|
||||
};
|
||||
|
||||
class ${SanitizedCppName}BusTraits
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// EBusTraits overrides
|
||||
static constexpr AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
static constexpr AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
};
|
||||
|
||||
using ${SanitizedCppName}RequestBus = AZ::EBus<${SanitizedCppName}Requests, ${SanitizedCppName}BusTraits>;
|
||||
using ${SanitizedCppName}Interface = AZ::Interface<${SanitizedCppName}Requests>;
|
||||
|
||||
} // namespace ${SanitizedCppName}
|
||||
@ -0,0 +1,15 @@
|
||||
# {BEGIN_LICENSE}
|
||||
# Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
#
|
||||
# {END_LICENSE}
|
||||
|
||||
# Platform specific files for Android
|
||||
# i.e. ../Source/Android/${Name}Android.cpp
|
||||
# ../Source/Android/${Name}Android.h
|
||||
# ../Include/Android/${Name}Android.h
|
||||
|
||||
set(FILES
|
||||
)
|
||||
@ -0,0 +1,15 @@
|
||||
# {BEGIN_LICENSE}
|
||||
# Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
#
|
||||
# {END_LICENSE}
|
||||
|
||||
# Platform specific files for Android
|
||||
# i.e. ../Source/Android/${Name}Android.cpp
|
||||
# ../Source/Android/${Name}Android.h
|
||||
# ../Include/Android/${Name}Android.h
|
||||
|
||||
set(FILES
|
||||
)
|
||||
@ -0,0 +1,11 @@
|
||||
# {BEGIN_LICENSE}
|
||||
# Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
#
|
||||
# {END_LICENSE}
|
||||
|
||||
set(PAL_TRAIT_${NameUpper}_SUPPORTED TRUE)
|
||||
set(PAL_TRAIT_${NameUpper}_TEST_SUPPORTED TRUE)
|
||||
set(PAL_TRAIT_${NameUpper}_EDITOR_TEST_SUPPORTED FALSE)
|
||||
@ -0,0 +1,15 @@
|
||||
# {BEGIN_LICENSE}
|
||||
# Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
#
|
||||
# {END_LICENSE}
|
||||
|
||||
# Platform specific files for Linux
|
||||
# i.e. ../Source/Linux/${Name}Linux.cpp
|
||||
# ../Source/Linux/${Name}Linux.h
|
||||
# ../Include/Linux/${Name}Linux.h
|
||||
|
||||
set(FILES
|
||||
)
|
||||
@ -0,0 +1,15 @@
|
||||
# {BEGIN_LICENSE}
|
||||
# Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
#
|
||||
# {END_LICENSE}
|
||||
|
||||
# Platform specific files for Linux
|
||||
# i.e. ../Source/Linux/${Name}Linux.cpp
|
||||
# ../Source/Linux/${Name}Linux.h
|
||||
# ../Include/Linux/${Name}Linux.h
|
||||
|
||||
set(FILES
|
||||
)
|
||||
@ -0,0 +1,11 @@
|
||||
# {BEGIN_LICENSE}
|
||||
# Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
#
|
||||
# {END_LICENSE}
|
||||
|
||||
set(PAL_TRAIT_${NameUpper}_SUPPORTED TRUE)
|
||||
set(PAL_TRAIT_${NameUpper}_TEST_SUPPORTED TRUE)
|
||||
set(PAL_TRAIT_${NameUpper}_EDITOR_TEST_SUPPORTED TRUE)
|
||||
@ -0,0 +1,15 @@
|
||||
# {BEGIN_LICENSE}
|
||||
# Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
#
|
||||
# {END_LICENSE}
|
||||
|
||||
# Platform specific files for Mac
|
||||
# i.e. ../Source/Mac/${Name}Mac.cpp
|
||||
# ../Source/Mac/${Name}Mac.h
|
||||
# ../Include/Mac/${Name}Mac.h
|
||||
|
||||
set(FILES
|
||||
)
|
||||
@ -0,0 +1,15 @@
|
||||
# {BEGIN_LICENSE}
|
||||
# Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
#
|
||||
# {END_LICENSE}
|
||||
|
||||
# Platform specific files for Mac
|
||||
# i.e. ../Source/Mac/${Name}Mac.cpp
|
||||
# ../Source/Mac/${Name}Mac.h
|
||||
# ../Include/Mac/${Name}Mac.h
|
||||
|
||||
set(FILES
|
||||
)
|
||||
@ -0,0 +1,11 @@
|
||||
# {BEGIN_LICENSE}
|
||||
# Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
#
|
||||
# {END_LICENSE}
|
||||
|
||||
set(PAL_TRAIT_${NameUpper}_SUPPORTED TRUE)
|
||||
set(PAL_TRAIT_${NameUpper}_TEST_SUPPORTED TRUE)
|
||||
set(PAL_TRAIT_${NameUpper}_EDITOR_TEST_SUPPORTED TRUE)
|
||||
@ -0,0 +1,15 @@
|
||||
# {BEGIN_LICENSE}
|
||||
# Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
#
|
||||
# {END_LICENSE}
|
||||
|
||||
# Platform specific files for Windows
|
||||
# i.e. ../Source/Windows/${Name}Windows.cpp
|
||||
# ../Source/Windows/${Name}Windows.h
|
||||
# ../Include/Windows/${Name}Windows.h
|
||||
|
||||
set(FILES
|
||||
)
|
||||
@ -0,0 +1,15 @@
|
||||
# {BEGIN_LICENSE}
|
||||
# Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
#
|
||||
# {END_LICENSE}
|
||||
|
||||
# Platform specific files for Windows
|
||||
# i.e. ../Source/Windows/${Name}Windows.cpp
|
||||
# ../Source/Windows/${Name}Windows.h
|
||||
# ../Include/Windows/${Name}Windows.h
|
||||
|
||||
set(FILES
|
||||
)
|
||||
@ -0,0 +1,11 @@
|
||||
# {BEGIN_LICENSE}
|
||||
# Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
#
|
||||
# {END_LICENSE}
|
||||
|
||||
set(PAL_TRAIT_${NameUpper}_SUPPORTED TRUE)
|
||||
set(PAL_TRAIT_${NameUpper}_TEST_SUPPORTED TRUE)
|
||||
set(PAL_TRAIT_${NameUpper}_EDITOR_TEST_SUPPORTED TRUE)
|
||||
@ -0,0 +1,15 @@
|
||||
# {BEGIN_LICENSE}
|
||||
# Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
#
|
||||
# {END_LICENSE}
|
||||
|
||||
# Platform specific files for iOS
|
||||
# i.e. ../Source/iOS/${Name}iOS.cpp
|
||||
# ../Source/iOS/${Name}iOS.h
|
||||
# ../Include/iOS/${Name}iOS.h
|
||||
|
||||
set(FILES
|
||||
)
|
||||
@ -0,0 +1,15 @@
|
||||
# {BEGIN_LICENSE}
|
||||
# Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
#
|
||||
# {END_LICENSE}
|
||||
|
||||
# Platform specific files for iOS
|
||||
# i.e. ../Source/iOS/${Name}iOS.cpp
|
||||
# ../Source/iOS/${Name}iOS.h
|
||||
# ../Include/iOS/${Name}iOS.h
|
||||
|
||||
set(FILES
|
||||
)
|
||||
@ -0,0 +1,11 @@
|
||||
# {BEGIN_LICENSE}
|
||||
# Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
#
|
||||
# {END_LICENSE}
|
||||
|
||||
set(PAL_TRAIT_${NameUpper}_SUPPORTED TRUE)
|
||||
set(PAL_TRAIT_${NameUpper}_TEST_SUPPORTED TRUE)
|
||||
set(PAL_TRAIT_${NameUpper}_EDITOR_TEST_SUPPORTED FALSE)
|
||||
@ -0,0 +1,5 @@
|
||||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource prefix="/${Name}">
|
||||
<file alias="toolbar_icon.svg">toolbar_icon.svg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
@ -0,0 +1,55 @@
|
||||
// {BEGIN_LICENSE}
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
// {END_LICENSE}
|
||||
|
||||
#include <${Name}ModuleInterface.h>
|
||||
#include <${Name}EditorSystemComponent.h>
|
||||
|
||||
void Init${SanitizedCppName}Resources()
|
||||
{
|
||||
// We must register our Qt resources (.qrc file) since this is being loaded from a separate module (gem)
|
||||
Q_INIT_RESOURCE(${SanitizedCppName});
|
||||
}
|
||||
|
||||
namespace ${SanitizedCppName}
|
||||
{
|
||||
class ${SanitizedCppName}EditorModule
|
||||
: public ${SanitizedCppName}ModuleInterface
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(${SanitizedCppName}EditorModule, "${ModuleClassId}", ${SanitizedCppName}ModuleInterface);
|
||||
AZ_CLASS_ALLOCATOR(${SanitizedCppName}EditorModule, AZ::SystemAllocator, 0);
|
||||
|
||||
${SanitizedCppName}EditorModule()
|
||||
{
|
||||
Init${SanitizedCppName}Resources();
|
||||
|
||||
// Push results of [MyComponent]::CreateDescriptor() into m_descriptors here.
|
||||
// Add ALL components descriptors associated with this gem to m_descriptors.
|
||||
// This will associate the AzTypeInfo information for the components with the the SerializeContext, BehaviorContext and EditContext.
|
||||
// This happens through the [MyComponent]::Reflect() function.
|
||||
m_descriptors.insert(m_descriptors.end(), {
|
||||
${SanitizedCppName}EditorSystemComponent::CreateDescriptor(),
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Add required SystemComponents to the SystemEntity.
|
||||
* Non-SystemComponents should not be added here
|
||||
*/
|
||||
AZ::ComponentTypeList GetRequiredSystemComponents() const override
|
||||
{
|
||||
return AZ::ComponentTypeList {
|
||||
azrtti_typeid<${SanitizedCppName}EditorSystemComponent>(),
|
||||
};
|
||||
}
|
||||
};
|
||||
}// namespace ${SanitizedCppName}
|
||||
|
||||
AZ_DECLARE_MODULE_CLASS(Gem_${SanitizedCppName}, ${SanitizedCppName}::${SanitizedCppName}EditorModule)
|
||||
@ -0,0 +1,78 @@
|
||||
// {BEGIN_LICENSE}
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
// {END_LICENSE}
|
||||
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
|
||||
#include <AzToolsFramework/API/ViewPaneOptions.h>
|
||||
|
||||
#include <${Name}Widget.h>
|
||||
#include <${Name}EditorSystemComponent.h>
|
||||
|
||||
namespace ${SanitizedCppName}
|
||||
{
|
||||
void ${SanitizedCppName}EditorSystemComponent::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
|
||||
{
|
||||
serializeContext->Class<${SanitizedCppName}EditorSystemComponent, ${SanitizedCppName}SystemComponent>()
|
||||
->Version(0);
|
||||
}
|
||||
}
|
||||
|
||||
${SanitizedCppName}EditorSystemComponent::${SanitizedCppName}EditorSystemComponent() = default;
|
||||
|
||||
${SanitizedCppName}EditorSystemComponent::~${SanitizedCppName}EditorSystemComponent() = default;
|
||||
|
||||
void ${SanitizedCppName}EditorSystemComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
|
||||
{
|
||||
BaseSystemComponent::GetProvidedServices(provided);
|
||||
provided.push_back(AZ_CRC_CE("${SanitizedCppName}EditorService"));
|
||||
}
|
||||
|
||||
void ${SanitizedCppName}EditorSystemComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
|
||||
{
|
||||
BaseSystemComponent::GetIncompatibleServices(incompatible);
|
||||
incompatible.push_back(AZ_CRC_CE("${SanitizedCppName}EditorService"));
|
||||
}
|
||||
|
||||
void ${SanitizedCppName}EditorSystemComponent::GetRequiredServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& required)
|
||||
{
|
||||
BaseSystemComponent::GetRequiredServices(required);
|
||||
}
|
||||
|
||||
void ${SanitizedCppName}EditorSystemComponent::GetDependentServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& dependent)
|
||||
{
|
||||
BaseSystemComponent::GetDependentServices(dependent);
|
||||
}
|
||||
|
||||
void ${SanitizedCppName}EditorSystemComponent::Activate()
|
||||
{
|
||||
${SanitizedCppName}SystemComponent::Activate();
|
||||
AzToolsFramework::EditorEvents::Bus::Handler::BusConnect();
|
||||
}
|
||||
|
||||
void ${SanitizedCppName}EditorSystemComponent::Deactivate()
|
||||
{
|
||||
AzToolsFramework::EditorEvents::Bus::Handler::BusDisconnect();
|
||||
${SanitizedCppName}SystemComponent::Deactivate();
|
||||
}
|
||||
|
||||
void ${SanitizedCppName}EditorSystemComponent::NotifyRegisterViews()
|
||||
{
|
||||
AzToolsFramework::ViewPaneOptions options;
|
||||
options.paneRect = QRect(100, 100, 500, 400);
|
||||
options.showOnToolsToolbar = true;
|
||||
options.toolbarIcon = ":/${Name}/toolbar_icon.svg";
|
||||
|
||||
// Register our custom widget as a dockable tool with the Editor
|
||||
AzToolsFramework::RegisterViewPane<${SanitizedCppName}Widget>("${Name}", "Tools", options);
|
||||
}
|
||||
|
||||
} // namespace ${SanitizedCppName}
|
||||
@ -0,0 +1,45 @@
|
||||
// {BEGIN_LICENSE}
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
// {END_LICENSE}
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <${Name}SystemComponent.h>
|
||||
|
||||
#include <AzToolsFramework/Entity/EditorEntityContextBus.h>
|
||||
|
||||
namespace ${SanitizedCppName}
|
||||
{
|
||||
/// System component for ${SanitizedCppName} editor
|
||||
class ${SanitizedCppName}EditorSystemComponent
|
||||
: public ${SanitizedCppName}SystemComponent
|
||||
, private AzToolsFramework::EditorEvents::Bus::Handler
|
||||
{
|
||||
using BaseSystemComponent = ${SanitizedCppName}SystemComponent;
|
||||
public:
|
||||
AZ_COMPONENT(${SanitizedCppName}EditorSystemComponent, "${EditorSysCompClassId}", BaseSystemComponent);
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
${SanitizedCppName}EditorSystemComponent();
|
||||
~${SanitizedCppName}EditorSystemComponent();
|
||||
|
||||
private:
|
||||
static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
|
||||
static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
|
||||
static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
|
||||
static void GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent);
|
||||
|
||||
// AZ::Component
|
||||
void Activate() override;
|
||||
void Deactivate() override;
|
||||
|
||||
// AzToolsFramework::EditorEventsBus overrides ...
|
||||
void NotifyRegisterViews() override;
|
||||
};
|
||||
} // namespace ${SanitizedCppName}
|
||||
@ -0,0 +1,25 @@
|
||||
// {BEGIN_LICENSE}
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
// {END_LICENSE}
|
||||
|
||||
#include <${Name}ModuleInterface.h>
|
||||
#include <${Name}SystemComponent.h>
|
||||
|
||||
namespace ${SanitizedCppName}
|
||||
{
|
||||
class ${SanitizedCppName}Module
|
||||
: public ${SanitizedCppName}ModuleInterface
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(${SanitizedCppName}Module, "${ModuleClassId}", ${SanitizedCppName}ModuleInterface);
|
||||
AZ_CLASS_ALLOCATOR(${SanitizedCppName}Module, AZ::SystemAllocator, 0);
|
||||
};
|
||||
}// namespace ${SanitizedCppName}
|
||||
|
||||
AZ_DECLARE_MODULE_CLASS(Gem_${SanitizedCppName}, ${SanitizedCppName}::${SanitizedCppName}Module)
|
||||
@ -0,0 +1,45 @@
|
||||
// {BEGIN_LICENSE}
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
// {END_LICENSE}
|
||||
|
||||
#include <AzCore/Memory/SystemAllocator.h>
|
||||
#include <AzCore/Module/Module.h>
|
||||
#include <${Name}SystemComponent.h>
|
||||
|
||||
namespace ${SanitizedCppName}
|
||||
{
|
||||
class ${SanitizedCppName}ModuleInterface
|
||||
: public AZ::Module
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(${SanitizedCppName}ModuleInterface, "{${Random_Uuid}}", AZ::Module);
|
||||
AZ_CLASS_ALLOCATOR(${SanitizedCppName}ModuleInterface, AZ::SystemAllocator, 0);
|
||||
|
||||
${SanitizedCppName}ModuleInterface()
|
||||
{
|
||||
// Push results of [MyComponent]::CreateDescriptor() into m_descriptors here.
|
||||
// Add ALL components descriptors associated with this gem to m_descriptors.
|
||||
// This will associate the AzTypeInfo information for the components with the the SerializeContext, BehaviorContext and EditContext.
|
||||
// This happens through the [MyComponent]::Reflect() function.
|
||||
m_descriptors.insert(m_descriptors.end(), {
|
||||
${SanitizedCppName}SystemComponent::CreateDescriptor(),
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Add required SystemComponents to the SystemEntity.
|
||||
*/
|
||||
AZ::ComponentTypeList GetRequiredSystemComponents() const override
|
||||
{
|
||||
return AZ::ComponentTypeList{
|
||||
azrtti_typeid<${SanitizedCppName}SystemComponent>(),
|
||||
};
|
||||
}
|
||||
};
|
||||
}// namespace ${SanitizedCppName}
|
||||
@ -0,0 +1,92 @@
|
||||
// {BEGIN_LICENSE}
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
// {END_LICENSE}
|
||||
|
||||
#include <${Name}SystemComponent.h>
|
||||
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
#include <AzCore/Serialization/EditContextConstants.inl>
|
||||
|
||||
namespace ${SanitizedCppName}
|
||||
{
|
||||
void ${SanitizedCppName}SystemComponent::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
if (AZ::SerializeContext* serialize = azrtti_cast<AZ::SerializeContext*>(context))
|
||||
{
|
||||
serialize->Class<${SanitizedCppName}SystemComponent, AZ::Component>()
|
||||
->Version(0)
|
||||
;
|
||||
|
||||
if (AZ::EditContext* ec = serialize->GetEditContext())
|
||||
{
|
||||
ec->Class<${SanitizedCppName}SystemComponent>("${SanitizedCppName}", "[Description of functionality provided by this System Component]")
|
||||
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
|
||||
->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("System"))
|
||||
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ${SanitizedCppName}SystemComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
|
||||
{
|
||||
provided.push_back(AZ_CRC_CE("${SanitizedCppName}Service"));
|
||||
}
|
||||
|
||||
void ${SanitizedCppName}SystemComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
|
||||
{
|
||||
incompatible.push_back(AZ_CRC_CE("${SanitizedCppName}Service"));
|
||||
}
|
||||
|
||||
void ${SanitizedCppName}SystemComponent::GetRequiredServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& required)
|
||||
{
|
||||
}
|
||||
|
||||
void ${SanitizedCppName}SystemComponent::GetDependentServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& dependent)
|
||||
{
|
||||
}
|
||||
|
||||
${SanitizedCppName}SystemComponent::${SanitizedCppName}SystemComponent()
|
||||
{
|
||||
if (${SanitizedCppName}Interface::Get() == nullptr)
|
||||
{
|
||||
${SanitizedCppName}Interface::Register(this);
|
||||
}
|
||||
}
|
||||
|
||||
${SanitizedCppName}SystemComponent::~${SanitizedCppName}SystemComponent()
|
||||
{
|
||||
if (${SanitizedCppName}Interface::Get() == this)
|
||||
{
|
||||
${SanitizedCppName}Interface::Unregister(this);
|
||||
}
|
||||
}
|
||||
|
||||
void ${SanitizedCppName}SystemComponent::Init()
|
||||
{
|
||||
}
|
||||
|
||||
void ${SanitizedCppName}SystemComponent::Activate()
|
||||
{
|
||||
${SanitizedCppName}RequestBus::Handler::BusConnect();
|
||||
AZ::TickBus::Handler::BusConnect();
|
||||
}
|
||||
|
||||
void ${SanitizedCppName}SystemComponent::Deactivate()
|
||||
{
|
||||
AZ::TickBus::Handler::BusDisconnect();
|
||||
${SanitizedCppName}RequestBus::Handler::BusDisconnect();
|
||||
}
|
||||
|
||||
void ${SanitizedCppName}SystemComponent::OnTick([[maybe_unused]] float deltaTime, [[maybe_unused]] AZ::ScriptTimePoint time)
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace ${SanitizedCppName}
|
||||
@ -0,0 +1,56 @@
|
||||
// {BEGIN_LICENSE}
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
// {END_LICENSE}
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Component/Component.h>
|
||||
#include <AzCore/Component/TickBus.h>
|
||||
#include <${Name}/${Name}Bus.h>
|
||||
|
||||
namespace ${SanitizedCppName}
|
||||
{
|
||||
class ${SanitizedCppName}SystemComponent
|
||||
: public AZ::Component
|
||||
, protected ${SanitizedCppName}RequestBus::Handler
|
||||
, public AZ::TickBus::Handler
|
||||
{
|
||||
public:
|
||||
AZ_COMPONENT(${SanitizedCppName}SystemComponent, "${SysCompClassId}");
|
||||
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
|
||||
static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
|
||||
static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
|
||||
static void GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent);
|
||||
|
||||
${SanitizedCppName}SystemComponent();
|
||||
~${SanitizedCppName}SystemComponent();
|
||||
|
||||
protected:
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// ${SanitizedCppName}RequestBus interface implementation
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// AZ::Component interface implementation
|
||||
void Init() override;
|
||||
void Activate() override;
|
||||
void Deactivate() override;
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// AZTickBus interface implementation
|
||||
void OnTick(float deltaTime, AZ::ScriptTimePoint time) override;
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
};
|
||||
|
||||
} // namespace ${SanitizedCppName}
|
||||
@ -0,0 +1,44 @@
|
||||
// {BEGIN_LICENSE}
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
// {END_LICENSE}
|
||||
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
|
||||
#include <QLabel>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include <${Name}Widget.h>
|
||||
|
||||
namespace ${SanitizedCppName}
|
||||
{
|
||||
${SanitizedCppName}Widget::${SanitizedCppName}Widget(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
setWindowTitle(QObject::tr("${Name}"));
|
||||
|
||||
QVBoxLayout* mainLayout = new QVBoxLayout(this);
|
||||
|
||||
QLabel* introLabel = new QLabel(QObject::tr("Put your cool stuff here!"), this);
|
||||
mainLayout->addWidget(introLabel, 0, Qt::AlignCenter);
|
||||
|
||||
QString helpText = QString(
|
||||
"For help getting started, visit the <a href=\"https://o3de.org/docs/tools-ui/ui-dev-intro/\">UI Development</a> documentation<br/>or come ask a question in the <a href=\"https://discord.gg/R77Wss3kHe\">sig-ui-ux channel</a> on Discord");
|
||||
|
||||
QLabel* helpLabel = new QLabel(this);
|
||||
helpLabel->setTextFormat(Qt::RichText);
|
||||
helpLabel->setText(helpText);
|
||||
helpLabel->setOpenExternalLinks(true);
|
||||
|
||||
mainLayout->addWidget(helpLabel, 0, Qt::AlignCenter);
|
||||
|
||||
setLayout(mainLayout);
|
||||
}
|
||||
}
|
||||
|
||||
#include <moc_${Name}Widget.cpp>
|
||||
@ -0,0 +1,28 @@
|
||||
// {BEGIN_LICENSE}
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
// {END_LICENSE}
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
|
||||
|
||||
#include <QWidget>
|
||||
#endif
|
||||
|
||||
namespace ${SanitizedCppName}
|
||||
{
|
||||
class ${SanitizedCppName}Widget
|
||||
: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ${SanitizedCppName}Widget(QWidget* parent = nullptr);
|
||||
};
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#FFFFFF"><g><rect fill="none" height="24" width="24"/><path d="M19,3H5C3.89,3,3,3.9,3,5v14c0,1.1,0.89,2,2,2h14c1.1,0,2-0.9,2-2V5C21,3.9,20.11,3,19,3z M19,19H5V7h14V19z M13.5,13 c0,0.83-0.67,1.5-1.5,1.5s-1.5-0.67-1.5-1.5c0-0.83,0.67-1.5,1.5-1.5S13.5,12.17,13.5,13z M12,9c-2.73,0-5.06,1.66-6,4 c0.94,2.34,3.27,4,6,4s5.06-1.66,6-4C17.06,10.66,14.73,9,12,9z M12,15.5c-1.38,0-2.5-1.12-2.5-2.5c0-1.38,1.12-2.5,2.5-2.5 c1.38,0,2.5,1.12,2.5,2.5C14.5,14.38,13.38,15.5,12,15.5z"/></g></svg>
|
||||
|
After Width: | Height: | Size: 607 B |
@ -0,0 +1,13 @@
|
||||
// {BEGIN_LICENSE}
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
// {END_LICENSE}
|
||||
|
||||
#include <AzTest/AzTest.h>
|
||||
|
||||
AZ_UNIT_TEST_HOOK(DEFAULT_UNIT_TEST_ENV);
|
||||
@ -0,0 +1,13 @@
|
||||
// {BEGIN_LICENSE}
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
// {END_LICENSE}
|
||||
|
||||
#include <AzTest/AzTest.h>
|
||||
|
||||
AZ_UNIT_TEST_HOOK(DEFAULT_UNIT_TEST_ENV);
|
||||
@ -0,0 +1,8 @@
|
||||
# {BEGIN_LICENSE}
|
||||
# Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
#
|
||||
# {END_LICENSE}
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
{
|
||||
"Tags": ["Android"],
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
# {BEGIN_LICENSE}
|
||||
# Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
#
|
||||
# {END_LICENSE}
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
{
|
||||
"Tags": ["Linux"]
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue