Engine editor tool development method and device, medium and equipment
By building interactive interface blueprints in the Unreal Engine editor and utilizing Python scripts and C++ extension interfaces, the high difficulty of developing Unreal Engine editor tools has been solved, enabling rapid creation and efficient development of custom tools, thus improving development efficiency and applicability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-26
- Publication Date
- 2026-03-27
AI Technical Summary
In existing technologies, the development of editor tools for Unreal Engine suffers from high development difficulty and low efficiency. In particular, in development schemes based on C++ and Blueprint system, the lack of visualization functions and efficient development environment leads to low development efficiency and poor applicability of custom tools.
By building a blueprint for the interactive interface of a custom tool in the Unreal Engine editor, writing scripts in a Python-based development framework, and utilizing Unreal Engine's C++ extended application programming interface to obtain and configure editor tool controls, a plugin file is generated to be integrated into the editor, thus realizing the tool functionality of the custom tool.
It enables the rapid creation and development of custom tools, lowers the development threshold, improves development efficiency, and has wide applicability.
Smart Images

Figure CN121742833A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of program development technology, specifically to a method, apparatus, medium, and device for developing an engine editor tool. Background Technology
[0002] In the existing technology, there are two main development solutions for custom tools for the Unreal Engine editor: a C++-based development solution and a EUW (Editor Utility Widget) blueprint-based development solution.
[0003] Among the C++-based development solutions, since the Unreal Engine editor itself is implemented in C++, there are no underlying encapsulation limitations. Therefore, developing or extending editor tools directly in C++ offers a high degree of freedom. However, C++, as a low-level language, is more difficult to develop with. Furthermore, implementing custom tool user interfaces often requires using Slate (Unreal Engine's built-in pure code-based user interface development system). The lack of visual functionality and complex coding rules lead to low development efficiency. Moreover, because the underlying source code of most projects is not open to all team members, C++-based development solutions lack widespread applicability.
[0004] In EUW Blueprint-based development solutions, the Unreal Engine's Blueprint system is used for visual, node-based programming to quickly develop custom tools. It also supports adding UMG (Unreal Motion Graphics) components to rapidly create graphical user interfaces for these tools. However, unlike code, Blueprint node connections result in poor code readability, and Blueprint performance is also low. Unlike C++ programs that can be directly executed after compilation, Blueprint compilation requires converting the Blueprint into intermediate code (e.g., bytecode) before execution via a virtual machine. While Python code can be executed through Blueprint nodes, developing Python scripts using Blueprint nodes lacks smoothness, and the Blueprint system lacks an integrated development environment (IDE) for Python, missing features like code completion and highlighting, significantly reducing development and debugging efficiency. Summary of the Invention
[0005] To improve the development efficiency of editor tools in virtual engines and expand the functionality of virtual engine editors, this application provides a development method, apparatus, medium, and device for engine editor tools. The technical solution is as follows:
[0006] Firstly, this application provides a method for developing an engine editor tool, the method comprising:
[0007] In the Unreal Engine editor, a blueprint for the user interface corresponding to a custom tool is constructed. The blueprint includes at least one target editor tool control. The blueprint is used to implement the tool panel of the custom tool.
[0008] In a Python-based development framework, a Python script is written for the interactive interface blueprint. The Python script obtains at least one target editor tool control in the interactive interface blueprint through the Unreal Engine's C++ extended application interface, and configures the callback events corresponding to the at least one target editor tool control to realize the tool function of the custom tool.
[0009] Based on the interactive interface blueprint and the Python script, a plugin file corresponding to the custom tool is generated. The plugin file is used to integrate into the editor to execute the tool functions of the custom tool based on the tool panel.
[0010] In an optional embodiment, the method further includes:
[0011] The C++ extended application programming interface is defined in the Unreal Engine's program module; the C++ extended application programming interface includes a first interface function, which is encapsulated and participates in the Unreal Engine's reflection mechanism, and is used to obtain all control objects in the Blueprint object.
[0012] In an optional embodiment, building the blueprint for the custom tool's interface in the Unreal Engine editor includes:
[0013] Create an editor tool control blueprint in the editor;
[0014] Add at least one target editing tool control corresponding to the custom tool to the editor tool control blueprint to obtain the interactive interface blueprint.
[0015] In an optional embodiment, obtaining the at least one target editor tool control from the interface blueprint via the Unreal Engine's C++ Extended Application Programming Interface includes:
[0016] The interactive interface blueprint is compiled to obtain an instantiated interactive interface blueprint object;
[0017] Call the first interface function in the C++ extended application interface of the Unreal Engine;
[0018] The blueprint object parameter corresponding to the instantiated interactive interface blueprint object is passed to the first interface function, so that the first interface function obtains a list of editing tool control objects in the instantiated interactive interface blueprint object based on the blueprint object parameter; the list of editing tool control objects corresponds to the at least one target editing tool control.
[0019] In an optional embodiment, configuring the callback events corresponding to the at least one target editor tool control includes:
[0020] Configure callback events corresponding to the at least one target editor tool control according to the function library in the Python-based development framework. The callback events are interface interaction events or function execution events.
[0021] In an optional embodiment, the method further includes:
[0022] After the plugin file is generated, the second interface function is called to add a submenu to the editor's menu bar;
[0023] Add a menu item corresponding to the plugin file to the submenu, so that the plugin file is executed based on the menu item.
[0024] In an optional embodiment, the editor's menu bar also integrates a Python-based hot-update tool, and the method further includes:
[0025] After the plugin file is modified, the hot-update tool is triggered to reload the code modules of the modified plugin file.
[0026] Secondly, this application provides a development apparatus for an engine editor tool, the apparatus comprising:
[0027] An interactive interface blueprint building module is used to build an interactive interface blueprint corresponding to a custom tool in the Unreal Engine editor. The interactive interface blueprint includes at least one target editor tool control. The interactive interface blueprint is used to implement the tool panel of the custom tool.
[0028] The Python script development module is used to write Python scripts for the interactive interface blueprint in a Python-based development framework. The Python scripts obtain at least one target editor tool control in the interactive interface blueprint through the Unreal Engine's C++ extended application interface, and configure the callback events corresponding to the at least one target editor tool control to realize the tool function of the custom tool.
[0029] The plugin file generation module is used to generate a plugin file corresponding to the custom tool based on the interactive interface blueprint and the Python script. The plugin file is used to integrate into the editor to execute the tool function of the custom tool based on the tool panel.
[0030] Thirdly, this application provides a computer-readable storage medium storing at least one instruction or at least one program, which is loaded and executed by a processor to implement a development method for an engine editor tool as described in the first aspect.
[0031] Fourthly, this application provides a computer device including a processor and a memory, wherein the memory stores at least one instruction or at least one program, the at least one instruction or the at least one program being loaded and executed by the processor to implement a development method for an engine editor tool as described in the first aspect.
[0032] Fifthly, this application provides a computer program product, the computer program product including computer instructions, which, when executed by a processor, implement a development method for an engine editor tool as described in the first aspect.
[0033] The development method, apparatus, medium, and device for an engine editor tool provided in this application have the following technical effects:
[0034] The technical solution provided in this application offers a Python-based development framework that can centrally address the development tasks of custom tools in the Unreal Engine editor. Within the Python-based development framework, communication between Python and Blueprints and controls within Blueprints can be achieved through a pre-defined C++ extended application interface in Unreal Engine. Specifically, in the technical solution provided in this application, an interactive interface blueprint corresponding to a custom tool is constructed in the Unreal Engine editor to realize the tool panel of the custom tool. The interactive interface blueprint includes at least one target editor tool control, that is, the tool panel of the custom tool is quickly created through visual controls. In a Python-based development framework, a Python script is written for the interactive interface blueprint. In the Python script, at least one target editor tool control in the interactive interface blueprint can be obtained by calling the Unreal Engine's C++ extension application interface, and the callback events of at least one target editor tool control can be configured, thereby quickly and agilely developing complete tool functions of the custom tool. In the technical solution provided in this application, based on the interactive interface blueprint used to implement the tool panel of the custom tool and the Python script used to implement the tool functions of the custom tool, a plugin file for the custom tool can be compiled and generated. In the Python-based development framework, the plugin file for the custom tool can also be integrated into the Unreal Engine editor to extend the editor tool, and developers can input based on the tool panel of the custom tool and trigger the callback events of the custom tool to execute the tool functions of the custom tool. The technical solution provided in this application is based on the Python development framework and proposes a standardized editor tool development process. It can realize the rapid creation of editor tool interfaces and the quick development of editor tool functions, greatly reducing the threshold and difficulty of editor tool development, improving the development efficiency of editor tools, and has wide applicability.
[0035] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description
[0036] To more clearly illustrate the technical solutions and advantages in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0037] Figure 1 This is a schematic diagram illustrating the implementation environment of a development method for an engine editor tool provided in an embodiment of this application;
[0038] Figure 2 This is a flowchart illustrating a development method for an engine editor tool provided in an embodiment of this application;
[0039] Figure 3 This is a schematic diagram illustrating the development of a tool panel based on a blueprint editor, as provided in an embodiment of this application.
[0040] Figure 4 This is a schematic diagram illustrating the property settings of an editor tool control provided in an embodiment of this application;
[0041] Figure 5 This is a schematic diagram of a blueprint compilation process provided in an embodiment of this application;
[0042] Figure 6 This is a schematic diagram illustrating the integration of a custom tool into the menu bar of an editor tool, as provided in an embodiment of this application.
[0043] Figure 7 This is a schematic diagram of a tool panel for displaying custom tools in an editor tool, provided in an embodiment of this application;
[0044] Figure 8 This is a schematic diagram illustrating the execution of Python code for implementing tool functions, provided in an embodiment of this application.
[0045] Figure 9 This is a schematic diagram illustrating a method for reloading plugin files according to an embodiment of this application;
[0046] Figure 10 This is a schematic diagram of a development apparatus for an engine editor tool provided in an embodiment of this application;
[0047] Figure 11 This is a schematic diagram of the hardware structure of a device for implementing a development method for an engine editor tool, provided in an embodiment of this application. Detailed Implementation
[0048] To improve the development efficiency of editor tools, this application provides a method, apparatus, medium, and device for developing engine editor tools. The technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout.
[0049] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or server that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or devices.
[0050] To facilitate understanding of the technical solutions and their effects described in the embodiments of this application, the relevant technical terms are explained in the embodiments of this application:
[0051] Python: A widely used high-level programming language with concise and clear syntax, easy for beginners to learn. Python code is highly readable, making it easier to maintain and understand existing code. Python has a large ecosystem of standard and third-party libraries. As an interpreted language, Python allows code to be run directly without compilation, which helps with rapid testing and development.
[0052] UE: Unreal Engine, a powerful game development platform and real-time 3D creation tool.
[0053] UMG: Unreal Motion Graphics, is a tool in Unreal Engine used to create user interfaces. It allows developers to design user interfaces, including dialog boxes, menus, and other graphical user interface elements, through drag-and-drop. UMG components can be exposed to Blueprints. UMG is primarily used for in-game user interface design and creating in-game graphical user interfaces.
[0054] EUW: Editor Utility Widget is a new type of editor utility widget introduced in Unreal Engine. It is built on UMG but is mainly used within the Unreal Engine editor to create utility panels and implement custom functions.
[0055] Slate: The pure code-based UI (User Interface) system built into Unreal Engine, which can only be used in C++ development.
[0056] Please see Figure 1This is a schematic diagram illustrating the implementation environment of a development method for an engine editor tool provided in this application embodiment, such as... Figure 1 As shown, the implementation environment may include at least client 01 and server 02.
[0057] Specifically, the client 01 may include devices such as smartphones, desktop computers, tablets, laptops, digital assistants, smart wearable devices, and voice interaction devices. It may also include software running on the device, such as web pages provided to users by service providers, or applications provided by such service providers. Specifically, the client 01 can be used to run Unreal Engine, constructing an interactive interface blueprint corresponding to the custom tool within the Unreal Engine editor. The interactive interface blueprint includes at least one target editor tool control; the interactive interface blueprint is used to implement the tool panel of the custom tool; Unreal Engine may integrate a Python-based development framework, in which Python scripts are written for the interactive interface blueprint. The Python scripts obtain at least one target editor tool control from the interactive interface blueprint and configure callback events corresponding to at least one target editor tool control by calling Unreal Engine's C++ extended application programming interface (API) to implement the tool functionality of the custom tool; based on the interactive interface blueprint and the Python script, a plugin file corresponding to the custom tool is generated. The plugin file can be integrated into the editor to execute the tool functionality of the custom tool based on the tool panel. Simultaneously, the client 01 can also publish the plugin file of the custom tool through the server 02.
[0058] Specifically, server 02 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. Server 02 may include network communication units, processors, and memory, etc. Terminals and servers can be connected directly or indirectly via wired or wireless communication, which is not limited herein. Specifically, server 02 can be used to respond to requests from other clients by sending the plugin files of the custom tool published by client 01 to other clients.
[0059] This application embodiment can also be implemented using cloud technology. Cloud technology refers to a hosting technology that unifies hardware, software, and network resources within a wide area network (WAN) or local area network (LAN) to achieve data computation, storage, processing, and sharing. It can also be understood as a general term for network technologies, information technologies, integration technologies, management platform technologies, and application technologies based on cloud computing business models. Cloud technology requires cloud computing as its support. Cloud computing is a computing model that distributes computing tasks across a resource pool composed of a large number of computers, enabling various application systems to obtain computing power, storage space, and information services as needed. The network providing these resources is called the "cloud." Specifically, the server 02 and the database are located in the cloud. The server 02 can be a physical machine or a virtualized machine.
[0060] The following describes a development method for an engine editor tool provided in this application. Figure 2 This is a flowchart illustrating a development method for an engine editor tool provided in an embodiment of this application. This application provides the operational steps described in the embodiments or flowchart, but based on conventional or non-inventive labor, more or fewer operational steps may be included. The order of steps listed in the embodiments is merely one possible execution order among many and does not represent the only possible execution order. In actual system or server product execution, the methods shown in the embodiments or drawings can be executed sequentially or in parallel (e.g., in a parallel processor or multi-threaded processing environment). Please refer to... Figure 2 The development method of an engine editor tool provided in this application embodiment may include the following steps:
[0061] S210: Build a blueprint for the user interface of a custom tool in the Unreal Engine editor. The blueprint includes at least one target editor tool control. The blueprint is used to implement the tool panel of the custom tool.
[0062] In the embodiments of this application, the custom tool can provide functionality that the Unreal Engine editor cannot provide, and can handle actual game development tasks or 3D video editing tasks more efficiently.
[0063] In this application embodiment, Unreal Engine provides a variety of editors, including but not limited to level editor, behavior tree editor, blueprint editor and material editor; the editor is a tool suite for manipulating content in Unreal Engine, which can achieve more complex target tasks, such as the development and design of game levels, the development and design of game screens, and the development of editor extension tools within Unreal Engine.
[0064] In one embodiment of this application, an editor tool control blueprint is created in the editor; at least one target editing tool control corresponding to the custom tool is added to the editor tool control blueprint to obtain an interactive interface blueprint. Specifically, an initialization blueprint of type Editor Tool Control Blueprint (EUW Blueprint) can be created in the blueprint editor; at least one target editing tool control required for the tool panel of the custom tool is added to the initialization blueprint to obtain the interactive interface blueprint. The tool panel of the custom tool is also the corresponding GUI (Graphical User Interface) of the custom tool, which is displayed in the editor window to enable communication between the developer and the terminal. The blueprint editor supports the quick and visual creation of the tool GUI of the custom tool by dragging and dropping UMG controls or EUW controls.
[0065] Specifically, launch the Unreal Engine Blueprint Editor, create a new EUWBlueprint in the Blueprint Editor, double-click the newly created EUWBlueprint to display the initialized EUWBlueprint in the Blueprint Editor, use the Designer tab of the Blueprint Editor to drag and drop at least one target editing tool control onto the canvas, and you can also set properties for at least one dragged and dropped target editing tool control in the Details tab.
[0066] For example, such as Figure 3 As shown, you can drag and drop text-based editing tool controls (named "BlaBla") and button-based editing tool controls (named "Button01" and "Button02" respectively) into the EUW Blueprint displayed in the Blueprint Editor. Figure 4 As shown, for Figure 3 In the editing tool control, check the "IsVariable" property in the Details tab for later retrieval.
[0067] S220: In a Python-based development framework, write a Python script for the interactive interface blueprint. The Python script obtains at least one target editor tool control of the interactive interface blueprint through the Unreal Engine's C++ extended application interface, and configures the callback events corresponding to at least one target editor tool control to implement the tool functionality of the custom tool.
[0068] In this embodiment of the application, a Python-based development framework is pre-built. This Python-based development framework itself can be packaged and released as a plugin and made available to all Unreal Engine developers.
[0069] In a specific embodiment, considering that the current Unreal Engine version's support for Python is insufficient to realize data communication between Python and EUW Blueprint, a C++ extended application programming interface can be defined in the Unreal Engine's program module. That is, using Unreal Engine's underlying programming language C++, an application programming interface can be set up to realize data communication between Python and EUW Blueprint, thereby realizing the development of a custom editor tool based on Python. The C++ extended application programming interface includes a first interface function, which is encapsulated and can be parameterized by Unreal Engine's reflection mechanism (Unreal Engine's reflection mechanism can provide dynamic acquisition of object member information at runtime, and is often used to expose interfaces to the blueprint editor). The first interface function is used to obtain all control objects in the blueprint object, where the blueprint object is the instantiation result of the constructed blueprint, and the control object is the instantiation result of the control.
[0070] In one exemplary embodiment, an application programming interface (API) is extended in the UE's C++ program module, as shown in the following code, which defines a class named UPythonToolsetWidgetBPLibrary, which inherits from UBlueprintFunctionLibrary:
[0071] UCLASS()
[0072] 0derived blueprint classe
[0073] class PYTHONTOOLSET_API UPythonToolsetwidgetBPLibrary:publicuBlueprintfunctionLibrary
[0074] {
[0075] GENERATED_BODY()
[0076] public:
[0077] / / For python to use, get all widgets of the EditorutilityWidget.
[0078] UFUNCTION (Blueprintcallable)
[0079] static TArray<UWidget*> GetAllWidgets(UUserWidget*UserWidget);
[0080] }
[0081] UCLASS() is a macro used to declare a class in Unreal Engine. It tells Unreal Engine that this class is a UClass and can be used as the basis for Blueprints.
[0082] 0derived blueprint classes: This line of code indicates that there are currently no blueprint classes derived from this class.
[0083] class PYTHONTOOLSET_API UPythonToolsetWidgetBPLibrary:public UBlueprintFunctionLibrary: declares a class named UPythonToolsetWidgetBPLibrary, which inherits from UBlueprintFunctionLibrary. PYTHONTOOLSET_API is a macro used to define the class's linking method, ensuring that it can be correctly linked between different modules.
[0084] GENERATED_BODY(): This macro is used to automatically generate some basic members of a class, such as the default constructor and destructor.
[0085] Public: Specifies that the following members are public and can be accessed from outside the class.
[0086] / / For Python to use, get all widgets of the EditorUtilityWidget: This is a comment explaining that the static function GetAllWidgets below is designed for Python use and is used to retrieve all widgets in the EditorUtilityWidget.
[0087] UFUNCTION(BlueprintCallable): This is a macro used to declare a member function. The BlueprintCallable attribute indicates that this function participates in the reflection mechanism and can be called by Python.
[0088] static TArray<UWidget*> GetAllWidgets(UUserWidget*UserWidget): This declares a static function GetAllWidgets that accepts a UserWidget parameter of type UUserWidget* and returns an array TArray of type UWidget*. This function is used to retrieve all the widgets in the passed-in UserWidget.
[0089] The static function GetAllWidgets (equivalent to the first interface function) retrieves all control objects from the Blueprint object UserWidget of the EditorUtilityWidget class and returns them as an array TArray. In the embodiments of this application, UserWidget corresponds to the name of the instantiated interactive interface Blueprint object, and the array TArray corresponds to at least one instantiated target editor tool control object.
[0090] In an exemplary embodiment, in UE5, the first interface function can be defined as: TArray<UWidget*> PythonToolsetWidgetBPLibrary::GetAllWidgets(UUserWidget*UserWidget)
[0091] {
[0092] TArray<Uwidget*> Widgets;
[0093] TObjectPtr <uwidgettree>UserWidgetTree=UserWidget->WidgetTree;
[0094] UserWidgetTree->GetAllWidgets([&]Widgets);
[0095] return Widgets;
[0096] }
[0097] The code above demonstrates how to write the first interface function in C++ in Unreal Engine 5 to retrieve all Widgets from a UserWidget. The following is a detailed summary of the core content:
[0098] Function definition: The function name is GetAllWidgets, and it belongs to the UPythonToolsetWidgetBPLibrary class. The function is static, meaning it can be called without creating an instance of the class.
[0099] Parameter: Accepts a parameter of type UUserWidget*, named UserWidget, which represents the object whose control is to be retrieved, and in this embodiment, it is the name of the Blueprint object.
[0100] Return type: The function returns an array of type UWidget* (TArray)<UWidget*> This includes all retrieved control pointers, which are used to point to the corresponding controls. In this embodiment, they are used to indicate editor tool control objects.
[0101] Local variable: A local variable Widgets is defined to store the retrieved array of controls.
[0102] Get the Widget Tree: Use UserWidget->WidgetTree to get the widget tree (WidgetTree) passed to UserWidget. This is a data structure that manages the hierarchy of widgets.
[0103] Retrieve controls: Call the UserWidgetTree->GetAllWidgets(&Widgets) method to populate the Widgets array with all controls in the control tree.
[0104] Return value: The function returns a populated array of Widgets containing pointers to all the widgets within UserWidget.
[0105] The above provides an example of writing the first interface function GetAllWidgets in C++ in Unreal Engine 5 to retrieve the editor tool control objects Widgets in the Blueprint object UserWidget.
[0106] In one embodiment of this application, the written Python script can obtain at least one target editor tool control of the interactive interface blueprint through the Unreal Engine's C++ extended application programming interface, including:
[0107] S221: Compile the user interface blueprint to obtain an instantiated user interface blueprint object.
[0108] Specifically, in the process of calling the editor tool control of the C++ extended application programming interface to access the interactive interface blueprint, the interactive interface blueprint needs to be compiled first to obtain an instantiated interactive interface blueprint object.
[0109] Figure 5 The blueprint compilation mechanism is illustrated. Specifically, the blueprint assets in the interactive interface blueprint EUW Blueprint are first determined. The blueprint assets include the properties of various variables (such as function variables, control variables, image variables, etc.) in the interactive interface blueprint. Then, the various variables of the blueprint assets are converted into classes, and a new class instance object is generated to store the properties and other information of various variables.
[0110] S222: Call the first interface function in the Unreal Engine's C++ extended application interface.
[0111] In an exemplary embodiment, in the above Python script, the call to the first interface function can be implemented by defining the following function:
[0112] widget_components =
[0113] unreal.PythonToolsetWidgetBPLibrary.get_all_widgets(self.widget_object)
[0114] The first interface function in the C++ extended application programming interface is unreal.PythonToolsetWidgetBPLibrary.get_all_widgets, which takes self.widget_object (object parameter) as input to retrieve all controls associated with widget_object.
[0115] S223: Pass the blueprint object parameter corresponding to the instantiated interactive interface blueprint object to the first interface function, so that the first interface function can obtain the list of editing tool control objects in the instantiated interactive interface blueprint object based on the blueprint object parameter, and the list of editing tool control objects corresponds to at least one target editing tool control.
[0116] Based on the call to the first interface function shown in step S222, by passing the Blueprint object parameter corresponding to the instantiated interactive interface Blueprint object as self.widget_object to get_all_widgets, the list of editor tool control objects corresponding to the instantiated interactive interface Blueprint object returned by the first interface function can be received. Based on the foregoing embodiment, the list of editor tool control objects is in array form, including pointers to at least one target editor tool control.
[0117] In an exemplary embodiment, a function `get_widget_component_by_name` can be defined in the Python script based on the `widget_components` function. This function can retrieve a specific control by name from the list of edit tool control objects, as shown below:
[0118]
[0119] The function get_widget_component_by_name accepts two parameters: self and widget_component_name. self represents an instance of the class; widget_component_name is a string representing the name of the control to be retrieved.
[0120] The function get_widget_component_by_name returns an Optional[unreal.Widget], meaning it will return an unreal.Widget object or None.
[0121] The execution logic of the function `get_widget_component_by_name` includes: calling the Unreal Engine API and using the static method `unreal.PythonToolsetWidgetBPLibrary.get_all_widgets` to obtain the list of widgets corresponding to `self.widget_object`. It then iterates through the list of widgets `widget_components` returned by `get_all_widgets`. For each widget component, it uses `widget_component.get_name()` to obtain its name and compares it with the passed `widget_component_name` parameter. If a widget component with a matching name is found, the function immediately returns that widget. If no matching widget component is found after iterating through all widgets, the function returns `None`.
[0122] In an exemplary embodiment, based on the function get_widget_component_by_name described above, instantiated control variables can be created in a Python script, and editor tool controls in the interactive interface blueprint can be retrieved, added, or deleted by variable name. The code can be implemented as follows:
[0123] self.text=self.get_widget_component_by_name("TextBlock_0")
[0124] self.button01=self.get_widget_component_by_name("Button01")
[0125] self.button02=self.get_widget_component_by_name("Button02")
[0126] The above uses the self.get_widget_component_by_name function to retrieve the text control variable named "TextBlock_0", the button control variable named "Button01", and the button control variable named "Button02", respectively.
[0127] In one embodiment of this application, configuring a callback event corresponding to at least one target editor tool control includes:
[0128] Configure at least one callback event corresponding to the target editor tool control based on the function library in the Python-based development framework.
[0129] Specifically, the function libraries in a Python-based development framework can include the Python standard library and third-party libraries. These libraries encapsulate functions corresponding to various callback events, allowing users to directly call the callback event functions when configuring callback events for at least one target editor tool control, without needing to repeat development.
[0130] Specifically, after obtaining the control variable through the get_widget_component_by_name function, you can set a callback event for the obtained control variable.
[0131] Callback events can be either UI interaction events or function execution events. UI interaction events are used to enable interaction between the displayed tool panel and the developer, including but not limited to jumping to a window and displaying a drop-down menu. Function execution events are used to execute the tool functions of the custom tool in the backend, such as reading resources and their attributes from the currently pending object, or making batch modifications to the attributes, depending on the custom tool.
[0132] S230: Based on the interactive interface blueprint and Python script, generate plugin files corresponding to custom tools. These plugin files are used to integrate into the editor to execute the tool functions of the custom tools based on the tool panel.
[0133] In this embodiment, the interactive interface blueprint and Python script are compiled to obtain the plugin file corresponding to the custom tool. Within a Python-based development framework, the plugin file for the custom tool can also be integrated into the Unreal Engine editor to extend the editor tools. This allows developers to input data based on the custom tool's toolbar and trigger callback events, thereby executing the custom tool's functionality.
[0134] In one embodiment of this application, the above steps may include:
[0135] S240: After the plugin file is generated, call the second interface function to add a submenu to the editor's menu bar.
[0136] S250: Add a menu item corresponding to the plugin file to the submenu to trigger the execution of the plugin file based on the menu item.
[0137] Specifically, a submenu (ToolMenu) is added using unreal.ToolMenu.add_sub_menu, and then an action is triggered using unreal.ToolMenu.add_menu_entry, which in turn executes the Python command in the plugin file.
[0138] The second interface function is used to configure the editor's menu bar, including adding and deleting menu items. Menu items indicate specific tools and can be interactive controls. Plugin files are executed in response to actions triggered by menu items, thereby enabling the functionality of custom tools.
[0139] For example, Figure 6 The diagram illustrates an editor interface, including a menu bar that already contains PythonToolset (a collection of tools developed using Python). Additional tools, such as..., can be added by calling a second interface function. Figure 6 The submenu shown consists of three parts: PYTHON TOOLS, PYTHON RELOAD, and HELP. It can also be used as follows: Figure 6 The example shows setting up a smaller menu level below the toolset and integrating custom tools developed within that smaller menu level. Figure 6 It showcases a variety of integrated custom tools, including asset renaming and channel compression.
[0140] In response to a triggered action, a tool panel for custom tools can be displayed in the editor. Figure 7 This showcases the tool panel for a custom channel compression tool (EUW Channel Compress). Input to the tool panel (such as channel selection, importing projects, and channel merging) triggers the execution of commands in the corresponding Python script. The complete tool functionality written in Python can be executed via Command, with the execution mechanism as follows: Figure 8 As shown.
[0141] In one embodiment of this application, the Python-based development framework also integrates a Python-based hot-update tool in the editor's menu bar, and the method further includes:
[0142] After modifying the plugin file, the hot-reload tool is triggered to reload the code modules of the modified plugin file.
[0143] Specifically, unlike C++ code where changes require compilation and an editor restart, Python code can be hot-loaded, allowing developers to debug quickly without waiting for compilation or an editor restart. The `Reload` function defined in a Python script can reload Python code modules, achieving the same effect as... Figure 9 As shown, the reload process generates log data and initializes the menu bar in the editor after the reload is complete.
[0144] In one specific embodiment, an application programming interface (API) is pre-extended in the UE's C++ program module, including a first interface function GetAllWidgets(UUserWidget*UserWidget), which retrieves the editor tool control objects Widgets from the blueprint object UserWidget of type UUserWidget*, and can return an array of type UWidget* (TArray).<UWidget*> ).
[0145] In the process of developing a custom image channel compression tool for game visuals, we utilized methods such as... Figure 3 The EUW blueprint shown requires at least one target editor tool control in the tool panel of the drag-and-drop image channel compression tool to generate the initial blueprint. Figure 7 The interactive interface blueprint with a consistent visual effect of the tool panel in the middle, at least one target editor tool control can include multiple static text controls, dynamic drop-down menu controls, channel merging corresponding button controls, etc.
[0146] Meanwhile, within a Python-based development framework, a Python script was written for the interactive interface blueprint of the image channel compression tool to implement its functionality. Specifically, the Python script contains instructions for compiling the interactive interface blueprint of the image channel compression tool and defines a function `widget_components` to call the first interface function `GetAllWidgets(UUserWidget*UserWidget)`. By passing the blueprint object parameter of the interactive interface blueprint of the image channel compression tool to the first interface function, a list of editor tool objects is obtained, including pointers to at least one target editor tool control. Secondly, based on the Python standard library and third-party libraries in the Python development framework, the Python script also defines corresponding callback events for at least one target editor tool control. These callback events can be either interface interaction events or function execution events. Interface interaction events are used to enable interaction between the displayed tool panel and the developer, including but not limited to the jump event of the button control and the drop-down list display event of the drop-down menu control. Function execution events are used to execute the tool functions of the image channel compression tool in the backend. For example, the button control corresponding to channel merging is set with the following event: read all image resources in the current game screen and merge all image resources according to the current selection result corresponding to the channel selection space, thereby completing the compression processing of the image resources.
[0147] During development, based on the blueprint of the image channel compression tool's interactive interface and Python scripts, plugin files for the image channel compression tool were obtained and integrated into, for example, […]. Figure 6 As shown in the editor toolbar, when game developers need to compress image channels in the game screen, they can click the "Channel Compression" option in the toolbar to display the image in the editor window as shown. Figure 7 The tool panel shown allows developers to... Figure 7 The tool panel shown allows you to perform operations such as importing game projects to be processed, selecting the channels to be compressed, and triggering the channel merging process.
[0148] As can be seen from the above embodiments, the technical solution provided by this application provides a Python-based development framework that can centrally solve the development task of custom tools in the Unreal Engine editor. In the Python-based development framework, communication between Python and Blueprints and controls in Blueprints can be realized through the C++ extended application interface predefined in Unreal Engine. Specifically, in the technical solution provided in this application, an interactive interface blueprint corresponding to a custom tool is constructed in the Unreal Engine editor to realize the tool panel of the custom tool. The interactive interface blueprint includes at least one target editor tool control, that is, the tool panel of the custom tool is quickly created through visual controls. In a Python-based development framework, a Python script is written for the interactive interface blueprint. In the Python script, at least one target editor tool control in the interactive interface blueprint can be obtained by calling the Unreal Engine's C++ extension application interface, and the callback events of at least one target editor tool control can be configured, thereby quickly and agilely developing complete tool functions of the custom tool. In the technical solution provided in this application, based on the interactive interface blueprint used to implement the tool panel of the custom tool and the Python script used to implement the tool functions of the custom tool, a plugin file for the custom tool can be compiled and generated. In the Python-based development framework, the plugin file for the custom tool can also be integrated into the Unreal Engine editor to extend the editor tool, and developers can input based on the tool panel of the custom tool and trigger the callback events of the custom tool to execute the tool functions of the custom tool. The technical solution provided in this application is based on the Python development framework and proposes a standardized editor tool development process. It can realize the rapid creation of editor tool interfaces and the quick development of editor tool functions, greatly reducing the threshold and difficulty of editor tool development, improving the development efficiency of editor tools, and has wide applicability.
[0149] This application embodiment also provides a development apparatus 1000 for an engine editor tool, such as... Figure 10 As shown, the device may include:
[0150] The interactive interface blueprint building module 1010 is used to build an interactive interface blueprint corresponding to a custom tool in the Unreal Engine editor. The interactive interface blueprint includes at least one target editor tool control. The interactive interface blueprint is used to implement the tool panel of the custom tool.
[0151] The Python script development module 1020 is used to write Python scripts for the interactive interface blueprint in a Python-based development framework. The Python scripts obtain at least one target editor tool control in the interactive interface blueprint through the Unreal Engine's C++ extended application interface, and configure the callback events corresponding to the at least one target editor tool control to realize the tool function of the custom tool.
[0152] The plugin file generation module 1030 is used to generate a plugin file corresponding to the custom tool based on the interactive interface blueprint and the Python script. The plugin file is used to be integrated into the editor to execute the tool function of the custom tool based on the tool panel.
[0153] In an optional embodiment, the device 1000 further includes:
[0154] An interface extension module is used to define the C++ extended application interface in the program module of the Unreal Engine; the C++ extended application interface includes a first interface function, which is encapsulated and participates in the reflection mechanism of the Unreal Engine, and is used to obtain all control objects in the Blueprint object.
[0155] In an optional embodiment, the interactive interface blueprint construction module 1010 includes:
[0156] A blueprint creation unit is used to create editor tool control blueprints in the editor.
[0157] The control adding unit is used to add at least one target editing tool control corresponding to the custom tool to the editor tool control blueprint to obtain the interactive interface blueprint.
[0158] In an optional embodiment, the Python script development module 1020 includes:
[0159] The compilation code unit is used to compile the interactive interface blueprint to obtain an instantiated interactive interface blueprint object;
[0160] The first interface function call unit is used to call the first interface function in the C++ extended application interface of the Unreal Engine;
[0161] The editing tool control acquisition unit is used to pass the blueprint object parameter corresponding to the instantiated interactive interface blueprint object to the first interface function, so that the first interface function can obtain a list of editing tool control objects in the instantiated interactive interface blueprint object based on the blueprint object parameter; the list of editing tool control objects corresponds to the at least one target editing tool control.
[0162] In an optional embodiment, the Python script development module 1020 includes:
[0163] The event configuration unit is used to configure callback events corresponding to the at least one target editor tool control according to the function library in the Python-based development framework. The callback events are interface interaction events or function execution events.
[0164] In an optional embodiment, the device 1000 further includes:
[0165] The menu bar extension unit is used to call a second interface function after the plugin file is generated to add a submenu to the menu bar of the editor.
[0166] The menu item adding unit is used to add a menu item corresponding to the plugin file to the sub-menu, so as to trigger the execution of the plugin file based on the menu item.
[0167] In an optional embodiment, the editor's menu bar also integrates a Python-based hot-update tool, and the device 1000 further includes:
[0168] The hot-update unit is used to trigger the hot-update tool after the plugin file is modified, so as to reload the code module of the modified plugin file.
[0169] In this application embodiment, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0170] It should be noted that the apparatus provided in the above embodiments is only illustrated by the division of the above functional modules when implementing its functions. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus and method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.
[0171] This application provides a computer device including a processor and a memory. The memory stores at least one instruction or at least one program, which is loaded and executed by the processor to implement a method for developing an engine editor tool as provided in the above method embodiments.
[0172] Figure 11 A schematic diagram of the hardware structure of a device for implementing a development method for an engine editor tool provided in an embodiment of this application is shown. This device may participate in or include the apparatus or system provided in the embodiment of this application. Figure 11 As shown, device 10 may include one or more processors 1002 (shown as 1002a, 1002b, ..., 1002n in the figure) 1002 (processor 1002 may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 1004 for storing data, and a transmission device 1006 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, a power supply, and / or a camera. Those skilled in the art will understand that... Figure 11 The structure shown is for illustrative purposes only and does not limit the structure of the electronic device described above. For example, device 10 may also include a... Figure 11 The more or fewer components shown, or having the same Figure 11 The different configurations shown.
[0173] It should be noted that the aforementioned one or more processors 1002 and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be embodied, in whole or in part, in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be integrated, in whole or in part, into any other element within device 10 (or mobile device). As involved in the embodiments of this application, the data processing circuits serve as a processor control mechanism (e.g., selection of a variable resistor termination path connected to an interface).
[0174] The memory 1004 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the method described in the embodiments of this application. The processor 1002 executes various functional applications and data processing by running the software programs and modules stored in the memory 1004, thereby realizing the above-described method for developing an engine editor tool. The memory 1004 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 1004 may further include memory remotely located relative to the processor 1002, and these remote memories can be connected to the device 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0175] The transmission device 1006 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of device 10. In one example, the transmission device 1006 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 1006 may be a Radio Frequency (RF) module, used for wireless communication with the Internet.
[0176] The display may be, for example, a touchscreen liquid crystal display (LCD) that allows a user to interact with the user interface of device 10 (or a mobile device).
[0177] This application embodiment also provides a computer-readable storage medium, which can be disposed in a server to store at least one instruction or at least one program related to the development method of an engine editor tool in the method embodiment. The at least one instruction or the at least one program is loaded and executed by the processor to implement the development method of an engine editor tool provided in the above method embodiment.
[0178] Optionally, in this embodiment, the storage medium may be located at at least one of the multiple network servers in a computer network. Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0179] This invention also provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform a method for developing an engine editor tool provided in the various optional embodiments described above.
[0180] As can be seen from the embodiments of the development method, apparatus, medium, and device for an engine editor tool provided in this application,
[0181] The technical solution provided in this application offers a Python-based development framework that can centrally address the development tasks of custom tools in the Unreal Engine editor. Within the Python-based development framework, communication between Python and Blueprints and controls within Blueprints can be achieved through a pre-defined C++ extended application interface in Unreal Engine. Specifically, in the technical solution provided in this application, an interactive interface blueprint corresponding to a custom tool is constructed in the Unreal Engine editor to realize the tool panel of the custom tool. The interactive interface blueprint includes at least one target editor tool control, that is, the tool panel of the custom tool is quickly created through visual controls. In a Python-based development framework, a Python script is written for the interactive interface blueprint. In the Python script, at least one target editor tool control in the interactive interface blueprint can be obtained by calling the Unreal Engine's C++ extension application interface, and the callback events of at least one target editor tool control can be configured, thereby quickly and agilely developing complete tool functions of the custom tool. In the technical solution provided in this application, based on the interactive interface blueprint used to implement the tool panel of the custom tool and the Python script used to implement the tool functions of the custom tool, a plugin file for the custom tool can be compiled and generated. In the Python-based development framework, the plugin file for the custom tool can also be integrated into the Unreal Engine editor to extend the editor tool, and developers can input based on the tool panel of the custom tool and trigger the callback events of the custom tool to execute the tool functions of the custom tool. The technical solution provided in this application is based on the Python development framework and proposes a standardized editor tool development process. It can realize the rapid creation of editor tool interfaces and the quick development of editor tool functions, greatly reducing the threshold and difficulty of editor tool development, improving the development efficiency of editor tools, and has wide applicability.
[0182] It should be noted that the order of the embodiments described above is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. Furthermore, the above description focuses on specific embodiments of this application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps described in the claims can be performed in a different order than that shown in the embodiments and still achieve the desired results. Additionally, the processes depicted in the drawings do not necessarily require a specific or sequential order to achieve the desired results. In some implementations, multitasking and parallel processing are also possible or may be advantageous.
[0183] The various embodiments in this application are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the device, equipment, and storage medium embodiments are basically similar to the method embodiments, so the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0184] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0185] The above description is only a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.< / uwidgettree>
Claims
1. A method for developing an engine editor tool, characterized in that, The method includes: In the Unreal Engine editor, a blueprint for the user interface corresponding to a custom tool is constructed. The blueprint includes at least one target editor tool control. The blueprint is used to implement the tool panel of the custom tool. In a Python-based development framework, a Python script is written for the interactive interface blueprint. The Python script obtains at least one target editor tool control in the interactive interface blueprint through the Unreal Engine's C++ extended application interface, and configures the callback events corresponding to the at least one target editor tool control to realize the tool function of the custom tool. Based on the interactive interface blueprint and the Python script, a plugin file corresponding to the custom tool is generated. The plugin file is used to integrate into the editor to execute the tool functions of the custom tool based on the tool panel.
2. The method according to claim 1, characterized in that, The method further includes: The C++ extended application programming interface is defined in the Unreal Engine's program module; the C++ extended application programming interface includes a first interface function, which is encapsulated and participates in the Unreal Engine's reflection mechanism, and is used to obtain all control objects in the Blueprint object.
3. The method according to claim 1, characterized in that, The process of building the blueprint for the interactive interface of a custom tool in the Unreal Engine editor includes: Create an editor tool control blueprint in the editor; Add at least one target editing tool control corresponding to the custom tool to the editor tool control blueprint to obtain the interactive interface blueprint.
4. The method according to claim 2, characterized in that, The step of obtaining at least one target editor tool control from the interactive interface blueprint through the Unreal Engine's C++ Extended Application Programming Interface includes: The interactive interface blueprint is compiled to obtain an instantiated interactive interface blueprint object; Call the first interface function in the C++ extended application interface of the Unreal Engine; The blueprint object parameter corresponding to the instantiated interactive interface blueprint object is passed to the first interface function so that the first interface function can obtain a list of editing tool control objects in the instantiated interactive interface blueprint object based on the blueprint object parameter, and the list of editing tool control objects corresponds to the at least one target editing tool control.
5. The method according to claim 1, characterized in that, The configuration of the callback events corresponding to the at least one target editor tool control includes: Configure callback events corresponding to the at least one target editor tool control according to the function library in the Python-based development framework. The callback events are interface interaction events or function execution events.
6. The method according to claim 1, characterized in that, The method further includes: After the plugin file is generated, the second interface function is called to add a submenu to the editor's menu bar; Add a menu item corresponding to the plugin file to the submenu, so that the plugin file is executed based on the menu item.
7. The method according to claim 6, characterized in that, The editor's menu bar also integrates a Python-based hot-update tool, and the method further includes: After the plugin file is modified, the hot-update tool is triggered to reload the code modules of the modified plugin file.
8. A development apparatus for an engine editor tool, characterized in that, The device includes: An interactive interface blueprint building module is used to build an interactive interface blueprint corresponding to a custom tool in the Unreal Engine editor. The interactive interface blueprint includes at least one target editor tool control. The interactive interface blueprint is used to implement the tool panel of the custom tool. The Python script development module is used to write Python scripts for the interactive interface blueprint in a Python-based development framework. The Python scripts obtain at least one target editor tool control in the interactive interface blueprint through the Unreal Engine's C++ extended application interface, and configure the callback events corresponding to the at least one target editor tool control to realize the tool function of the custom tool. The plugin file generation module is used to generate a plugin file corresponding to the custom tool based on the interactive interface blueprint and the Python script. The plugin file is used to integrate into the editor to execute the tool function of the custom tool based on the tool panel.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores at least one instruction or at least one program segment, which is loaded and executed by a processor to implement the development method of the engine editor tool as described in any one of claims 1 to 7.
10. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing at least one instruction or at least one program, the at least one instruction or the at least one program being loaded and executed by the processor to implement the development method of the engine editor tool as described in any one of claims 1 to 7.