56904d1799
* Generic Cleanup Removals: * Unused cvars,member variables and defines * Windows media center edition support routines * CSystem - removed debug_GetCallStackRaw/GetRootWindowMessageHandler/ UnloadDLL/ShutdownModuleLibraries Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Fix CryMessageBox return values in Windows build Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Remove named selection group and a few smaller unused functionalities Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Remove ObjectManager export functionality + 2 deprecated functions Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Remove object legacy freeze/hide support from ObjectManager Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Remove ObjectManager duplicate name dection, as well as object renaming Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Remove ObjectManager serialization and selection callbacks Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * ObjectManager - remove MoveObjects/HitTestObject/EndEditParams and related members/functions Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Remove a bunch of unused clone related functionality + misc Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * ObjectManager - misc removals Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * ObjectManager - more removals Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Remove unused object selection/retrieval in ObjectManager and LoadObjects in ObjectLoader Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * CBaseObject - remove unused material layers mask support Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * More CBaseObject cleanups. Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * CBaseObject - remove SubObj functions and IMouseCreateCallback Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Remove unused procedural floor management, helper scale and tags. Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * CBaseObject - remove more unused methods. Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Removals in multiple places. CBaseObject - unused `OBJTYPE_DUMMY` flag removed, member `IsSameClass` CObjectArchive removed unused methods/members CObjectManager removed unused `Update` method Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * More removals IDisplayViewport - HitTestLine/GetGridStep/setHitcontext/ GetConstructionPlane Unused Cry_Matrix44 template specializations. Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * O3DE.exe Project-Centric "Open Editor" fix (#5852) * The O3DE.exe Open Editor button now attempts to open the Editor in the build directory of the project being opened. If their is no Editor within the build directory of the Project, it uses the Editor.exe in the current O3DE.exe executable directory if it exists Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Engine .gitignore now ignores the build directory if placed in the AutomatedTesting project Previously it was just ignoring a `[Bb]uild` directory if it was directly within the engine root. This change matches the behavior of the project templates. Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Renamed the ProjectUtils GetEditorDirectory function to GetEditorExecutablePath Added a platform specific implementation for retrieving the path to the Editor executable in the GetEditorExectuablePath function. It first attempts to locate the Editor via checking the project build directory for an Editor executable before falling back to checking the binary directory of the currently running O3DE executable. Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Correct the MacOS GetEditorExecutablePath to return the Editor path Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Adding missing C++20 std::erase implementations (#5735) There were already implementations for std::erase_if. This adds the counterpart AZStd::erase versions resolves #5734 Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * More removals and refactors `ShowMessage` and `CryMessageBox` return void now Simplify code in `CSystem::WarningV` Remove unused `CryGetTicksPerSec` Remove unused WinBase functionality Replace `nanosleep` call in WinBase with `std::this_thread::sleep_for` Remove unused Win32Wrapper routines Remove unused IFunctorBase.h and IEntityObjectListener.h Fix VectorAndArray.cpp compilation Use QMessageBox instead of CryMessageBox in the editor. Remove empty ArchiveVars platform specific files Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Fix test code. Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Remove an unused function Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * CBaseObject and undo description removals. Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * A bunch of removals * Remove IRenderNode * Remove editor's KDTree * Remove StatObjBus, InstanceStatObjEventBus::ReleaseData is redundant ( same functionality in the only available handler is triggered by `OnCryEditorCloseScene`) * Remove CExportManager::AddStatObj/AddMeshes/AddMesh, IExportManager::ExportSingleStatObj * Remove CIconManager/IIconManager::GetObject * Remove CBaseObject::IntersectRayMesh * Remove IIndexedMesh and related structs. * Unused IUndoObject::GetDescription and all derived implementations. * Unused CUndoBaseLibrary/CUndoBaseLibraryManager * Unused Matrix34_tpl typedefs * Legacy Xml classes cleanup Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Remove unused `Vec3ToVector3D` helper Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * fix - remove unused static variable Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> Co-authored-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
118 lines
3.9 KiB
Python
Executable File
118 lines
3.9 KiB
Python
Executable File
"""
|
|
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
|
|
"""
|
|
|
|
# Tests a portion of the Python API from ObjectManager.cpp while the Editor is running
|
|
|
|
import azlmbr.bus as bus
|
|
import azlmbr.editor as editor
|
|
import azlmbr.math
|
|
import azlmbr.legacy.general as general
|
|
|
|
def fetch_vector3_parts(vec3):
|
|
x = vec3.get_property('x')
|
|
y = vec3.get_property('y')
|
|
z = vec3.get_property('z')
|
|
return (x, y, z)
|
|
|
|
general.idle_enable(True)
|
|
|
|
# Try to open the WaterSample level. If not, fail the test.
|
|
# We need to rely on an existing level since the API does not provide
|
|
# a way to create entities, but only lets us manipulate them.
|
|
editor.EditorToolsApplicationRequestBus(bus.Broadcast, 'OpenLevelNoPrompt', 'WaterSample')
|
|
|
|
if (editor.EditorToolsApplicationRequestBus(bus.Broadcast, 'GetCurrentLevelName') == 'WaterSample'):
|
|
|
|
objs_list = general.get_all_objects()
|
|
|
|
if(len(objs_list) > 0):
|
|
print("get_all_objects works")
|
|
|
|
general.clear_selection()
|
|
general.select_object(objs_list[0])
|
|
|
|
selected_objs_list = general.get_names_of_selected_objects()
|
|
|
|
if(len(selected_objs_list) == 1):
|
|
print("get_names_of_selected_objects works")
|
|
|
|
select = [objs_list[1], objs_list[2]]
|
|
general.select_objects(select)
|
|
|
|
selected_objs_list = general.get_names_of_selected_objects()
|
|
|
|
if(len(selected_objs_list) == 3):
|
|
print("select_objects works")
|
|
|
|
sel_position = general.get_selection_center()
|
|
sel_aabb = general.get_selection_aabb()
|
|
centerX = sel_position.get_property("x")
|
|
cornerX = sel_aabb.get_property("min").get_property("x")
|
|
|
|
if not(centerX == cornerX):
|
|
print("sel_position and sel_aabb both work")
|
|
|
|
unselect = [objs_list[0], objs_list[2]]
|
|
general.unselect_objects(unselect)
|
|
|
|
if(general.get_num_selected() == 1):
|
|
print("get_num_selected and unselect_objects both work")
|
|
|
|
general.clear_selection()
|
|
|
|
if(general.get_num_selected() == 0):
|
|
print("clear_selection works")
|
|
|
|
position = general.get_position(objs_list[1])
|
|
px1, py1, pz1 = fetch_vector3_parts(position)
|
|
general.set_position(objs_list[1], px1 + 10, py1 - 4, pz1 + 3)
|
|
new_position = general.get_position(objs_list[1])
|
|
px2, py2, pz2 = fetch_vector3_parts(new_position)
|
|
|
|
if(px2 > px1) and (py2 < py1) and (pz2 > pz1):
|
|
print("position setter/getter works")
|
|
|
|
rotation = general.get_rotation(objs_list[1])
|
|
rx1, ry1, rz1 = fetch_vector3_parts(rotation)
|
|
general.set_rotation(objs_list[1], rx1 + 10, ry1 - 4, rz1 + 3)
|
|
new_rotation = general.get_rotation(objs_list[1])
|
|
rx2, ry2, rz2 = fetch_vector3_parts(new_rotation)
|
|
|
|
if(rx2 > rx1) and (ry2 < ry1) and (rz2 > rz1):
|
|
print("rotation setter/getter works")
|
|
|
|
scale = general.get_scale(objs_list[1])
|
|
sx1, sy1, sz1 = fetch_vector3_parts(scale)
|
|
general.set_scale(objs_list[1], sx1 + 10, sy1 + 4, sz1 + 3)
|
|
new_scale = general.get_scale(objs_list[1])
|
|
sx2, sy2, sz2 = fetch_vector3_parts(new_scale)
|
|
|
|
if(sx2 > sx1) and (sy2 > sy1) and (sz2 > sz1):
|
|
print("scale setter/getter works")
|
|
|
|
general.select_object(objs_list[2])
|
|
general.delete_selected()
|
|
new_objs_list = general.get_all_objects()
|
|
|
|
if(len(new_objs_list) < len(objs_list)):
|
|
print("delete_selected works")
|
|
|
|
general.delete_object(objs_list[0])
|
|
new_objs_list = general.get_all_objects()
|
|
|
|
if(len(new_objs_list) < len(objs_list)):
|
|
print("delete_object works")
|
|
|
|
general.rename_object(objs_list[1], "some_test_name")
|
|
new_objs_list = general.get_all_objects()
|
|
|
|
for elem in new_objs_list:
|
|
if(elem == "some_test_name"):
|
|
print("rename_object works")
|
|
|
|
editor.EditorToolsApplicationRequestBus(bus.Broadcast, 'ExitNoPrompt')
|