merge from development
Signed-off-by: greerdv <greerdv@amazon.com>monroegm-disable-blank-issue-2
commit
0f40aae8fa
@ -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
|
||||
@ -1,234 +0,0 @@
|
||||
/*
|
||||
* 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/Math/Matrix3x3.h>
|
||||
#include <AzCore/Math/Vector3.h>
|
||||
#include <AzCore/Math/Aabb.h>
|
||||
|
||||
#include <AzFramework/Physics/WorldBody.h>
|
||||
#include <AzFramework/Physics/ShapeConfiguration.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
class ReflectContext;
|
||||
}
|
||||
|
||||
namespace Physics
|
||||
{
|
||||
class ShapeConfiguration;
|
||||
class World;
|
||||
class Shape;
|
||||
|
||||
/// Default values used for initializing RigidBodySettings.
|
||||
/// These can be modified by Physics Implementation gems. // O3DE_DEPRECATED(LY-114472) - DefaultRigidBodyConfiguration values are not shared across modules.
|
||||
// Use RigidBodyConfiguration default values.
|
||||
struct DefaultRigidBodyConfiguration
|
||||
{
|
||||
static float m_mass;
|
||||
static bool m_computeInertiaTensor;
|
||||
static float m_linearDamping;
|
||||
static float m_angularDamping;
|
||||
static float m_sleepMinEnergy;
|
||||
static float m_maxAngularVelocity;
|
||||
};
|
||||
|
||||
enum class MassComputeFlags : AZ::u8
|
||||
{
|
||||
NONE = 0,
|
||||
|
||||
//! Flags indicating whether a certain mass property should be auto-computed or not.
|
||||
COMPUTE_MASS = 1,
|
||||
COMPUTE_INERTIA = 1 << 1,
|
||||
COMPUTE_COM = 1 << 2,
|
||||
|
||||
//! If set, non-simulated shapes will also be included in the mass properties calculation.
|
||||
INCLUDE_ALL_SHAPES = 1 << 3,
|
||||
|
||||
DEFAULT = COMPUTE_COM | COMPUTE_INERTIA | COMPUTE_MASS
|
||||
};
|
||||
|
||||
class RigidBodyConfiguration
|
||||
: public WorldBodyConfiguration
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(RigidBodyConfiguration, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(RigidBodyConfiguration, "{ACFA8900-8530-4744-AF00-AA533C868A8E}", WorldBodyConfiguration);
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
enum PropertyVisibility : AZ::u16
|
||||
{
|
||||
InitialVelocities = 1 << 0, ///< Whether the initial linear and angular velocities are visible.
|
||||
InertiaProperties = 1 << 1, ///< Whether the whole category of inertia properties (mass, compute inertia,
|
||||
///< inertia tensor etc) is visible.
|
||||
Damping = 1 << 2, ///< Whether linear and angular damping are visible.
|
||||
SleepOptions = 1 << 3, ///< Whether the sleep threshold and start asleep options are visible.
|
||||
Interpolation = 1 << 4, ///< Whether the interpolation option is visible.
|
||||
Gravity = 1 << 5, ///< Whether the effected by gravity option is visible.
|
||||
Kinematic = 1 << 6, ///< Whether the option to make the body kinematic is visible.
|
||||
ContinuousCollisionDetection = 1 << 7, ///< Whether the option to enable continuous collision detection is visible.
|
||||
MaxVelocities = 1 << 8 ///< Whether upper limits on velocities are visible.
|
||||
};
|
||||
|
||||
RigidBodyConfiguration() = default;
|
||||
RigidBodyConfiguration(const RigidBodyConfiguration& settings) = default;
|
||||
|
||||
// Visibility functions.
|
||||
AZ::Crc32 GetPropertyVisibility(PropertyVisibility property) const;
|
||||
void SetPropertyVisibility(PropertyVisibility property, bool isVisible);
|
||||
|
||||
AZ::Crc32 GetInitialVelocitiesVisibility() const;
|
||||
/// Returns whether the whole category of inertia settings (mass, inertia, center of mass offset etc) is visible.
|
||||
AZ::Crc32 GetInertiaSettingsVisibility() const;
|
||||
/// Returns whether the individual inertia tensor field is visible or is hidden because the compute inertia option is selected.
|
||||
AZ::Crc32 GetInertiaVisibility() const;
|
||||
/// Returns whether the mass field is visible or is hidden because compute mass option is selected.
|
||||
AZ::Crc32 GetMassVisibility() const;
|
||||
/// Returns whether the individual centre of mass offset field is visible or is hidden because compute CoM option is selected.
|
||||
AZ::Crc32 GetCoMVisibility() const;
|
||||
AZ::Crc32 GetDampingVisibility() const;
|
||||
AZ::Crc32 GetSleepOptionsVisibility() const;
|
||||
AZ::Crc32 GetInterpolationVisibility() const;
|
||||
AZ::Crc32 GetGravityVisibility() const;
|
||||
AZ::Crc32 GetKinematicVisibility() const;
|
||||
AZ::Crc32 GetCCDVisibility() const;
|
||||
AZ::Crc32 GetMaxVelocitiesVisibility() const;
|
||||
MassComputeFlags GetMassComputeFlags() const;
|
||||
void SetMassComputeFlags(MassComputeFlags flags);
|
||||
|
||||
bool IsCCDEnabled() const;
|
||||
|
||||
// Basic initial settings.
|
||||
AZ::Vector3 m_initialLinearVelocity = AZ::Vector3::CreateZero();
|
||||
AZ::Vector3 m_initialAngularVelocity = AZ::Vector3::CreateZero();
|
||||
AZ::Vector3 m_centerOfMassOffset = AZ::Vector3::CreateZero();
|
||||
|
||||
// Simulation parameters.
|
||||
float m_mass = DefaultRigidBodyConfiguration::m_mass;
|
||||
AZ::Matrix3x3 m_inertiaTensor = AZ::Matrix3x3::CreateIdentity();
|
||||
float m_linearDamping = DefaultRigidBodyConfiguration::m_linearDamping;
|
||||
float m_angularDamping = DefaultRigidBodyConfiguration::m_angularDamping;
|
||||
float m_sleepMinEnergy = DefaultRigidBodyConfiguration::m_sleepMinEnergy;
|
||||
float m_maxAngularVelocity = DefaultRigidBodyConfiguration::m_maxAngularVelocity;
|
||||
|
||||
// Visibility settings.
|
||||
AZ::u16 m_propertyVisibilityFlags = (std::numeric_limits<AZ::u16>::max)();
|
||||
|
||||
bool m_startAsleep = false;
|
||||
bool m_interpolateMotion = false;
|
||||
bool m_gravityEnabled = true;
|
||||
bool m_simulated = true;
|
||||
bool m_kinematic = false;
|
||||
bool m_ccdEnabled = false; ///< Whether continuous collision detection is enabled.
|
||||
float m_ccdMinAdvanceCoefficient = 0.15f; ///< Coefficient affecting how granularly time is subdivided in CCD.
|
||||
bool m_ccdFrictionEnabled = false; ///< Whether friction is applied when resolving CCD collisions.
|
||||
|
||||
bool m_computeCenterOfMass = true;
|
||||
bool m_computeInertiaTensor = true;
|
||||
bool m_computeMass = true;
|
||||
|
||||
//! If set, non-simulated shapes will also be included in the mass properties calculation.
|
||||
bool m_includeAllShapesInMassCalculation = false;
|
||||
};
|
||||
|
||||
/// Dynamic rigid body.
|
||||
class RigidBody
|
||||
: public WorldBody
|
||||
{
|
||||
public:
|
||||
|
||||
AZ_CLASS_ALLOCATOR(RigidBody, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(RigidBody, "{156E459F-7BB7-4B4E-ADA0-2130D96B7E80}", WorldBody);
|
||||
|
||||
public:
|
||||
RigidBody() = default;
|
||||
explicit RigidBody(const RigidBodyConfiguration& settings);
|
||||
|
||||
|
||||
virtual void AddShape(AZStd::shared_ptr<Shape> shape) = 0;
|
||||
virtual void RemoveShape(AZStd::shared_ptr<Shape> shape) = 0;
|
||||
virtual AZ::u32 GetShapeCount() { return 0; }
|
||||
virtual AZStd::shared_ptr<Shape> GetShape(AZ::u32 /*index*/) { return nullptr; }
|
||||
|
||||
virtual AZ::Vector3 GetCenterOfMassWorld() const = 0;
|
||||
virtual AZ::Vector3 GetCenterOfMassLocal() const = 0;
|
||||
|
||||
virtual AZ::Matrix3x3 GetInverseInertiaWorld() const = 0;
|
||||
virtual AZ::Matrix3x3 GetInverseInertiaLocal() const = 0;
|
||||
|
||||
virtual float GetMass() const = 0;
|
||||
virtual float GetInverseMass() const = 0;
|
||||
virtual void SetMass(float mass) = 0;
|
||||
virtual void SetCenterOfMassOffset(const AZ::Vector3& comOffset) = 0;
|
||||
|
||||
/// Retrieves the velocity at center of mass; only linear velocity, no rotational velocity contribution.
|
||||
virtual AZ::Vector3 GetLinearVelocity() const = 0;
|
||||
virtual void SetLinearVelocity(const AZ::Vector3& velocity) = 0;
|
||||
virtual AZ::Vector3 GetAngularVelocity() const = 0;
|
||||
virtual void SetAngularVelocity(const AZ::Vector3& angularVelocity) = 0;
|
||||
virtual AZ::Vector3 GetLinearVelocityAtWorldPoint(const AZ::Vector3& worldPoint) = 0;
|
||||
virtual void ApplyLinearImpulse(const AZ::Vector3& impulse) = 0;
|
||||
virtual void ApplyLinearImpulseAtWorldPoint(const AZ::Vector3& impulse, const AZ::Vector3& worldPoint) = 0;
|
||||
virtual void ApplyAngularImpulse(const AZ::Vector3& angularImpulse) = 0;
|
||||
|
||||
virtual float GetLinearDamping() const = 0;
|
||||
virtual void SetLinearDamping(float damping) = 0;
|
||||
virtual float GetAngularDamping() const = 0;
|
||||
virtual void SetAngularDamping(float damping) = 0;
|
||||
|
||||
virtual bool IsAwake() const = 0;
|
||||
virtual void ForceAsleep() = 0;
|
||||
virtual void ForceAwake() = 0;
|
||||
virtual float GetSleepThreshold() const = 0;
|
||||
virtual void SetSleepThreshold(float threshold) = 0;
|
||||
|
||||
virtual bool IsKinematic() const = 0;
|
||||
virtual void SetKinematic(bool kinematic) = 0;
|
||||
virtual void SetKinematicTarget(const AZ::Transform& targetPosition) = 0;
|
||||
|
||||
virtual bool IsGravityEnabled() const = 0;
|
||||
virtual void SetGravityEnabled(bool enabled) = 0;
|
||||
virtual void SetSimulationEnabled(bool enabled) = 0;
|
||||
virtual void SetCCDEnabled(bool enabled) = 0;
|
||||
|
||||
//! Recalculates mass, inertia and center of mass based on the flags passed.
|
||||
//! @param flags MassComputeFlags specifying which properties should be recomputed.
|
||||
//! @param centerOfMassOffsetOverride Optional override of the center of mass. Note: This parameter will be ignored if COMPUTE_COM is passed in flags.
|
||||
//! @param inertiaTensorOverride Optional override of the inertia. Note: This parameter will be ignored if COMPUTE_INERTIA is passed in flags.
|
||||
//! @param massOverride Optional override of the mass. Note: This parameter will be ignored if COMPUTE_MASS is passed in flags.
|
||||
virtual void UpdateMassProperties(MassComputeFlags flags = MassComputeFlags::DEFAULT,
|
||||
const AZ::Vector3* centerOfMassOffsetOverride = nullptr,
|
||||
const AZ::Matrix3x3* inertiaTensorOverride = nullptr,
|
||||
const float* massOverride = nullptr) = 0;
|
||||
};
|
||||
|
||||
/// Bitwise operators for MassComputeFlags
|
||||
inline MassComputeFlags operator|(MassComputeFlags lhs, MassComputeFlags rhs)
|
||||
{
|
||||
return aznumeric_cast<MassComputeFlags>(aznumeric_cast<AZ::u8>(lhs) | aznumeric_cast<AZ::u8>(rhs));
|
||||
}
|
||||
|
||||
inline MassComputeFlags operator&(MassComputeFlags lhs, MassComputeFlags rhs)
|
||||
{
|
||||
return aznumeric_cast<MassComputeFlags>(aznumeric_cast<AZ::u8>(lhs) & aznumeric_cast<AZ::u8>(rhs));
|
||||
}
|
||||
|
||||
/// Static rigid body.
|
||||
class RigidBodyStatic
|
||||
: public WorldBody
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(RigidBodyStatic, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(RigidBodyStatic, "{13A677BB-7085-4EDB-BCC8-306548238692}", WorldBody);
|
||||
|
||||
virtual void AddShape(const AZStd::shared_ptr<Shape>& shape) = 0;
|
||||
virtual AZ::u32 GetShapeCount() { return 0; }
|
||||
virtual AZStd::shared_ptr<Shape> GetShape(AZ::u32 /*index*/) { return nullptr; }
|
||||
};
|
||||
} // namespace Physics
|
||||
@ -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)
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue