CN116820467A - Method for editing Slate interface by Python language for Unreal Engine - Google Patents

Method for editing Slate interface by Python language for Unreal Engine Download PDF

Info

Publication number
CN116820467A
CN116820467A CN202310889940.XA CN202310889940A CN116820467A CN 116820467 A CN116820467 A CN 116820467A CN 202310889940 A CN202310889940 A CN 202310889940A CN 116820467 A CN116820467 A CN 116820467A
Authority
CN
China
Prior art keywords
interface
instance
python
description file
control
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310889940.XA
Other languages
Chinese (zh)
Inventor
陈慧鹏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Fantasy Mermaid Technology Co ltd
Original Assignee
Beijing Fantasy Mermaid Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Fantasy Mermaid Technology Co ltd filed Critical Beijing Fantasy Mermaid Technology Co ltd
Priority to CN202310889940.XA priority Critical patent/CN116820467A/en
Publication of CN116820467A publication Critical patent/CN116820467A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates

Abstract

The embodiment of the application provides a method for enabling a Unreal Engine to edit a Slate interface by using a Python language, which comprises the following steps: acquiring an interface description file in a JSON format, wherein the interface description file is associated with a Python tool instance, and the Python tool instance is associated with an interface middle layer instance; creating a slave interface according to the interface description file, wherein the slave interface comprises a control instance, and an event of the control instance is bound with a corresponding Python code in the Python tool instance; responding to event triggering aiming at the control instance on the slave interface, and acquiring an execution result of the Python code; and transmitting the execution result through the interface middle layer instance, searching the control instance according to the transmitted execution result and updating to update the slave interface. According to the technical scheme provided by the embodiment of the application, the definition of the Slate interface and the C++ code can be separated, the content of the Slate interface is quickly adjusted and created through Python, the C++ project is not required to be recompiled, the compiling time is effectively saved, and the development efficiency is improved.

Description

Method for editing Slate interface by Python language for Unreal Engine
Technical Field
The embodiment of the application relates to the technical field of computers, in particular to a method, a device, computer equipment, a computer readable storage medium and a system for enabling a Unreal Engine to edit a Slate interface by using Python language.
Background
With the development of the game market, a fantasy Engine (un real Engine) is increasingly applied in game item development. The slave interface frame is an interface frame used by the illusion engine and has the advantages of rich control, high execution efficiency, powerful function, attractive interface and the like.
The native development language of the illusion engine is the c++ language, which the developer uses to create and manage the Sl ate interface. However, due to the limitation of the C++ language, any point of modification or adjustment is performed on the slave interface in the development process, a great amount of time is required to wait for the recompilation of the C++ project to be completed so as to see the changed interface effect, and real-time updating and previewing of the interface cannot be performed, so that the development process is complicated and the development efficiency is low.
It should be noted that the foregoing is not necessarily prior art, and is not intended to limit the scope of the present application.
Disclosure of Invention
Embodiments of the present application provide a method, an apparatus, a computer device, and a computer readable storage medium for enabling a universal Engine to edit a slave interface in a Python language, so as to solve or alleviate one or more of the technical problems set forth above.
One aspect of the embodiment of the application provides a method for enabling a Unreal Engine to edit a Slate interface in a Python language, comprising the following steps:
acquiring an interface description file in a JSON format, wherein the interface description file is associated with a Python tool instance, and the Python tool instance is associated with an interface middle layer instance;
creating a slave interface according to the interface description file, wherein the slave interface comprises a control instance, and an event of the control instance is bound with a corresponding Python code in the Python tool instance;
responding to event triggering for the control instance on the slave interface, and acquiring an execution result of the Pytho n code;
and transmitting the execution result through the interface middle layer instance, searching the control instance according to the transmitted execution result and updating to update the slave interface.
Optionally, the interface description file is further used for specifying an initialization code and a cleaning code of the Python tool instance.
Optionally, the interface description file is further provided with a variable placeholder, and the variable placeholder is used for marking the text position to be filled.
Optionally, obtaining the interface description file in JSON format includes:
Acquiring a configuration file, wherein the configuration file comprises a first path and a target position, the first path is the path of a menu configuration description file, and the target position is the hooking position of a menu item;
acquiring the menu configuration description file according to the first path, wherein the menu configuration description file is used for specifying path information of an interface description file corresponding to the menu item;
creating the menu item at the target location according to the configuration file and the menu configuration description file;
and responding to clicking operation for the menu item, and acquiring a corresponding interface description file according to the path information.
Optionally, the menu configuration description file is further used for specifying a Python code segment without an interface; and/or the menu configuration description file is further used to specify interface icons and/or tool tips.
Optionally, the target location comprises a predefined location and/or a tool menu anchor location.
Optionally, the method for enabling the Unreal Engine to edit the Slate interface in the Python language further comprises the following steps:
responding to the acquisition request of the Python tool instance, and acquiring the interface middle layer instance according to the interface description file; the acquisition request comprises a second path, wherein the second path is the path of the interface description file;
Acquiring the interface intermediate layer instance according to a third path when the interface description file comprises the third path, wherein the third path is the path of the interface intermediate layer instance;
and in the case that the interface description file does not comprise the third path, creating the interface middle layer instance and distributing the interface middle layer instance to the Python tool instance.
Optionally, the configuration file further includes a directory of the interface middle layer instance;
correspondingly, the responding to the obtaining request of the Python tool instance obtains the interface middle layer instance according to the interface description file, and the method comprises the following steps:
and under the condition that the interface description file comprises the name of the interface middle layer instance, acquiring the interface middle layer instance according to the name of the interface middle layer instance and the directory where the interface middle layer instance is located.
Optionally, transmitting the execution result through the interface middle layer instance, and searching the control instance and updating according to the transmitted execution result, including:
searching a control path of the control instance through the interface middle layer instance, and transmitting the execution result and the control path through the interface middle layer instance;
And searching the control instance and updating according to the transmitted execution result and the control path.
Optionally, transmitting the execution result through the interface middle layer instance, and searching the control instance and updating according to the transmitted execution result, including:
searching for a control reference of the control instance through the interface middle layer instance, and transmitting the execution result and the control reference through the interface middle layer instance;
and searching the control instance and updating according to the transmitted execution result and the control reference.
Optionally, the method for enabling the Unreal Engine to edit the Slate interface in the Python language further comprises the following steps:
and providing a plurality of blueprint calling interfaces for a Python layer packaged based on a Python language, so that the Python layer can call the bottom layer function of the C++ package in the Unreal Engine.
Another aspect of the embodiment of the present application provides an apparatus for enabling a ureal Engine to edit a server interface in a Python language, the apparatus including:
the first acquisition module is used for acquiring an interface description file in a JSON format, wherein the interface description file is associated with a Python tool instance, and the Python tool instance is associated with an interface middle layer instance;
the creation module is used for creating a slave interface according to the interface description file, wherein the slave interface comprises a control instance, and the event of the control instance is bound with a corresponding Python code in the Python tool instance;
The second acquisition module is used for responding to the event trigger aiming at the control instance on the slave interface and acquiring the execution result of the Python code;
and the updating module is used for transmitting the execution result through the interface middle layer instance, searching the control instance according to the transmitted execution result and updating the control instance so as to update the slave interface.
Another aspect of an embodiment of the present application provides a computer apparatus, including:
at least one processor; a kind of electronic device with high-pressure air-conditioning system
A memory communicatively coupled to the at least one processor;
wherein: the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method as described above.
Another aspect of embodiments of the present application provides a computer-readable storage medium having stored therein computer instructions which, when executed by a processor, implement a method as described above.
Another aspect of an embodiment of the present application provides a system for enabling a ureal Engine to edit a server interface in a Python language, the system including:
The C++ module is used for providing a blueprint method interface and creating a slave interface through a C++ language;
the Python module is used for calling the blueprint method interface and transmitting path information of the interface description file in the JSON format to the C++ module;
the C++ module is also used for binding corresponding Python codes for the control instances in the slave interface;
an interface middle layer instance module, configured to feed back an execution result of the Python code to the c++ module;
and the C++ module is also used for updating the control instance according to the execution result so as to update the slave interface.
The embodiment of the application adopts the technical scheme and can have the following advantages:
firstly, acquiring an interface description file in a JSON format. Wherein, the interface description file is associated with a Python tool instance, and the Python tool instance is associated with an interface middle layer instance. And then, creating a slave interface comprising a control instance according to the interface description file, wherein the event of the control instance is bound with a corresponding Python code in the Python tool instance. When the event of the control instance is triggered, an execution result of the Python code is obtained, the execution result is transmitted through the interface middle layer instance, and the control instance is found and updated according to the transmitted execution result, so that the Slate interface is updated. It can be known that in the technical scheme, definition of the Slate interface and C++ codes can be separated, python codes can be called through the Slate control, the Slate interface can be modified and previewed in real time through an interface middle layer instance and Python language, and two-way communication between the Slate interface and the Python is achieved. When the slave interface is edited, interface content can be quickly adjusted and created through Python, C++ engineering is not required to be compiled again, compiling time is effectively saved, and development efficiency is improved.
Drawings
The accompanying drawings illustrate exemplary embodiments and, together with the description, serve to explain exemplary implementations of the embodiments. The illustrated embodiments are for exemplary purposes only and do not limit the scope of the claims. Throughout the drawings, identical reference numerals designate similar, but not necessarily identical, elements.
FIG. 1 schematically illustrates a block diagram of a system for enabling a Unreal Engine to edit a Slate interface in a Python language in accordance with an embodiment of the present application;
FIG. 2 schematically illustrates a flowchart of a method for enabling a Unreal Engine to edit a Slate interface in Python language in accordance with a second embodiment of the present application;
FIG. 3 schematically illustrates an application example diagram of a method for enabling a Unreal Engine to edit a Slate interface in a Python language according to a second embodiment of the present application;
FIG. 4 is a new flow chart schematically showing a method for enabling a Unreal Engine to edit a Slate interface in Python language according to a second embodiment of the present application;
FIG. 5 is a new flow chart schematically showing a method for enabling a Unreal Engine to edit a Slate interface in Python language in accordance with a second embodiment of the present application;
fig. 6 schematically shows a flow chart of substeps of step S206 in fig. 2;
Fig. 7 schematically shows a flow chart of sub-steps of step S206 in fig. 2;
FIG. 8 schematically illustrates an application example diagram of a method for enabling a Unreal Engine to edit a Slate interface in a Python language according to a second embodiment of the present application;
FIG. 9 schematically illustrates a block diagram of an apparatus for enabling a Unreal Engine to edit a Slate interface in a Python language in accordance with a third embodiment of the present application; a kind of electronic device with high-pressure air-conditioning system
Fig. 10 schematically shows a hardware architecture diagram of a computer device according to a fourth embodiment of the present application.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
It should be noted that the descriptions of "first," "second," etc. in the embodiments of the present application are for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include at least one such feature. In addition, the technical solutions of the embodiments may be combined with each other, but it is necessary to base that the technical solutions can be realized by those skilled in the art, and when the technical solutions are contradictory or cannot be realized, the combination of the technical solutions should be considered to be absent and not within the scope of protection claimed in the present application.
In the description of the present application, it should be understood that the numerical references before the steps do not identify the order in which the steps are performed, but are merely used to facilitate description of the present application and to distinguish between each step, and thus should not be construed as limiting the present application.
First, a term explanation is provided in relation to the present application:
phantom Engine (un real Engine): a real-time rendering game development engine with rich functions and high customization performance provides a comprehensive development suite for creating real-time interactive contents.
C++: the compiled language requires that the entire c++ project be compiled by a compiler before code execution.
Python: interpreted language, the program runs with the interpreter interpreting the execution code row by row without explicit compiling steps. Python has the characteristics of simple grammar, wide application range, convenient transplantation and the like, and is applied to the development flow of digital assets.
The slave interface: is a native interface framework of the illusion engine, and provides a set of custom interface elements and layout systems. The slave interface may be used to create various interface elements such as windows, buttons, text boxes, etc., and define their appearance and interaction behavior. The Slate interface is created and managed by using C++, and has the characteristics of rich control, high execution efficiency, powerful functions, attractive interface and the like.
Blueprint system: the visualization programming tool based on the nodes in the illusion engine. Game logic and definition interactions are created by connecting nodes, events, functions, and variables together using wires.
API (Application Programming Interface ): is a predefined function that aims to provide applications and developers the ability to access a set of routines based on certain software or hardware without having to access source code or understand the details of the internal operating mechanisms.
Next, in order to facilitate understanding of the technical solutions provided by the embodiments of the present application by those skilled in the art, the following description is made on related technologies:
with the development of the game market, more and more game items are beginning to be developed using the Unreal Engine. The native development language of the Unreal Engine is the C++ language, and the Slate interface system used by the Unreal Engine itself is also created and managed using the C++ language. Although the c++ language has higher operating efficiency than the interpreted scripting language, the c++ code needs to be able to see the interface effects it implements after the compilation is completed. As the gaming industry moves toward automation and industrialization, there is an increasing need for editor tool development. The editor tool itself is also evolving towards integration, complexity, automation. During development, changes and adjustments to the editor tool are typically required. If any change is made to the appearance or logic of the editor tool interface, the developer is required to wait for the C++ project to be recompiled, which obviously brings inconvenience to the developer, and is not beneficial to quick iteration of the project and polishing of a high-quality innovative editor tool.
The tool development scheme based on the Unreal Engine, known by the inventor, mostly has the following problems:
(1) The interface cannot be created dynamically.
In the plug-in and tool development of the Unreal Engine, the editor tool is developed by default with the native C++ provided by the Engine as the development language. The developer defines the layout and appearance of the interface under the plate framework directly in c++ code. This necessitates the modification of the slave interface to recompile the c++ project, resulting in a significant amount of time being spent by the developer waiting for the compilation to complete.
(2) A slave interface system cannot be used.
Since Python does not support the slave interface framework, the developer will use other interface schemes in Python as interface schemes for the un real Engine tool, for example: pySide, pyQt, tkint er, etc. These interface schemes are good choices for independent Python applications, but a set of interface frames different from the Engine itself is introduced into the Unreal Engine, so that a developer is forced to process and maintain control focuses under two sets of UI interface schemes at the same time, and the differences between the two sets of interface frames can cause various compatibility problems and anomalies.
(3) And carrying out text code merging.
The Unreal Engine provides a set of tool solutions based on editors UMG (Unreal Motion Graphics) and blueprints. Simple tools can be written based on drag-type interface fabrication and node-type logic, but there are two drawbacks: 1. too low an information density; 2. tool logic is maintained in a node and binary fashion. These two drawbacks make this solution impossible to develop complex tools, in particular text-based comparisons and merges.
(4) A portion of the critical editor interface is missing.
The Unreal Engine Engine provides a partial editor interface for use with editor blueprints and Python scripts. There are still few critical editor interface deletions that often result in bottlenecks encountered by developers when using Python development tools.
Therefore, in the related Unreal Engine tool development scheme, the scheme for developing the Slate interface framework by using C++ has great development difficulty and long development period. The use of the Python development tool is still in a simple application stage because of the compatibility problem of the interface scheme, and the value of Python in tool and process development cannot be fully embodied.
Therefore, the embodiment of the application provides a technical scheme for enabling the Unreal Engine to edit the Slate interface by using the Python language. In the technical scheme, (1) by separating the definition of the Slate interface from the C++ code, the Slate control can call the Python code, and the Python can create, inquire and modify the content of the Slate interface control through an interface middle layer instance, so that the two-way communication between the Slate interface and the Python is realized; (2) By configuring the interface description file, the dynamic creation and real-time preview of the slave interface are realized, so that the advantages of the slave interface can be utilized, the problem that the slave interface needs to be modified to wait for compiling is solved, and the development efficiency is improved; (3) The method has the advantages that the Slate interface scheme of the Unreal Engine is directly used at the bottom layer, so that various compatibility problems and anomalies caused by introducing other interface schemes are avoided; (4) The adoption of a textual interface description scheme and the use of Python for writing tool logic is beneficial to the migration, combination and subsequent development of tools; (5) Two hundred editor interfaces are extended while an interface framework is provided, so that the Python can realize the calling of the Unreal Engine bottom layer function. See in particular below.
The technical scheme of the application is described below through a plurality of embodiments. It should be understood that these embodiments may be embodied in many different forms and should not be construed as limited to the embodiments set forth herein.
Example 1
Fig. 1 schematically shows a block diagram of a system for enabling a Unreal Engine to edit a slave interface in Python language according to an embodiment of the present application.
As shown in FIG. 1, the method for enabling a Unreal Engine to edit a Slate interface in a Python language may include a C++ module, a Python module, and an interface middle layer instance module.
The function and the cooperation of the respective modules will be described with reference to fig. 1.
The c++ module may provide a blueprint method interface to the Python module and be configured to create a slip interface in the c++ language.
The Python module can call the blueprint method interface and send the interface description file in the specified JSON format to the c++ module.
The C++ module can bind corresponding Python codes for the control instance in the slave interface.
The interface middle layer instance module can feed back the execution result of the Python code to the C++ module, so that the C++ module can update the control instance according to the execution result, and the slave interface is updated.
Specifically, the C++ module may provide a blueprint method interface BluerintCalla to the Pytho n module through a blueprint system provided by the Unreal Engine. The Python module can send the interface description file in the specified JSON format to the c++ module through the blueprint method interface. For example, the Python module may call the class static method unrepeal. Then, the C++ module can create and combine the specific slave control configured in the interface description file by analyzing the specific content and the hierarchical structure of the interface description file, so as to create a slave interface.
After the slave interface is created, the C++ module can bind corresponding Python codes for the control instance on the slave interface through the Lambda expression. And associating the specific Python code unknown in the running process with a callback function of the control event, so that the clicking event, the dragging event and the selecting operation of the control can call the specific Python code.
When the control on the slave interface is clicked and dragged, the Python module executes the Python code corresponding to the event. After the execution of the Python code is finished, the Python module needs to correspondingly modify the Slate interface according to the execution result. However, limited by the weaker functionality provided by the Unreal Engine, the Python module cannot directly pass the modification information to the Slate interface. In order to achieve the purpose of editing the Slate interface in the Unreal Engine by using the Python language, an execution result can be sent to the C++ module through a custom interface middle layer instance module. Wherein the execution result may include an interface modification request.
In some embodiments, the interface middle layer instance may also hold named control instance information on the slave interface, such as: control references, control paths, etc., and provides an API interface for modifying the contents of the slave interface for subsequent interface modification requests initiated by the Python tool instance.
For example, an interface modification request may be sent to the c++ module through an interface middle layer instance self.
The self.data.set_text () is exemplified as follows:
self.data.set_text(a,b)
where a is a control instance name and b is a specific modification code.
Correspondingly, the C++ module can quickly and accurately find the control instance to be modified by combining the control instance name in the interface modification request and the control path stored in the interface middle layer instance, and correspondingly modify the control instance to be modified according to the specific modification code in the interface modification request, so that modification of the slave interface is realized. In some embodiments, if no control instance to be modified is found, an error prompt may be popped up to quickly inform the developer.
In the embodiment, the definition of the Slate interface is separated from the C++ code, and Python realizes rapid modification and adjustment of the content of the Slate interface through an interface intermediate layer instance, so that the modification of the Slate interface does not need to recompile C++ engineering, the compiling time is effectively saved, and the development efficiency is improved.
Example two
Fig. 2 schematically shows a flowchart of a method for enabling a Unreal Engine to edit a slave interface in Python language according to a second embodiment of the present application.
As shown in fig. 2, the method for enabling the universal Engine to edit the slot interface in the Python language may include steps S200 to S206, wherein:
step S200, obtaining an interface description file in a JSON format, wherein the interface description file is associated with a Python tool instance, and the Python tool instance is associated with an interface middle layer instance.
Step S202, a slave interface is created according to the interface description file, wherein the slave interface comprises a control instance, and the event of the control instance is bound with a corresponding Python code in the Python tool instance.
And step S204, responding to the event triggering of the control instance on the slave interface, and acquiring an execution result of the Python code.
Step S206, transmitting the execution result through the interface middle layer instance, and searching the control instance and updating according to the transmitted execution result to update the slave interface.
According to the method for editing the Slate interface by using the Python language for the Unreal Engine, the interface description file in the JSON format is acquired first. Wherein, the interface description file is associated with a Python tool instance, and the Python tool instance is associated with an interface middle layer instance. And then, creating a slave interface comprising a control instance according to the interface description file, wherein the event of the control instance is bound with a Python code corresponding to the Python tool instance. When the event of the control instance is triggered, an execution result of the Python code is obtained, the execution result is transmitted through the interface middle layer instance, and the control instance is found and updated according to the transmitted execution result, so that the Slate interface is updated. It can be known that in the technical scheme, definition of the Slate interface and C++ codes can be separated, python codes can be called through the Slate control, python can be modified and previewed in real time through an interface intermediate layer instance, and two-way communication between the Slate interface and the Python is achieved. When the slave interface is edited, interface content can be quickly adjusted and created through Python, C++ engineering is not required to be compiled again, compiling time is effectively saved, and development efficiency is improved.
Each of steps S200 to S206 and optional other steps are described in detail below in conjunction with fig. 2.
Step S200Obtaining an interface description file in a JSON format, wherein the interface description file is associated with a Python tool instance, and the Python tool instance is associated with an interface middle layer instance.
The interface description file may be used to configure layout and controls for the slave interface. For example: panel label of the slave interface, initialization size of the slave interface, initialization position coordinates of the slave interface, buttons, editable text boxes and the like.
Examples of interface description files are as follows:
wherein: minimal sample. Json is an interface description file.
TabLabel is the panel label of the Slate interface.
ChameleonData is a serialized resource path for interface middle layer instances.
InitTabSize is the initialized size of the slave interface.
The InitTabPosition is the initialized position coordinates of the slave interface.
InitPyCmd is the initialization code for the specified Python tool instance.
Root is an interface Root element, and the content below the Root is a specific interface control configuration item.
JSON is a common data exchange format that presents data in text form, independent of the particular programming language or operating system.
The use of a textual interface description scheme (JSON-format interface description file) facilitates tool migration, merging, and subsequent development. Because the definition of the slave interface is separated from the C++ code, the problem that the C++ project needs to be recompiled when the slave interface is modified later due to the fact that the slave interface is directly defined in the C++ code can be avoided, compiling time is saved, and development efficiency is improved. The same interface control base class can create different slave interfaces according to different interface description files, so that the problem that a plurality of interface control classes need to be added in C++ for the created slave interfaces is avoided.
The interface description file is associated with a Python tool instance, that is, the slot interface corresponds to the Python tool, and the Python tool instance may hold an interface middle layer instance for implementing communication between the Python tool instance and the slot interface.
In an alternative embodiment, the interface description file may also specify an initialization code for the Python tool instance for creating a Python tool corresponding to the slave interface.
The initialization code is exemplified as follows:
MinimalExample.json:
{
.....
"InitPyCmd":"import Example;chameleon_example=Example.MinimalEx ample.MinimalExample(%JsonPath)",
......
}
wherein, minimal sample. Json is an interface description file, initPyCmd is used to specify initialization code for Python tool instance.
When initializing the Python tool instance, the path information (% JsonPath) of the interface description file is transferred to the Python tool instance, the path information can be used as a unique identifier of the disc interface, and the Python tool instance can quickly and accurately acquire the corresponding interface intermediate layer instance by using the path information.
In an alternative embodiment, the interface description file may also specify the cleanup code at which the Python tool instance is turned off.
The clean up code is exemplified as follows:
MinimalExample.json:
{
.....
"OnCloseCmd":"chameleon_shelf.on_close",
......
}
where minimalsample. Json is an interface description file, onCloseCmd is used to specify the cleanup code at shutdown for the Pyth on tool instance.
By setting the cleaning code when the Python tool instance is closed, the problems of memory leakage, program breakdown and the like caused by that the Python tool instance always holds some references are solved, and the stability and performance of the system are improved.
Step S202And creating a slave interface according to the interface description file, wherein the slave interface comprises a control instance, and the event of the control instance is bound with a corresponding Python code in the Python tool instance.
By parsing specific contents and hierarchical structures in the interface description file, specific slave controls configured in the interface description file can be created and combined, so that a slave interface is created. Using the Lambd a expression of c++, one piece of Python code in the Python tool instance can be bound for an event of a control instance in the slave interface. Wherein the Python code is unknown at c++ compile time. And associating the Python code with the control event callback function, so that when the control clicks an event, drags the event and selects the event to trigger, the corresponding Python code can be called by the Slate interface.
In an alternative embodiment, a variable placeholder is also provided in the interface description file, where the variable placeholder is used to mark the text location that needs to be filled.
And triggering the control event, and executing Python codes corresponding to the event. When the variable placeholders beginning with "%" are arranged in the preconfigured Python codes, the text where the variable placeholders are located can be replaced by the actual values, so that the flexibility and reusability of the codes are effectively improved.
Step S204And responding to event triggering aiming at the control instance on the slave interface, and acquiring an execution result of the Python code.
When a control instance event on the slave interface triggers, the Python tool instance executes the corresponding Python code. As shown in FIG. 3, an example of a control on the board interface may be a "Click Me" button and the control event may be a Click event. When the user clicks the button, the clicking event of the button triggers the Python tool instance to execute the Python code, and obtain the execution result of the Python code, such as: clicking 6 times.
In this embodiment, since the slot control may call the Python code, the operation on the slot interface may be notified to the Python tool instance, so as to implement unidirectional communication from the slot interface to the Python tool instance.
Step S206, transmitting the execution result through the interface middle layer instance, and searching the control instance and updating according to the transmitted execution result to update the slave interface.
Limited by the weaker functionality provided by the Unreal Engine, the Python tool instance cannot pass modification information directly to the Slate interface. In order to achieve the purpose that the Python tool instance can feed back or inform information to the Slate interface, the execution result of the Python code can be transmitted through the customized interface intermediate layer instance, so that the Python tool instance can transmit the information to the Slate interface, and two-way communication between the Slate interface and the Python tool instance is achieved.
In order to enable the Unreal Engine to edit the Slate interface in the Python language, execution results may be transmitted through interface middle layer instances. Wherein the execution result may include an interface modification request.
For example, an interface modification request may be sent through an interface middle layer instance self.
Correspondingly, the control instance name in the interface modification request and the control path stored in the interface middle layer instance can be combined, the corresponding control instance can be quickly and accurately found, and the control instance is correspondingly modified according to the specific modification code in the interface modification request, so that modification and update of the slave interface are realized. As shown in fig. 3, the execution result may be "six clicks", and updating the slot control according to the execution result may be modifying "click 0 time(s)" to "click 6 time(s)". In some embodiments, if no corresponding control instance is found, an error prompt may be popped up, quickly alerting the developer.
The embodiment enables the Unreal Engine to create and modify the Slate interface by using the Python language, greatly simplifies the process of creating the tool in the Engine, and effectively improves the efficiency of developing the editor tool.
The embodiment introduces the method for creating the slave interface according to the interface description file and realizing the editing of the slave interface by the Python tool instance through the interface middle layer instance. In practical applications, the interface description file may be acquired through various schemes, and in order to acquire the specified interface description file more intuitively and conveniently, an exemplary acquisition method is provided below.
In an alternative embodiment, as shown in fig. 4, the method further comprises:
step S400, a configuration file is obtained, wherein the configuration file comprises a first path and a target position, the first path is the path of the menu configuration description file, and the target position is the hanging position of the menu item.
Step S402, according to the first path, acquiring the menu configuration description file, where the menu configuration description file is used to specify path information of an interface description file corresponding to the menu item.
Step S404, creating the menu item at the target position according to the configuration file and the menu configuration description file.
And step S406, responding to clicking operation for the menu item, and acquiring a corresponding interface description file according to the path information.
Before the configuration file is acquired, the plug-in module needs to be started, and functions required by the plug-in module are initialized during starting, including: registering the required editor style, registering the picture content in the plug-in as a corresponding picture brush (FSlateImageBrush), etc. Then, whether the configuration file exists or not is judged, and if the configuration file exists, the configuration file is directly acquired. If not, a default configuration file is created.
The configuration file is used for configuring the tool items, and the configuration file may include tool item configuration information, user log information, file location information, and the like. The values of the configuration items in the configuration file may be modified as needed to suit a particular application or environment. The purpose of setting the configuration file is to provide a flexible configuration mode, so that a user can change the behavior and the setting of the program more easily.
In this embodiment, the configuration file includes path information of the menu configuration description file and a specific hooking position of the menu item in the main toolbar.
Examples of configuration files are as follows:
config.ini:
[Settings]
MenuConfigFilePath=/TA/TAPython/UI/MenuConfig.json
ChameleonDataFolder=/Game/TA/ChameleonTools
[Advanced]
MainbarExtensionHookName=Play
wherein config. Ini is the configuration file.
Menu ConfigFilePath is the specific path that the menu configuration profile is located on.
Chameleon datafolder is the default directory where the serialized resource result of the interface middle layer instance resides.
Mainbar extension HookName is the specific hooking location of a menu item in the main toolbar.
By reading the corresponding item in the configuration file, the specific path (first path) where the designated menu configuration description file is located and the specific hooking position of the menu item in the main toolbar can be obtained. For example: the menu item is hooked in the "play" position of the main toolbar.
In an alternative embodiment, the target location may be a predefined plurality of locations, or may be a location where a Tool Menu Anchor (Tool Menu Anchor) provided by the illusion engine is located, which may be set according to actual requirements.
And acquiring the menu configuration description file according to the first path. In some embodiments, it may also be verified whether JSON content in the menu configuration file is legal, if so, the content in the menu configuration description file may be read, and if not, an error prompt may be popped up to quickly alert the developer. And by checking the JSON legitimacy, the safety and the correctness of the file data are improved.
The menu configuration description file may include a menu configuration item, which may be used to specify a name of a menu item display and path information of an interface description file corresponding to the menu item, and may also be used to specify a Python command corresponding to the menu item.
Examples of menu configuration profiles are as follows:
wherein Menu Config. Json is a menu configuration description file.
Command is used to specify Python commands that trigger when menu items are clicked.
Chameleon tools is used to specify path information for an interface description file that is opened when a menu item is clicked.
And registering a corresponding menu generating function with the Unreal Engine according to the content of the read menu configuration description file, wherein the menu generating function is used for creating a corresponding tree-shaped menu item at a target position of the editor according to the menu configuration item.
When a menu item defining the "chameleon tools" attribute is clicked, the content in the corresponding interface description file may be read according to the path of the interface description file specified in the configuration item.
In this embodiment, by associating the interface description file path with the menu item, the interface defined by the interface description file may be directly pulled up when the menu item is clicked, and then the Python tool instance associated with the interface description file may be obtained. It can be known that the embodiment can provide a configurable menu entry for the Python function and tools, and can quickly open the Python tools under the designated path, thereby effectively simplifying the process of creating the Python tools in the engine.
In an alternative embodiment, the menu configuration description file may also be used to specify a Python code segment without an interface, so that when the menu item is clicked, a corresponding Python code can be executed, and tool application efficiency is improved.
In an alternative embodiment, the menu configuration description file may also be used to specify the contents such as a slave interface icon, a tool tip, etc., so that the slave interface is more recognizable and the application difficulty is reduced.
The above embodiments introduce a solution for obtaining an interface description file. After creating the slave interface based on the interface description file, the Python tool instance cannot directly communicate with the slave interface due to the limitation of the Unreal Engine. Thus, the Python tool instance needs to communicate with the slave interface through its associated interface middle tier instance. An exemplary scenario for a Python tool instance to obtain a corresponding interface intermediate layer instance will be described below.
In an alternative embodiment, as shown in fig. 5, the method may further include:
step S500, responding to the acquisition request of the Python tool instance, and acquiring the interface middle layer instance according to the interface description file; the obtaining request comprises a second path, and the second path is the path where the interface description file is located.
Step S502, where the interface description file includes a third path, obtaining the interface intermediate layer instance according to the third path, where the third path is the path of the interface intermediate layer instance.
Step S504, in a case where the interface description file does not include the third path, creating the interface middle layer instance, and allocating the interface middle layer instance to the Python tool instance.
When creating the Python tool instance, the path information of the interface description file is transferred to the Python tool instance as a parameter. The path information, as a unique identifier of the slave interface, may be used to help the python tool instance obtain the corresponding interface intermediate layer instance.
The Python tool instance may send an acquisition request, which may include the second path. The second path is the path of the interface description file. And judging whether a path (a third path) where the serialized version of the interface middle layer instance is located exists in the interface description file. If the interface description file has the serialized resource path of the appointed interface middle layer instance, the corresponding interface middle layer instance can be directly obtained according to the path. Differentiation of the tool's local configuration can be achieved by reading the serialized interface middle layer instance. If the interface description file does not specify a resource path, a temporary interface middle layer instance can be created, and the interface middle layer instance is distributed to the Python tool instances, so that each Python tool instance can hold the corresponding interface middle layer instance, and further communication between the Python and the Slate interface is realized.
Benefits of preferentially locating serialized versions of interface middle tier instances specified in an interface description file include: (1) The interface middle layer instance is stored in the engine in the form of the illusion engine resource, so that different users can store own tool presets in the interface middle layer instance according to own needs, and the tool local configuration differentiation is realized. (2) The developer may be enabled to distribute different tools with different functions to different users without modifying the code, e.g., to provide more management and setup functions for an administrator.
When the serialized version of the interface intermediate layer instance cannot be found, a temporary interface intermediate layer instance can be created, the existence form of the temporary interface intermediate layer instance is transparent to a user and is imperceptible, the temporary interface intermediate layer instance can be destroyed when the engine is closed, and the problems of resource waste, memory leakage and the like are reduced.
In this embodiment, an interface middle layer instance corresponding to a Python tool instance may be obtained through an interface description file, or a temporary interface middle layer instance may be created for the Python tool instance, so that each Python tool instance may hold a corresponding interface middle layer instance, thereby implementing communication between Python and a slave interface.
In an alternative embodiment, the configuration file may also specify a default directory where the serialized resource result of the interface middle tier instance resides.
Correspondingly, the obtaining the interface middle layer instance according to the interface description file in response to the obtaining request of the Python tool instance may include: and under the condition that the interface description file comprises the name of the interface middle layer instance, acquiring the interface middle layer instance according to the name of the interface middle layer instance and the directory where the interface middle layer instance is located.
If the name of the interface middle layer instance is specified in the interface description file, the name of the interface middle layer instance and the default directory of the interface middle layer instance specified in the configuration file can be combined to quickly and accurately acquire the interface middle layer instance corresponding to the Python tool instance from the default directory, so that the tool local configuration differentiation is realized.
Likewise, if a serialized version of the corresponding interface middle tier instance cannot be found in the default directory, a temporary interface middle tier instance may also be created and assigned to the Python tool instance to enable the Python tool instance to communicate with the slave interface.
The above embodiments describe the scenario in which a Python tool instance obtains a corresponding interface interlayer instance. An exemplary scenario for the Python tool instance to modify and adjust the Slate interface through the interface middle layer instance will be described below.
In an alternative embodiment, as shown in fig. 6, step S206 may include:
step S600, searching a control path of the control instance through the interface middle layer instance, and transmitting the execution result and the control path through the interface middle layer instance.
Step S602, according to the transmitted execution result and the control path, searching the control instance and updating.
The control path may include a hierarchical relationship of the location of the control instance and the control instance. The interface middle tier instance may hold a control path for a named control instance, for a non-named control instance, it will not hold its control path.
When the interface middle layer instance receives an execution result (namely an interface modification request) from the Python tool instance, a control path of the control instance to be modified can be found according to the stored named control path, and the control path and the execution result are transmitted. And according to the transmitted control path and the execution result, finding out and updating the control instance so as to quickly and accurately update the content of the Slate interface, thereby realizing the purpose of editing the Slate interface in the Unreal Engine by using the Python language.
In an alternative embodiment, as shown in fig. 7, step S206 may include:
Step S700, searching for a control reference of the control instance through the interface middle layer instance, and transmitting the execution reference and the control path through the interface middle layer instance.
Step S702, searching for and updating the control instance according to the transmitted execution result and the control reference.
The control reference is used to point to the control. The interface middle tier instance may hold control references for named control instances, for which control references will not be held for unnamed control instances.
When receiving an execution result (i.e., an interface modification request) from the Python tool instance, the interface middle layer instance can find a control reference of the control instance to be modified according to the stored named control reference, and transmit the control reference and the execution result. And according to the transmitted control quotation and execution results, finding out and updating the control instance so as to quickly and accurately update the content of the Slate interface, thereby realizing the purpose of editing the Slate interface in the Unreal Engine by using the Python language.
The above embodiments describe editing a slip interface by a Python tool instance through an interface middle layer instance. How the Python tool instance can invoke the more underlying engine operations will be described below.
In an alternative embodiment, the method further includes providing a plurality of blueprint calling interfaces to a Python layer of the Python language based package for the Python layer to call underlying functions of the c++ package in the un real Engine.
C++ can provide methods in C++ to Python through BluerintCallabe (blueprint callable). The specific bottom layer functions in the engine are packaged into the ufection (function) which can be called by the Python, so that an additional editor extension API is provided for the Python tool, the Python can call the engine operation of a lower layer, the difficulty of tool development is greatly reduced, and the efficiency of tool development is improved.
To make the application easier to understand, an exemplary application is provided below in connection with fig. 8.
S11, starting the plug-in module.
Initializing the functions required by the plug-in module at start-up, including registering the required editor style, registering the picture content in the plug-in as a corresponding picture brush (FSlateImageBrush), etc
S12, judging whether configuration files required by the subsequent steps exist or not: if not, go to step S13; if so, step S14 is entered.
S13, creating a configuration file of the default tool.
S14, acquiring the target positions of the menu configuration description file and the menu item according to the configuration file.
S15, verifying whether the JSON content in the menu configuration description file is legal or not, and if so, entering a step S16; if not, prompting an error.
S16, registering the engine and creating corresponding tree menu items at corresponding positions of the editor according to the menu configuration description file and the configuration file.
S17, when the menu item is clicked, acquiring a designated interface description file (JSON format) and reading the content in the interface description file.
S18, checking whether JSON content of the interface description file is legal or not.
S19, creating a slave interface according to the interface description file.
S20, configuring Python codes called when the control binding event is triggered.
When the configured code has a variable placeholder beginning with "%", the text in which the variable placeholder is located is replaced with the actual value.
And S21, saving the specific reference of the named control in the created control and the corresponding control hierarchical path, and creating the necessary data object for the specific reference. For unnamed controls, their references will not be held.
For example, the interface middle layer instance may create a list view in which a array of objects for each element is listed. In the case of a two-dimensional list, this would correspond to a two-dimensional array. The interface middle layer instance is responsible for holding and maintaining the data of each named control.
S22, creating a Python tool instance.
When created, the path of the template interface description file is passed to the Python tool instance. The path is a unique identifier of the slave interface and is used for the Python tool instance to acquire a corresponding interface intermediate layer instance through the path.
S23, the Python tool instance sends a request for acquiring the corresponding interface middle layer instance according to the path of the interface description file.
S24, when the path of the serialized version of the appointed interface middle layer example exists in the read Slate interface description file, entering step S25; if not, the process advances to step S26.
S25, reading and returning to the interface intermediate layer instance corresponding to the path. Step S27 is entered.
S26, creating and returning to the temporary interface middle layer instance.
S27, a modification request is sent to the interface middle layer instance by the Python code (Python tool instance).
Wherein the interface middle tier instance can hold and manage named control paths and control references.
S28, searching a corresponding slave control instance according to the saved named control path. If found, go to step S29, if not, prompt for error.
S29, modifying the specific content in the corresponding slave control instance to update the slave interface.
In the exemplary application, (1) definition of the Slate interface and C++ codes can be separated, python codes can be called through the Slate control, python can modify and preview the Slate interface in real time through an interface middle layer instance, two-way communication of the Slate interface and the Python is achieved, and Python can create, inquire and modify control contents of the Slate interface. When the slave interface is edited, interface content can be quickly adjusted and created through Python, C++ engineering is not required to be compiled again, compiling time is effectively saved, and development efficiency is improved. (2) By configuring the interface description file, dynamic creation and real-time preview of the slave interface are realized, so that not only can the advantages of the slave interface be utilized, but also the problem that the slave interface needs to be modified to wait for compiling is solved, and the development efficiency is improved. (3) The Slat interface scheme of the Unreal Engine is directly used at the bottom layer, so that various compatibility problems and anomalies caused by introducing other interface schemes are avoided. (4) The use of a textual interface description scheme and the use of Python to write tool logic facilitates tool migration, merging and subsequent development. (5) Tool local configuration differentiation is achieved by reading the serialized interface middle layer instance.
Example III
Fig. 9 schematically shows a block diagram of an apparatus for enabling a Unreal Engine to edit a board interface in Python language, which may be divided into one or more program modules, which are stored in a storage medium and executed by one or more processors, to accomplish an embodiment of the present application. Program modules in accordance with the embodiments of the present application are directed to a series of computer program instruction segments capable of performing the specified functions, and the following description describes each program module in detail. As shown in fig. 9, the apparatus 9000 may comprise: a first acquisition module 9100, a creation module 9200, a second acquisition module 9300, an update module 9400, wherein:
a first obtaining module 9100, configured to obtain an interface description file in JSON format, where the interface description file is associated with a Python tool instance, and the Python tool instance is associated with an interface middle layer instance;
the creating module 9200 is configured to create a slave interface according to the interface description file, where the slave interface includes a control instance, and an event of the control instance is bound with a Python code corresponding to the Python tool instance;
A second obtaining module 9300, configured to obtain an execution result of the Python code in response to an event trigger for the control instance on the slave interface;
and the updating module 9400 is configured to transmit the execution result through the interface middle layer instance, and find the control instance according to the transmitted execution result, and update the control instance to update the slave interface.
As an alternative embodiment, the interface description file is further used to specify an initialization code and a cleaning code of the Python tool instance.
As an alternative embodiment, the interface description file is further provided with a variable placeholder, and the variable placeholder is used for marking the text position to be filled.
As an alternative embodiment, the device 9000 is further configured to:
acquiring a configuration file, wherein the configuration file comprises a first path and a target position, the first path is the path of a menu configuration description file, and the target position is the hooking position of a menu item;
acquiring the menu configuration description file according to the first path, wherein the menu configuration description file is used for specifying path information of an interface description file corresponding to the menu item;
creating the menu item at the target location according to the configuration file and the menu configuration description file;
And responding to clicking operation for the menu item, and acquiring a corresponding interface description file according to the path information.
As an alternative embodiment, the menu configuration description file is further used to specify a Python code segment without an interface; and/or the menu configuration description file is further used to specify interface icons and/or tool tips.
As an alternative embodiment, the target location comprises a predefined location and/or a tool menu anchor location.
As an alternative embodiment, the device 9000 is further configured to:
responding to the acquisition request of the Python tool instance, and acquiring the interface middle layer instance according to the interface description file; the acquisition request comprises a second path, wherein the second path is the path of the interface description file;
acquiring the interface intermediate layer instance according to a third path when the interface description file comprises the third path, wherein the third path is the path of the interface intermediate layer instance;
and in the case that the interface description file does not comprise the third path, creating the interface middle layer instance and distributing the interface middle layer instance to the Python tool instance.
As an alternative embodiment, the configuration file further includes a location directory of the interface middle layer instance;
correspondingly, the device 9000 is also to:
and under the condition that the interface description file comprises the name of the interface middle layer instance, acquiring the interface middle layer instance according to the name of the interface middle layer instance and the directory where the interface middle layer instance is located.
As an alternative embodiment, the update module 9400 is further configured to:
searching a control path of the control instance through the interface middle layer instance, and transmitting the execution result and the control path through the interface middle layer instance;
and searching the control instance and updating according to the transmitted execution result and the control path.
As an alternative embodiment, the update module 9400 is further configured to:
searching for a control reference of the control instance through the interface middle layer instance, and transmitting the execution result and the control reference through the interface middle layer instance;
and searching the control instance and updating according to the transmitted execution result and the control reference.
As an alternative embodiment, the device 9000 is further configured to:
and providing a plurality of blueprint calling interfaces for a Python layer packaged based on a Python language, so that the Python layer can call the bottom layer function of the C++ package in the Unreal Engine.
Example IV
Fig. 10 schematically shows a hardware architecture diagram of a computer device 10000 suitable for implementing a method for enabling a ureal Engine to edit a slot interface in Python language according to the third embodiment of the present application. In some embodiments, computer device 10000 may be a smart phone, a wearable device, a tablet, a personal computer, a vehicle terminal, a gaming machine, a virtual device, a workstation, a digital assistant, a set top box, a robot, or the like. In other embodiments, the computer device 10000 may be a rack server, a blade server, a tower server, or a rack server (including a stand-alone server, or a server cluster composed of multiple servers), or the like. As shown in fig. 10, the computer device 10000 includes, but is not limited to: the memory 10010, processor 10020, network interface 10030 may be communicatively linked to each other via a system bus.
Wherein:
memory 10010 includes at least one type of computer-readable storage medium including flash memory, hard disk, multimedia card, card memory (e.g., SD or DX memory), random Access Memory (RAM), static Random Access Memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, and the like. In some embodiments, memory 10010 may be an internal storage module of computer device 10000, such as a hard disk or memory of computer device 10000. In other embodiments, the memory 10010 may also be an external storage device of the computer device 10000, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which are provided on the computer device 10000. Of course, the memory 10010 may also include both an internal memory module of the computer device 10000 and an external memory device thereof. In this embodiment, the memory 10010 is typically used for storing an operating system installed in the computer device 10000 and various application software, such as program codes of a method for enabling the universal Engine to edit the slave interface in the Python language. In addition, the memory 10010 may be used to temporarily store various types of data that have been output or are to be output.
The processor 10020 may be a central processing unit (Central Processing Unit, CPU), controller, microcontroller, microprocessor, or other chip in some embodiments. The processor 10020 is typically configured to control overall operation of the computer device 10000, such as performing control and processing related to data interaction or communication with the computer device 10000. In this embodiment, the processor 10020 is configured to execute program codes or process data stored in the memory 10010.
The network interface 10030 may comprise a wireless network interface or a wired network interface, which network interface 10030 is typically used to establish a communication link between the computer device 10000 and other computer devices. For example, the network interface 10030 is used to connect the computer device 10000 to an external terminal through a network, establish a data transmission channel and a communication link between the computer device 10000 and the external terminal, and the like. The network may be a wireless or wired network such as an Intranet (Intranet), the Internet (Internet), a global system for mobile communications (Global System of Mobile communication, abbreviated as GSM), wideband code division multiple access (Wideband Code Divi sion Multiple Access, abbreviated as WCDMA), a 4G network, a 5G network, bluetooth (bluetooth), wi-Fi, etc.
It should be noted that fig. 10 only shows a computer device having components 10010-10030, but it should be understood that not all of the illustrated components are required to be implemented, and that more or fewer components may be implemented instead.
In this embodiment, the method for enabling the Unreal Engine to edit the Slate interface in the Python language stored in the memory 10010 may also be divided into one or more program modules and executed by one or more processors (e.g. the processor 10020) to complete the embodiment of the application.
Example five
The embodiment of the application also provides a computer readable storage medium, on which a computer program is stored, wherein the computer program when executed by a processor implements the steps of the method of the embodiment for enabling a Unr eal Engine to edit a Slate interface in a Python language.
In this embodiment, the computer-readable storage medium includes a flash memory, a hard disk, a multimedia card, a card memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEP ROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, and the like. In some embodiments, the computer readable storage medium may be an internal storage unit of a computer device, such as a hard disk or a memory of the computer device. In other embodiments, the computer readable storage medium may also be an external storage device of a computer device, such as a plug-in hard disk, smart Media Card (SMC), secure Digital (SD) Card, flash memory Card (Flash Card), etc. that are provided on the computer device. Of course, the computer-readable storage medium may also include both internal storage units of a computer device and external storage devices. In this embodiment, the computer readable storage medium is generally used to store an operating system installed on a computer device and various application software, such as program code of a method for enabling a ui Engine to edit a slot interface in Python in the embodiment. Furthermore, the computer-readable storage medium may also be used to temporarily store various types of data that have been output or are to be output.
It will be apparent to those skilled in the art that the modules or steps of the embodiments of the application described above may be implemented in a general purpose computer device, they may be concentrated on a single computer device, or distributed over a network of multiple computer devices, they may alternatively be implemented in program code executable by a computer device, so that they may be stored in a storage device for execution by the computer device, and in some cases, the steps shown or described may be performed in a different order than what is shown or described, or they may be separately made into individual integrated circuit modules, or a plurality of modules or steps in them may be made into a single integrated circuit module. Thus, embodiments of the application are not limited to any specific combination of hardware and software.
It should be noted that the foregoing is only a preferred embodiment of the present application, and is not intended to limit the scope of the present application, and all equivalent structures or equivalent processes using the descriptions of the present application and the accompanying drawings, or direct or indirect application in other related technical fields, are included in the scope of the present application.

Claims (15)

1. A method for enabling a ureal Engine to edit a board interface in a Python language, the method comprising:
acquiring an interface description file in a JSON format, wherein the interface description file is associated with a Python tool instance, and the Python tool instance is associated with an interface middle layer instance;
creating a slave interface according to the interface description file, wherein the slave interface comprises a control instance, and an event of the control instance is bound with a corresponding Python code in the Python tool instance;
responding to event triggering for the control instance on the slave interface, and acquiring an execution result of the Pytho n code;
and transmitting the execution result through the interface middle layer instance, searching the control instance according to the transmitted execution result and updating to update the slave interface.
2. The method of claim 1, wherein the step of determining the position of the substrate comprises,
the interface description file is also used for specifying initialization codes and cleaning codes of the Python tool instance.
3. The method of claim 1, wherein the step of determining the position of the substrate comprises,
the interface description file is also provided with a variable placeholder, and the variable placeholder is used for marking the text position needing to be filled.
4. The method of claim 1, wherein obtaining the interface description file in JSON format comprises:
acquiring a configuration file, wherein the configuration file comprises a first path and a target position, the first path is the path of a menu configuration description file, and the target position is the hooking position of a menu item;
acquiring the menu configuration description file according to the first path, wherein the menu configuration description file is used for specifying path information of an interface description file corresponding to the menu item;
creating the menu item at the target location according to the configuration file and the menu configuration description file;
and responding to clicking operation for the menu item, and acquiring a corresponding interface description file according to the path information.
5. The method of claim 4, wherein the step of determining the position of the first electrode is performed,
the menu configuration description file is also used for designating a Python code segment without an interface; and/or
The menu configuration description file is also used to specify interface icons and/or tool tips.
6. The method of claim 4, wherein the step of determining the position of the first electrode is performed,
the target location includes a predefined location and/or a tool menu anchor location.
7. The method according to claim 4, wherein the method further comprises:
responding to the acquisition request of the Python tool instance, and acquiring the interface middle layer instance according to the interface description file; the acquisition request comprises a second path, wherein the second path is the path of the interface description file;
acquiring the interface intermediate layer instance according to a third path when the interface description file comprises the third path, wherein the third path is the path of the interface intermediate layer instance;
and in the case that the interface description file does not comprise the third path, creating the interface middle layer instance and distributing the interface middle layer instance to the Python tool instance.
8. The method of claim 4, wherein the configuration file further comprises a local directory of the interface middle tier instance;
correspondingly, the responding to the obtaining request of the Python tool instance obtains the interface middle layer instance according to the interface description file, and the method comprises the following steps:
and under the condition that the interface description file comprises the name of the interface middle layer instance, acquiring the interface middle layer instance according to the name of the interface middle layer instance and the directory where the interface middle layer instance is located.
9. The method according to any one of claims 1 to 8, wherein transmitting the execution result through the interface middle layer instance, and searching the control instance and updating according to the transmitted execution result, comprises:
searching a control path of the control instance through the interface middle layer instance, and transmitting the execution result and the control path through the interface middle layer instance;
and searching the control instance and updating according to the transmitted execution result and the control path.
10. The method according to any one of claims 1 to 8, wherein transmitting the execution result through the interface middle layer instance, and searching the control instance and updating according to the transmitted execution result, comprises:
searching for a control reference of the control instance through the interface middle layer instance, and transmitting the execution result and the control reference through the interface middle layer instance;
and searching the control instance and updating according to the transmitted execution result and the control reference.
11. The method according to any one of claims 1 to 8, further comprising:
and providing a plurality of blueprint calling interfaces for a Python layer packaged based on a Python language, so that the Python layer can call the bottom layer function of the C++ package in the Unreal Engine.
12. An apparatus for enabling a ureal Engine to edit a board interface in a Python language, the apparatus comprising:
the first acquisition module is used for acquiring an interface description file in a JSON format, wherein the interface description file is associated with a Python tool instance, and the Python tool instance is associated with an interface middle layer instance;
the creation module is used for creating a slave interface according to the interface description file, wherein the slave interface comprises a control instance, and the event of the control instance is bound with a corresponding Python code in the Python tool instance;
the second acquisition module is used for responding to the event trigger aiming at the control instance on the slave interface and acquiring the execution result of the Python code;
and the updating module is used for transmitting the execution result through the interface middle layer instance, searching the control instance according to the transmitted execution result and updating the control instance so as to update the slave interface.
13. A computer device, comprising:
at least one processor; a kind of electronic device with high-pressure air-conditioning system
A memory communicatively coupled to the at least one processor; wherein:
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 11.
14. A computer readable storage medium, characterized in that the computer readable storage medium has stored therein computer instructions which, when executed by a processor, implement the method of any of claims 1 to 11.
15. A system for enabling a ureal Engine to edit a board interface in a Python language, comprising:
the C++ module is used for providing a blueprint method interface and creating a slave interface through a C++ language;
the Python module is used for calling the blueprint method interface and transmitting path information of the interface description file in the JSON format to the C++ module;
the C++ module is also used for binding corresponding Python codes for the control instances in the slave interface;
an interface middle layer instance module, configured to feed back an execution result of the Python code to the c++ module;
and the C++ module is also used for updating the control instance according to the execution result so as to update the slave interface.
CN202310889940.XA 2023-07-19 2023-07-19 Method for editing Slate interface by Python language for Unreal Engine Pending CN116820467A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310889940.XA CN116820467A (en) 2023-07-19 2023-07-19 Method for editing Slate interface by Python language for Unreal Engine

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310889940.XA CN116820467A (en) 2023-07-19 2023-07-19 Method for editing Slate interface by Python language for Unreal Engine

Publications (1)

Publication Number Publication Date
CN116820467A true CN116820467A (en) 2023-09-29

Family

ID=88141250

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310889940.XA Pending CN116820467A (en) 2023-07-19 2023-07-19 Method for editing Slate interface by Python language for Unreal Engine

Country Status (1)

Country Link
CN (1) CN116820467A (en)

Similar Documents

Publication Publication Date Title
CN107577459B (en) Dragging type cross-platform application development system and method based on componentization
CN109542556B (en) Method and system for interaction between process and form based on Activiti
US20210034336A1 (en) Executing a process-based software application in a first computing environment and a second computing environment
US7577937B2 (en) Methods and systems for generating a configurable user interface
US8341593B2 (en) Integrated development framework for composite applications
TW202141300A (en) Page processing method, device, apparatus and storage medium
US9021419B2 (en) System and method for supporting intelligent design pattern automation
US11635974B2 (en) Providing a different configuration of added functionality for each of the stages of predeployment, deployment, and post deployment using a layer of abstraction
US8296721B2 (en) Template-based software development
CN111522552B (en) Sub-application generation method and device, computer equipment and storage medium
WO2018036342A1 (en) Csar-based template design visualization method and device
CN101276275A (en) Software development visualizing editing method aiming at set top box
CN116304442A (en) Page code generation method and device, electronic equipment and storage medium
US20060101458A1 (en) Custom assembly to extend a wizard
CN110806891B (en) Method and device for generating software version of embedded device
CN114721647B (en) Object-oriented programming method based on codeless application development
CN101303663A (en) Simulation test method for digital set-top box software development
CN116820467A (en) Method for editing Slate interface by Python language for Unreal Engine
US20210271458A1 (en) Managing an app method and system
CN111124386B (en) Animation event processing method, device, equipment and storage medium based on Unity
CN111694723B (en) Method for editing nodes and components when product runs under H5 and storage medium
JP7280475B2 (en) Information processing device, its control method, and program
CN116595284B (en) Webpage system operation method, device, equipment, storage medium and program
CN111241454B (en) Method, system and device for generating webpage codes
Di Geronimo et al. Mixing and mashing website themes

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination