Method for generating graphical nodes in visual programming and related apparatus
Patent Information
- Application Number
- CN202510473925.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-15
- Publication Date
- 2026-10-23
AI Technical Summary
[0004]然而,相关技术中,部分游戏开发引擎中的可视化编程系统仍不够完善,可视化编程系统的应用存在局限
[0020]本申请实施例提供了一种可视化编程中图形节点的生成方法,该方法可以通过解析代码标注信息,来生成可视化编程系统中的图形节点。具体的,该方法包括:获取节点程序代码及其对应的代码标注信息,该节点程序代码用于指示待生成的目标图形节点的功能逻辑,该代码标注信息用于指示该目标图形节点的节点属性信息。接着,对代码标注信息进行解析,以确定出目标图形节点中的各项节点元素各自对应的元素属性信息。进一步地,将各项节点元素各自对应的元素属性信息映射至图形节点模板,以生成目标图形节点。相关人员使用可视化编程系统时,可以通过目标图形节点为其中包括的节点元素配置节点元素参数,相应地,该节点元素参数将被传回目标图形节点的节点程序代码,由此通过导入节点元素参数的节点程序代码实现目标图形节点对应的目标节点功能。
Smart Images

Figure CN122963524A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of programming technology, and in particular to a method and related apparatus for generating graphical nodes in visual programming. Background Technology
[0002] A game development engine is a software platform that provides game developers with a basic framework and toolset, which can help simplify the game development process and improve game development efficiency.
[0003] With the widespread use of game development engines, traditional scripting methods have gradually revealed some problems. For example, for artists and designers who are not professional programmers, the barrier to entry for directly writing code is high, making it difficult to quickly and accurately realize their creative ideas. To solve this problem, visual programming systems in game development engines have emerged, which present complex code logic in the form of graphical nodes, making it easier for game creators to intuitively build game functions.
[0004] However, in related technologies, the visual programming systems in some game development engines are still not perfect, and the application of visual programming systems has limitations. Summary of the Invention
[0005] This application provides a method and related apparatus for generating graphical nodes in visual programming, which can improve the visual programming system in game development engines and expand the application scope of the visual programming system.
[0006] The first aspect of this application provides a method for generating graphical nodes in visual programming, the method comprising:
[0007] Obtain the node program code and the code annotation information corresponding to the node program code. The node program code is used to indicate the functional logic of the target graphic node to be generated, and the code annotation information is used to indicate the node attribute information of the target graphic node.
[0008] The code annotation information is parsed to determine the element attribute information corresponding to each node element in the target graphic node;
[0009] The element attribute information corresponding to each of the node elements is mapped to the graphic node template to generate the target graphic node. The target graphic node is used to support the configuration of node element parameters through the node elements. The node program code and the node element parameters are used to jointly implement the target node function corresponding to the target graphic node.
[0010] A second aspect of this application provides an apparatus for generating graphical nodes in visual programming, the apparatus comprising:
[0011] The acquisition module is used to acquire node program code and code annotation information corresponding to the node program code. The node program code is used to indicate the functional logic of the target graphic node to be generated, and the code annotation information is used to indicate the node attribute information of the target graphic node.
[0012] The parsing module is used to parse the code annotation information to determine the element attribute information corresponding to each node element in the target graphic node;
[0013] The generation module is used to map the element attribute information corresponding to each of the node elements to the graphic node template to generate the target graphic node. The target graphic node is used to support the configuration of node element parameters through the node elements. The node program code and the node element parameters are used to jointly implement the target node function corresponding to the target graphic node.
[0014] A third aspect of this application provides a computer device, the device comprising a processor and a memory:
[0015] The memory is used to store computer programs;
[0016] The processor is configured to perform, according to the computer program, the steps of the method for generating graphical nodes in visual programming as described in the first aspect above.
[0017] A fourth aspect of this application provides a computer-readable storage medium for storing a computer program for performing the steps of the method for generating graphical nodes in visual programming as described in the first aspect above.
[0018] A fifth aspect of this application provides a computer program product or computer program including 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 the steps of the graphical node generation method in the visual programming described in the first aspect.
[0019] As can be seen from the above technical solutions, the embodiments of this application have the following advantages:
[0020] This application provides a method for generating graphical nodes in visual programming. This method generates graphical nodes in a visual programming system by parsing code annotation information. Specifically, the method includes: obtaining node program code and its corresponding code annotation information. The node program code indicates the functional logic of the target graphical node to be generated, and the code annotation information indicates the node attribute information of the target graphical node. Next, the code annotation information is parsed to determine the element attribute information corresponding to each node element in the target graphical node. Further, the element attribute information corresponding to each node element is mapped to a graphical node template to generate the target graphical node. When using the visual programming system, users can configure node element parameters for the node elements included in the target graphical node. Correspondingly, these node element parameters are returned to the node program code of the target graphical node, thereby implementing the target node function by importing the node program code containing the node element parameters.
[0021] The method described above, by parsing the code annotation information corresponding to the node program code, can accurately and quickly determine the element attribute information of each node element in the target graphical node. This facilitates the efficient generation of target graphical nodes in the visual programming system based on the parsed element attribute information and the graphical node template, providing a new way to generate graphical nodes for visual programming systems. On the one hand, the code annotation information in this method can be flexibly written according to actual application needs, thereby generating target graphical nodes that meet those needs and flexibly improving the performance of the visual programming system. On the other hand, the programming language for the node program code can also be selected according to actual application needs. For example, a scripting language suitable for most business scenarios can be chosen to write the node program code. Therefore, the programming files generated by the visual programming system are also based on scripting languages, applicable to most business scenarios, thus expanding the application scope of the visual programming system. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying 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.
[0023] Figure 1 An architecture diagram of a computer system provided in an embodiment of this application;
[0024] Figure 2 A schematic diagram illustrating an application scenario of the method for generating graphical nodes in visual programming provided in this application embodiment;
[0025] Figure 3 A flowchart illustrating the method for generating graphical nodes in visual programming provided in this application embodiment;
[0026] Figure 4 A schematic diagram of the target graphical node provided in the embodiments of this application;
[0027] Figure 5 A schematic diagram illustrating the trigger parameter editing operation provided in the embodiments of this application;
[0028] Figure 6 A schematic diagram of the editor interface provided in an embodiment of this application;
[0029] Figure 7 A schematic diagram illustrating the synchronous update of node element parameters provided in an embodiment of this application;
[0030] Figure 8 A schematic diagram of the interface for custom configuration provided in an embodiment of this application;
[0031] Figure 9 A schematic diagram illustrating the nested element parameter types provided in this application embodiment;
[0032] Figure 10 This is a schematic diagram of the interface for editing target child node elements in a target node element, provided as an embodiment of this application.
[0033] Figure 11 A schematic diagram illustrating a method for generating graphical nodes in visual programming as provided in this application embodiment;
[0034] Figure 12 A schematic diagram of the structure of the device for generating graphical nodes in visual programming provided in the embodiments of this application;
[0035] Figure 13 This is a schematic diagram of the structure of the terminal device provided in the embodiments of this application;
[0036] Figure 14 This is a schematic diagram of the server structure provided in an embodiment of this application. Detailed Implementation
[0037] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present application.
[0038] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a particular 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 a non-exclusive inclusion; for example, a process, method, system, product, or apparatus 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 apparatus.
[0039] Currently, business users without a professional programming background can use the visual programming system in game development engines to realize their creative ideas. In the game development engine (Unity), Bolt is a tool for implementing visual programming. It supports low-level calls to programming languages (C Sharp, C#), and can implement corresponding game logic by connecting different graphical nodes. For example, it can implement simple character control, and can also build complex artificial intelligence (AI) decision trees.
[0040] Due to continuous updates and deployment maintenance, large-scale game projects typically use scripting languages (such as Lua and Python) to write business logic, rather than C#. However, Bolt generates programming files that are usually based on C#. To apply these Bolt-generated files to large-scale game projects, they need to be modified. This modification process requires meticulous handling of data interaction and function calls, and is prone to compatibility issues such as data type mismatches and inconsistent function signatures. Because of the high difficulty of modification and the numerous potential problems, the application of Bolt in Unity is significantly limited.
[0041] To address the problems existing in the aforementioned related technologies, this application provides a method for generating graphical nodes in visual programming. In this method, node program code and its corresponding code annotation information are first obtained. The node program code indicates the functional logic of the target graphical node to be generated, and the code annotation information indicates the node attribute information of the target graphical node. Next, by parsing the code annotation information, the element attribute information corresponding to each node element in the target graphical node is accurately and quickly determined. Then, the parsed element attribute information corresponding to each node element is mapped to a graphical node template, thereby efficiently generating the target graphical node in the visual programming system and providing a new way to generate graphical nodes for the visual programming system. This method allows the selection of the programming language for the node program code according to actual application needs. For example, Lua, a scripting language suitable for most business scenarios, can be selected to write the node program code. This ensures that the programming file generated by the visual programming system is also based on the Lua language, facilitating its direct application in the business logic of large-scale game projects, thereby expanding the application scope of the visual programming system.
[0042] To facilitate understanding of the method for generating graphical nodes in visual programming provided in this application embodiment, the computer system used to implement this method for generating graphical nodes in visual programming will be described below as an example.
[0043] See Figure 1 , Figure 1 An architecture diagram of a computer system provided in an embodiment of this application. Figure 1 The computer system 100 is a system architecture for implementing a method for generating graphical nodes in visual programming. The computer system 100 includes a terminal device 120 and a server 140.
[0044] The terminal device 120 has a programming application installed and running. Business personnel can use the programming application in the terminal device 120 to write node program code and the corresponding code annotation information. Then, the node program code and the code annotation information are transmitted to the server 140 so that the server 140 can execute the graphical node generation method in the visual programming provided in this application embodiment to generate the target graphical node.
[0045] Terminal device 120 can be connected to server 140 via wireless network or wired network.
[0046] Server 140 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud servers, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms.
[0047] For example, server 140 includes processor 144 and memory 142. Memory 142 stores computer programs, such as a computer program for executing the method for generating graphical nodes in visual programming according to embodiments of this application. Processor 144 reads the computer program from memory 142 to execute the method for generating graphical nodes in visual programming according to embodiments of this application. Specifically, when processor 144 executes the method for generating graphical nodes in visual programming, it can obtain node program code transmitted from terminal device 120, which indicates the functional logic of the target graphical node to be generated, and code annotation information, which indicates the node attribute information of the target graphical node. Then, the code annotation information can be parsed to determine the element attribute information corresponding to each node element in the target graphical node. Then, the element attribute information corresponding to each node element is mapped to a graphical node template to generate the target graphical node. This target graphical node supports configuring node element parameters through node elements, and the target node function corresponding to the target graphical node can be jointly implemented through node program code and node element parameters.
[0048] Optionally, server 140 undertakes the main computing work and terminal device 120 undertakes the secondary computing work; or, server 140 undertakes the secondary computing work and terminal device 120 undertakes the main computing work; or, server 140 and terminal device 120 adopt a distributed computing architecture for collaborative computing.
[0049] This application embodiment does not limit the form of the programming application installed on the terminal device 120, including but not limited to clients (Applications, Apps), mini-programs, etc., installed on the terminal device 120, and can also be in the form of web pages. Terminal device 120 can refer to one of multiple terminal devices; this embodiment only uses terminal device 120 as an example. The device type of terminal device 120 includes, but is not limited to, at least one of: smartphones, tablets, wearable devices, personal computers (PCs), laptops, and desktop computers.
[0050] Those skilled in the art will understand that the number of terminal devices 120 may be more or less. For example, there may be only one terminal device 120, or there may be multiple or more terminal devices 120. The embodiments of this application do not limit the number or type of terminal devices 120.
[0051] See Figure 2 , Figure 2 This is a schematic diagram illustrating an application scenario of the method for generating graphical nodes in visual programming provided in this application embodiment. The method is executed by a computer device, which may be, for example, a computer device... Figure 1 The server 140 is shown. The steps of the method for generating graphical nodes in visual programming performed by server 140 are as follows:
[0052] Server 140 can obtain node program code 201 and corresponding code annotation information 202 from terminal device 120. Node program code 201 indicates the functional logic of the target graphic node to be generated, and code annotation information 202 indicates the node attribute information of the target graphic node.
[0053] After the server 140 obtains the node program code 201 and code annotation information 202, it can parse the code annotation information 202 to determine the element attribute information 203 corresponding to each node element in the target graphic node from the parsing results.
[0054] Then, the element attribute information 203 corresponding to each node element can be mapped to the graphic node template 204 to generate the target graphic node 205. When business personnel use the visual programming system, they can configure node element parameters 206 for the node elements in the target graphic node 205. These node element parameters 206 will be passed back to the node program code 201. Then, the target node function corresponding to the target graphic node can be implemented based on the node program code 201 that imports the node element parameters 206.
[0055] The following describes in detail the method for generating graphical nodes in visual programming provided in this application through method embodiments.
[0056] See Figure 3 , Figure 3 This is a flowchart illustrating a method for generating graphical nodes in visual programming, as provided in an embodiment of this application. This method for generating graphical nodes in visual programming is executed by a computer device. For ease of description, the executing entity of this method for generating graphical nodes in visual programming will be referred to below. Figure 1 The example described uses server 140 in the computer system shown. Figure 3 As shown, the method for generating graphical nodes in this visual programming includes the following steps:
[0057] S301: Obtain the node program code and the corresponding code annotation information. The node program code is used to indicate the functional logic of the target graphic node to be generated, and the code annotation information is used to indicate the node attribute information of the target graphic node.
[0058] A visual programming system is a development environment for building programs through a graphical interface. The system includes graphical nodes for implementing various functions. Business users can design the program's business logic by dragging and dropping, connecting graphical nodes, and configuring node parameters. This allows the system to implement corresponding business functions based on the business logic constructed by the users. Programs built using a visual programming system can include, but are not limited to, game programs, modeling programs, and machine learning programs. This application does not specifically limit the development content of the visual programming system. A graphical node is the basic unit in the visual programming system, representing an independent functional module (such as a function, data manipulation, or event trigger).
[0059] The target graphic node to be generated refers to the generation target in this application embodiment. The target graphic node can realize its corresponding function in the visual programming system.
[0060] Node program code is used to instruct the functional logic of the target graphic node to be generated. That is, node program code is the functional logic code written for the target graphic node to be generated, which defines the specific functions that the target graphic node to be generated can implement at runtime. The programming language of node program code can be any of Lua, Python, and C#, etc. This application does not specifically limit the programming language of node program code.
[0061] The code annotation information corresponding to the node program code is used to indicate the node attribute information of the target graphical node. The node attribute information of the target graphical node describes the attribute information of the target graphical node in the visual programming system. For example, node attribute information may include, but is not limited to, node type, basic node information, and port information included in the node. That is, the code annotation information defines the attribute information of the target graphical node, such as node type, basic node information, and port information. The code annotation information can be written using any annotation language, such as EmmyLua. This application does not specifically limit the annotation language used when writing the code annotation information.
[0062] As an example, code annotation information can be used to indicate the port attribute information of each port in the target graphical node, the node type of the target graphical node, and the basic node information of the target graphical node. The port attribute information includes at least the port data type.
[0063] For example, the node type of the target graphical node is used to describe the functional type of the target graphical node in the visual programming interface. For example, the node type is used to affect the display and export functional logic. The node type may include, but is not limited to, data nodes, event nodes, synchronous nodes, asynchronous nodes, variable nodes, macro nodes, condition nodes, and process nodes.
[0064] The port attribute information of the port in the target graphical node is used to describe the specific information of the port. For example, the port attribute information includes at least the port data type, which refers to the data type supported by the port. Port data types can include, but are not limited to, Boolean (Bool), Integer (Int), Float, Double, String, Enumeration (Enum), List, Alias, Structure (Struct), Generic, and composite structures (i.e., nested combinations of the above node types). Optionally, the port attribute information may also include the port name, port comments, etc. This embodiment of the application does not impose any limitations on the specific content included in the port attribute information.
[0065] The basic information of the target graphic node is used to describe the basic information of the target graphic node. For example, the basic information of the node may include, but is not limited to, the node name, node comments, and custom attributes of the node. Furthermore, the custom attributes of the node can be extended according to actual needs.
[0066] Thus, as can be seen from the above, various node attribute information required for the target graphic node can be set through code annotation information, thereby ensuring the generation of a fully functional and rich target graphic node.
[0067] Taking Lua code as an example, the code annotation information corresponding to Lua code is implemented using EmmyLua. That is, EmmyLua can be used to write the code annotation information corresponding to Lua code according to the preset format definition rules.
[0068] For example, the format definition rules can be referred to in Table 1 below.
[0069] Table 1
[0070]
[0071]
[0072] Specifically, code annotations written using the "class" format definition rules can be used to indicate a class; code annotations written using the "alias" format definition rules can be used to define aliases for port data types; code annotations written using the "parameter" format definition rules can be used to describe function parameters; code annotations written using the "field" format definition rules can be used to describe fields in a class; code annotations written using the "generic" format definition rules can be used to define port data types as generic; and code annotations written using the "function" format definition rules can be used to declare functions.
[0073] The @comment annotation in the code above can be extended in depth to support custom data content. For example, it can be extended to mark synchronous code with @sync, classify by category with @category= / object management / combat objects, mark asynchronous code with @async, export content with @export, and mark the person in charge with @owner=xxx, etc.
[0074] It should be noted that the code annotation information indicates the node attribute information of the target graphic node according to the preset format definition rules. This format definition rule is partly determined by the framework layer and partly by the EmmyLua configuration information annotated in the Lua file, so that the code annotation information can define the node attribute information of the target graphic node according to the format definition rules.
[0075] It should be noted that during program execution, only the node program code is executed, and the code annotation information has no relation to the actual execution logic of the node program code.
[0076] For example, the obtained node program code and code annotation information can be shown in the following code: --- @class MonsterCreateNode:FlowNode @class_node @owner=Pudge @async @export @name=Refresh Monster @category= / Object Management / Combat Object
[0077] localMonsterCreateNode=singleton("MonsterCreateNode")
[0078] ---@function@export@version=1
[0079] ---@generic GenericLayerEntityUniqueId@allow_types=Monster SpawnerUniqueId|LevelUnit GroupId
[0080] ---@param monsterIds GenericLayerEntityUniqueId[]@name = List of monster generator IDs
[0081] ---@param needReborn boolean@name = Whether to refresh repeatedly
[0082] ---@flowout onFinish
[0083] ---@valueout monsterIds MonsterSpawnerUniqueId[]@name = List of monster generator IDs
[0084] function MonsterCreateNode.Execute(flowObject,_nodeId,monsterIds,needReborn,callback,generic)
[0085] end
[0086] function MonsterCreateNode.Undo(flowObject,_nodeId)
[0087] end
[0088] return MonsterCreateNode
[0089] In the code above, each line of code that includes the prefix "---@" is code annotation information, while the code that does not include the prefix is node program code.
[0090] As an example, programmers can write node program code and corresponding code annotation information using a programming application, and then transmit the node program code and its corresponding code annotation information to a server so that the server can generate the target graphical node accordingly. Alternatively, the server can also obtain the node program code and code annotation information from a database. This application does not specifically limit the source from which the node program code and code annotation information are obtained.
[0091] S302: Parse the code annotation information to determine the element attribute information corresponding to each node element in the target graphic node.
[0092] The target graph node includes various node elements, which refer to the basic data that constitutes the target graph node. For example, the node elements may include, but are not limited to, the node name, node type, and the various ports included in the node.
[0093] The element attribute information corresponding to each node element is used to describe the attribute information corresponding to each node element. For example, the element attribute information corresponding to the node name is the specific node name written by the programmer, the element attribute information corresponding to the node type is the type of the target graphic node written by the programmer, and the element attribute information corresponding to the port can be the port data type and port name, etc. In this regard, this application does not specifically limit the element attribute information corresponding to each node element.
[0094] For example, code annotation information can be parsed according to preset parsing rules to determine the element attribute information corresponding to each node element in the target graphic node from the parsing results.
[0095] As an example, taking EmmyLua as the annotation language for code annotation information, the ANother Tool for Language Recognition (Antlr4) can be used as the parser for EmmyLua code annotation information. The parser can use the preset parsing rules provided by Antlr4, such as lexical and syntactic parsing rules, to parse the EmmyLua code annotation information, obtaining the parsing results. From these results, the element attribute information corresponding to each node element in the target graphical node can be directly determined. For example, the parsing results may include a preset structure, which is composed of various node elements. The element attribute information corresponding to each node element can be directly read from its position within the preset structure.
[0096] S303: Map the element attribute information corresponding to each node element to the graphic node template to generate the target graphic node. The target graphic node is used to support the configuration of node element parameters through node elements. The node program code and node element parameters are used together to implement the target node function corresponding to the target graphic node.
[0097] A graphical node template indicates the template structure corresponding to a target graphical node in the visual programming interface; that is, the structure corresponding to a graphical node with a blank graphical node template. Mapping the element attribute information of each node element to the graphical node template—in other words, filling the corresponding positions in the graphical node template with the element attribute information of each node element—generates the target graphical node. The target graphical node contains node elements filled with their corresponding element attribute information.
[0098] For example, refer to Figure 4 , Figure 4 This is a schematic diagram of the target graphic node provided in the embodiments of this application. By parsing the code annotation information in S301 above, the element attribute information corresponding to each node element in the target graphic node can be obtained. For example, one port name is the monster generator ID list, and another port name is whether to refresh repeatedly. By mapping the element attribute information corresponding to each node element in the parsed target graphic node to the graphic node template, the following can be obtained: Figure 4 The target graphic node "Refresh Monster" 401 can be viewed and edited in the details panel 402. The element attribute information of each node element in the target graphic node can be viewed and edited.
[0099] As seen from the steps above, the flow of code annotation information is as follows: First, annotation information is generated for the Lua node code. Second, the code annotation information is parsed to determine the element attribute information corresponding to each node element in the target graphical node. The parsed element attribute information corresponding to each node element can be stored as an interface file. Finally, the element attribute information corresponding to each node element can be mapped to the graphical node template to obtain the target graphical node.
[0100] Node element parameters refer to the specific parameters configured for node elements in the target graphic node in the visual programming interface, which affect the specific functions of the target graphic node at runtime.
[0101] The target graphical node is used to support configuring node element parameters through node elements. That is, business users can edit the target graphical node in the visual programming interface. For example, business users can configure corresponding node element parameters for node elements within the target graphical node. It should be understood that, taking a port in the target graphical node as an example, if the element attribute information corresponding to that port is of the port data type, the programmer restricts the types of node element parameters that can be configured for that port through this port data type. Therefore, business users need to configure node element parameters with that port data type for that port.
[0102] Once the node element parameters corresponding to the node element are obtained, the obtained node element parameters can be passed back to the corresponding position of the node element in the node program code. Thus, the target node function corresponding to the target graphic node can be implemented based on the node program code containing the node element parameters. In other words, by running the node program code containing the node element parameters, the target node function corresponding to the target graphic node can be implemented.
[0103] For example, business personnel can Figure 4 In the details panel 402, node element parameters are configured for the node elements. After obtaining the node element parameters, they can be passed back to the node program code corresponding to the above code annotation information, thereby running the node program code containing the node element parameters, and thus realizing the target node function corresponding to the target graphic node.
[0104] The target node function refers to the specific function that the target graphic node can achieve, which is determined by the node program code and node element parameters.
[0105] In the method for generating graphical nodes in visual programming provided in this application embodiment, the method can generate graphical nodes in the visual programming system by parsing code annotation information. By parsing the code annotation information corresponding to the node program code, this method can accurately and quickly determine the element attribute information corresponding to each node element in the target graphical node. This helps to efficiently generate the target graphical node in the visual programming system based on the parsed element attribute information and the graphical node template, providing a new way to generate graphical nodes for the visual programming system. On the one hand, the code annotation information in the above method can be flexibly written according to actual application needs, thereby generating target graphical nodes that meet the actual application requirements and flexibly improving the performance of the visual programming system. On the other hand, the programming language of the node program code in the above method can also be selected according to actual application needs. For example, a scripting language suitable for most business scenarios can be selected to write the node program code. Therefore, the programming files generated by the visual programming system are also based on scripting languages, applicable to most business scenarios, expanding the application scope of the visual programming system.
[0106] • Methods for parsing code annotation information
[0107] In one possible implementation, the step of "parse the code annotation information to determine the element attribute information corresponding to each node element in the target graphic node" in S302 above may include S3021-S3022:
[0108] S3021: For each sentence annotation information in the code annotation information, perform lexical analysis on the sub-annotation information to obtain the lexical analysis result corresponding to the sub-annotation information, and perform syntax analysis based on the lexical analysis result to obtain the syntax analysis result corresponding to the sub-annotation information.
[0109] In code annotation information, each sentence annotation refers to the result of dividing the code annotation information into sentences. For example, the code annotation information of each line can be treated as a separate sentence annotation.
[0110] Lexical analysis is used to segment and parse sub-tag information. That is, it can parse multiple tag units included in the sub-tag information separately, thereby obtaining the meanings corresponding to each tag unit. These meanings of each tag unit can then form the lexical analysis result of the sub-tag information. Here, each tag unit refers to each basic unit in the sub-tag information, which can be determined according to a preset unit partitioning rule.
[0111] For example, for each sentence annotation in the code annotation information, lexical analysis can be performed on the sub-annotation information according to preset lexical analysis rules to obtain the corresponding lexical analysis result. The preset lexical analysis rules refer to the rules used when performing lexical analysis on the sub-annotation information.
[0112] Syntax parsing is used to analyze the lexical analysis results corresponding to sub-tag information to verify the validity of the sub-tag information's grammatical structure and to obtain the corresponding syntax parsing result. The syntax parsing result of the sub-tag information indicates the overall meaning of the sub-tag information with a valid grammatical structure.
[0113] For example, after obtaining the lexical analysis results corresponding to each sentence's annotation information, for each sentence's annotation information, grammatical analysis can be performed based on the lexical analysis results corresponding to that sub-annotation information according to preset grammatical analysis rules, thus obtaining the grammatical analysis result corresponding to that sub-annotation information. The preset grammatical analysis rules refer to the rules used when performing grammatical analysis on the lexical analysis results corresponding to the sub-annotation information.
[0114] S3022: Based on the syntax parsing result corresponding to the sub-annotation information, determine the element attribute information corresponding to the node element indicated by the sub-annotation information.
[0115] After determining the syntax parsing result corresponding to the sub-tag information, the element attribute information corresponding to the node element defined by the sub-tag information can be determined based on the overall meaning expressed by the sub-tag information as indicated by the syntax parsing result.
[0116] Therefore, using the above method, with each sentence's annotation information as the parsing unit, lexical analysis can be performed on the sub-annotation information first to preliminarily parse the meaning indicated by each tag unit in the sub-annotation information, thus obtaining the lexical analysis result corresponding to the sub-annotation information. Then, based on the lexical analysis result, syntactic analysis can be performed to further verify the syntactic structure of the sub-annotation information. If the syntactic structure of the sub-annotation information passes verification, the corresponding syntactic analysis result indicating the overall meaning of the sub-annotation information can be obtained. Finally, based on the syntactic analysis result corresponding to the sub-annotation information, the element attribute information corresponding to the node elements indicated by the sub-annotation information can be determined, thereby accurately parsing the element attribute information corresponding to the node elements defined by the sub-annotation information.
[0117] In one possible implementation, "performing lexical analysis on the sub-tag information to obtain the lexical analysis result corresponding to the sub-tag information" in S3021 above may include S3021-1:
[0118] S3021-1: According to the preset lexical analysis rules, determine the meaning of each unit corresponding to each tag unit included in the sub-tag information, and use it as the lexical analysis result corresponding to the sub-tag information. The lexical analysis rules record multiple preset tag units and their respective unit meanings.
[0119] The unit meaning corresponding to the marker unit is used to indicate the actual meaning indicated by the marker unit as determined by lexical analysis.
[0120] The lexical parsing rules record multiple preset marker units and their corresponding unit meanings. During the lexical parsing process, the unit meanings corresponding to each marker unit can be found from the lexical parsing rules based on each marker unit in the sub-label information. Thus, the unit meanings corresponding to each marker unit can be used as the lexical parsing results corresponding to the sub-label information.
[0121] For example, the preset lexical parsing rules can be referred to in Table 2 below.
[0122] Table 2
[0123]
[0124]
[0125] Taking the sub-annotation "---@param needReborn boolean@name=Whether to refresh repeatedly" as an example, the various marker units in the sub-annotation include "---@param", "needReborn", "boolean", and "@name=Whether to refresh repeatedly". Based on these marker units, according to the lexical analysis rules, the unit meaning corresponding to each marker unit can be found. For example, the unit meaning corresponding to "---@param" is "AT_PARAM", the unit meaning corresponding to "needReborn" is "VAR", the unit meaning corresponding to "boolean" is "BOOLEAN", and the unit meaning corresponding to "@name=Whether to refresh repeatedly" is "AT_COMMENT". In this way, the unit meanings corresponding to each of the above marker units can be combined to form the lexical analysis result corresponding to this sub-annotation.
[0126] It should be noted that for any parts not declared in the sub-annotation information, the default values in the graphic node template can be used to fill them in.
[0127] Thus, as can be seen from the above, by recording multiple marker units and their corresponding unit meanings in the preset lexical parsing rules, the unit meanings of each marker unit included in the sub-label information can be determined, thereby obtaining the lexical parsing results corresponding to the sub-label information. This allows for the initial decomposition of each sentence's label information into marker units with clear meanings, which helps to quickly determine the meaning expressed by the sub-label information in the subsequent process.
[0128] In one possible implementation, the lexical analysis result includes the meaning of each unit corresponding to the tagging unit in the sub-tag information. The phrase "perform syntax analysis based on the lexical analysis result to obtain the syntax analysis result corresponding to the sub-tag information" in S3021 above can include S3021-2:
[0129] S3021-2: According to the preset syntax parsing rules, based on the meaning of each unit corresponding to each tag unit in the lexical parsing result, construct the syntax tree data corresponding to the sub-tag information, which serves as the syntax parsing result corresponding to the sub-tag information.
[0130] The syntax tree data corresponding to the sub-tag information refers to the parsing data with a legal grammatical structure determined from the preset syntax parsing rules based on the lexical parsing results. Furthermore, the syntax tree data corresponding to the sub-tag information that is finally determined can be used as the syntax parsing result corresponding to the sub-tag information.
[0131] For example, based on the meaning of each tag unit in the lexical analysis result, the grammatical structure corresponding to the sub-tag information can be found from the preset syntax parsing rules and the corresponding data can be filled in to construct the syntax tree data corresponding to the sub-tag information.
[0132] As an example, the phrase "constructing syntax tree data corresponding to sub-annotation information based on the unit meanings corresponding to each tag unit in the lexical analysis results according to preset syntax parsing rules" in S3021-2 above can include S11-S13:
[0133] S11: According to the syntax parsing rules, based on the type tagging units included in the lexical parsing results, determine the syntax tree structure corresponding to the sub-tag information. The type tagging units are used to indicate the statement type to which the sub-tag information belongs. The syntax parsing rules record the syntax tree structure corresponding to each of the preset type tagging units.
[0134] Type marker units are marker units in the lexical analysis results used to indicate the statement type to which the sub-tag information belongs. The syntax tree structure corresponding to the sub-tag information refers to the legal syntax structure that the sub-tag information should satisfy.
[0135] The syntax parsing rules record the syntax tree structure corresponding to each of the multiple preset type marker units. During the syntax parsing process, the syntax tree structure corresponding to the type marker unit can be found from the syntax parsing rules based on the type marker unit in the lexical analysis results.
[0136] For example, the preset syntax parsing rules can be found in Table 3 below.
[0137] Table 3
[0138]
[0139]
[0140] Taking the sub-annotation information "---@param needReborn boolean@name=whether to refresh repeatedly" as an example, in its corresponding lexical analysis result, the type tag unit is "AT_PARAM". Based on this type tag unit, the syntax tree structure corresponding to this sub-annotation information can be found from the syntax parsing rules as "AT_PARAM var typeNameatComment*".
[0141] S12: For each tree element in the syntax tree structure corresponding to the sub-annotation information, based on the syntax parsing rules and the unit meaning of the tag unit corresponding to the tree element in the lexical parsing results, determine the element content corresponding to the tree element. The syntax parsing rules also record the element parsing methods corresponding to multiple preset tree elements.
[0142] Tree elements refer to the constituent elements of a syntax tree structure. For example, taking the syntax tree structure "AT_PARAM vartypeName atComment*", "AT_PARAM", "var", "typeName", and "atComment*" all represent tree elements in the syntax tree structure.
[0143] The element content corresponding to a tree element refers to the specific content corresponding to the tree element. The syntax parsing rules also record the parsing methods for multiple preset tree elements, that is, the syntax parsing rules also record the parsing methods for resolving the element content corresponding to the tree element.
[0144] For example, after determining the syntax tree structure corresponding to the sub-annotation information, the parsing method corresponding to each tree element in the syntax tree structure can be searched in the syntax parsing rules. The element parsing method for a given tree element can be determined based on the meaning of the unit corresponding to the tagging unit in the lexical analysis result, thus determining the element content. For instance, taking the tree element "var" as an example, its parsing method in the syntax parsing rules is "VAR". Therefore, the meaning of the unit corresponding to the tagging unit in the lexical analysis result can be directly used as the element content, i.e., "needReborn" can be directly used as the element content. In this way, the element content corresponding to each tree element can be determined using the above method.
[0145] S13: Determine the syntax tree data corresponding to the sub-label information based on the syntax tree structure corresponding to the sub-label information and the content of each element in the tree.
[0146] After determining the syntax tree structure corresponding to the sub-annotation information and the content of each tree element, the content of each tree element can be filled into the syntax tree structure to obtain the syntax tree data corresponding to the sub-annotation information.
[0147] Taking the sub-annotation information "---@param needReborn boolean@name=whether to refresh repeatedly" as an example, the corresponding syntax tree data should be "AT_PARAM needReborn BOOLEAN@name=whether to refresh repeatedly". It is used to indicate that the sub-annotation information defines a port parameter of a node. The data type of the port is boolean, and the parameter name of the port is needReborn, which means whether to refresh repeatedly.
[0148] Thus, as can be seen from the above, by recording multiple type marker units and their corresponding syntax tree structures in the preset syntax parsing rules, the syntax tree structure corresponding to the sub-annotation information can be initially determined. Furthermore, based on the syntax parsing rules and lexical analysis results, the element content corresponding to the tree element in the syntax tree structure can be determined and filled into the corresponding syntax tree structure, thereby constructing the syntax tree data corresponding to the sub-annotation information, so that the computer device can accurately understand the true meaning expressed by the code annotation information.
[0149] • Parameter editing for target graphic nodes
[0150] In one possible implementation, the method provided in this application embodiment may further include S304:
[0151] S304: Receive parameter editing operation for the target graphic node displayed in the editor interface. The parameter editing operation is used to edit the node element parameters corresponding to the target node element in the target graphic node.
[0152] The editor interface can include multiple graphical nodes, including the target graphical node. The editor interface refers to the interface used to edit graphical nodes in a visual programming system. That is, business personnel can edit the connection relationship between different graphical nodes in the editor interface, and can also edit the node element parameters of the node elements in the graphical nodes.
[0153] The target node element refers to the node element within the target graphic node that is being edited. The parameter editing operation is used to edit the parameters of the node element corresponding to the target node element within the target graphic node. That is, business personnel can trigger the parameter editing operation on the target node element within the target graphic node to edit its node element parameters. For example, the parameter editing operation can be triggered by entering parameters in the edit box of the node element parameter corresponding to the target node element. This application does not specifically limit the triggering method of the parameter editing operation.
[0154] For example, business personnel can trigger parameter editing operations for a target graphic node by entering parameters in the parameter editing box corresponding to the target node element in the editor interface. After receiving the parameter editing operation, the terminal device can display the edited parameters in the parameter editing box corresponding to the target node element.
[0155] As an example, see Figure 5 , Figure 5 This is a schematic diagram illustrating the trigger parameter editing operation provided in the embodiments of this application, such as... Figure 5As shown, the target graphical node is "Add Entry" 501. The target graphical node includes an object identifier (ID), entry ID, lifecycle, lifecycle parameters, Cd time (seconds), and update type (add / delete), etc. Taking the lifecycle parameter as an example, for instance... Figure 5 As shown, Figure 5 The variable type, including the lifecycle parameter, is Float502. Figure 5 The system also includes a node element parameter editing box 503 corresponding to the lifecycle parameter. Salespeople can edit the specific value of the lifecycle parameter in this node element parameter editing box 503. That is, salespeople can trigger a parameter editing operation on the lifecycle parameter in "Add Entry" 501 by clicking on this node element parameter editing box 503. After the terminal device receives the parameter editing operation, it can display the edited parameter in the node element parameter editing box 503.
[0156] Thus, as can be seen from the above, business personnel can edit the node element parameters of the target node in the target graphic node in the editor interface, thereby completing the configuration of the target node element. At the same time, it has a real-time visual feedback mechanism that can display the edited node element parameters in real time.
[0157] In one possible implementation, the editor interface includes a node sub-interface, a content sub-interface, and a details sub-interface. The node sub-interface displays the connection relationships between multiple graphic nodes, the content sub-interface displays the overview node content obtained by organizing the node content of each of the multiple graphic nodes, and the details sub-interface displays the node details content of any graphic node. The target graphic node is one of the multiple graphic nodes. The "receiving parameter editing operation for the target graphic node displayed in the editor interface" in S304 above may include S3041:
[0158] S3041: Receive parameter editing operations for target node elements triggered in the target sub-interface, where the target sub-interface is either the content sub-interface or the details sub-interface.
[0159] As an example, the editor interface is a blueprint editor interface that integrates several custom property editor extension plugins (OdinEditor) editor window interfaces and a visual scripting tool (Flowcanvas) interface. The node sub-interface is a modified version of the Flowcanvas plugin, providing the ability to display graphical nodes and edit the connections between them. The editor window interface includes content sub-interfaces and details sub-interfaces.
[0160] The node sub-interface is used to display the connection relationships between multiple graphical nodes. That is, the node sub-interface includes multiple graphical nodes, and business users can configure the connection relationships between these nodes to implement corresponding functional logic. For example, refer to... Figure 6 , Figure 6 A schematic diagram of the editor interface provided in the embodiments of this application is shown below. Figure 6 As shown, the node sub-interface 601 includes multiple graphical nodes, such as parallel nodes, waiting, showing or hiding non-player characters (NPCs), adding entries, and NPC in-place actions. Business personnel can configure the connection relationships between multiple graphical nodes in the node sub-interface 601.
[0161] The node content of multiple graph nodes refers to the content of the node elements corresponding to each graph node, such as the node name and port name. This application does not specifically limit the node content of multiple graph nodes.
[0162] Overview node content refers to the node content obtained by organizing the individual node content of multiple graphic nodes included in the node sub-interface. For example, it can be organized according to the type of node content, and the node content of the same type can be grouped together to obtain the overview node content.
[0163] The content sub-interface is used to display the overview node content obtained by organizing the individual node content of multiple graphical nodes, such as... Figure 6 As shown, the content sub-interface 602 includes overview node content, such as the monster information bar which includes the node content of each of the multiple graphic nodes related to the monster. That is, the overview node content in the monster information bar is obtained by organizing the node content of each of the multiple graphic nodes related to the monster.
[0164] The details sub-interface is used to display the node details of any graphical node. Node details refer to the detailed information corresponding to the node elements of the graphical node. For example, node details may include, but are not limited to, port type, port name, node name, and node attributes. This application does not specifically limit the node details content in this regard. Figure 6 As shown, taking the graphical node of adding an entry as an example, the details sub-interface 603 includes the node details of the graphical node of adding an entry, including the names of each port in the added entry, the port type, and the node element parameters corresponding to the port. For example, the port includes the object ID, entry ID, lifecycle, lifecycle parameter, cd time (seconds), and update type (add / delete). Taking the lifecycle parameter as an example, the port type is Float, and its corresponding node element parameter is 0.
[0165] The target graphic node is one of multiple graphic nodes; that is, the target graphic node is one of the multiple graphic nodes displayed in the node sub-interface that has had its parameter editing operation triggered.
[0166] The target sub-interface refers to the interface that receives parameter editing operations. The target sub-interface can be either the content sub-interface or the details sub-interface. That is, business personnel can trigger parameter editing operations in the content sub-interface or the details sub-interface.
[0167] For example, business users can trigger parameter editing operations on target node elements in the target sub-interface to edit the node element parameters corresponding to the target node element, such as... Figure 6 As shown, taking the target sub-interface as the details sub-interface 603 as an example, and the target node element as the lifecycle parameter, in the details sub-interface 603, business personnel can trigger parameter editing operations for the lifecycle parameter by clicking the corresponding node element parameter editing box 604. Upon receiving this parameter editing operation, the terminal device can display the edited node element parameter.
[0168] Thus, as can be seen from the above, business personnel can trigger parameter editing operations on target node elements in the content sub-interface, or they can trigger parameter editing operations on target node elements in the details sub-interface. This helps business personnel to trigger parameter editing operations based on a simpler interface, thereby improving the ease of operation for business personnel.
[0169] In one possible implementation, after step S3041, the method provided in this application embodiment may further include S305:
[0170] S305: In response to the parameter editing operation, the node element parameters corresponding to the target node element in the target sub-interface are displayed as the edited parameters, and the node element parameters corresponding to the target node element in the node sub-interface and the node element parameters corresponding to the target node element in the non-target sub-interface are all updated and displayed as the edited parameters.
[0171] When the target sub-interface is a content sub-interface, the non-target sub-interface is a details sub-interface; when the target sub-interface is a details sub-interface, the non-target sub-interface is a content sub-interface.
[0172] A non-target sub-interface refers to an interface that has not received parameter editing operations. It should be noted that parameter editing operations cannot be triggered within a node sub-interface. Therefore, when the target sub-interface is a content sub-interface, the non-target sub-interface is a details sub-interface; conversely, when the target sub-interface is a details sub-interface, the non-target sub-interface is a content sub-interface.
[0173] In response to parameter editing operations, the terminal device can display the edited parameters of the node elements corresponding to the target node element in the target sub-interface. For example, after a salesperson edits the parameters of the node elements corresponding to the target node element in the target sub-interface, the edited parameters can be displayed in the parameter editing box of the target node element. Simultaneously, the terminal device can also synchronously update and display the edited parameters of the node elements corresponding to the target node element in other sub-interfaces.
[0174] It should be understood that the same target graphical node can be displayed in different forms in the node sub-interface, content sub-interface, and details sub-interface. For example, the node sub-interface can simply display the connection relationship between the target graphical node and other graphical nodes, as well as the port names and node element parameters of the target graphical node. The overview node content displayed in the content sub-interface includes the node element parameters of the target node element, and the details sub-interface includes detailed information about the target graphical node. Therefore, when a salesperson triggers a parameter editing operation on a target node element, the node element parameters of the target node element in other interfaces can be modified simultaneously, that is, the node element parameters corresponding to the target node element are updated to the edited parameters.
[0175] Thus, as can be seen from the above, when a salesperson triggers a parameter editing operation on a target node element, the node element parameters corresponding to the target node element can be kept updated synchronously in the content sub-interface, node sub-interface, and details sub-interface. This ensures that the node element parameters corresponding to the target node element remain synchronized in the editor interface, thereby ensuring that the target node element can achieve seamless data flow across multiple sub-interfaces.
[0176] In one possible implementation, the node sub-interface, content sub-interface, and details sub-interface each include a target view corresponding to the target node element, and the target views included in each of the node sub-interface, content sub-interface, and details sub-interface are associated with the same target view model.
[0177] The phrase "update and display the node element parameters corresponding to the target node element in the node sub-interface and the node element parameters corresponding to the target node element in the non-target sub-interface as the edited parameters" in S305 above can include S3051-S3053:
[0178] S3051: In response to the parameter editing operation, a first message is sent to the target view model through the target view in the target sub-interface. The first message is used to indicate that the node element parameter corresponding to the target node element is set to the edited parameter.
[0179] The target view (V) corresponding to the target node element is used to display the target node element and receive events from business users' interactions. It does not contain complex business logic or data processing operations. The target view corresponding to the target node element is included in the node sub-interface, content sub-interface, and detail sub-interface. That is, the target node element has a corresponding target view in the node sub-interface, the content sub-interface, and the detail sub-interface. It should be understood that the target view of the target node element can be different in different sub-interfaces; that is, the representation of the target node element can be different in different sub-interfaces.
[0180] The target view model (VM) contains the rules for business logic and data processing. The target view model is used to update the node element parameters corresponding to the target node element in different sub-interfaces.
[0181] It should be noted that the target view refers to the 'V' in the Model-View-ViewModel (MVVM) pattern, and the target view model refers to the 'VM' in the MVVM pattern, which includes the control logic (controller). That is, all editing operations can be implemented through the target view model, thus simplifying the model implementation. In this embodiment, the MVVM pattern is used for interface editing, which features flexible data binding methods, supports one-to-many data binding, and allows for simultaneous modification of parameters of the same node element across multiple interfaces.
[0182] The target views included in the node sub-interface, content sub-interface, and details sub-interface are all associated with the same target view model. That is, through the same target view model, the node element parameters corresponding to the target node elements displayed in the above three sub-interfaces can be controlled synchronously.
[0183] The first message refers to the message sent from the target view in the target sub-interface to the target view model. It is used to indicate that the node element parameters corresponding to the target node elements displayed in the target sub-interface are set to the edited parameters.
[0184] In response to parameter editing operations, the terminal device can send a first message to the target view model through the target view in the target sub-interface, so that the target view model can send messages to the other two sub-interfaces to synchronously update the node element parameters corresponding to the target node element.
[0185] S3052: Send a second message to the target view in the node sub-interface and the target view in the non-target sub-interface through the target view model. The second message is used to indicate that the node element parameters corresponding to the target node element are set to the edited parameters.
[0186] The second message refers to the message sent by the target view model to the node sub-interface and non-target sub-interface, which is used to instruct the node element parameters corresponding to the target node element to be set to the edited parameters.
[0187] Once the target view model receives the first message, it can read the edited parameters from the first message. Then, it can send the second message to the target view in the node sub-interface and the target view in the non-target sub-interface to synchronously update the node element parameters corresponding to the target node element in the node sub-interface and the non-target sub-interface.
[0188] For example, refer to Figure 7 , Figure 7 This is a schematic diagram of synchronously updating node element parameters provided in an embodiment of this application. The target view 701 in the target sub-interface can send a first message to the target view model 702. After the target view model 702 reads the edited parameters from the first message, it can send a second message to the target view 703 in the node sub-interface and the target view 704 in the non-target sub-interface to synchronously update the node element parameters corresponding to the target node elements in the node sub-interface and the non-target sub-interface.
[0189] S3053: Through the target view in the node sub-interface, update and display the node element parameters corresponding to the target node element in the node sub-interface as the edited parameters; through the target view in the non-target sub-interface, update and display the node element parameters corresponding to the target node element in the non-target sub-interface as the edited parameters.
[0190] When the target view in the node sub-interface receives the second message, it can read the edited parameters from the second message, and then update the node element parameters corresponding to the target node element in the node sub-interface to the edited parameters through the target view in the node sub-interface.
[0191] When the target view in the non-target sub-interface receives the second message, it can read the edited parameters from the second message. Then, through the target view in the non-target sub-interface, the node element parameters corresponding to the target node element in the non-target sub-interface can be updated and displayed with the edited parameters.
[0192] Therefore, when business personnel modify the node element parameters corresponding to the target node element in the target sub-interface, no additional operation is required. Through the binding relationship between the target view included in each of the three sub-interfaces and the same target view model, the target view model can quickly capture the change information and synchronize the edited parameters to other sub-interfaces, realizing seamless data flow between multiple interfaces and ensuring the continuity and consistency of the entire development process.
[0193] In one possible implementation, the target view model is associated with the target model corresponding to the target node element, and the method provided in this application embodiment may further include S306-S307:
[0194] S306: Send a third message to the target model through the target view model. The third message is used to indicate that the node element parameters corresponding to the target node element have been set to the edited parameters.
[0195] The target model (Model, M) in the MVVM pattern is used to store and manage the data corresponding to the target node elements. The target view model is associated with the target model corresponding to the target node element; that is, there is a one-to-one binding relationship between the target view model and the target model corresponding to the target node element.
[0196] The third message refers to the message sent from the target view model to the target model, which indicates that the node element parameters corresponding to the target node element have been set to the edited parameters.
[0197] Through the target view model, a third message can be sent to the target model to change the node element parameters corresponding to the target node element stored in the target model to the edited parameters.
[0198] For example, such as Figure 7 As shown, the target view model 702 can send a third message to its associated target model 705 to change the node element parameters corresponding to the target node elements stored in the target model 705 to the edited parameters.
[0199] S307: Using the target model, record the node element parameters corresponding to the target node element as the edited parameters.
[0200] After the target model receives the third message, it can read the edited parameters from the third message, and then use the target model to record the node element parameters corresponding to the target node element as the edited parameters.
[0201] Thus, as can be seen from the above, the interaction between the VM and M in the MVVM pattern allows for the timely storage of edited parameters, thereby achieving reliable management of node element data.
[0202] • Editing custom configuration parameters
[0203] In one possible implementation, the "receiving parameter editing operation for the target graphical node displayed in the editor interface" in S304 above may include S21:
[0204] S21: Receive parameter editing operations triggered by custom configuration. Custom configuration is the parameter configuration method that is set independently for the target node element when the target graphic node is created. The custom configuration method is different from the default configuration method of the element parameter type corresponding to the target node element.
[0205] The custom configuration method is a parameter configuration method that is set independently for the target node element when creating the target graphic node. In other words, when programmers create the target graphic node, they can set the parameter configuration method for the target node element, and business users can customize the node element parameters corresponding to the target node element according to this parameter configuration method.
[0206] The element parameter type corresponding to the target node element refers to the parameter type that the node element parameter corresponding to the target node element needs to satisfy. The default configuration method of the element parameter type corresponding to the target node element refers to the configuration method of the element parameter type by default. For example, the default configuration method of integer int is manual input, etc. In this regard, this application does not specifically limit the default configuration method of the element parameter type corresponding to the target node element.
[0207] The custom configuration method differs from the default configuration method. This means that a more convenient custom configuration method can be set according to actual application needs. For example, considering that manually entering an `int` type parameter is cumbersome and prone to errors, programmers can customize the configuration method by selecting from a dropdown menu of various preset `int` type parameters. This application does not specifically limit the custom configuration method.
[0208] For example, the target node element is a Non-Player Character Identifier (NPCID), its corresponding element parameter type is int, and its corresponding port type is Alias. The default configuration for the element parameter type of this target node element is to manually input an int value. However, in this case, manually inputting an int value by business personnel is very likely to result in editing errors. Custom configuration methods can be used to customize the Alias configuration. For example, refer to... Figure 8 , Figure 8 This is a schematic diagram of the interface for custom configuration provided in an embodiment of this application. Programmers can read the entire NPC table and integrate it into a drop-down list option 801 for business personnel to customize the configuration. This allows business personnel to directly select int data from the drop-down list option, thereby ensuring the accuracy of the int data.
[0209] like Figure 8As shown, business personnel can trigger parameter editing operations by clicking on the data in the drop-down menu to customize the node element parameters corresponding to the target node element. After receiving the parameter editing operation, the terminal device can display the edited parameters.
[0210] Thus, as can be seen from the above, when creating target graphic nodes, custom configuration methods can be set for target node elements according to actual needs, thereby providing business personnel with a more convenient parameter configuration method. This allows business personnel to flexibly customize the configuration parameters of node elements, improves editing efficiency, and helps ensure the accuracy and stability of node element parameters.
[0211] In one possible implementation, the target node element includes multiple child node elements, the element parameter type corresponding to the target node element is a first type, and the element parameter type corresponding to the child node elements is a second type; the "receiving parameter editing operation triggered by a custom configuration method" in S21 above may include S211:
[0212] S211: Receive parameter editing operation for the target child node element in the target node element. The parameter editing operation is used to set the second type of node element parameters for the target child node element. The set second type of node element parameters are used to determine the first type of node element parameters corresponding to the target node element.
[0213] Multiple child nodes refer to nested child nodes within a target node. The element parameter type of each child node refers to the required parameter type for that node element. The target node element has a first-type element parameter, while the child node elements have a second-type element parameter, indicating that the target node element and its nested child nodes have different element parameter types. The first type can be any nested element parameter type, such as BasicTypeDesc, AliasTypeDesc, StructTypeDesc, or ListTypeDesc. The second type is any element parameter type that supports nesting other than the first type.
[0214] For reference Figure 9 , Figure 9This diagram illustrates the nested element parameter types provided in this application embodiment. In the base class (VariableTypeDesc) 901 of all drawing classes, the nested element parameter types can include BasicTypeDesc 902, AliasTypeDesc 903, StructTypeDesc 904, and ListTypeDesc 905. BasicTypeDesc 902 is responsible for drawing basic data types, such as int, long integers, and string. AliasTypeDesc 903 is responsible for drawing alias types, embedding a drawing base class to support drawing other types. StructTypeDesc 904 is responsible for drawing struct type data, embedding a list of drawing base classes to support drawing other types of lists. ListTypeDesc 905 is responsible for drawing list type data, embedding a list of drawing base classes to support drawing other types of lists. It should be noted that the above-mentioned nested element parameter types can be nested within each other. Furthermore, other drawing classes, such as Enum types and generic types, can also be included. In this regard, this application does not specifically limit the types of nested element parameters that are supported.
[0215] As an example, in the details sub-interface, when a business user expands an element parameter type containing nested attributes, the visual programming system can dynamically generate corresponding sub-editing areas. In these sub-editing areas, parameter editing operations can be triggered on the target child node elements within the target node element. The hierarchical relationship is clearly presented with indentation. When the business user edits the parameters of the target child node element, they can clearly determine their editing content, ensuring the accuracy of the node element parameters corresponding to the target child node element.
[0216] For example, refer to Figure 10 , Figure 10 This is a schematic diagram of an interface for editing target child node elements in a target node element, provided in an embodiment of this application. Taking a List as the first type and an Alias as the second type as an example, the target node element is a new level target ID 1001, which includes multiple target IDs. These multiple target IDs are multiple child node elements, such as
[115] Return to the scarecrow's location 1002,
[108] Talk to the scarecrow 1003, and
[110] Eliminate the monsters that appear from the treasure chest 1004. Among them, the first type corresponding to the target node element is List type, and the second type corresponding to the new level target ID is Alias type, with the alias int type. This target graphical node supports the ability of List to nest Alias.
[0217] For example, such as Figure 10As shown, business users can trigger parameter editing operations on target child node elements within the target node element in the details sub-interface. The parameter editing operation is used to set second-type node element parameters for the target child node element. That is, business users can set Alias-type node element parameters for the target child node element in the details sub-interface. Since the target child node element is nested inside the target node element, the second-type node element parameters set by the business user for the target child node element are also used to determine the first-type node element parameters corresponding to the target node element, thus realizing the ability of List to nest Alias.
[0218] After receiving a parameter editing operation triggered for the target child node element, the terminal device can display the edited parameters.
[0219] Thus, as can be seen from the above, the visual programming system also supports nested attribute editing capabilities. Business users can also edit the node element parameters corresponding to the nested child node elements within the target node element, enhancing the flexibility of the configuration process and expanding the application scope of the visual programming system to meet the needs of relevant scenarios.
[0220] • Store visual programming files
[0221] In one possible implementation, the method provided in this application embodiment may further include S308:
[0222] S308: In response to a file storage operation triggered by the editor interface, a visual programming file is stored according to a preset format structure. The visual programming file includes a chart object, which includes at least one sub-chart object. Each sub-chart object includes at least one of the following: graphic node data, node additional data, connection data, nested sub-chart objects, and additional descriptive data.
[0223] File storage operation refers to the operation used to store visual programming files. For example, a file storage operation can be triggered by clicking a storage control. This application does not specifically limit the triggering method of the file storage operation. The visual programming file is a file composed of graphical nodes included in the editor interface, which records the functional logic composed of multiple graphical nodes.
[0224] The visual programming file includes a Chart object, which contains all the information in the editor interface. Each Chart object includes at least one Graph object, which is a child element of the Chart object and contains information about each graph node in the editor interface. Each Graph object includes at least one of the following: Node data, NodeExtras, Connections, SubGraphs, and EditorOnlyData. Node data records relevant data for each graph node in the editor interface. For example, it may include a list of ports for each graph node, method descriptions for each node element, and version data for each graph node. NodeExtras records additional information beyond the node data. Connections record the connections between different graph nodes in the editor interface. Nested Graph objects record data about nested graph nodes. EditorOnlyData records custom data generated during editing.
[0225] For example, business personnel can trigger a file storage operation by clicking the storage control in the editor interface. The terminal device responds to the file storage operation and can store the visual programming file according to a preset format structure.
[0226] The preset format structure refers to the storage format that the visual programming file needs to meet. For example, the preset format structure can be found in the following directory:
[0227] ●Chart(Macro)
[0228] ●Graphs (EventGraph --> MainGraph)
[0229] ●Nodes
[0230] ●Ports
[0231] ●Method Description
[0232] ●Version
[0233] ●NodeExtras
[0234] ●Connections
[0235] ●SubGraphs
[0236] ●EditorOnlyData
[0237] In other words, a visual programming file can include a chart object, which in turn includes multiple sub-chart objects. Each sub-chart object can include graph node data, additional node data, connection data, nested sub-chart objects, and additional descriptive data. Thus, when business users trigger a file storage operation, the visual programming file can be stored according to the aforementioned preset format structure.
[0238] In practical applications, serializing a chart object using a data exchange format (JSON) and storing it in a local file transforms it into a string text file, thus obtaining a JSON-formatted visualization programming file. This facilitates reading, loading, and using the visualization programming file across various scenarios. For example, external difference comparison tools (Diff) can identify modifications made within the visualization programming file. This application does not specifically limit the storage format of the visualization programming file.
[0239] Thus, as can be seen from the above, visual programming files can be stored according to a preset format structure, thereby enabling reasonable and standardized management of visual programming files. Furthermore, storing visual programming files in JSON format helps other application scenarios to quickly apply the visual programming files, thereby expanding the application scope of the visual programming files.
[0240] • Provides an overall explanation of the methods for generating graphical nodes in visual programming.
[0241] Finally, it can be combined Figure 11 The method for generating graphical nodes in visual programming provided in the embodiments of this application will be described in its entirety by way of example. Figure 11 This is a schematic diagram illustrating a method for generating graphical nodes in visual programming, as provided in an embodiment of this application.
[0242] First, the Lua code 1101 used to indicate the functional logic of the target graphical node to be generated can be obtained, along with the corresponding EmmyLua code annotation information. Then, the EmmyLua code annotation information can be parsed according to preset lexical and syntax parsing rules to obtain the element attribute information corresponding to each node element in the target graphical node, stored as interface file 1102. Further, the element attribute information corresponding to each node element can be mapped to a graphical node template to generate the target graphical node.
[0243] In the visual programming system, parameter editing operations on target graphic nodes can be triggered within the editor interface to set specific node element parameters for the target graphic node elements. The editor interface supports node editing capabilities (editing target graphic node data); connection editing capabilities (editing connection data); debugging capabilities (debugging any content within the editor interface); attribute editing capabilities (editing additional node data); search capabilities (searching within the editor interface); variable editing capabilities (editing node element parameters); export capabilities (exporting graphic nodes included in the editor interface); and customization capabilities (customizing various additional descriptive data). After completing the editing operations on the graphic nodes within this editor interface, the corresponding visual programming file 1103 can be saved according to a preset format structure.
[0244] Furthermore, the graphical nodes included in the editor interface can be exported as Lua code, allowing direct execution of the exported file 1104 and the original Lua code file to achieve the corresponding target functionality. The exported file can also be in other language formats; this application does not specifically limit the code format of the exported file.
[0245] Based on the method for generating graphical nodes in visual programming provided in the preceding embodiments, this application also provides a corresponding apparatus for generating graphical nodes in visual programming. The following, in conjunction with... Figure 12 To explain, Figure 12 This is a schematic diagram of the structure of a graphical node generation device 1200 in visual programming provided in an embodiment of this application. The device includes:
[0246] The acquisition module 1201 is used to acquire node program code and code annotation information corresponding to the node program code. The node program code is used to indicate the functional logic of the target graphic node to be generated, and the code annotation information is used to indicate the node attribute information of the target graphic node.
[0247] The parsing module 1202 is used to parse the code annotation information to determine the element attribute information corresponding to each node element in the target graphic node;
[0248] The generation module 1203 is used to map the element attribute information corresponding to each of the node elements to the graphic node template to generate the target graphic node. The target graphic node is used to support the configuration of node element parameters through the node elements. The node program code and the node element parameters are used to jointly implement the target node function corresponding to the target graphic node.
[0249] Optionally, the parsing module 1202 is specifically used for:
[0250] For each sentence annotation in the code annotation information, lexical analysis is performed on the sub-annotation information to obtain the lexical analysis result corresponding to the sub-annotation information, and syntactic analysis is performed based on the lexical analysis result to obtain the syntactic analysis result corresponding to the sub-annotation information;
[0251] Based on the syntax parsing result corresponding to the sub-annotation information, determine the element attribute information corresponding to the node element indicated by the sub-annotation information.
[0252] Optionally, the parsing module 1202 is specifically used for:
[0253] According to the preset lexical parsing rules, the meaning of each tag unit included in the sub-tag information is determined as the lexical parsing result corresponding to the sub-tag information. The lexical parsing rules record multiple preset tag units and their respective meanings.
[0254] Optionally, the lexical analysis result includes the unit meaning corresponding to each tag unit in the sub-tag information, and the parsing module 1202 is specifically used for:
[0255] According to the preset syntax parsing rules, based on the meaning of each unit corresponding to each tag unit in the lexical parsing result, the syntax tree data corresponding to the sub-tag information is constructed as the syntax parsing result corresponding to the sub-tag information.
[0256] Optionally, the parsing module 1202 is specifically used for:
[0257] According to the syntax parsing rules, based on the type tagging units included in the lexical parsing results, the syntax tree structure corresponding to the sub-tag information is determined. The type tagging units are used to indicate the statement type to which the sub-tag information belongs. The syntax parsing rules record the syntax tree structures corresponding to multiple preset type tagging units.
[0258] For each tree element in the syntax tree structure corresponding to the sub-annotation information, the element content corresponding to the tree element is determined based on the syntax parsing rules and the unit meaning of the tag unit corresponding to the tree element in the lexical parsing result. The syntax parsing rules also record multiple preset element parsing methods corresponding to each tree element.
[0259] Based on the syntax tree structure corresponding to the sub-annotation information and the element content corresponding to each of the tree elements therein, the syntax tree data corresponding to the sub-annotation information is determined.
[0260] Optionally, the code annotation information is used to indicate the port attribute information of each port in the target graphical node, the node type of the target graphical node, and the basic node information of the target graphical node, wherein the port attribute information includes at least the port data type.
[0261] Optionally, the device further includes:
[0262] The first receiving module is used to receive parameter editing operations for the target graphic node displayed in the editor interface, wherein the parameter editing operations are used to edit the node element parameters corresponding to the target node element in the target graphic node.
[0263] Optionally, the editor interface includes a node sub-interface, a content sub-interface, and a details sub-interface. The node sub-interface is used to display the connection relationships between multiple graphic nodes. The content sub-interface is used to display the overview node content obtained by organizing the node content of each of the multiple graphic nodes. The details sub-interface is used to display the node details content of any one of the graphic nodes. The target graphic node is one of the multiple graphic nodes. The first receiving module is specifically used for:
[0264] Receive parameter editing operations for the target node element triggered in the target sub-interface, wherein the target sub-interface is either the content sub-interface or the details sub-interface.
[0265] Optionally, the device further includes:
[0266] The display module is used to respond to the parameter editing operation by displaying the node element parameters corresponding to the target node element in the target sub-interface as the edited parameters, and updating and displaying the node element parameters corresponding to the target node element in the node sub-interface and the node element parameters corresponding to the target node element in the non-target sub-interface as the edited parameters.
[0267] Wherein, when the target sub-interface is the content sub-interface, the non-target sub-interface is the details sub-interface; when the target sub-interface is the details sub-interface, the non-target sub-interface is the content sub-interface.
[0268] Optionally, the node sub-interface, the content sub-interface, and the details sub-interface all include a target view corresponding to the target node element, and the target views included in each of the node sub-interface, the content sub-interface, and the details sub-interface are associated with the same target view model;
[0269] The display module is specifically used for:
[0270] In response to the parameter editing operation, a first message is sent to the target view model through the target view in the target sub-interface. The first message is used to indicate that the node element parameter corresponding to the target node element is set to the edited parameter.
[0271] Through the target view model, a second message is sent to the target view in the node sub-interface and the target view in the non-target sub-interface. The second message is used to indicate that the node element parameter corresponding to the target node element is set to the edited parameter.
[0272] The node element parameters corresponding to the target node element in the node sub-interface are updated and displayed as the edited parameters through the target view in the node sub-interface; the node element parameters corresponding to the target node element in the non-target sub-interface are updated and displayed as the edited parameters through the target view in the non-target sub-interface.
[0273] Optionally, the target view model is associated with the target model corresponding to the target node element, and the device further includes:
[0274] The first sending module is used to send a third message to the target model through the target view model, the third message being used to indicate that the node element parameter corresponding to the target node element is set to the edited parameter;
[0275] The recording module is used to record, through the target model, the node element parameters corresponding to the target node element as the edited parameters.
[0276] Optionally, the first receiving module is specifically used for:
[0277] The parameter editing operation is received through a custom configuration method, which is a parameter configuration method that is set independently for the target node element when the target graphic node is created. The custom configuration method is different from the default configuration method of the element parameter type corresponding to the target node element.
[0278] Optionally, the target node element includes multiple child node elements, the element parameter type corresponding to the target node element is a first type, and the element parameter type corresponding to the child node elements is a second type; the first receiving module is specifically used for:
[0279] The parameter editing operation is received for the target child node element in the target node element. The parameter editing operation is used to set the second type of node element parameters for the target child node element. The set second type of node element parameters are used to determine the first type of node element parameters corresponding to the target node element.
[0280] Optionally, the device further includes:
[0281] The storage module is used to respond to a file storage operation triggered based on the editor interface and store the visual programming file according to a preset format structure. The visual programming file includes a chart object, and the chart object includes at least one sub-chart object. Each sub-chart object includes at least one of the following: graphic node data, node additional data, connection data, nested sub-chart objects, and additional description data.
[0282] This application also provides a computer device, which may specifically be a terminal device or a server. The terminal device and server provided in this application will be described below from the perspective of hardware implementation.
[0283] See Figure 13 , Figure 13 This is a schematic diagram of the structure of the terminal device provided in the embodiments of this application. For example... Figure 13 As shown, for ease of explanation, only the parts related to the embodiments of this application are shown. For specific technical details not disclosed, please refer to the method section of the embodiments of this application. The terminal can be any terminal device including mobile phones, tablets, personal digital assistants (PDAs), point-of-sale (POS) terminals, in-vehicle computers, etc. Taking a computer as an example:
[0284] Figure 13 This is a block diagram illustrating a portion of the structure of a computer associated with the terminal provided in an embodiment of this application. (Reference) Figure 13 The computer includes: a radio frequency (RF) circuit 1210, a memory 1220, an input unit 1230 (including a touch panel 1231 and other input devices 1232), a display unit 1240 (including a display panel 1241), a sensor 1250, an audio circuit 1260 (connected to a speaker 1261 and a microphone 1262), a wireless fidelity (WiFi) module 1270, a processor 1280, and a power supply 1290, etc. Those skilled in the art will understand that... Figure 13The computer architecture shown does not constitute a limitation on the computer and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0285] The memory 1220 can be used to store software programs and modules. The processor 1280 executes various computer functions and data processing by running the software programs and modules stored in the memory 1220. The memory 1220 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the computer (such as audio data, telephone directory, etc.). In addition, the memory 1220 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0286] The processor 1280 is the control center of the computer, connecting various parts of the computer through various interfaces and lines. It performs various computer functions and processes data by running or executing software programs and / or modules stored in the memory 1220, and by calling data stored in the memory 1220. Optionally, the processor 1280 may include one or more processing units; preferably, the processor 1280 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may also not be integrated into the processor 1280.
[0287] In this embodiment of the application, the processor 1280 included in the terminal is used to execute the steps in the method for generating graphical nodes in the visual programming described in the foregoing embodiments.
[0288] See Figure 14 , Figure 14This is a schematic diagram of the structure of a server 1300 provided in an embodiment of this application. The server 1300 can vary significantly due to different configurations or performance, and may include one or more central processing units (CPUs) 1322 (e.g., one or more processors) and memory 1332, and one or more storage media 1330 (e.g., one or more mass storage devices) for storing application programs 1342 or data 1344. The memory 1332 and storage media 1330 can be temporary or persistent storage. The program stored in the storage media 1330 may include one or more modules (not shown in the diagram), each module including a series of instruction operations on the server. Furthermore, the CPU 1322 may be configured to communicate with the storage media 1330 and execute the series of instruction operations stored in the storage media 1330 on the server 1300.
[0289] Server 1300 may also include one or more power supplies 1326, one or more wired or wireless network interfaces 1350, one or more input / output interfaces 1358, and / or one or more operating systems, such as Windows Server. TM Mac OS X TM Unix TM Linux TM FreeBSD TM etc.
[0290] The steps performed by the server in the above embodiments can be based on this Figure 14 The server structure shown is illustrated. The CPU 1322 is used to execute the steps in the graphical node generation method of the visual programming described in the foregoing embodiments.
[0291] This application also provides a computer-readable storage medium for storing a computer program that performs the steps in the method for generating graphical nodes in the visual programming described in the foregoing embodiments.
[0292] This application also provides a computer program product or computer program that 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 the steps in the graphical node generation method in the visual programming described in the foregoing embodiments.
[0293] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0294] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between apparatuses or units through some interfaces, and may be electrical, mechanical, or other forms.
[0295] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0296] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0297] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing computer programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0298] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0299] 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.
[0300] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A method for generating graphical nodes in visual programming, characterized in that, The method includes: Obtain the node program code and the corresponding code annotation information. The node program code is used to indicate the functional logic of the target graphic node to be generated, and the code annotation information is used to indicate the node attribute information of the target graphic node. The code annotation information is parsed to determine the element attribute information corresponding to each node element in the target graphic node; The element attribute information corresponding to each of the node elements is mapped to the graphic node template to generate the target graphic node. The target graphic node is used to support the configuration of node element parameters through the node elements. The node program code and the node element parameters are used to jointly implement the target node function corresponding to the target graphic node.
2. The method according to claim 1, characterized in that, The step of parsing the code annotation information to determine the element attribute information corresponding to each node element in the target graphic node includes: For each sentence annotation in the code annotation information, lexical analysis is performed on the sub-annotation information to obtain the lexical analysis result corresponding to the sub-annotation information, and syntactic analysis is performed based on the lexical analysis result to obtain the syntactic analysis result corresponding to the sub-annotation information; Based on the syntax parsing result corresponding to the sub-annotation information, determine the element attribute information corresponding to the node element indicated by the sub-annotation information.
3. The method according to claim 2, characterized in that, The step of performing lexical analysis on the sub-label information to obtain the lexical analysis result corresponding to the sub-label information includes: According to the preset lexical parsing rules, the meaning of each tag unit included in the sub-tag information is determined as the lexical parsing result corresponding to the sub-tag information. The lexical parsing rules record multiple preset tag units and their respective unit meanings.
4. The method according to claim 2 or 3, characterized in that, The lexical analysis result includes the meaning of each unit corresponding to the tagging unit in the sub-tag information. The step of performing syntax parsing based on the lexical analysis result to obtain the syntax parsing result corresponding to the sub-tag information includes: According to the preset syntax parsing rules, based on the meaning of each unit corresponding to each tag unit in the lexical parsing result, the syntax tree data corresponding to the sub-tag information is constructed as the syntax parsing result corresponding to the sub-tag information.
5. The method according to claim 4, characterized in that, The step of constructing the syntax tree data corresponding to the sub-annotation information based on the unit meaning corresponding to each marked unit in the lexical analysis result, according to preset syntax parsing rules, includes: According to the syntax parsing rules, based on the type tagging units included in the lexical parsing results, the syntax tree structure corresponding to the sub-tag information is determined. The type tagging units are used to indicate the statement type to which the sub-tag information belongs. The syntax parsing rules record the syntax tree structures corresponding to multiple preset type tagging units. For each tree element in the syntax tree structure corresponding to the sub-annotation information, the element content corresponding to the tree element is determined based on the syntax parsing rules and the unit meaning of the tag unit corresponding to the tree element in the lexical parsing result. The syntax parsing rules also record multiple preset element parsing methods corresponding to each tree element. Based on the syntax tree structure corresponding to the sub-annotation information and the element content corresponding to each of the tree elements therein, the syntax tree data corresponding to the sub-annotation information is determined.
6. The method according to any one of claims 1 to 5, characterized in that, The code annotation information is used to indicate the port attribute information of each port in the target graphic node, the node type of the target graphic node, and the basic node information of the target graphic node. The port attribute information includes at least the port data type.
7. The method according to any one of claims 1 to 6, characterized in that, The method further includes: The system receives parameter editing operations for the target graphic node displayed in the editor interface. The parameter editing operations are used to edit the node element parameters corresponding to the target node element in the target graphic node.
8. The method according to claim 7, characterized in that, The editor interface includes a node sub-interface, a content sub-interface, and a details sub-interface. The node sub-interface displays the connection relationships between multiple graphic nodes. The content sub-interface displays an overview of the node content obtained by organizing the node content of each of the multiple graphic nodes. The details sub-interface displays the node details of any one of the graphic nodes. The target graphic node is one of the multiple graphic nodes. Receiving parameter editing operations for the target graphic node displayed in the editor interface includes: Receive parameter editing operations for the target node element triggered in the target sub-interface, wherein the target sub-interface is either the content sub-interface or the details sub-interface.
9. The method according to claim 8, characterized in that, The method further includes: In response to the parameter editing operation, the node element parameters corresponding to the target node element in the target sub-interface are displayed as the edited parameters, and the node element parameters corresponding to the target node element in the node sub-interface and the node element parameters corresponding to the target node element in the non-target sub-interface are all updated and displayed as the edited parameters. Wherein, when the target sub-interface is the content sub-interface, the non-target sub-interface is the details sub-interface; when the target sub-interface is the details sub-interface, the non-target sub-interface is the content sub-interface.
10. The method according to claim 9, characterized in that, The node sub-interface, the content sub-interface, and the details sub-interface all include the target view corresponding to the target node element, and the target views included in each of the node sub-interface, the content sub-interface, and the details sub-interface are associated with the same target view model; The step of updating and displaying the node element parameters corresponding to the target node element in the node sub-interface and the node element parameters corresponding to the target node element in the non-target sub-interface as the edited parameters includes: In response to the parameter editing operation, a first message is sent to the target view model through the target view in the target sub-interface. The first message is used to indicate that the node element parameter corresponding to the target node element is set to the edited parameter. Through the target view model, a second message is sent to the target view in the node sub-interface and the target view in the non-target sub-interface. The second message is used to indicate that the node element parameter corresponding to the target node element is set to the edited parameter. The node element parameters corresponding to the target node element in the node sub-interface are updated and displayed as the edited parameters through the target view in the node sub-interface; the node element parameters corresponding to the target node element in the non-target sub-interface are updated and displayed as the edited parameters through the target view in the non-target sub-interface.
11. The method according to claim 10, characterized in that, The target view model is associated with the target model corresponding to the target node element, and the method further includes: A third message is sent to the target view model, the third message being used to indicate that the node element parameter corresponding to the target node element is set to the edited parameter; Using the target model, the node element parameters corresponding to the target node element are recorded as the edited parameters.
12. The method according to any one of claims 7 to 11, characterized in that, The receiving of parameter editing operations for the target graphical node displayed in the editor interface includes: The parameter editing operation is received through a custom configuration method, which is a parameter configuration method that is set independently for the target node element when the target graphic node is created. The custom configuration method is different from the default configuration method of the element parameter type corresponding to the target node element.
13. The method according to claim 12, characterized in that, The target node element includes multiple child node elements, the element parameter type corresponding to the target node element is a first type, and the element parameter type corresponding to the child node element is a second type; The receiving of the parameter editing operation triggered by the custom configuration method includes: The parameter editing operation is received for the target child node element in the target node element. The parameter editing operation is used to set the second type of node element parameters for the target child node element. The set second type of node element parameters are used to determine the first type of node element parameters corresponding to the target node element.
14. The method according to any one of claims 7 to 13, characterized in that, The method further includes: In response to a file storage operation triggered by the editor interface, a visual programming file is stored according to a preset format structure. The visual programming file includes a chart object, which includes at least one sub-chart object. Each sub-chart object includes at least one of the following: graphic node data, node extra data, connection data, nested sub-chart objects, and extra description data.
15. A device for generating graphical nodes in visual programming, characterized in that, The device includes: The acquisition module is used to acquire node program code and code annotation information corresponding to the node program code. The node program code is used to indicate the functional logic of the target graphic node to be generated, and the code annotation information is used to indicate the node attribute information of the target graphic node. The parsing module is used to parse the code annotation information to determine the element attribute information corresponding to each node element in the target graphic node; The generation module is used to map the element attribute information corresponding to each of the node elements to the graphic node template to generate the target graphic node. The target graphic node is used to support the configuration of node element parameters through the node elements. The node program code and the node element parameters are used to jointly implement the target node function corresponding to the target graphic node.
16. A computer device, characterized in that, The device includes a processor and a memory; The memory is used to store computer programs; The processor is configured to execute, according to the computer program, the method for generating graphical nodes in visual programming as described in any one of claims 1 to 14.
17. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store a computer program that, when executed by an electronic device, implements the method for generating graphical nodes in visual programming as described in any one of claims 1 to 14.
18. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method for generating graphical nodes in visual programming as described in any one of claims 1 to 14.