Integrating latest 47acbe8
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
"""
|
||||
All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
its licensors.
|
||||
|
||||
For complete copyright and license terms please see the LICENSE at the root of this
|
||||
distribution (the "License"). All use of this software is governed by the License,
|
||||
or, if provided, by the license below or the license accompanying this file. Do not
|
||||
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
"""
|
||||
|
||||
# Tests a portion of the Editor View Python API from CryEdit.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)
|
||||
|
||||
pos = general.get_current_view_position()
|
||||
rot = general.get_current_view_rotation()
|
||||
|
||||
px, py, pz = fetch_vector3_parts(pos)
|
||||
rx, ry, rz = fetch_vector3_parts(rot)
|
||||
|
||||
px = px + 5.0
|
||||
py = py - 2.0
|
||||
pz = pz + 1.0
|
||||
|
||||
rx = rx + 2.0
|
||||
ry = ry + 3.0
|
||||
rz = rz - 5.0
|
||||
|
||||
general.set_current_view_position(px, py, pz)
|
||||
general.set_current_view_rotation(rx, ry, rz)
|
||||
|
||||
pos2 = general.get_current_view_position()
|
||||
rot2 = general.get_current_view_rotation()
|
||||
|
||||
p2x, p2y, p2z = fetch_vector3_parts(pos2)
|
||||
r2x, r2y, r2z = fetch_vector3_parts(rot2)
|
||||
|
||||
if not (px == p2x) and not (py == p2y) and not (pz == p2z):
|
||||
print("set_current_view_position works")
|
||||
|
||||
if not (rx == r2x) and not (ry == r2y) and not (rz == r2z):
|
||||
print("set_current_view_rotation works")
|
||||
|
||||
editor.EditorToolsApplicationRequestBus(bus.Broadcast, 'ExitNoPrompt')
|
||||
Reference in New Issue
Block a user