A method and apparatus for testing scene gizmo geometry
By using automated testing methods that simulate mouse events and camera angle adjustments, the problem of low efficiency in Scene gizmo functional testing was solved, achieving highly efficient automated testing.
Patent Information
- Application Number
- CN202210111250.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-29
- Publication Date
- 2026-02-27
- Estimated Expiration
- 2042-01-29
AI Technical Summary
In existing technologies, the functional testing of Scene gizmo mainly relies on manual operation, which is inefficient and lacks efficient automated testing methods.
By simulating mouse events to drag and drop the target geometry of Scene gizmo, combined with preprocessing and camera angle adjustment, the functional status of Scene gizmo is automatically tested.
It has enabled automated testing of Scene Gizmo geometry, improving testing efficiency, replacing manual operation, and ensuring the accuracy and consistency of test results.
Smart Images

Figure CN114443489B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of game development, in particular, the present application relates to a method and device for testing Scene gizmo geometry, electronic equipment and computer readable storage medium. BACKGROUND
[0002] At present, the mainstream mode of game development is data-driven mode, so the editing efficiency of data is directly related to the development efficiency of the project, and Scene gizmo emerges as the times require. Scene gizmo is becoming a standard tool of various engine editors, and provides a set of data visualization tools for assisting scene editing and debugging for game scenes.
[0003] Due to the influence of Scene gizmo on game development efficiency, how to test the function of Scene gizmo has become an important research direction.
[0004] However, at present, the function of Scene gizmo is mainly tested by manual testing, which is relatively low in efficiency, and there is no other efficient way to test the function of Scene gizmo. SUMMARY
[0005] The purpose of the embodiments of the present application is to solve the above problems.
[0006] According to an aspect of an embodiment of the present application, a method for testing Scene gizmo geometry is provided, the method comprising:
[0007] preprocessing the selected host node;
[0008] determining the target geometry of Scene gizmo and the second scene coordinates of the target geometry, and performing offset processing on the second scene coordinates to obtain the first scene coordinates;
[0009] under a preset camera angle, dragging the target geometry to the first screen coordinates of the display screen by simulating a mouse event, and calling Scene gizmo to update the position of the target geometry to the third scene coordinates according to the simulated mouse event, wherein the first screen coordinates are obtained by processing the first scene coordinates according to a preset calculation method;
[0010] determining the fourth scene coordinates of the host node through the third scene coordinates, and determining the function state of the target geometry according to the fourth scene coordinates.
[0011] In a possible implementation, the target geometry is dragged to the first screen coordinates of the display screen by simulating a mouse event, which can specifically include:
[0012] According to a preset calculation manner, the second scene coordinates are processed to obtain second screen coordinates in a display screen.
[0013] The target geometry is moved from the second screen coordinates to the first screen coordinates by simulating a mouse event.
[0014] In a possible implementation, the display screen includes a current window of an editor, and the first scene coordinates are processed according to the preset calculation manner to obtain the first screen coordinates, which can specifically include:
[0015] A third screen coordinate of the current window in the display screen is obtained.
[0016] A window coordinate and a height of an editing panel of the current scene in the current window are obtained.
[0017] The first screen coordinates are calculated according to the window coordinate, the first scene coordinates, the third screen coordinate and the height.
[0018] In a possible implementation, the Scene gizmo is called to update the position of the target geometry to the third scene coordinates according to the simulated mouse event, which can specifically include:
[0019] The Scene gizmo is called to capture the simulated mouse event, and the latest screen coordinates of the target geometry are obtained according to the simulated mouse event.
[0020] The Scene gizmo is called to update the position of the target geometry to the third scene coordinates according to the latest screen coordinates.
[0021] In a possible implementation, the Scene gizmo includes an X axis, a Y axis, a Z axis, an xy plane, an xz plane and a yz plane, and the preset camera angle adjustment operation includes:
[0022] If the target geometry is any one of the X axis, the Y axis and the Z axis, the camera is adjusted to make the target geometry parallel to the display screen.
[0023] If the target geometry is any one of the xy plane, the xz plane and the yz plane, the camera is adjusted to make the target geometry perpendicular to the display screen.
[0024] In a possible implementation, the second scene coordinates are offset to obtain the first scene coordinates, which can specifically include:
[0025] The offset coordinates are set according to the direction corresponding to the target geometry.
[0026] The second scene coordinates are offset according to the offset coordinates to obtain the first scene coordinates.
[0027] In a possible implementation, the pre-processing operation comprises setting the host node at the origin of the current scene, and the rotation angle of the host node as the initial angle.
[0028] In a possible implementation, the fourth scene coordinate of the host node is obtained through the third scene coordinate, and the function state of the target geometric body is determined according to the fourth scene coordinate, which can specifically comprise:
[0029] The Scenegizmo is invoked to determine the fourth scene coordinate of the host node according to the third scene coordinate;
[0030] If the value of the fourth scene coordinate in the direction other than the direction of the target geometric body is zero, it is determined that the dragging direction of the target geometric body is correct.
[0031] If the difference between the fourth scene coordinate and the offset coordinate in the direction of the target geometric body is within a preset range, it is determined that the function state of the target geometric body is normal.
[0032] According to another aspect of the embodiments of the present application, a device for testing Scene gizmo is provided, which comprises:
[0033] The first processing module is configured to pre-process the selected host node.
[0034] The first determining module is configured to determine the target geometric body of the Scene gizmo and the second scene coordinate of the target geometric body, and to obtain the first scene coordinate by performing offset processing on the second scene coordinate.
[0035] The second processing module is configured to drag the target geometric body to the first screen coordinate of the display screen under a preset camera angle by simulating a mouse event, and to invoke the Scene gizmo to update the position of the target geometric body to the third scene coordinate according to the simulated mouse event, wherein the first screen coordinate is obtained by processing the first scene coordinate according to a preset calculation manner.
[0036] The second determining module is configured to determine the fourth scene coordinate of the host node through the third scene coordinate.
[0037] The third determining module is configured to determine whether the function of the target geometric body is normal according to the fourth scene coordinate.
[0038] According to another aspect of the embodiments of the present application, an electronic device is provided, which comprises a memory, a processor and a computer program stored in the memory, and the processor executes the computer program to implement the steps of the method shown in the above-mentioned aspect of the present application.
[0039] According to still another aspect of the embodiments of the present application, a computer readable storage medium is provided, and the computer readable storage medium has a computer program stored thereon, and the computer program is executed by a processor to implement the steps of the method according to the aspect of the present application.
[0040] The technical scheme provided by the embodiments of the present application has the beneficial effects that:
[0041] The embodiments of the present application provide a method for testing a Scene gizmo geometry. First, a second scene coordinate of a target geometry is offset to obtain a first scene coordinate, and the first scene coordinate is processed according to a pre-designed calculation mode to obtain a first screen coordinate. Then, the target geometry is moved to the first screen coordinate of a display screen by simulating a mouse event, and a Scene gizmo is called to update the position of a host node to a third scene coordinate according to the simulated mouse event. After the fourth scene coordinate of the host node is determined by the third scene coordinate, it is determined whether the function of the target geometry is normal according to the fourth scene coordinate. The pre-processing operation of the host node is used to eliminate relevant interference, and then the drag operation is provided by simulating the mouse event, so as to replace the manual mouse operation and realize the automatic testing. BRIEF DESCRIPTION OF DRAWINGS
[0042] In order to more clearly illustrate the technical scheme in the embodiments of the present application, the drawings needed in the description of the embodiments of the present application will be briefly introduced.
[0043] Figure 1 FIG. 1 is a structural schematic diagram of a Scene gizmo in the prior art;
[0044] Figure 2a FIG. 3 is a test scene schematic diagram of an automatic test script based on Spectron provided by the embodiments of the present application;
[0045] Figure 2b FIG. 4 is another test scene schematic diagram of an automatic test script based on Spectron provided by the embodiments of the present application;
[0046] Figure 3 FIG. 5 is a flow schematic diagram of a method for testing a Scene gizmo geometry provided by the embodiments of the present application;
[0047] Figure 4 FIG. 6 is a structural schematic diagram of a device for testing a Scene gizmo geometry provided by the embodiments of the present application;
[0048] Figure 5 FIG. 7 is a structural schematic diagram of an electronic device provided by the embodiments of the present application. DETAILED DESCRIPTION
[0049] The embodiments of the present application will be described below in conjunction with the accompanying drawings. It should be understood that the embodiments described below in conjunction with the accompanying drawings are exemplary descriptions of the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions of the embodiments of the present application.
[0050] Those skilled in the art can understand that the singular forms "a", "an" and "the" used herein include plural forms, unless specifically stated otherwise. It should be further understood that the terms "include" and "contain" used in the embodiments of the present application mean that the corresponding features can be implemented as the presented features, information, data, steps, operations, elements and / or components, but do not exclude other features, information, data, steps, operations, elements, components and / or their combinations supported by the present technology. It should be understood that when we say that an element is "connected" or "coupled" to another element, the element can be directly connected or coupled to the other element, or it can mean that the element and the other element establish a connection relationship through an intermediate element. In addition, "connection" or "coupling" used herein can include wireless connection or wireless coupling. The term "and / or" used herein indicates that at least one of the items defined by the term, for example, "A and / or B" can be implemented as "A", or as "B", or as "A and B".
[0051] In order to make the purpose, technical solutions and advantages of the present application clearer, the embodiments of the present application will be described in further detail below in conjunction with the accompanying drawings.
[0052] First, several terms related to the present application are introduced and explained:
[0053] Electron is an open source framework on GitHub, which uses Node.js and Chromium's rendering engine to complete the development of cross-platform desktop GUI applications.
[0054] Cocos creator editor: an application developed based on the Electron framework, the editor shown in the embodiments of the present application is configured with SceneGizmo and includes multiple HTML panels, such as: scene editor panel, layer manager panel, property inspector panel. Among them, the scene editor panel: the scene editor renders the scene based on the game engine; the layer manager panel: you can view the node hierarchy in the scene and left-click to select the node; the property inspector panel: this panel displays the properties of the current node, such as position (coordinates), rotation (rotation angle), etc.
[0055] Game Engine: refers to some already written and editable computer game system or some core components of interactive real-time image application. The system or core component provides various tools required for game designers to write games, aiming to make game designers easily and quickly make game programs without starting from scratch.
[0056] Node: a node is a basic building block for creating a game, with editable attributes.
[0057] Scene: a scene of a game is composed of multiple nodes. A scene is composed of a set of nodes organized in layers (in a tree-like manner). There is a camera in the scene, and changing the position of the camera can view the rendering result of the scene from different angles and positions.
[0058] SceneGizmo: SceneGizmo is a set of data visualization tools for assisting scene editing and debugging, composed of various types of Gizmo modules, such as positionGizmo for adjusting position. SceneGizmo includes various geometric bodies, such as X-axis, Y-axis, and Z-axis. The intersection of the X-axis, Y-axis, and Z-axis is the node that can currently be interacted with, and dragging any axis can change the position of the node. Since the intersection of the X-axis, Y-axis, and Z-axis is the node, the node that can be interacted with can also be called the host node.
[0059] Referring to Figure 1 The prior art structure of a Scenegizmo is shown in the figure. In addition to the above-mentioned X-axis, Y-axis, and Z-axis, the Scenegizmo can also include xy plane, xz plane, and yz plane. Among them, dragging the Z-axis can make the host node move along the Z-axis direction; dragging the X-axis can make the host node move along the X-axis direction; dragging the Y-axis can make the host node move along the Y-axis direction; dragging the plane xy plane can make the host node move along the plane where the X-axis and the Y-axis are located; dragging the plane xz plane can make the host node move along the plane where the X-axis and the Z-axis are located; and dragging the plane yz can make the host node move along the plane where the Y-axis and the Z-axis are located.
[0060] The editor shown in the embodiments of the present application is configured with SceneGizmo. As stated in the background art, SceneGizmo has a great influence on game development efficiency, and the function testing of SceneGizmo has become an important research direction. At present, the main way to test the function of SceneGizmo is by manual testing, which is relatively low in efficiency. Among them, X-axis, Y-axis, Z-axis, xy plane, xz plane, and yz plane are commonly used geometric body functions, and how to test this function is also the focus of the present application.
[0061] The method, device, electronic device and computer readable storage medium for testing a Scene gizmo geometry provided by the present application are intended to solve how to test the geometry of the Scene gizmo.
[0062] The technical solutions of the embodiments of the present application and the technical effects generated by the technical solutions of the present application will be described below through the description of several exemplary embodiments. It should be pointed out that the following embodiments can be mutually referenced, borrowed or combined. For the same terms, similar features and similar implementation steps in different embodiments, they will not be described repeatedly.
[0063] Referring to Figure 2a , the embodiments of the present application provide a test scene diagram based on an automated test script written by Spectron, which is used to test whether the function of the geometry is normal. Spectron is an official test framework recommended by Electron, and the function of Scenegizmo can be tested through Spectron. RobotJS is also used in the script. RobotJS is a GUI automation tool based on the Node.js framework, which can be used to control the mouse, keyboard, read the screen, etc., to provide mouse events, keyboard events, etc. generated when simulating manual mouse and keyboard operations.
[0064] The terminal environment involved in the script can include: a display screen of the terminal, a window of an editor displayed on the display screen (hereinafter referred to as a current window), and a scene editor panel in the current window (i.e. the editing panel where the current scene is located). The display screen is configured with a screen coordinate system, and the origin of the screen coordinate system is the upper left corner of the display screen, i.e. the coordinate system identified by the X3 axis and the Y3 axis. The current window is configured with a window coordinate system, and the origin of the window coordinate system is the upper left corner of the current window, i.e. the coordinate system identified by the X2 axis and the Y2 axis. The editing panel is configured with a screen space coordinate system, and the origin of the screen space coordinate system is located at the lower left corner of the editing panel, i.e. the coordinate system identified by the X1 axis and the Y1 axis. The current scene has been configured with a scene coordinate system, which is a three-dimensional coordinate system. The coordinates in the scene coordinate system can be converted into coordinates in the screen space coordinate system through the game engine of the editor, and based on the converted coordinates, the coordinates on the screen coordinate system can be obtained through multi-step conversion. It should be pointed out that in Figure 1 , Figure 2a and 2b , a black circle is used to represent the origin of the coordinate system, and a node A with a smiley icon is used.
[0065] The window of the editor can specifically include: a scene editor panel (i.e. the editing panel in the embodiments of the present application), a layer manager panel, and a property inspector panel.
[0066] The geometry that needs to be moved (e.g., the Z-axis in Scenegizmo) has an initial position of point 'a' and a target position of point 'b' in the scene coordinate system. Dragging this geometry is specifically an operation where the geometry is dragged from its initial position 'a' to the position 'b'.
[0067] The implementation logic of this script is shown in flowcharts S210-S260:
[0068] S210, Select the host node.
[0069] Specifically, create a new node A in the current scene. Select node A by left-clicking in the RobotJS Hierarchy Manager; this node will then become the host node A. Further, use the Properties Inspector to set the position (x, y, z) of node A to (0, 0, 0). You can also set other information for node A, such as setting the rotation angle to (0, 0, 0). This node can be a rigid body node configured with a mesh renderer, such as a capsule or sphere, and its shape is not limited. It can also be an empty node in the current scene without a mesh renderer.
[0070] Specifically, when selecting node A using RobotJS, it's necessary to first obtain the position of node A in the hierarchy manager, and then use RobotJS to move the mouse to that position and left-click to select node A. Obtaining the position of node A can be done through the following process:
[0071] First, obtain the width, height, and coordinates of the current window through the Spectron framework's interface. Second, query the width, height, and position of the editing panel using an element selector (the editing panel is an HTML element, and its position and size information can be queried using an element selector). Obtain the coordinates of node A in the scene coordinate system through the game engine and convert them to coordinates in the screen space coordinate system. Then, calculate the screen coordinates of node A on the display screen based on the screen space coordinates of node A, the position and height information of the editing panel, and the position information of the current window.
[0072] After calculating the screen coordinates, node A can be selected by simulating a mouse click at that location. Once selected, position information can be input via simulated keyboard input to adjust the coordinates and rotation angle of node A in the Attribute Inspector. It should be noted that other information about node A can also be adjusted in the Attribute Inspector, such as scaling and layer. Those skilled in the art can determine the attributes to be set in the Attribute Editor as needed.
[0073] S220 adjusts the camera in the current scene to a suitable angle.
[0074] Specifically, in the test script based on the Spectron framework, the interaction operation with the editor is increased, so that the editor calls the camera interface in the current scene, changes the camera position, and obtains a suitable angle. The suitable angle means that the target geometry to be dragged is completely parallel or perpendicular to the display screen. The target geometry to be dragged is completely parallel or perpendicular to the display screen specifically can include: if the target geometry is an X axis, a Y axis, or a Z axis, the target geometry is parallel to the display screen; if the target geometry is an xy face, an xz face, or a yz face, the target geometry is perpendicular to the display screen.
[0075] In the embodiment of the present application, the target geometry can be selected as the Z axis.
[0076] In the embodiment of the present application, the target geometry can be selected as the Z axis.
[0076] S230, obtains the screen coordinates of the original position a point of the target geometry on the display screen according to the configuration file.
[0077] Specifically, the screen space coordinates of the a point are queried and obtained as p1(x1, y1); the window coordinates of the editor panel relative to the current window are queried and obtained as p2(x2, y2); and the screen coordinates of the current window relative to the display screen are queried and obtained as p3(x3, y3). The height of the scene editor panel is h. The actual coordinates of the a point on the display screen are obtained according to p1, p2, p3, and h as (x1+x2+x3, y2+y3+h-y1).
[0078] S240, obtains the screen coordinates of the target position b point of the target geometry on the display screen according to the configuration file.
[0079] Specifically, the deviation coordinates are set in the configuration file, the scene coordinates of the a point are processed according to the deviation coordinates to obtain the scene coordinates of the target position b point. Then, the scene coordinates of the b point are transformed into the screen space coordinates p4(x4, y4) by the engine of the editor; the window coordinates of the editor panel in the current window are queried and obtained as p5(x5, y5); and the screen coordinates of the current window in the display screen are queried and obtained as p6(x6, y6). The coordinates of the target position b point on the display screen are obtained according to p4, p5, p6, and h as (x4+x5+x6, y5+y6+h-y4).
[0080] If the current window does not change relative to the display screen, p6 is the same as p3; if the editor panel does not change relative to the current window, p5 is the same as p2.
[0081] For example, the scene coordinates of point a are p7(0, 0, 10). After calculation, the screen coordinates of point a on the display screen are p7'(200, 200). If the target geometric body is the Z axis, the offset coordinates set are (0, 0, 1). According to the offset coordinates, the scene coordinates of point a are processed, and the scene coordinates of point b are p8(0, 0, 10+1). After the above calculation, the screen coordinates of point b on the display screen are p8'(190, 200).
[0082] S250, dragging the target geometric body from point a to point b by simulating a mouse.
[0083] Specifically, the original coordinates of the mouse, i.e., p7', and the target coordinates of the mouse, i.e., p8', are obtained. From point a to point b, a mouse drag event is provided, and the Z axis is dragged from point a to point b. In the ideal drag process, the change of the coordinates is that the screen coordinates change from p7' to p8', and the scene coordinates change from p7 to p8.
[0084] S260, comparing the attributes of node A displayed on the property inspector to determine whether the position of the node after being dragged changes towards the expected position.
[0085] Specifically, after dragging the target geometric body, Scenegizmo determines the real coordinates p9 of the target geometric body in the scene coordinate system according to the real coordinates p9' of the target geometric body on the display screen, and determines the coordinates of node A after being moved according to p9.
[0086] For example, referring to Figure 2b , the coordinates of node A displayed on the property inspector panel are (0, 0, 0.965). Relative to the offset coordinates (0, 0, 1), the adjustment of the Z axis direction of Scenegizmo is accurate, but there is a small error in the drag distance.
[0087] Due to the error in calculation, the test result is that the scene coordinates of node A change towards the direction of the target geometric body, i.e., the function of the Z axis is accurate in direction. Although the offset value set in the Z axis direction is 1, and the actual offset value of the Z axis is 0.965, the error is 0.035. If 0.035 is within the allowable error range, it can be determined that the function state of the Z axis is normal. The causes of the error include but are not limited to the deviation of the position returned by Spectron and the deviation of the mouse operation by the RobotJS framework.
[0088] Therefore, in the case of whether the direction of displacement meets the expectation, a deviation range can be set to determine whether the function state of the Z axis is normal.
[0089] The above is the process of testing the Z axis of Scenegizmo. When testing other geometries, you only need to adjust the angle of the camera according to the above steps and set the corresponding offset coordinates. When testing the three faces of Scenegizmo, you also need to adjust the angle of the camera to make the face perpendicular to the screen direction and set the offset coordinates.
[0090] It should be noted that the above embodiment uses the coordinates of the arrow on the Z axis to correspond to the position of the Z axis when describing the position of the Z axis. The way of describing the position is consistent when describing the positions of the Y axis and the X axis. When describing the position of the face, since the face is a square, the center point of the square can be used to correspond to the position of the face.
[0091] Referring to Figure 3 In the embodiments of the present application, a flowchart of a method for testing a Scene gizmo geometry is provided, which is applied to a terminal. The terminal is configured with a display screen, an editor, an editing panel on the editor, and the current scene displayed on the editing panel as shown in Figure 2a The method comprises the following steps:
[0092] S310, preprocessing the selected host node.
[0093] In a possible implementation, the preprocessing operation comprises setting the host node at the origin of the current scene and the rotation angle of the host node as the initial angle. The setting operation can make the testing process more intuitive and simple.
[0094] Specifically, the coordinates of the host node are set as (x, y, z) = (0, 0, 0), and the rotation angles of the host node relative to the X axis, the Y axis and the Z axis are respectively 0, 0 and 0. In the property inspector panel, x = 0, y = 0 and z = 0 can be used to represent.
[0095] Exemplarily, when the coordinates of the host node are set as the origin (0, 0, 0), if the Z axis of Scenegizmo is dragged, the expected result is that the z value in the coordinates of the host node is updated, and the x value and the y value remain 0. If it is not the case, for example, the x value and / or the y value is greater than or less than 0, it can be directly seen that the Z axis function is abnormal. Since the testing process is intuitive, the user can see the final coordinates of the host node through the property inspector panel on the editor, and quickly determine whether the function status of the Z axis is normal.
[0096] Specifically, after starting the editor, a node can be newly created in the current scene, and then the node A is selected by clicking in the layer manager of the current window through the RobotJS. After being selected, the node A can be the host node.
[0097] S320, determine the target geometry of the Scene gizmo and the second scene coordinate of the target geometry, and offset the second scene coordinate to obtain the first scene coordinate.
[0098] The Scene gizmo includes a plurality of geometries, specifically, X-axis, Y-axis, Z-axis, xy plane, xz plane, and yz plane. Dragging different geometries can adjust the position information of the host node from different directions.
[0099] The current scene has a three-dimensional coordinate system, which can be referred to as a scene coordinate system. In the embodiment of the application, the first scene coordinate, the second scene coordinate, and the third scene coordinate are all coordinates in the scene coordinate system. The current scene is located in the editing panel, and the editing panel also has a two-dimensional coordinate system, which can be referred to as a screen space coordinate system. In the embodiment of the application, the screen space coordinate is a coordinate in the screen space coordinate system. The editing panel is in the current window of the editor, and the current window also has a two-dimensional coordinate system, which can be referred to as a window coordinate system in the embodiment of the application. It should be pointed out that the coordinates in the scene coordinate system can be converted into coordinates in the screen space coordinate system through the engine in the editor. The specific conversion method can refer to the prior art, and for the sake of simplicity of description, it will not be described here.
[0100] In a possible implementation, the offset processing of the second scene coordinate to obtain the first scene coordinate includes:
[0101] The offset coordinate is set according to the direction corresponding to the target geometry, and the second scene coordinate is offset according to the offset coordinate to obtain the first scene coordinate. Specifically, the direction corresponding to the target geometry can include: if the target geometry is an axis, the direction of the axis; if the target geometry is a plane, the direction perpendicular to the plane.
[0102] The offset coordinate can be exemplarily referenced to the offset coordinate (0, 0, 1) in the above embodiment; the first scene coordinate and the second scene coordinate can be respectively referenced to p7 (0, 0, 10) and p8 (0, 0, 10+1).
[0103] S330, under a preset camera angle, the target geometry is dragged to a first screen coordinate of the display screen through a simulated mouse event, and a scene gizmo is called to update the position of the target geometry to a third scene coordinate according to the simulated mouse event, wherein the first screen coordinate is obtained by processing the first scene coordinate according to a preset calculation manner.
[0104] In a possible implementation, the Scene gizmo includes X-axis, Y-axis, Z-axis, xy plane, xz plane, and yz plane, and the adjustment operation of the preset camera angle can include:
[0105] If the target geometry is any one of the X-axis, Y-axis, Z-axis, the camera is adjusted to make the target geometry parallel to the display screen; if the target geometry is any one of the xy plane, xz plane, yz plane, the camera is adjusted to make the target geometry perpendicular to the display screen.
[0106] Specifically, when testing the function of the target geometry of Scenegizmo, coordinate conversion is involved. If the target geometry tested (for example, the X-axis, Y-axis, Z-axis) is not parallel to the display screen, or the target geometry (xy plane, xz plane, yz plane) is not perpendicular to the display screen, an error may occur during coordinate conversion, which in turn affects the third scene coordinates, and ultimately affects the test results. Therefore, it is necessary to set any one axis parallel to the display screen to test the functional status of any one axis, or set any one plane perpendicular to the display screen to test the functional status of any one plane.
[0107] For example, referring to S240, S250, S260 in the above embodiment, the first screen coordinates can refer to the screen coordinates p8', and the third scene coordinates can refer to the real coordinates p9 of the target geometry in the scene coordinate system.
[0108] S340, determine the fourth scene coordinates of the host node through the third scene coordinates, and determine whether the function of the target geometry is normal according to the fourth scene coordinates.
[0109] The fourth scene coordinates are the scene coordinates of the host node in the current scene. In addition, the fourth scene coordinates are displayed on the property inspector panel of the editor for the user to view. The Scene gizmo target geometry is simulated to be dragged by the mouse, and the Scene gizmo target geometry obtains the third scene coordinates by analyzing the mouse events of the drag, and transmits the third scene coordinates to the host node to update the coordinate data of the host node, to obtain the fourth scene coordinates of the host node. It should be noted that the principle of simulating the mouse operation of the target geometry to update the position of the host node is that the relative position between the target geometry and the host node is always unchanged, therefore, if the position of the target geometry is updated, in order to ensure that the relative position between the two is unchanged, the coordinate of the host node needs to be modified by the same offset.
[0110] The application provides a method for testing a Scene gizmo geometry, first, a second scene coordinate of a target geometry is offset to obtain a first scene coordinate, and the first scene coordinate is processed according to a pre-designed calculation mode to obtain a first screen coordinate; then the target geometry is moved to the first screen coordinate of a display screen through a simulated mouse event, and a Scene gizmo is called to update the position of a host node to a third scene coordinate according to the simulated mouse event. After the fourth scene coordinate of the host node is determined through the third scene coordinate, whether the function of the target geometry is normal is determined according to the fourth scene coordinate. The pre-processing operation of the host node is used to exclude relevant interference, and then the simulated mouse event is used to provide a dragging operation, so as to replace manual mouse operation and realize automatic testing.
[0111] The application embodiment also provides a possible implementation manner, and the target geometry is dragged to the first screen coordinate of the display screen through a simulated mouse event, which can specifically include:
[0112] The second scene coordinate is processed according to the pre-designed calculation mode to obtain a second screen coordinate in the display screen; and the target geometry is moved from the second screen coordinate to the first screen coordinate through a simulated mouse event.
[0113] Specifically, the engine of the editor is called to convert the second scene coordinate into a second screen space coordinate in a screen space coordinate system; the window coordinate of the editor panel in a window coordinate system and the height of the editor panel are obtained; and the third screen coordinate of the current window in a screen coordinate system is obtained. Finally, the second screen coordinate is calculated according to the second screen space coordinate, the window coordinate, the third screen coordinate and the height of the editor panel. As for the pre-designed calculation mode, S230 and S240 in the above embodiment can also be referred to, for example, the second screen space coordinate, the window coordinate and the third screen coordinate are sequentially referred to as p1, p2 and p3, and the height of the editor panel is referred to as h.
[0114] In a possible implementation manner, the display screen includes a current window of the editor, and processing the first scene coordinate according to the pre-designed calculation mode to obtain the first screen coordinate can include:
[0115] The third screen coordinate of the current window in the display screen is obtained; the window coordinate and the height of the editor panel of the current scene in the current window are obtained; and the first screen coordinate is calculated according to the window coordinate, the first scene coordinate, the third screen coordinate and the height.
[0116] Specifically, the engine invoking the editor converts the three-dimensional first scene coordinates into two-dimensional first screen space coordinates in a screen space coordinate system; obtains window coordinates of the editing panel in a window coordinate system and a height of the editing panel; and obtains third screen coordinates of the current window in a screen coordinate system. Finally, the first screen coordinates are calculated according to the first screen space coordinates, the window coordinates, the third screen coordinates and the height of the editing panel. As for the budget calculation manner, reference can also be made to S230 and S240 in the above embodiments, for example, the first screen space coordinates, the window coordinates and the third screen coordinates refer to p4, p5 and p6 respectively, and the height of the editing panel refers to h.
[0117] Specifically, the simulated mouse event can include: simulating a mouse click event to realize selection of the target geometry; simulating a mouse drag event to realize dragging of the selected target geometry; and simulating a mouse cancel event to realize canceling of the selection after the selected target geometry reaches the first screen coordinates.
[0118] In a possible implementation, the Scene gizmo is invoked to update the position of the target geometry to the third scene coordinates according to the simulated mouse event, and specifically can include:
[0119] The Scene gizmo is invoked to capture the simulated mouse event and obtain the latest position data of the target geometry according to the simulated mouse event; and the Scene gizmo is invoked to update the position of the target geometry to the third scene coordinates according to the latest position data.
[0120] Specifically, there is a module in the Scene gizmo for capturing the simulated mouse event, and the most critical data in the simulated mouse event is the position data of the mouse. Therefore, after the position data is obtained, the Scene gizmo is invoked to update the position of the target geometry according to the position data, and finally the position data of the host node is updated according to the updated position data of the target geometry.
[0121] The embodiments of the present application also provide a possible implementation, which obtains the fourth scene coordinates of the host node through the third scene coordinates, and specifically can include:
[0122] The Scene gizmo is invoked to determine the fourth scene coordinates of the host node according to the third scene coordinates.
[0123] In a possible implementation, whether the function of the target geometry is normal is determined according to the fourth scene coordinates, and specifically can include:
[0124] If the value in the fourth scene coordinate in the direction other than the direction of the target geometry is zero, it is determined that the dragging direction of the target geometry is correct; if the difference between the fourth scene coordinate and the offset coordinate in the direction of the target geometry is within a preset range, it is determined that the function of the target geometry is normal.
[0125] Specifically, the embodiment of the present application provides an expected direction, so as to drag the target geometry according to the expected direction, and thus the key to determining that the function of the target geometry is normal lies in that the target geometry can be dragged in the expected direction. If the dragging direction conforms to the expected direction, it is further determined whether the error between the dragging distance in the expected direction and the expected distance is within a preset range, and if yes, it is determined that the dragging function of the target geometry is normal. The expected direction can include: if the target geometry is an axis, the direction of the axis; or if the target geometry is a face, the direction perpendicular to the face.
[0126] In the embodiment, since the initial position of the host node is set as the origin, after the target geometry is dragged in the direction of the target geometry, the value in the first scene coordinate in the direction other than the direction of the target geometry is zero. For example, when the target geometry is the Z axis, the dragging direction is the direction of the Z axis, and the value in the Z axis direction of the coordinate of the host node will not be zero, while the values in the X axis and Y axis directions are zero.
[0127] In addition, the function of the target geometry can also be determined according to the fourth scene coordinate according to the step S260 in the above embodiment.
[0128] Referring to Figure 4 The embodiment of the present application provides a device for testing a Scene gizmo geometry, which specifically can include:
[0129] The first processing module 410 is configured to preprocess the selected host node; the first determining module 420 is configured to determine the target geometry of the Scene gizmo and the second scene coordinate of the target geometry, and offset processes the second scene coordinate to obtain the first scene coordinate; the second processing module 430 is configured to drag the target geometry to the first screen coordinate of the display screen under a preset camera angle through simulation of a mouse event, and call the Scene gizmo to update the position of the target geometry to the third scene coordinate according to the simulated mouse event, wherein the first screen coordinate is obtained by processing the first scene coordinate according to a preset calculation manner; the second determining module 440 is configured to determine the fourth scene coordinate of the host node through the third scene coordinate; and the third determining module 450 is configured to determine the function state of the target geometry according to the fourth scene coordinate.
[0130] In a possible implementation, the second processing module 430 is specifically configured to:
[0131] The second scene coordinates are processed according to the preset calculation manner to obtain second screen coordinates in the display screen; and the target geometry is moved from the second screen coordinates to the first screen coordinates by simulating a mouse event.
[0132] In a possible implementation, the display screen includes a current window of the editor, and the device 500 further includes a coordinate conversion module 460 (not shown in the figure), which is specifically configured to:
[0133] obtain third screen coordinates of the current window in the display screen;
[0134] obtain window coordinates and a height of an editing panel of the current scene in the current window;
[0135] calculate the first screen coordinates according to the window coordinates, the first scene coordinates, the third screen coordinates and the height.
[0136] In a possible implementation, the second processing module 430 is specifically configured to:
[0137] invoke the Scene gizmo to capture the simulated mouse event, and obtain the latest screen coordinates of the target geometry according to the simulated mouse event; and invoke the Scene gizmo to update the position of the target geometry to the third scene coordinates according to the latest screen coordinates.
[0138] In a possible implementation, the Scene gizmo includes an X axis, a Y axis, a Z axis, an xy plane, an xz plane and a yz plane, and the first processing module 410 is further configured to:
[0139] if the target geometry is any one of the X axis, the Y axis and the Z axis, adjust the camera to make the target geometry parallel to the display screen; or if the target geometry is any one of the xy plane, the xz plane and the yz plane, adjust the camera to make the target geometry perpendicular to the display screen.
[0140] In a possible implementation, the first determining module 420 is specifically configured to:
[0141] The offset coordinate is set according to a direction corresponding to the target geometric body; and the second scene coordinate is offset according to the offset coordinate, to obtain the first scene coordinate.
[0142] In a possible implementation, the first processing module 410 is specifically configured to, in the preprocessing operation:
[0143] The host node is set to be at an original point of the current scene, and a rotation angle of the host node is an initial angle.
[0144] In a possible implementation, the second determining module 440 is specifically configured to, in determining the fourth scene coordinate of the host node through the third scene coordinate:
[0145] The Scenegizmo is invoked to determine the fourth scene coordinate of the host node according to the third scene coordinate.
[0146] In a possible implementation, the third determining module 450 is specifically configured to, in determining the function state of the target geometric body according to the fourth scene coordinate:
[0147] If a value in the fourth scene coordinate in a direction other than the direction of the target geometric body is zero, it is determined that the dragging direction of the target geometric body is correct; and if a difference between the fourth scene coordinate and the offset coordinate in the direction of the target geometric body is within a preset range, it is determined that the function state of the target geometric body is normal.
[0148] In the embodiments of the present application, an electronic device is provided, which includes a memory, a processor, and a computer program stored in the memory. The processor executes the computer program to implement the steps of the method in the foregoing embodiments.
[0149] Referring to Figure 5 The embodiments of the present application provide a structural schematic diagram of an electronic device. Figure 5 The electronic device 5000 shown includes a processor 5001 and a memory 5003. The processor 5001 and the memory 5003 are connected, for example, through a bus 5002. Optionally, the electronic device 5000 can also include a transceiver 5004, which can be used for data interaction, such as data sending and / or data receiving, between the electronic device and other electronic devices. It should be noted that in actual applications, the transceiver 5004 is not limited to one, and the structure of the electronic device 5000 does not constitute a limitation on the embodiments of the present application.
[0150] The processor 5001 can be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other programmable logic device, transistor logic device, hardware component, or any combination thereof. It can implement or execute various exemplary logical blocks, modules and circuits described in connection with the disclosure. The processor 5001 can also be a combination of computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.
[0151] The bus 5002 can include a path for transmitting information between the above-mentioned components. The bus 5002 can be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The bus 5002 can be divided into an address bus, a data bus, a control bus, etc. For convenience of representation, Figure 5 Only one thick line is used in the figure, but it does not mean that there is only one bus or only one type of bus.
[0152] The memory 5003 can be a ROM (Read Only Memory) or other type of static storage device that can store static information and instructions, a RAM (Random Access Memory) or other type of dynamic storage device that can store information and instructions, an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, an optical disk storage (including a compact disk, a laser disk, an optical disk, a digital versatile disk, a Blu-ray disk, etc.), a magnetic disk storage medium, other magnetic storage device, or any other medium capable of carrying or storing computer programs and capable of being read by a computer, without limitation.
[0153] The memory 5003 is configured to store a computer program for implementing the embodiments of the present application, and the processor 5001 is configured to control the execution of the computer program stored in the memory 5003. The processor 5001 is configured to execute the computer program stored in the memory 5003 to implement the steps shown in the foregoing method embodiments.
[0154] The electronic device includes, but is not limited to, a computer device, a server device, and the like.
[0155] The computer readable storage medium provided by the embodiments of the present application stores a computer program, and the computer program is executed by the processor to implement the steps and corresponding contents of the foregoing method embodiments.
[0156] The terms "first", "second", "third", "fourth", "1", "2", and the like (if any) in the specification and claims of the present application and the above-described drawings are used to distinguish similar objects, and do not necessarily have to describe a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that shown or described.
[0157] It should be understood that, although the flowcharts of the embodiments of the present application indicate the respective operation steps by arrows, the implementation order of the steps is not limited to the order indicated by the arrows. Unless otherwise specified herein, in some implementation scenarios of the embodiments of the present application, the implementation steps in each flowchart can be executed in other orders as required. In addition, part or all of the steps in each flowchart can include multiple sub-steps or multiple stages based on the actual implementation scenario. Part or all of these sub-steps or stages can be executed at the same time, and each of these sub-steps or stages can also be executed at different times. In the scenario where the execution times are different, the execution order of these sub-steps or stages can be flexibly configured according to requirements, and the embodiments of the present application do not limit this.
[0158] The above is only an optional implementation of some implementation scenarios of the present application. It should be pointed out that, for those skilled in the art, other similar implementation means based on the technical concept of the present application can also be adopted without departing from the technical concept of the present application, and such implementation means also belong to the protection scope of the embodiments of the present application.
Claims
1. A method of testing Scene gizmo geometry, characterized by, The method comprises: preprocessing a selected host node, the preprocessing comprising setting the host node at an origin of a current scene and a rotation angle of the host node being (0, 0, 0); determining a target geometry of a Scene gizmo and second scene coordinates of the target geometry, and performing offset processing on the second scene coordinates to obtain first scene coordinates; in a preset camera angle, dragging the target geometry to a first screen coordinate of a display screen through a simulated mouse event, and calling the Scene gizmo to update a position of the target geometry to third scene coordinates according to the simulated mouse event, wherein the first screen coordinate is obtained by processing the first scene coordinates according to a preset calculation manner; determining fourth scene coordinates of the host node through the third scene coordinates, and determining a function state of the target geometry according to the fourth scene coordinates, wherein a relative position of the target geometry to the host node is always unchanged; wherein the offset processing on the second scene coordinates to obtain the first scene coordinates comprises: setting an offset coordinate according to a direction corresponding to the target geometry; performing offset processing on the second scene coordinates according to the offset coordinate to obtain the first scene coordinates; the determination of the fourth scene coordinates of the host node through the third scene coordinates, and the determination of the function state of the target geometry according to the fourth scene coordinates, comprises: calling the Scene gizmo to determine the fourth scene coordinates of the host node according to the third scene coordinates; if a value of a direction other than a direction of the target geometry in the fourth scene coordinates is zero, determining that a dragging direction of the target geometry is correct; if a difference between the fourth scene coordinates and the offset coordinate in the direction of the target geometry is within a preset range, determining that the function state of the target geometry is normal.
2. The method of claim 1, wherein, the dragging of the target geometry to the first screen coordinate of the display screen through the simulated mouse event comprises: processing the second scene coordinates according to the preset calculation manner to obtain second screen coordinates in the display screen; moving the target geometry from the second screen coordinates to the first screen coordinates through the simulated mouse event.
3. The method of claim 1, wherein, the display screen comprises a current window of an editor, and the processing of the first scene coordinates according to the preset calculation manner to obtain the first screen coordinates comprises: obtaining third screen coordinates of the current window in the display screen; obtaining window coordinates and a height of an editing panel of the current scene in the current window; calculating the first screen coordinates according to the window coordinates, the first scene coordinates, the third screen coordinates and the height.
4. The method of claim 1, wherein, the calling of the Scene gizmo to update the position of the target geometry to the third scene coordinates according to the simulated mouse event comprises: calling the Scene gizmo to capture the simulated mouse event, and obtaining a latest screen coordinate of the target geometry according to the simulated mouse event; The Scene gizmo is called to update the position of the target geometry to the third scene coordinate according to the latest screen coordinate.
5. The method according to any one of claims 1-4, characterized in that, The Scene gizmo comprises an X axis, a Y axis, a Z axis, an xy plane, an xz plane and a yz plane, and the preset camera angle adjustment operation comprises: If the target geometry is any one of the X axis, the Y axis and the Z axis, the camera is adjusted to make the target geometry parallel to the display screen; If the target geometry is any one of the xy plane, the xz plane and the yz plane, the camera is adjusted to make the target geometry perpendicular to the display screen.
6. An apparatus for testing a Scene gizmo, characterized by: The method comprises: A first processing module is configured to pre-process a selected host node, wherein the pre-processing comprises setting the host node at an origin of a current scene and setting a rotation angle of the host node as (0, 0, 0); A first determining module is configured to determine a target geometry of a Scene gizmo and a second scene coordinate of the target geometry, and to offset the second scene coordinate to obtain a first scene coordinate; A second processing module is configured to, under a preset camera angle, drag the target geometry to a first screen coordinate of a display screen by simulating a mouse event, and to call the Scene gizmo to update the position of the target geometry to a third scene coordinate according to the simulated mouse event, wherein the first screen coordinate is obtained by processing the first scene coordinate in a preset calculation manner; A second determining module is configured to determine a fourth scene coordinate of the host node by using the third scene coordinate, wherein a relative position between the target geometry and the host node is always unchanged; A third determining module is configured to determine whether a function of the target geometry is normal according to the fourth scene coordinate; The first processing module is specifically configured to: set an offset coordinate according to a direction corresponding to the target geometry; and offset the second scene coordinate according to the offset coordinate to obtain the first scene coordinate. The second determining module is specifically configured to call the Scene gizmo to determine the fourth scene coordinate of the host node according to the third scene coordinate. The third determining module is specifically configured to: if a value of a direction other than the direction of the target geometry in the fourth scene coordinate is zero, determine that a dragging direction of the target geometry is correct; and if a difference between the fourth scene coordinate and the offset coordinate in the direction of the target geometry is within a preset range, determine that a function state of the target geometry is normal.
7. An electronic device comprising a memory, a processor, and a computer program stored on the memory, wherein the computer program comprises instructions that, when executed by the processor, cause the electronic device to perform the method of any one of claims 1-6. The processor executes the computer program to implement the steps of the method of any one of claims 1-5.
8. A computer-readable storage medium having stored thereon a computer program, characterized in that The computer program is executed by the processor to implement the steps of the method of any one of claims 1-5.
Citation Information
Patent Citations
Verification code design method based on random position object semantic recognition
CN113190310A