Merge pull request #5043 from aws-lumberyard-dev/cgalvan/CherryPickPythonGemTemplate
Cherry picked PythonGem template to stabilization.monroegm-disable-blank-issue-2
commit
d23df465dd
@ -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(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)
|
||||
|
||||
add_subdirectory(Code)
|
||||
@ -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}EditorSystemComponent.cpp
|
||||
Source/${Name}EditorSystemComponent.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}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,76 @@
|
||||
# {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)
|
||||
|
||||
|
||||
# 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
|
||||
FILES_CMAKE
|
||||
${NameLower}_editor_files.cmake
|
||||
INCLUDE_DIRECTORIES
|
||||
PRIVATE
|
||||
Source
|
||||
PUBLIC
|
||||
Include
|
||||
BUILD_DEPENDENCIES
|
||||
PUBLIC
|
||||
AZ::AzToolsFramework
|
||||
)
|
||||
|
||||
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 we are a host platform we want to add tools test like editor tests here
|
||||
if(PAL_TRAIT_BUILD_HOST_TOOLS)
|
||||
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 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,47 @@
|
||||
// {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>
|
||||
|
||||
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()
|
||||
{
|
||||
// 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,70 @@
|
||||
// {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 <${Name}EditorSystemComponent.h>
|
||||
|
||||
namespace ${SanitizedCppName}
|
||||
{
|
||||
void ${SanitizedCppName}EditorSystemComponent::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
|
||||
{
|
||||
serializeContext->Class<${SanitizedCppName}EditorSystemComponent, AZ::Component>();
|
||||
}
|
||||
}
|
||||
|
||||
${SanitizedCppName}EditorSystemComponent::${SanitizedCppName}EditorSystemComponent()
|
||||
{
|
||||
if (${SanitizedCppName}Interface::Get() == nullptr)
|
||||
{
|
||||
${SanitizedCppName}Interface::Register(this);
|
||||
}
|
||||
}
|
||||
|
||||
${SanitizedCppName}EditorSystemComponent::~${SanitizedCppName}EditorSystemComponent()
|
||||
{
|
||||
if (${SanitizedCppName}Interface::Get() == this)
|
||||
{
|
||||
${SanitizedCppName}Interface::Unregister(this);
|
||||
}
|
||||
}
|
||||
|
||||
void ${SanitizedCppName}EditorSystemComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
|
||||
{
|
||||
provided.push_back(AZ_CRC_CE("${SanitizedCppName}EditorService"));
|
||||
}
|
||||
|
||||
void ${SanitizedCppName}EditorSystemComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
|
||||
{
|
||||
incompatible.push_back(AZ_CRC_CE("${SanitizedCppName}EditorService"));
|
||||
}
|
||||
|
||||
void ${SanitizedCppName}EditorSystemComponent::GetRequiredServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& required)
|
||||
{
|
||||
}
|
||||
|
||||
void ${SanitizedCppName}EditorSystemComponent::GetDependentServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& dependent)
|
||||
{
|
||||
}
|
||||
|
||||
void ${SanitizedCppName}EditorSystemComponent::Activate()
|
||||
{
|
||||
${SanitizedCppName}RequestBus::Handler::BusConnect();
|
||||
AzToolsFramework::EditorEvents::Bus::Handler::BusConnect();
|
||||
}
|
||||
|
||||
void ${SanitizedCppName}EditorSystemComponent::Deactivate()
|
||||
{
|
||||
AzToolsFramework::EditorEvents::Bus::Handler::BusDisconnect();
|
||||
${SanitizedCppName}RequestBus::Handler::BusDisconnect();
|
||||
}
|
||||
|
||||
} // namespace ${SanitizedCppName}
|
||||
@ -0,0 +1,42 @@
|
||||
// {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 <${Name}/${Name}Bus.h>
|
||||
|
||||
#include <AzToolsFramework/Entity/EditorEntityContextBus.h>
|
||||
|
||||
namespace ${SanitizedCppName}
|
||||
{
|
||||
/// System component for ${SanitizedCppName} editor
|
||||
class ${SanitizedCppName}EditorSystemComponent
|
||||
: public ${SanitizedCppName}RequestBus::Handler
|
||||
, private AzToolsFramework::EditorEvents::Bus::Handler
|
||||
, public AZ::Component
|
||||
{
|
||||
public:
|
||||
AZ_COMPONENT(${SanitizedCppName}EditorSystemComponent, "${EditorSysCompClassId}");
|
||||
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();
|
||||
void Deactivate();
|
||||
};
|
||||
} // namespace ${SanitizedCppName}
|
||||
@ -0,0 +1,36 @@
|
||||
// {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>
|
||||
|
||||
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()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Add required SystemComponents to the SystemEntity.
|
||||
*/
|
||||
AZ::ComponentTypeList GetRequiredSystemComponents() const override
|
||||
{
|
||||
return AZ::ComponentTypeList{
|
||||
};
|
||||
}
|
||||
};
|
||||
}// namespace ${SanitizedCppName}
|
||||
@ -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,46 @@
|
||||
"""
|
||||
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
|
||||
"""
|
||||
# -------------------------------------------------------------------------
|
||||
"""${SanitizedCppName}\\editor\\scripts\\${SanitizedCppName}_dialog.py
|
||||
Generated from O3DE PythonGem Template"""
|
||||
|
||||
import azlmbr
|
||||
from shiboken2 import wrapInstance, getCppPointer
|
||||
from PySide2 import QtCore, QtWidgets, QtGui
|
||||
from PySide2.QtCore import QEvent, Qt
|
||||
from PySide2.QtWidgets import QVBoxLayout, QAction, QDialog, QHeaderView, QLabel, QLineEdit, QPushButton, QSplitter, QTreeWidget, QTreeWidgetItem, QWidget, QAbstractButton
|
||||
|
||||
# Once PySide2 has been bootstrapped, register our ${SanitizedCppName}Dialog with the Editor
|
||||
|
||||
class ${SanitizedCppName}Dialog(QDialog):
|
||||
def __init__(self, parent=None):
|
||||
super(${SanitizedCppName}Dialog, self).__init__(parent)
|
||||
|
||||
self.setObjectName("${SanitizedCppName}Dialog")
|
||||
|
||||
self.setWindowTitle("HelloWorld, ${SanitizedCppName} Dialog")
|
||||
|
||||
self.mainLayout = QVBoxLayout(self)
|
||||
|
||||
self.introLabel = QLabel("Put your cool stuff here!")
|
||||
|
||||
self.mainLayout.addWidget(self.introLabel, 0, Qt.AlignCenter)
|
||||
|
||||
self.helpText = str("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")
|
||||
|
||||
self.helpLabel = QLabel()
|
||||
self.helpLabel.setTextFormat(Qt.RichText)
|
||||
self.helpLabel.setText(self.helpText)
|
||||
self.helpLabel.setOpenExternalLinks(True)
|
||||
|
||||
self.mainLayout.addWidget(self.helpLabel, 0, Qt.AlignCenter)
|
||||
|
||||
self.setLayout(self.mainLayout)
|
||||
|
||||
return
|
||||
@ -0,0 +1,9 @@
|
||||
"""
|
||||
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
|
||||
"""
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
__ALL__ = ['bootstrap','${NameLower}_dialog']
|
||||
@ -0,0 +1,117 @@
|
||||
"""
|
||||
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
|
||||
"""
|
||||
# -------------------------------------------------------------------------
|
||||
"""${SanitizedCppName}\\editor\\scripts\\boostrap.py
|
||||
Generated from O3DE PythonGem Template"""
|
||||
|
||||
import azlmbr
|
||||
import az_qt_helpers
|
||||
from PySide2 import QtCore, QtWidgets, QtGui
|
||||
from PySide2.QtCore import QEvent, Qt
|
||||
from PySide2.QtWidgets import QMainWindow, QAction, QDialog, QHeaderView, QLabel, QLineEdit, QPushButton, QSplitter, QTreeWidget, QTreeWidgetItem, QWidget, QAbstractButton
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
class SampleUI(QtWidgets.QDialog):
|
||||
"""Lightweight UI Test Class created a button"""
|
||||
def __init__(self, parent, title='Not Set'):
|
||||
super(SampleUI, self).__init__(parent)
|
||||
self.setWindowTitle(title)
|
||||
self.initUI()
|
||||
|
||||
def initUI(self):
|
||||
mainLayout = QtWidgets.QHBoxLayout()
|
||||
testBtn = QtWidgets.QPushButton("I am just a Button man!")
|
||||
mainLayout.addWidget(testBtn)
|
||||
self.setLayout(mainLayout)
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
if __name__ == "__main__":
|
||||
print("${SanitizedCppName}.boostrap, Generated from O3DE PythonGem Template")
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
# validate pyside before continuing
|
||||
try:
|
||||
azlmbr.qt.QtForPythonRequestBus(azlmbr.bus.Broadcast, 'IsActive')
|
||||
params = azlmbr.qt.QtForPythonRequestBus(azlmbr.bus.Broadcast, 'GetQtBootstrapParameters')
|
||||
params is not None and params.mainWindowId is not 0
|
||||
from PySide2 import QtWidgets
|
||||
except Exception as e:
|
||||
_LOGGER.error(f'Pyside not available, exception: {e}')
|
||||
raise e
|
||||
|
||||
# keep going, import the other PySide2 bits we will use
|
||||
from PySide2 import QtGui
|
||||
from PySide2.QtCore import Slot
|
||||
from shiboken2 import wrapInstance, getCppPointer
|
||||
|
||||
# Get our Editor main window
|
||||
_widget_main_window = None
|
||||
try:
|
||||
_widget_main_window = az_qt_helpers.get_editor_main_window()
|
||||
except:
|
||||
pass # may be booting in the AP?
|
||||
# ---------------------------------------------------------------------
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
if _widget_main_window:
|
||||
# creat a custom menu
|
||||
_tag_str = '${SanitizedCppName}'
|
||||
|
||||
# create our own menuBar
|
||||
${SanitizedCppName}_menu = _widget_main_window.menuBar().addMenu(f"&{_tag_str}")
|
||||
|
||||
# nest a menu for util/tool launching
|
||||
${SanitizedCppName}_launch_menu = ${SanitizedCppName}_menu.addMenu("examples")
|
||||
else:
|
||||
print('No O3DE MainWindow')
|
||||
# ---------------------------------------------------------------------
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
if _widget_main_window:
|
||||
# (1) add the first SampleUI
|
||||
action_launch_sample_ui = ${SanitizedCppName}_launch_menu.addAction("O3DE:SampleUI")
|
||||
|
||||
@Slot()
|
||||
def clicked_sample_ui():
|
||||
while 1: # simple PySide2 test, set to 0 to disable
|
||||
ui = SampleUI(parent=_widget_main_window, title='O3DE:SampleUI')
|
||||
ui.show()
|
||||
break
|
||||
return
|
||||
# Add click event to menu bar
|
||||
action_launch_sample_ui.triggered.connect(clicked_sample_ui)
|
||||
# ---------------------------------------------------------------------
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
if _widget_main_window:
|
||||
# (1) and custom external module Qwidget
|
||||
action_launch_${SanitizedCppName}_dialog = ${SanitizedCppName}_launch_menu.addAction("O3DE:${SanitizedCppName}_dialog")
|
||||
|
||||
@Slot()
|
||||
def clicked_${SanitizedCppName}_dialog():
|
||||
while 1: # simple PySide2 test, set to 0 to disable
|
||||
try:
|
||||
import az_qt_helpers
|
||||
from ${NameLower}_dialog import ${SanitizedCppName}Dialog
|
||||
az_qt_helpers.register_view_pane('${SanitizedCppName} Popup', ${SanitizedCppName}Dialog)
|
||||
except Exception as e:
|
||||
print(f'Error: {e}')
|
||||
print('Skipping register our ${SanitizedCppName}Dialog with the Editor.')
|
||||
${SanitizedCppName}_dialog = ${SanitizedCppName}Dialog(parent=_widget_main_window)
|
||||
${SanitizedCppName}_dialog.show()
|
||||
break
|
||||
return
|
||||
# Add click event to menu bar
|
||||
action_launch_${SanitizedCppName}_dialog.triggered.connect(clicked_${SanitizedCppName}_dialog)
|
||||
# ---------------------------------------------------------------------
|
||||
|
||||
# end
|
||||
@ -0,0 +1,16 @@
|
||||
{
|
||||
"gem_name": "${Name}",
|
||||
"display_name": "${Name}",
|
||||
"license": "What license ${Name} uses goes here: i.e. https://opensource.org/licenses/MIT",
|
||||
"origin": "The primary repo for ${Name} goes here: i.e. http://www.mydomain.com",
|
||||
"type": "Code",
|
||||
"summary": "A short description of ${Name}.",
|
||||
"canonical_tags": [
|
||||
"Gem"
|
||||
],
|
||||
"user_tags": [
|
||||
"${Name}"
|
||||
],
|
||||
"icon_path": "preview.png",
|
||||
"requirements": ""
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:7ac9dd09bde78f389e3725ac49d61eff109857e004840bc0bc3881739df9618d
|
||||
size 2217
|
||||
@ -0,0 +1,216 @@
|
||||
{
|
||||
"template_name": "PythonGem",
|
||||
"restricted_name": "o3de",
|
||||
"restricted_platform_relative_path": "Templates",
|
||||
"origin": "The primary repo for PythonGem goes here: i.e. http://www.mydomain.com",
|
||||
"license": "What license PythonGem uses goes here: i.e. https://opensource.org/licenses/MIT",
|
||||
"display_name": "PythonGem",
|
||||
"summary": "A short description of PythonGem.",
|
||||
"canonical_tags": [],
|
||||
"user_tags": [
|
||||
"PythonGem"
|
||||
],
|
||||
"icon_path": "preview.png",
|
||||
"copyFiles": [
|
||||
{
|
||||
"file": "CMakeLists.txt",
|
||||
"origin": "CMakeLists.txt",
|
||||
"isTemplated": true,
|
||||
"isOptional": false
|
||||
},
|
||||
{
|
||||
"file": "Code/${NameLower}_editor_files.cmake",
|
||||
"origin": "Code/${NameLower}_editor_files.cmake",
|
||||
"isTemplated": true,
|
||||
"isOptional": false
|
||||
},
|
||||
{
|
||||
"file": "Code/${NameLower}_editor_shared_files.cmake",
|
||||
"origin": "Code/${NameLower}_editor_shared_files.cmake",
|
||||
"isTemplated": true,
|
||||
"isOptional": false
|
||||
},
|
||||
{
|
||||
"file": "Code/${NameLower}_editor_tests_files.cmake",
|
||||
"origin": "Code/${NameLower}_editor_tests_files.cmake",
|
||||
"isTemplated": true,
|
||||
"isOptional": false
|
||||
},
|
||||
{
|
||||
"file": "Code/CMakeLists.txt",
|
||||
"origin": "Code/CMakeLists.txt",
|
||||
"isTemplated": true,
|
||||
"isOptional": false
|
||||
},
|
||||
{
|
||||
"file": "Code/Include/${Name}/${Name}Bus.h",
|
||||
"origin": "Code/Include/${Name}/${Name}Bus.h",
|
||||
"isTemplated": true,
|
||||
"isOptional": false
|
||||
},
|
||||
{
|
||||
"file": "Code/Platform/Linux/${NameLower}_linux_files.cmake",
|
||||
"origin": "Code/Platform/Linux/${NameLower}_linux_files.cmake",
|
||||
"isTemplated": true,
|
||||
"isOptional": false
|
||||
},
|
||||
{
|
||||
"file": "Code/Platform/Linux/${NameLower}_shared_linux_files.cmake",
|
||||
"origin": "Code/Platform/Linux/${NameLower}_shared_linux_files.cmake",
|
||||
"isTemplated": true,
|
||||
"isOptional": false
|
||||
},
|
||||
{
|
||||
"file": "Code/Platform/Linux/PAL_linux.cmake",
|
||||
"origin": "Code/Platform/Linux/PAL_linux.cmake",
|
||||
"isTemplated": true,
|
||||
"isOptional": false
|
||||
},
|
||||
{
|
||||
"file": "Code/Platform/Mac/${NameLower}_mac_files.cmake",
|
||||
"origin": "Code/Platform/Mac/${NameLower}_mac_files.cmake",
|
||||
"isTemplated": true,
|
||||
"isOptional": false
|
||||
},
|
||||
{
|
||||
"file": "Code/Platform/Mac/${NameLower}_shared_mac_files.cmake",
|
||||
"origin": "Code/Platform/Mac/${NameLower}_shared_mac_files.cmake",
|
||||
"isTemplated": true,
|
||||
"isOptional": false
|
||||
},
|
||||
{
|
||||
"file": "Code/Platform/Mac/PAL_mac.cmake",
|
||||
"origin": "Code/Platform/Mac/PAL_mac.cmake",
|
||||
"isTemplated": true,
|
||||
"isOptional": false
|
||||
},
|
||||
{
|
||||
"file": "Code/Platform/Windows/${NameLower}_shared_windows_files.cmake",
|
||||
"origin": "Code/Platform/Windows/${NameLower}_shared_windows_files.cmake",
|
||||
"isTemplated": true,
|
||||
"isOptional": false
|
||||
},
|
||||
{
|
||||
"file": "Code/Platform/Windows/${NameLower}_windows_files.cmake",
|
||||
"origin": "Code/Platform/Windows/${NameLower}_windows_files.cmake",
|
||||
"isTemplated": true,
|
||||
"isOptional": false
|
||||
},
|
||||
{
|
||||
"file": "Code/Platform/Windows/PAL_windows.cmake",
|
||||
"origin": "Code/Platform/Windows/PAL_windows.cmake",
|
||||
"isTemplated": true,
|
||||
"isOptional": false
|
||||
},
|
||||
{
|
||||
"file": "Code/Source/${Name}EditorModule.cpp",
|
||||
"origin": "Code/Source/${Name}EditorModule.cpp",
|
||||
"isTemplated": true,
|
||||
"isOptional": false
|
||||
},
|
||||
{
|
||||
"file": "Code/Source/${Name}EditorSystemComponent.cpp",
|
||||
"origin": "Code/Source/${Name}EditorSystemComponent.cpp",
|
||||
"isTemplated": true,
|
||||
"isOptional": false
|
||||
},
|
||||
{
|
||||
"file": "Code/Source/${Name}EditorSystemComponent.h",
|
||||
"origin": "Code/Source/${Name}EditorSystemComponent.h",
|
||||
"isTemplated": true,
|
||||
"isOptional": false
|
||||
},
|
||||
{
|
||||
"file": "Code/Source/${Name}ModuleInterface.h",
|
||||
"origin": "Code/Source/${Name}ModuleInterface.h",
|
||||
"isTemplated": true,
|
||||
"isOptional": false
|
||||
},
|
||||
{
|
||||
"file": "Code/Tests/${Name}EditorTest.cpp",
|
||||
"origin": "Code/Tests/${Name}EditorTest.cpp",
|
||||
"isTemplated": true,
|
||||
"isOptional": false
|
||||
},
|
||||
{
|
||||
"file": "Editor/Scripts/__init__.py",
|
||||
"origin": "Editor/Scripts/__init__.py",
|
||||
"isTemplated": true,
|
||||
"isOptional": false
|
||||
},
|
||||
{
|
||||
"file": "Editor/Scripts/bootstrap.py",
|
||||
"origin": "Editor/Scripts/bootstrap.py",
|
||||
"isTemplated": true,
|
||||
"isOptional": false
|
||||
},
|
||||
{
|
||||
"file": "Editor/Scripts/${NameLower}_dialog.py",
|
||||
"origin": "Editor/Scripts/${NameLower}_dialog.py",
|
||||
"isTemplated": true,
|
||||
"isOptional": false
|
||||
},
|
||||
{
|
||||
"file": "gem.json",
|
||||
"origin": "gem.json",
|
||||
"isTemplated": true,
|
||||
"isOptional": false
|
||||
},
|
||||
{
|
||||
"file": "preview.png",
|
||||
"origin": "preview.png",
|
||||
"isTemplated": false,
|
||||
"isOptional": false
|
||||
}
|
||||
],
|
||||
"createDirectories": [
|
||||
{
|
||||
"dir": "Assets",
|
||||
"origin": "Assets"
|
||||
},
|
||||
{
|
||||
"dir": "Code",
|
||||
"origin": "Code"
|
||||
},
|
||||
{
|
||||
"dir": "Editor",
|
||||
"origin": "Editor"
|
||||
},
|
||||
{
|
||||
"dir": "Editor/Scripts",
|
||||
"origin": "Editor/Scripts"
|
||||
},
|
||||
{
|
||||
"dir": "Code/Include",
|
||||
"origin": "Code/Include"
|
||||
},
|
||||
{
|
||||
"dir": "Code/Include/${Name}",
|
||||
"origin": "Code/Include/${Name}"
|
||||
},
|
||||
{
|
||||
"dir": "Code/Platform",
|
||||
"origin": "Code/Platform"
|
||||
},
|
||||
{
|
||||
"dir": "Code/Platform/Linux",
|
||||
"origin": "Code/Platform/Linux"
|
||||
},
|
||||
{
|
||||
"dir": "Code/Platform/Mac",
|
||||
"origin": "Code/Platform/Mac"
|
||||
},
|
||||
{
|
||||
"dir": "Code/Platform/Windows",
|
||||
"origin": "Code/Platform/Windows"
|
||||
},
|
||||
{
|
||||
"dir": "Code/Source",
|
||||
"origin": "Code/Source"
|
||||
},
|
||||
{
|
||||
"dir": "Code/Tests",
|
||||
"origin": "Code/Tests"
|
||||
}
|
||||
]
|
||||
}
|
||||
Loading…
Reference in New Issue