Object variable operation method and device, storage medium and electronic device
By obtaining and executing variable type matching operations in a visual programming interface, the problem of low efficiency in variable type confirmation in existing technologies is solved, and real-time variable management and efficient programming are realized.
Patent Information
- Application Number
- CN202411330681.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-23
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2044-09-23
AI Technical Summary
In existing visual programming methods, developers need to confirm the type of each variable when dealing with variable objects, which leads to low programming efficiency. Furthermore, type errors are often only discovered at compile time and cannot be avoided in real-time programming.
By receiving variable object operations in the visual programming interface, obtaining the target variable type, determining the matching operation interface from the variable operation interface set, executing object operations in real time, and generating code blocks that match the variable type, unified management of the variable object collection is achieved.
It enables real-time acquisition of variable matching results during visual programming, avoids type errors, improves programming efficiency, ensures correct program execution, and enhances the efficiency of visual programming.
Smart Images

Figure CN119292583B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computers, and more specifically, to a method and apparatus for operating object variables, a storage medium, and an electronic device. Background Technology
[0002] In visual programming environments, developers can typically utilize a series of predefined visual tiles, each corresponding to a predefined piece of program code. By dragging and dropping these predefined visual tiles and configuring them, the processing and visualization of program code becomes quick and easy. This approach significantly improves development efficiency and simplifies the programming process.
[0003] However, in existing visual programming practices, developers must verify the variable type associated with each visual tile when dragging or editing the tiles representing variables to prevent errors in the generated code. Furthermore, if an error occurs while using a visual tile representing a variable, the error, caused by a mismatch in variable types, is usually only discovered during the compilation of the entire program code. Therefore, existing visual programming methods suffer from low programming efficiency.
[0004] There is currently no effective solution to the above problems. Summary of the Invention
[0005] This invention provides a method and apparatus for manipulating object variables, a storage medium, and an electronic device to at least solve the technical problem of low efficiency in conventional visual programming.
[0006] According to one aspect of the present invention, a method for manipulating object variables is provided, comprising: in response to a variable object operation received in a visual programming interface, obtaining a target variable type indicated by the variable object operation, wherein the visual programming interface is used to receive interactive operations to generate program content matching the interactive operations, the interactive operations including the variable object operation; determining at least one target variable operation interface matching the variable object operation from a set of variable operation interfaces, wherein the set of variable operation interfaces includes multiple variable operation interfaces; performing at least one object operation on a set of variable objects according to at least one target variable operation interface and the target variable type, wherein the set of variable objects is used to store object information of at least one variable object created according to the visual programming interface, the variable object being displayed as a variable block style in the visual programming interface.
[0007] According to another aspect of the present invention, an object variable manipulation apparatus is also provided, comprising: an acquisition unit, configured to acquire a target variable type indicated by the variable object operation in response to a variable object operation received in a visual programming interface, wherein the visual programming interface is configured to receive an interactive operation to generate program content matching the interactive operation, the interactive operation including the variable object operation; a determination unit, configured to determine at least one target variable operation interface matching the variable object operation from a set of variable operation interfaces, wherein the set of variable operation interfaces includes a plurality of variable operation interfaces; and an operation unit, configured to perform at least one object operation on a set of variable objects according to at least one target variable operation interface and the target variable type, wherein the set of variable objects is configured to store object information of at least one variable object created according to the visual programming interface, the variable object being displayed as a variable block style in the visual programming interface.
[0008] In some embodiments, the above-mentioned operation unit includes: a generation module, configured to generate target array elements matching the target variable object based on the variable identification information indicated by the variable creation operation and the type description information used to indicate the type of the target variable when the variable object operation is a variable creation operation; and an adding module, configured to add the target array elements to an object array used to indicate the set of variable objects, wherein the array elements in the object array are used to indicate a variable object.
[0009] In some embodiments, the determining unit includes: a first determining module, configured to determine an array element adding interface matching the variable creation operation from the variable operation interface set, wherein the variable operation interface set includes the array element adding interface, and the array element adding interface is configured to generate the array element matching the variable object according to the variable identification information and type description information indicated by the variable creation operation.
[0010] In some embodiments, the above-mentioned object variable manipulation device further includes: an editing unit, configured to, in response to receiving a variable editing operation performed on the target variable object in a visual programming interface, determine an array element editing interface matching the variable editing operation from the variable operation interface set, wherein the variable operation interface set includes the array element editing interface; and perform an element editing operation on the target array element according to the variable editing information carried in the variable editing operation and the array element editing interface to obtain the updated target array element.
[0011] In some embodiments, the above-mentioned object variable manipulation device further includes: a display unit, configured to determine an array element acquisition interface from the above-mentioned variable operation interface set when the variable creation control is displayed on the variable preview page in the above-mentioned visual programming interface, wherein the variable creation control is used to detect the above-mentioned variable creation operation, the above-mentioned variable preview page is used to display a variable object of type the above-mentioned target variable type, and the above-mentioned variable operation interface set includes the above-mentioned array element acquisition interface; and when at least one first array element is found from the above-mentioned object array according to the array element acquisition interface and the above-mentioned target variable type, a first code block corresponding to the at least one first array element is obtained, wherein the above-mentioned first array element matches the first variable object of the above-mentioned target variable type, and the above-mentioned first code block is used to display a first variable block in the above-mentioned visual programming interface for indicating the above-mentioned first variable object.
[0012] In some embodiments, the above-mentioned object variable manipulation device includes: a deletion unit, configured to: obtain a second variable identifier indicated by the variable deletion operation when the variable object operation is a variable deletion operation; determine an array element deletion interface matching the variable deletion operation from the variable operation interface set, wherein the variable operation interface set includes the array element deletion interface; and delete a second array element matching the second variable object from the variable object set according to the second variable identifier and the array element deletion interface, wherein the second variable identifier is used to indicate the second variable object.
[0013] In some embodiments, the above-mentioned object variable manipulation device further includes: a code block generation unit, configured to, when the above-mentioned variable object operation is a variable creation operation, obtain a first code block matching the above-mentioned target variable type, wherein the first code block is used to describe the variable attribute information of the above-mentioned variable object; and update the first code block to a second code block according to the variable description information carried by the above-mentioned variable creation operation, wherein the second code block is used to display a target variable tile matching the above-mentioned target variable object on the above-mentioned visual programming interface, and the variable description information includes the above-mentioned variable identification information.
[0014] In some embodiments, the code block generation unit further includes: a prompting module, configured to, in response to dragging the target variable block to a block area associated with the operation block in the visual programming interface, obtain a reference variable type matching the operation block, wherein the operation block is used to generate a variable operation code block associated with a variable object, and the reference variable type is a variable type matching the variable operation code block; and determine the dragging result of the dragging operation based on the matching relationship between the reference variable type and the second code block.
[0015] In some embodiments, the prompting module is configured to: when the target variable object is a variable object to be input in the operation block, obtain a first variable type from a first field in the second code block, wherein the first field is used to indicate the variable type that allows the target variable object to be obtained as input; when the first variable type and the reference variable type do not match, display a target prompt message; when the target variable object is a variable object that accepts input in the operation block, obtain the target variable type from a second field in the second code block, wherein the second field is used to indicate the target variable type of the target variable object; when the target variable type and the reference variable type do not match, display a target prompt message; wherein the target prompt message is used to indicate that the drag operation failed.
[0016] In some embodiments, the code block generation unit is further configured to: obtain a third code block matching the reference variable type when the drag operation fails, wherein the third code block is used to describe the variable attribute information of the candidate variable object; and display the candidate variable block in the visual programming interface according to the third code block.
[0017] In some embodiments, the code block generation unit is further configured to: in response to a variable editing operation on the target variable block in the visual programming interface, obtain variable editing information indicated by the variable editing operation; update the third field in the second code block according to the variable editing information, wherein the third field is used to indicate the variable identification information of the target variable object.
[0018] In some embodiments, the code block generation unit is configured to: when the variable creation operation is a first variable creation operation, update the third field in the first code block according to the variable identification information included in the variable description information to obtain the second code block, wherein the variable type corresponding to the first variable creation operation is determined from a plurality of preset variable types; when the variable creation operation is a second variable creation operation, update the first code block to a fourth code block according to the variable identification information and variable combination information included in the variable description information, wherein the variable type corresponding to the second variable creation operation is a custom variable type, and the variable combination information is used to indicate at least one data type carried in the target variable.
[0019] According to another aspect of the present invention, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer program, wherein the computer program is configured to execute the operation method of the above-mentioned object variable at runtime.
[0020] According to another aspect of the embodiments of this application, a computer program product is provided, the computer program product including a computer program / instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer program / instructions from the computer-readable storage medium, and executes the computer program / instructions, causing the computer device to perform the operation method of the object variable as described above.
[0021] According to another aspect of the present invention, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to execute the operation method of the object variable described above through the computer program.
[0022] In this embodiment of the invention, when a variable object operation is received based on a visual programming interface, the target variable type indicated by the variable object operation is obtained; at least one target variable operation interface matching the variable object operation is determined from a set of variable operation interfaces, wherein the set of variable operation interfaces includes multiple variable operation interfaces; based on at least one target variable operation interface and the target variable type, at least one object operation is performed on the variable object set. Thus, through the operation interfaces provided by the variable operation interface set, the interactive operations related to variable objects in the visual programming interface are mapped in real time to object operations on the variable object set.
[0023] Because the variable operation interface needs to be called based on the variable type of the object variable, it is possible to accurately obtain the type matching result of the object operation on the variable object during the process of mapping interactive operations to object operations on the variable object collection in real time. This enables real-time acquisition of variable matching results during visual programming, avoiding program failures or unexpected results caused by type errors. In addition, the variable object collection enables unified and efficient management of variable objects involved in the visual programming process, improving the efficiency of visual programming and solving the technical problem of low efficiency in existing visual programming methods. Attached Figure Description
[0024] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:
[0025] Figure 1 This is a schematic diagram of the hardware environment for an optional object variable operation method according to an embodiment of the present invention;
[0026] Figure 2 This is a flowchart of an optional object variable operation method according to an embodiment of the present invention;
[0027] Figure 3 This is a schematic diagram of an optional object variable operation method according to an embodiment of the present invention;
[0028] Figure 4 This is a schematic diagram of another optional method for operating object variables according to an embodiment of the present invention;
[0029] Figure 5 This is a schematic diagram of another optional method for operating object variables according to an embodiment of the present invention;
[0030] Figure 6 This is a timing diagram of another optional object variable operation method according to an embodiment of the present invention;
[0031] Figure 7 This is a schematic diagram of another optional method for operating object variables according to an embodiment of the present invention;
[0032] Figure 8 This is a timing diagram of another optional object variable operation method according to an embodiment of the present invention;
[0033] Figure 9 This is a schematic diagram of another optional method for operating object variables according to an embodiment of the present invention;
[0034] Figure 10 This is a schematic diagram of another optional method for operating object variables according to an embodiment of the present invention;
[0035] Figure 11 This is a schematic diagram of another optional method for operating object variables according to an embodiment of the present invention;
[0036] Figure 12 This is a schematic diagram of another optional method for operating object variables according to an embodiment of the present invention;
[0037] Figure 13 This is a schematic diagram of another optional method for operating object variables according to an embodiment of the present invention;
[0038] Figure 14 This is a schematic diagram of another optional method for operating object variables according to an embodiment of the present invention;
[0039] Figure 15 This is a schematic diagram of another optional method for operating object variables according to an embodiment of the present invention;
[0040] Figure 16 This is a schematic diagram of another optional method for operating object variables according to an embodiment of the present invention;
[0041] Figure 17This is a schematic diagram of another optional method for operating object variables according to an embodiment of the present invention;
[0042] Figure 18 This is a schematic diagram of another optional method for operating object variables according to an embodiment of the present invention;
[0043] Figure 19 This is a schematic diagram of another optional method for operating object variables according to an embodiment of the present invention;
[0044] Figure 20 This is a schematic diagram of another optional method for operating object variables according to an embodiment of the present invention;
[0045] Figure 21 This is a timing diagram of another optional object variable operation method according to an embodiment of the present invention;
[0046] Figure 22 This is a timing diagram of another optional object variable operation method according to an embodiment of the present invention;
[0047] Figure 23 This is a schematic diagram of the structure of an optional object variable manipulation device according to an embodiment of the present invention;
[0048] Figure 24 This is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present invention. Detailed Implementation
[0049] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0050] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention 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.
[0051] According to one aspect of the present invention, a method for manipulating object variables is provided. As an optional implementation, the above-described method for manipulating object variables can be applied to, but is not limited to, [examples of other methods]. Figure 1 The operating system of the object variable in the hardware environment shown may include, but is not limited to, terminal device 102, network 104, server 106, and database 108. The target client (e.g., ...) is running on terminal device 102. Figure 1 As shown, taking a target client that provides visual programming functionality as an example, the target client may include, but is not limited to, instant messaging clients, educational clients, game clients, etc. The terminal device 102 includes a human-computer interaction screen, a processor, and a memory. The human-computer interaction screen is used to display the application interface and the results of interactive operations (such as...). Figure 1 The application interface shown also provides a human-computer interaction interface to receive various interactive operations from the user, including drag-and-drop operations. The processor generates interaction instructions in response to these human-computer interaction operations and sends the program code generated based on the interaction instructions to the server. The memory stores relevant attribute data.
[0052] Visual programming provides an intuitive interface that allows users to build programs by dragging and connecting various blocks (such as programming blocks) that indicate different code segments. Each block represents a programming concept or operation, such as loops, conditional statements, mathematical operations, and variables. Visual programming typically supports multiple programming languages, such as JavaScript and Python. Optionally, visual programming functionality can be built into an application, such as a user-generated content (UGC) editor within a game application. It's worth noting that UGC editors support creating, adjusting, and sharing custom content (such as virtual maps, virtual scenes, and virtual characters). UGC editors can lower the barrier to creation while maintaining high-quality output; in particular, UGC editors have visual programming capabilities.
[0053] Schematic illustration: Terminal device 102 can be used to display a UGC editor in a game application. This UGC editor provides a visual programming interface, which includes multiple interactive functions. Users can perform the visual programming process through these interactive functions. The interactive functions include at least one of several functions such as selection, zoom in, zoom out, delete, and move. Users can select blocks used to indicate code blocks in the visual programming interface using the selection function, adjust the size of the blocks using the zoom in and zoom out functions, and adjust the state of the blocks in the programming interface using the delete and move functions. The interactive functions are not limited here.
[0054] In addition, server 106 includes a processing engine for performing store or read operations on database 108. Specifically, the processing engine reads the target program code sent by each object account from database 108.
[0055] Assumption Figure 1 The terminal device 102 is the terminal device used for login of the current object account. The specific process of this embodiment is as follows: The terminal device 102 executes steps S102 to S106, responding to the variable object operation received in the visual programming interface, and obtains the target variable type indicated by the variable object operation. The visual programming interface is used to receive interactive operations to generate program content that matches the interactive operations. The interactive operations include variable object operations. From the variable operation interface set, at least one target variable operation interface that matches the variable object operation is determined. The variable operation interface set includes multiple variable operation interfaces. According to the at least one target variable operation interface and the target variable type, at least one object operation is performed on the variable object set. The variable object set is used to store the object information of at least one variable object created according to the visual programming interface. The variable object is displayed as a variable block style in the visual programming interface. The target program code that matches the visual programming operation is generated and compiled.
[0056] Next, as in step S110, terminal device 102 sends the target program code to server 106 via network 104; finally, server 106 executes step S112 and stores the target program code.
[0057] It is understood that the operating system of the above-mentioned object variable can be a programming environment that provides cloud services, and the server 106 can perform real-time cloud storage of the target code program generated through visual programming operations; in another optional implementation, the code generation and compilation operations of the above-mentioned step S108 can also be performed through the above-mentioned server 106.
[0058] Optionally, in this embodiment, the terminal device can be a terminal device configured with a target client, which may include, but is not limited to, at least one of the following: mobile phone (such as Android phone, iOS phone, etc.), laptop computer, tablet computer, PDA, MID (Mobile Internet Devices), PAD, desktop computer, smart TV, vehicle terminal, VR / AR device, etc. The target client can be a video client, instant messaging client, browser client, educational client, or other client that supports providing shooting game tasks. The network may include, but is not limited to, wired network and wireless network, wherein the wired network includes: local area network, metropolitan area network, and wide area network, and the wireless network includes: Bluetooth, WIFI, and other networks that enable wireless communication. The server may be a single server, a server cluster composed of multiple servers, or a cloud server. The above is only an example, and no limitation is made in this embodiment.
[0059] In this embodiment of the invention, when a variable object operation is received based on a visual programming interface, the target variable type indicated by the variable object operation is obtained; at least one target variable operation interface matching the variable object operation is determined from a set of variable operation interfaces, wherein the set of variable operation interfaces includes multiple variable operation interfaces; based on at least one target variable operation interface and the target variable type, at least one object operation is performed on the variable object set. Thus, through the operation interfaces provided by the variable operation interface set, the interactive operations related to variable objects in the visual programming interface are mapped in real time to object operations on the variable object set.
[0060] Because the variable operation interface needs to be called based on the variable type of the object variable, it is possible to accurately obtain the type matching result of the object operation on the variable object during the process of mapping interactive operations to object operations on the variable object collection in real time. This enables real-time acquisition of variable matching results during visual programming, avoiding program failures or unexpected results caused by type errors. In addition, the variable object collection enables unified and efficient management of variable objects involved in the visual programming process, improving the efficiency of visual programming and solving the technical problem of low efficiency in existing visual programming methods.
[0061] As an optional implementation method, such as Figure 2 As shown, the methods for manipulating the above object variables include the following steps:
[0062] S202, in response to a variable object operation received in the visual programming interface, obtain the target variable type indicated by the variable object operation, wherein the visual programming interface is used to receive interactive operations to generate program content that matches the interactive operations, the interactive operations including variable object operations;
[0063] S204, From the set of variable operation interfaces, determine at least one target variable operation interface that matches the variable object operation, wherein the set of variable operation interfaces includes multiple variable operation interfaces.
[0064] S206, Perform at least one object operation on a set of variable objects according to at least one target variable operation interface and target variable type, wherein the set of variable objects is used to store object information of at least one variable object created according to the visual programming interface, and the variable object is displayed as a variable block style in the visual programming interface.
[0065] It should be noted that the above-described embodiments of this application can be applied to an educational application that provides a visual programming tool, allowing users to learn programming operations and logic by dragging and dropping interactive blocks to indicate code blocks. Furthermore, the above-described embodiments can also be applied to a game application that provides a UGC editor with a visual programming interface, transforming complex programming languages into intuitive and interactive blocks, allowing users to customize game content through visual interaction. The above application scenarios are merely illustrative and do not limit the specific application scenarios of the above-described embodiments of this application.
[0066] In educational applications, users can access visual programming tools via terminal devices. They can then select tiles from the available tiles provided in the visual programming interface of these applications and build tile combinations. Since each tile can be mapped to a code block or logic block in the program code, the execution logic relationship between multiple code blocks can be indicated through tile combinations, thus obtaining a set of code programs.
[0067] In game development, users can access the UGC editor within a game application via a terminal device. Through the visual programming interface provided by the UGC editor, they can select preset interactive tiles to indicate pre-defined virtual elements in the game scene, or customize interactive tiles to indicate custom virtual elements. The connections between these interactive tiles indicate the relationships or interactions between different game elements within the custom game content. Furthermore, by editing these interactive tiles, users can build their own custom game content. It is understood that these interactive tiles can be used to indicate virtual game elements in the game scene, and also to indicate the corresponding code blocks during the implementation or rendering of these virtual game elements on the terminal device.
[0068] It is understandable that in the above application scenarios, the process of performing programming operations based on a visual programming interface usually involves the processing of different variable objects. In this embodiment, a variable object can be used to indicate a data container for storing data values. During programming, the corresponding variable object can be called to use the corresponding data value in the program logic.
[0069] In program code, variable objects of a specific type can typically only be used to store data values of that corresponding type, such as integer (int), floating-point (float), character (char), and string (string). If the processing operation performed on a variable object is different from the data type it stores, it may cause the program to report an error or crash.
[0070] However, in conventional visual programming scenarios, variable tiles used to indicate variable objects do not have configured tile type attributes. This means that users can store different types of data, such as strings, numbers, or boolean values, within the same variable tile without needing type conversion. Therefore, typeless variable tiles used to indicate variable objects in conventional visual programming scenarios present significant problems. First, the lack of explicit type restrictions on variable tiles can lead to type errors, such as using a string type variable tile in a logical position that requires numbers. Such type errors may cause applications generated based on visual programming to fail or produce unexpected results. Second, typeless variable tiles may reduce code readability and maintainability. That is, when reading program code obtained from visual programming operations, it is impossible to determine the type and purpose of variable objects mapped from typeless variable tiles. In other words, in conventional visual programming methods, developers need to expend considerable effort to confirm the type of variable tiles when processing variable objects based on them to ensure the generation of correct and executable code. Therefore, conventional visual programming methods suffer from low operational efficiency.
[0071] exist Figure 2 In the illustrated embodiment, through S202, the target variable type indicated by the variable object operation can be obtained in response to the variable object operation received in the visual programming interface. It should be noted that the aforementioned variable object operation can be an interactive operation performed on the target variable block used to indicate the target variable object in the visual programming interface, thereby mapping the received data in the visual programming interface to logical processing operations performed on the target variable object in the program code.
[0072] It should be noted that, in the embodiments of this application, the variable type of the target variable corresponding to the above-mentioned variable object operation may include, but is not limited to, data types involved in conventional programming operations, such as numeric types, string types, vector types, boolean types, etc. Furthermore, the target variable type of the above-mentioned target variable object may also be a data type associated with a specific application scenario.
[0073] For example, in teaching application scenarios, the target variable type of the above-mentioned target variable object can also be any data type that may be involved in the teaching application scenario, such as a geometric element type.
[0074] For example, in a game editing scenario, the aforementioned target variable type can also be an object type used to indicate virtual objects in the virtual game scene. For instance, it could be a "player type" indicating the object performing the current game operation, a "character type" indicating the control object currently being interacted with, an "item type" indicating an interactive object in the virtual scene, or a "timer type" indicating a trigger node for a specific event in the virtual scene. In this embodiment, the variable type of the target variable object described above is not limited.
[0075] Corresponding to variable objects of different variable types, the operation methods for the aforementioned variable objects can also include different types. For example, for variable objects of numerical type, the operation types for variable objects can include, but are not limited to, creation, editing, deletion, display, and assignment operations; for variable objects of "character type," the operation methods for variable objects can include, but are not limited to, creation, editing, deletion, display, and movement control operations; for variable objects of "item type," the operation methods for variable objects can include, but are not limited to, creation, editing, deletion, display, pickup, and exchange operations. In this embodiment, the operation types for the aforementioned variable objects are not limited.
[0076] The following combination Figure 3 This section describes a specific visual programming interface. For example... Figure 3The visual programming interface shown includes a first menu bar 302, which indicates the object types of interactive objects supported in the current visual programming interface. For example, the "Event Control" included in the first menu bar 302 can be used to indicate that event objects in the virtual scene can be edited and processed through interactive operations on event blocks in the current visual programming interface. Specifically, triggering the "Event Control" can display a secondary menu bar matching the "Event Control," which displays interactive event blocks used to indicate different virtual events. It can be understood that an event block can be mapped to an event code block in the program code, used to indicate and describe the event content of virtual events in the virtual scene. Similarly, the "Control Control" included in the first menu bar 302 can be used to indicate that the control logic indicated by the control blocks can be edited and processed through interactive operations on the control blocks in the current visual programming interface.
[0077] Furthermore, if "Variable Control" is currently selected from the first menu bar 302, a second menu bar 304 matching "Variable Control" can be displayed. The second menu bar 304 displays operation controls for selecting variable blocks to manipulate different variable types. For example, if the "Boolean Value" control is currently selected, a Boolean value type variable block can be displayed in the second operation area 306, which can be used to indicate created Boolean value type variable objects. Additionally, the "Boolean Value" control in the second menu bar 304 further displays a superscript "①" to indicate that the number of created Boolean value type variable objects is 1. Understandably, if a touch operation is performed on the "Number" control in the second menu bar 304, a created number variable block can be displayed in the second operation area 306 to indicate created number type variable objects (not currently shown). In addition, the second menu bar 304 also displays a "String" control, a "Vector" control, a "Player" control, a "Character" control, a "Component" control, a "Props" control, a "Logic Component" control, a "Motion Unit" control, a "Timer" control, and a "Task" control. Each of these controls can trigger the display of a variable tile matching the current control in the second operation area 306 to indicate the different variable objects that have been created.
[0078] Furthermore, in response to a drag operation on the Boolean variable block in the second operation area 306, if the drag endpoint is located in the first operation area 308 and a release operation is detected, a first variable block 310 indicating the Boolean variable object can be displayed in the first operation area 308. It is understood that different interactive operations can be performed on the first variable block 310 in the first operation area 308, such as drag operations or editing operations. Optionally, as... Figure 4As shown, when a first function block 312 is displayed in the first operation area 308, in response to dragging the first variable block 310 to the empty area of the first function block 312, the first Boolean value object corresponding to the first variable block 310 is input into the first function object indicated by the first function block 312 to obtain the output result of the first function object.
[0079] Furthermore, through the above S204 and S206, a target variable operation interface matching the above variable object operation can be determined from the variable operation interface set, and object operations can be performed on the variable object set based on the above target variable type through the target variable operation interface, thereby realizing real-time management and maintenance of variable objects in the variable object set in response to the variable object operations performed in the visual programming interface.
[0080] It is understood that, in the above embodiments of this application, the variable objects processed or manipulated during the visual programming operation can be managed through the above-mentioned variable object set.
[0081] In one optional implementation, the aforementioned set of variable objects can be specifically represented by a variable-capacity array object, wherein each array element in the array object can indicate a variable object; in another optional implementation, the aforementioned set of variable objects can also be stored in a list object for storing list elements used to represent the variable objects.
[0082] Furthermore, when programming operations performed through the aforementioned visual programming interface involve variable objects with a hierarchical structure, leaf nodes representing these variable objects can be stored using tree objects. For example, during game development operations performed through the visual programming interface, multiple objects in the game application can have hierarchical relationships: specifically, game scene objects, virtual objects included in a game scene, and interactive text objects corresponding to a virtual object can have significant hierarchical relationships. In specific visual programming processes, when it is necessary to manage the aforementioned game scene objects, virtual objects, and interactive text objects, the aforementioned tree structure can be used to store and manage the collection of variable objects.
[0083] In an optional implementation, when the aforementioned set of variable objects is specifically an array object, and when the variable object operations include variable creation operations, the variable operation interface set may include an element addition interface for performing array element addition operations; when the aforementioned variable object operations include variable editing operations, the variable operation interface set may include an array element editing interface for performing array element editing operations; when the aforementioned variable object operations include variable deletion operations, the variable operation interface set may include an array element deletion interface for performing array element deletion operations; and when the aforementioned variable object operations include variable viewing operations, the variable operation interface set may include an array element search interface for performing array element search operations.
[0084] In one optional implementation, the aforementioned set of variable operation interfaces and the collection of variable objects can be stored and managed using a data object class. On one hand, the data object class can include an array variable indicating the collection of variable objects. On the other hand, the data object class can also provide interfaces for creating array elements, deleting variables, and renaming variables, thereby enabling the storage and management of multiple variable objects involved in the visual programming interface.
[0085] Because the variable operation interface needs to be called based on the variable type of the object variable, it is possible to accurately obtain the type matching result of the object operation on the variable object during the process of mapping interactive operations to object operations on the variable object collection in real time. This enables real-time acquisition of variable matching results during visual programming, avoiding program failures or unexpected results caused by type errors. In addition, the variable object collection enables unified and efficient management of variable objects involved in the visual programming process, improving the efficiency of visual programming and solving the technical problem of low efficiency in existing visual programming methods.
[0086] In one optional implementation, the above-described execution of at least one object operation on the variable object collection based on at least one target variable operation interface and the target variable type includes:
[0087] S1, when the variable object operation is a variable creation operation, generate target array elements that match the target variable object based on the variable identification information indicated by the variable creation operation and the type description information used to indicate the type of the target variable;
[0088] S2, add the target array elements to the object array used to indicate the collection of variable objects, where each array element in the object array is used to indicate a variable object.
[0089] It is understood that in this embodiment, the object array represents a collection of variable objects, and the array elements indicate the variable objects. Furthermore, in this embodiment, the array elements include at least two types of element data: the first type of element data may be type description information indicating the type of the target variable, and the second type of element data may be variable identification information used to indicate the variable object.
[0090] Optionally, the variable identification information may further include a variable id and a variable name. The variable id is used to uniquely indicate the variable object in the program code determined by the visual programming interface, and the variable name can be displayed in the visual programming interface to facilitate the developer's identification and operation of the variable object.
[0091] Specifically, the array elements in the above object array can be represented by the following data structure: {id:string,name:string,type:T};
[0092] In the array elements above, the "id" field is used to store the variable ID information of string type, the "name" field is used to store the variable name information of string type, and the "type" field is used to store the variable type, such as Boolean (Boolean value), Number (array), or String (string).
[0093] In one optional implementation, determining at least one target variable operation interface matching the variable object operation from the variable operation interface set includes: determining an array element addition interface matching the variable creation operation from the variable operation interface set, wherein the variable operation interface set includes an array element addition interface, which is used to generate array elements matching the variable object according to the variable identification information and type description information indicated by the variable creation operation.
[0094] It is understood that in this embodiment, an array element addition interface is provided to synchronize with the variable object creation operation detected in the visual programming interface, and to add target array elements to the object array used to represent the collection of variable objects to indicate the target variable object.
[0095] In one specific approach, the `addVariable` method can be used to represent the interface for adding array elements. The definition of the array element addition interface is as follows:
[0096] public addVariable(variable:VariableModel){
[0097] this.variables.push(variable);
[0098] };
[0099] The `public` character can be an access modifier, indicating that the `addVariable` interface for adding array elements is public and can be accessed outside the class. The `(variable: VariableModel)` character represents the parameter list of the `addVariable` interface, indicating that the `addVariable` method accepts one parameter, whose name can be the array name `variable` of the array of objects, and whose type is the array type `VariableModel`.
[0100] Furthermore, in the code above, `this.variables.push(variable)`, the `this` field can be used to indicate the instance of the current object, and is used to access the class's member variables and methods. `variables` is a member variable of the current object, which is an array. `push` is a method of the array used to add a new element to the end of the array. `variable` is the parameter passed to the `addVariable` method, which is here added to the object array, i.e., the `variables` array.
[0101] In the above implementation, an array of variables of type VariableModel can be added to the current variables array using the externally provided addVariable method.
[0102] In the above embodiments of this application, since the variable operation interface needs to be called based on the variable type of the object variable, it is possible to accurately obtain the type matching result of the object operation on the variable object during the process of mapping the interactive operation to the object operation on the variable object collection in real time. This enables the real-time acquisition of variable matching results during visual programming, avoiding program failure or unexpected results caused by type errors. In addition, the variable object collection enables unified and efficient management of the variable objects involved in the visual programming process, improving the efficiency of visual programming and solving the technical problem of low efficiency in existing visual programming methods.
[0103] In an optional implementation, when the variable object operation is a variable creation operation, before generating the target array element matching the target variable object based on the variable identification information indicated by the variable creation operation and the type description information used to indicate the target variable type, the method further includes:
[0104] S1, when the variable creation control is displayed on the variable preview page in the visual programming interface, the array element acquisition interface is determined from the variable operation interface set. The variable creation control is used to detect variable creation operations, the variable preview page is used to display variable objects of type target variable type, and the variable operation interface set includes the array element acquisition interface.
[0105] S2, if at least one first array element is found in the object array based on the array element acquisition interface and the target variable type, a first code block corresponding to each of the at least one first array element is obtained, wherein the first array element matches the first variable object of the target variable type, and the first code block is used to display the first variable block for indicating the first variable object in the visual programming interface.
[0106] It is understandable that, in this embodiment, when the variable creation control in the visual programming interface is displayed on the variable preview page, before adding the target array element according to the array element addition interface called in the background, it is also necessary to respond to the display operation of the variable preview page and obtain the array element corresponding to the variable object to be displayed on the preview page through the array element retrieval interface.
[0107] In one alternative implementation, if it is necessary to display the variable blocks corresponding to each of the variable objects in the variable preview page, the variable code blocks corresponding to each array object can be obtained directly from the object array, which includes all array objects, and the variable blocks corresponding to each variable object can be displayed in the variable preview page based on the corresponding variable code blocks.
[0108] In another optional implementation, as in step S2 of the above implementation, if it is necessary to display the variable blocks corresponding to each variable object of a specific variable type in the variable preview page, a filtering operation can be performed on the object array based on the variable type, and the variable code blocks corresponding to each of the filtered first array objects can be obtained, and the variable blocks corresponding to each variable object can be displayed in the variable preview page based on their respective variable code blocks.
[0109] The following combination Figure 3 , Figure 5 This document describes the preview of variable blocks for a variable object within a visual programming interface, as well as the interactive operations involved in creating these variable blocks. Figure 5As shown, in response to a trigger operation on the "Variable" control in the first menu bar 502, a second menu bar 504 matching the "Variable" control is displayed. The second menu bar 504 displays trigger controls indicating the respective variable objects of different variable types that can be created. In response to a trigger operation on the "Boolean value" control in the second menu bar 504, a variable block preview page matching the Boolean variable object is displayed in the second operation area 516. As shown in the second operation area 516, no variable block is displayed, indicating that no Boolean variable object is currently being created. Simultaneously, the second operation area 516 displays a creation control 514, indicating that a target variable control of the Boolean type can be created using the creation control 514.
[0110] In response to Figure 5 The trigger operation of control 514 in the creation process causes the interface to switch displays as follows: Figure 3 As shown, in Figure 3 The second operation area 306 displays the variable block corresponding to the currently created Boolean variable object. Furthermore, the "Boolean Value" control in the second menu bar 304 displays a superscript "①" to indicate that the number of Boolean variable objects created is 1.
[0111] The following combination Figure 6 Regarding the above Figure 5 , Figure 3 The implementation process of the interaction process will be explained. For example... Figure 6 As shown, in this embodiment, the interactive objects involved include a user interface, a variable controller for providing variable object management operations, and an object array VariableStore for storing array elements corresponding to variable objects.
[0112] Before performing visual programming operations, the object array first executes S600 to initialize the object array Variables;
[0113] Next, in response to Figure 5 In the second menu bar 504, the user interface executes S602 to request the variable controller to obtain the list of boolean variables; the variable controller executes S604 to obtain the array object of boolean type through the getAllVariables('Boolean') method.
[0114] Next, S606 is executed to filter out array objects of Boolean value type; it is understood that at the current stage in this embodiment, Boolean variable objects have not yet been created, so the object array executes S608 to the variable controller, returning an empty set;
[0115] The user interface receives the return result from the variable controller, executes S610, and in response to the return of an empty array, the list is displayed as empty; subsequently, the visual programming interface can display as follows: Figure 5 As shown.
[0116] Next, in response to Figure 5 The creation control 514 in the middle triggers the user interface to execute S611, creating a boolean variable;
[0117] The variable controller executes S612, calling the method addVariable({id:'1',name:'Boolean variable 1',type:'Boolean'}) to add array elements; then, the object array executes S614, updating the object array Variables = [{id:'1',name:'Boolean variable 1',type:'Boolean'}]; and executes S616, returning the update result;
[0118] Further, the variable controller executes S618 to obtain an array object of Boolean type through the getAllVariables('Boolean') method; the object array executes S620 and S622 to filter out the array object of Boolean type; and returns the filtering result ({id:'1',name:'Boolean variable 1',type:'Boolean'}).
[0119] The user interface receives the return result from the variable controller, executes S624, and in response to the return of a new Boolean variable, displays a Boolean variable block. Furthermore, the interface displays as follows: Figure 3 As shown, the variable block corresponding to the created Boolean variable object is displayed in the second operation area 306. Meanwhile, the "Boolean Value" control in the second menu bar 304 further displays a superscript "①" to indicate that the number of Boolean variable objects created is 1.
[0120] In one alternative implementation, after adding the target array elements to the object array used to indicate the collection of variable objects, the method further includes:
[0121] S1, in response to receiving a variable editing operation performed on the target variable object in the visual programming interface, determines the array element editing interface that matches the variable editing operation from the variable operation interface set, wherein the variable operation interface set includes array element editing interfaces;
[0122] S2, based on the variable editing information carried in the variable editing operation and the array element editing interface, performs element editing operation on the target array element to obtain the updated target array element.
[0123] It is understood that this embodiment further provides an array element editing interface corresponding to variable editing operations performed in the visual programming interface, so as to realize real-time response to editing operations performed in the visual programming interface and manage the edited content in the object array. In this embodiment, the element information included in the array elements in the object array may include: {id:string, name:string, type:T}. That is to say, if any item of variable id, variable name, or variable type is edited or changed in the visual programming interface, any of the above information can be synchronously changed in the above object array.
[0124] In a specific editing method, the editable content of a variable object can include the variable name of the variable object. Specifically, the array element editing interface can be represented by `renameVariable`, and the definition of the array element editing interface is as follows:
[0125] public renameVariable(id:string,name:string){
[0126] const variable=this.getVariableById(id);
[0127] if(!variable){
[0128] return;
[0129] }
[0130] variable.name = name;
[0131] };
[0132] The `public` character can be an access modifier, indicating that the array element editing interface `renameVariable` is public and can be accessed outside the class. The character `(variable:VariableModel)` represents the parameter list of the array element editing interface, indicating that the `addVariable` method accepts two parameters, the first of which is the variable `id` (`id:string`) and the updated variable name `name:string`.
[0133] Furthermore, in the code above, `const variable = this.getVariableById(id)` declares a constant named `variable`, whose value is obtained by calling the `getVariableById` method of the current object and passing in the `id` parameter. This method can return a variable object with the given `id`, or return `undefined` or `null` if it cannot be found.
[0134] The `if(!variable){return;}` statement indicates a conditional statement that checks if the variable object indicated by the received `id` exists. If it does not exist, it returns `null` or `undefined`. In other words, if the array element corresponding to the variable object to be edited does not exist (i.e., no matching variable is found), the method will exit prematurely without performing any operation. If the variable object is found, the variable's `name` property will be updated to the value of the passed-in `name` parameter.
[0135] In summary, the code snippet above allows you to find a variable with a specific id in an array of objects and update its name property to the new name. If a variable with the given id is not found, no operation is performed.
[0136] In an alternative implementation, after adding the target array elements to the object array used to indicate the collection of variable objects, the method further includes:
[0137] S1, in response to a variable deletion operation received in the visual programming interface, obtain the second variable identifier indicated by the variable deletion operation, wherein the variable object operation includes the variable deletion operation;
[0138] S2, from the set of variable operation interfaces, determine the array element deletion interface that matches the variable deletion operation, wherein the set of variable operation interfaces includes array element deletion interfaces;
[0139] S3, based on the second variable identifier and the array element deletion interface, delete the second array element that matches the second variable object from the variable object collection, where the second variable identifier is used to indicate the second variable object.
[0140] It is understood that, in this embodiment, an array element deletion interface corresponding to the variable deletion operation performed in the visual programming interface is further provided, so as to realize real-time response to the deletion operation performed in the visual programming interface and delete the corresponding variable in the object array.
[0141] In one specific implementation, the above array element deletion interface can be defined by the following code snippet:
[0142] public deleteVariable(id:string){
[0143] const index=this.variables.findIndex((v)=>v.id===id);
[0144] if(index===-1){
[0145] return;
[0146] }
[0147] this.variables.splice(index,1);
[0148] In this embodiment, the above code block can be used to find the corresponding variable in the variables array based on the variable's ID and delete it when an interactive operation to delete a variable object is received in the visual editing interface.
[0149] The `public deleteVariable(id:string)` field defines a public method `deleteVariable` that accepts a string parameter `id`, which identifies the variable to be deleted. Additionally, the `const index = this.variables.findIndex((v) => v.id === id)` field indicates that the `findIndex` method is used to search the `variables` array for a variable whose `id` attribute matches the passed-in `id` parameter and returns the index of that variable in the array. The `findIndex` method accepts a callback function that executes for each array element until a match is found.
[0150] Furthermore, the conditional statement `if(index === -1)` in the code block above checks if `index` is -1. If `index` is -1, it means no matching element was found in the array. If no matching element was found (i.e., `index` is -1), the method will exit prematurely without performing any operation. Conversely, `this.variables.splice(index, 1)` is executed; if a matching element was found (i.e., `index` is not -1), this line of code uses the `splice` method to delete the found element from the `variables` array. The first parameter of the `splice` method is the index at which to start deleting the element, and the second parameter is the number of elements to delete; here, one element is being deleted, so the number is 1.
[0151] In the above implementation, a variable with a specific id can be found in the this.variables array using the array element deletion interface and then deleted. If no variable with the given id is found, no operation is performed.
[0152] The following combination Figure 7 This section describes an operation for editing variable objects within a visual programming interface. For example... Figure 7 As shown, in response to a long press operation on the variable tile 712 displayed in the second operation area 706, which indicates a Boolean variable object, an editing window 710 can be displayed in the first operation area 708. The editing window 710 further displays the variable name "Boolean variable 1" of the current variable object. It is understood that, in response to a trigger operation on the "Edit" control, the variable name "Boolean variable 1" can be edited, for example, by renaming it; similarly, in response to a trigger operation on the "Delete" control, the currently created Boolean variable "Boolean variable 1" can be deleted.
[0153] The following combination Figure 8 Regarding the above Figure 7 This section explains the specific implementation methods of the editing and deletion operations involved. It responds to... Figure 7 The editing control in the editing window 710 triggers the following operations: User interface executes S802, renaming "Boolean variable 1" to "Boolean 1"; Variable controller executes S804, modifying the variable name using the renameVariable('2','Boolean 1') method (i.e., the array element editing interface); Object array executes S806, searching the object array Variables = [{id:'1',name:'Boolean variable 1',type:'Boolean'}]; S808, returns the search results, indicating a successful search.
[0154] Next, the variable controller executes S810, calling the method getAllVariables('Boolean') (i.e., the array element retrieval interface); the object array executes S812, filtering out array objects of Boolean type; after the variable names in the array elements are edited, S812, the edited result is returned ({id:'1', name:'Boolean1', type:'Boolean'}); in the user interface, as in step S814, in response to the return of a new Boolean variable, the interface displays an edited Boolean variable tile;
[0155] Understandably, after completing the variable name editing operations for the Boolean variables described above, further steps can be taken based on... Figure 7 The deletion control in the editing window 710 is triggered to perform the operation. Figure 8In S816, "Boolean 1" is deleted; the variable controller executes S818, calling the method deleteVariable('1') (i.e., the array element deletion interface); then after the object array has completed the deletion operation, S820 is executed to find the object array Variables = [] (i.e., the current object array has become an empty set); further, S822 is executed, returning the deletion result [];
[0156] The variable controller continues to execute S824, calling the method getAllVariables('Boolean') (i.e., the array element retrieval interface); the object array executes S826, filtering out variables with type = 'Boolean'; it is understandable that the current object array no longer includes array elements of Boolean type, so S828 is executed, returning the filtered result []; the variable controller executes S830 to the user interface, returning an empty array (there are currently no array elements), and the list is displayed as empty.
[0157] Through the above-described embodiments of this application, a user-friendly interface is provided for creating and managing different types of variables, allowing users to clearly identify the types of variables during use. This reduces the complexity and difficulty of programming and improves the efficiency of visual programming.
[0158] In an optional implementation, after obtaining the variable type indicated by the variable object operation in response to the variable object operation received in the visual programming interface, the method further includes:
[0159] S1, when the variable object operation is a variable creation operation, obtain the first code block that matches the target variable type, wherein the first code block is used to describe the variable attribute information of the variable object;
[0160] S2, based on the variable description information carried by the variable creation operation, update the first code block to the second code block, wherein the second code block is used to display the target variable block that matches the target variable object in the visual programming interface, and the variable description information includes variable identification information.
[0161] It is understood that in this embodiment, the aforementioned visual programming interface can be implemented based on Blockly, and different types of variable blocks (also known as variable building blocks) can be predefined based on Blockly. It should be noted that Blockly is an open-source graphical programming library. Through the Blockly programming library, users can program using building block blocks as the interactive medium, and it supports converting user-dragdled blocks into different programming languages.
[0162] In this embodiment, variable blocks can be predefined for various variable objects to represent different variable objects based on different block styles in the above-mentioned visual programming interface.
[0163] In one alternative approach, the attribute content included in the first code block used to define the variable block representing the variable object may include the following aspects:
[0164] The tile type attribute, which is the unique identifier of a tile, is used to distinguish the variable tiles corresponding to different types of variable objects;
[0165] Text attributes are used to indicate the display text shown on the variable block and can include placeholders to represent fields and inputs;
[0166] Array attributes can be used to indicate the fields and input configurations included in a tile. For example, the `field_image` field can indicate the image displayed in the variable tile, the `field_label` field can indicate the text displayed in the variable tile, and the `field_dropdown` field can indicate the dropdown menu displayed in the variable tile.
[0167] Output attributes can be used to indicate the output type of the variable object indicated by the variable block, representing which types of variable objects the current variable object can connect to as input.
[0168] Extended attributes can be used to indicate the extended functionality of the variable object pointed to by the current variable block.
[0169] It should be noted that in game development scenarios using a visual programming interface, the special variable types that can be included may include, but are not limited to, "component" variables, "item" variables, "particle" variables, "sound effect" variables, "logic component" variables, "motion unit" variables, "timer" variables, "task" variables, "trigger box" variables, "character" variables, "animation" variables, and "creature" variables. The extended functionality of these special variable types can be described and defined in the aforementioned extended attributes.
[0170] For example, the "component" variable can be used to indicate a general component or object in a game task. Its related attributes, such as position, size, color, visibility, and hierarchy, can be defined in the extended attributes mentioned above.
[0171] For example, the "item" variable can be used to indicate items that players can pick up or use in the game. Its attributes, such as type, durability, effect, weight, icon, and description, can be defined in the extended attributes mentioned above.
[0172] For example, the "particle" variable can be used to indicate visual effects created in a game scene, such as smoke, fire, and magic effects. Its related attributes, such as particle type, speed, lifespan, color, size, and emissivity, can be defined in the extended attributes mentioned above.
[0173] For example, the "sound effects" variable can be used to indicate sound effects in a game, such as background music, character voices, and action sound effects. Its attributes, such as volume, pitch, loop, playback status, and sound effect file path, can be defined in the extended attributes mentioned above.
[0174] For example, the "logic element" variable can be used to indicate the components that implement game logic, such as triggers and conditional statements. Its attributes, such as trigger conditions, actions to be performed, priority, and activation status, can be defined in the extended attributes mentioned above.
[0175] For example, the "motion unit" variable can be used to indicate the component that controls the movement of objects in a game. Its attributes, such as speed, acceleration, direction, path, and movement type (e.g., linear, curvilinear), can be defined in the extended attributes mentioned above.
[0176] For example, the "Timer" variable can be used to indicate components in a game that track time intervals and perform timed tasks. Its properties, such as duration, delay, number of repetitions, and current status (e.g., running, paused, stopped), can be defined in the extended properties mentioned above.
[0177] For example, the "Task" variable can be used to indicate tasks or objectives in the game that players need to complete to advance the game. Its attributes, such as description, objective, completion status, reward, and difficulty, can be defined in the extended attributes mentioned above.
[0178] For example, the "Trigger Box" variable can be used to indicate specific areas defined in the game, where events are triggered when a player or object enters these areas. Its properties, such as size, position, trigger event, and activation status, can be defined in the extended properties mentioned above.
[0179] For example, the "Character" variable can be used to indicate the main character or NPC (non-player controlled character) in the game. Its attributes, such as health, energy, attack power, defense, movement speed, and character model, can be defined in the aforementioned extended attributes.
[0180] For example, the "Animation" variable can be used to indicate visual animations in a game, which are used on characters, objects, or interface elements. Its properties, such as animation status, frame rate, loop, playback speed, and animation file path, can be defined in the extended properties mentioned above.
[0181] For example, the "Creature" variable can be used to indicate virtual creatures or monsters in a game, which may have aggressive or specific behaviors. Their attributes, such as health points, behavior patterns, attack methods, reproduction rate, and ecological niche, can be defined in the aforementioned extended attributes.
[0182] In one specific implementation, variable tiles can be defined using JSON objects. These JSON objects describe the appearance, behavior, and attributes of the variable tiles. Therefore, different JSON objects can be predefined for different variable types, allowing the creation and display of corresponding variable tiles for each type.
[0183] Furthermore, in this embodiment, a function `generateVarGetterBlockDefinitionCodeByVarType` can be encapsulated for generating variable block definitions of different types. This function accepts a parameter `type` representing the variable type of the variable object. Based on the variable object creation operation in the visual programming interface and the variable type given by the variable creation operation, this function uses the variable block creation method `Blockly.defineBlocksWithJsonArray` to define a new block.
[0184] The method for creating variable blocks, namely Blockly.defineBlocksW1thJsonArray, can be implemented as follows:
[0185] Blockly.defineBlocksW1thJsonArray([
[0186] {
[0187] type:'Variable_Getter_${type}',
[0188] message0: %1%2',
[0189] args0:[
[0190] {
[0191] type:'field_image',
[0192] src:globalVarIcon,
[0193] width:28,
[0194] height:22,
[0195] name:"varicon",
[0196] },
[0197] {
[0198] type:'field_label',
[0199] name:'varName',
[0200] },
[0201] ],
[0202] output:[type,'${type}_Var'],
[0203] style:'variables_blocks',
[0204] mutator:'var_mutator',
[0205] }, ]);
[0207] The method Blockly.defineBlocksWithJsonArray described above can accept a JSON array as a parameter to define a newly created variable block that represents the variable object.
[0208] The `type` field defines the type of the block, using the template string `Variable_Getter_${type}`, indicating that the block type will be dynamically generated based on the variable types carried in the received creation request. The `message0` field defines the message displayed on the block, using placeholders `%1` and `%2`, which will be replaced during actual use. The `args0` array defines the block's input parameters, including an image field `field_image` (displaying variable icons) and a label field `field_label` (displaying variable names). The `output` field defines the block's output type, using the template string `${type}_Var`, indicating that the output type is related to the variable type. The `style` field specifies the block's style; `variables_blocks` may be a predefined style. The `mutator` field specifies the type of editor that pops up when the block is clicked; `var_mutator` may be a custom editor for editing variables.
[0209] In the above implementation, a function can be defined to create variable tiles. This function can generate corresponding tile definition code based on different variable types. This code is then used to create visual tiles in the Blockly editor. These tiles can be used to retrieve different types of variables within the Blockly programming environment.
[0210] It is understandable that since the output connections, block display styles, and default variable names corresponding to different variable objects can be different, the definition content corresponding to different types of variable objects can also be different. In the above implementation, the first code block corresponding to the variable type indicated by the current variable creation operation can be obtained through S1, and then the first code block can be updated to a second code block according to other creation information obtained, so as to display the variable block in the visual programming interface according to the second code block.
[0211] Specifically, a correspondence between a second code block and a variable block can be as follows: Figure 9 As shown. When the input type is Boolean, the corresponding generated variable tile type is Variable_Getter_Boolean, and the final generated variable tile is as follows. Figure 9 As shown on the right. Figure 9 In the second code block shown on the left, code segment 900 can be determined based on the target variable type (Boolean type) of the acquired target variable object, and based on the preset content in the first code block corresponding to the target variable type. Figure 9Code segment 901 defines the icon style for the variable icon displayed in the target variable block. It defines the pixel height and width of the icon, as well as its style. Optionally, this style can be used to indicate that the current variable object is a global variable object. Furthermore, based on the variable description information obtained from the creation request, namely the variable identifier "Boolean variable 1," code segment 902 is determined, defining the variable name displayed in the variable block. Finally, code segment 903 defines the variable types that the current variable object can connect to. It can be understood that code segment 903 can be the content carried in the first code segment mentioned above; that is, the variable types of the variable objects that each variable object can connect to can be predefined in code segment 903. Figure 9 In code segment 903, the output type can be defined as "Boolean".
[0212] In another specific implementation, the correspondence between the second code block and the variable block can be as follows: Figure 10 As shown. When the input type is a numeric type (Number), the corresponding generated variable tile will have a type of Variable_Getter_Number, and the final generated variable tile will look like this. Figure 10 As shown on the right. Figure 10 In the second code block shown on the left, code segment 1000 can be determined based on the target variable type (numeric type) of the acquired target variable object, and the preset content in the first code block corresponding to the target variable type can be determined. Figure 10 Code segment 1001 defines the icon style for the variable icon displayed in the target variable block. It defines the pixel height and width of the icon, as well as its style. Optionally, this style can be used to indicate that the current variable object is a global variable object. Furthermore, based on the variable description information obtained from the creation request, namely the variable identifier "numerical variable 1," code segment 1002 is determined, defining the variable name displayed in the variable block. Finally, code segment 1003 defines the variable types that the current variable object can connect to. It can be understood that code segment 1003 can be the content carried in the first code segment mentioned above; that is, the variable types of the variable objects that each variable object can connect to can be predefined in code segment 1003. Figure 10 In code segment 1003, the output type can be defined as "numeric".
[0213] Furthermore, in this embodiment, different block styles can be configured for the variable blocks used to represent different variable objects, for example... Figure 9In the first code block corresponding to the Boolean value type, the block style of the Boolean variable block used to represent the Boolean variable object can be set to hexagonal through the attribute in the block definition. For example... Figure 10 In the first code block corresponding to the numerical value, the block style of the numerical variable block used to represent the numerical variable object can be set to ellipse through the attribute in the block definition, so that the variable blocks of different variable types can be displayed differently in the visual programming interface.
[0214] By introducing types to variables during the visual programming process, the above-described embodiments of this application can ensure that users use the correct variable types during visual programming, thereby avoiding program failures or unexpected results caused by type errors, and thus improving the programming efficiency of visual programming.
[0215] In an optional implementation, after updating the first code block to the second code block based on the variable description information carried by the variable creation operation, the method further includes:
[0216] S1, in response to dragging the target variable block to the block area associated with the operation block in the visual programming interface, obtain the reference variable type matching the operation block, wherein the operation block is used to generate the variable operation code block associated with the variable object, and the reference variable type is the variable type matching the variable operation code block;
[0217] S2 determines the drag result of the drag operation based on the matching relationship between the reference variable type and the second code block.
[0218] It is understood that, in this embodiment, after the target variable block is created in the visual programming interface, if further variable operations on the target variable object indicated by the target variable block are involved in subsequent visual operations, the matching result related to the interaction will be determined during the interaction process.
[0219] It should be noted that, in this embodiment, the aforementioned operation block can be used to indicate the type of operation performed on the variable object. For example, if the operation block is specifically an assignment block, it can be used to indicate an assignment operation performed on the variable object; or, if the operation block is specifically a calculation block, it can be used to indicate a numerical calculation operation performed on the variable object. In this embodiment, the reference variable type matching the operation block can be determined based on at least one of the multiple block regions included in the operation block. The following is in conjunction with... Figure 11 The various optional operation blocks involved in the above visual programming interface are explained in detail.
[0220] For example Figure 11In the visual programming interface shown, in response to selecting the "Action" control from the first menu bar 1102 and then selecting the "Assignment" control from the corresponding second menu bar 1104, the operation blocks corresponding to various assignment controls are displayed in the second operation area 1106. When the first operation block is selected as the target operation block, operation block 1110 can be displayed in the first operation area 1108. This operation block 1110 includes two interactive block areas: the first block area is used to fill variable blocks indicating variable objects, and the second block area is used to fill blocks or values indicating specific numerical values. Furthermore, the first operation area 1108 also displays a first variable block 1112 of Boolean type and a second variable block 1114 of numeric type. Understandably, in operation block 1110, the block type corresponding to the first block area needs to match the numerical type in the second block area. For example, if the first block area is a variable block of Boolean type, the numerical type in the second block area should be Boolean; if the first block area is a variable block of numerical type, the numerical type in the second block area should be numerical.
[0221] Assuming in Figure 11 Drag the first variable block 1112 in the first operation area 1108 to the first block area in operation block 1110. Since the second block area in the current operation block 1110 does not include relevant values, it can be directly determined that the reference variable type matching the operation block matches the target variable type corresponding to the first variable block 1112, and so on. Figure 12 As shown, operation block 1200 is updated and displayed as the first operation block 1206.
[0222] It should be noted that, in Figure 12 In the context of operation block 1200, if no other blocks are dragged into the first block area 1202 and the second block area 1204, the default elliptical style can be displayed. When the first variable block corresponding to the Boolean variable 1 is dragged into the first block area, operation block 1200 is updated to display as the first operation block 1206. On one hand, in the first operation block 1206, the area styles of the first and second block areas are adjusted to match the block style of the first variable block, i.e., a hexagonal style, indicating that both block areas can only accept Boolean variable objects or numerical objects. On the other hand, the content displayed in the second block area is updated to display the default Boolean value "false" and a drop-down window to select another Boolean value "true".
[0223] When the second variable block corresponding to the numerical variable 1 is dragged into the first block area, the operation block 1200 is then updated to display as the second operation block 1208. On one hand, in the first operation block 1208, the area styles of the first and second block areas are adjusted to match the block style of the second variable block, i.e., the ellipse style, indicating that both block areas can only accept variable objects or numerical objects of numerical type. On the other hand, the content displayed in the second block area is updated to the default "numerical value 0" and the editing window, so that the variable object "numerical variable 1" can be assigned a different numerical value.
[0224] It is understandable that if the variable block in the first block area 1202 of the dragged operation block 1200 is a string block, the first block area 1202 will be updated to display the area style corresponding to the string block, and the second block area 1204 will also be updated to the area style corresponding to the string block, so as to indicate the object type of the variable object allowed by the current assignment operation.
[0225] In one optional implementation, determining the drag result of the drag operation based on the matching relationship between the reference variable type and the second code block includes:
[0226] Scenario 1: When the target variable object is the variable object to be input in the operation block, obtain the first variable type from the first field in the second code block. The first field is used to indicate the variable type that is allowed to be obtained as input from the target variable object. If the first variable type and the reference variable type do not match, display the target prompt message.
[0227] It is understandable that, when the target variable object is a variable object to be input in the operation block, a first variable type indicating the output type of the target variable object can be obtained from the first field. Based on the matching relationship between the output type of the target variable object and the corresponding reference variable type of the operation block, it is determined whether to display a prompt message. In a specific implementation, the aforementioned first field can specifically be... Figure 10 The code segment 1003 in the second code block.
[0228] Scenario 2: When the target variable object is a variable object that accepts input in the operation block, the target variable type is obtained from the second field in the second code block, where the second field is used to indicate the target variable type of the target variable object; if the target variable type and the reference variable type do not match, a target prompt message is displayed.
[0229] It is understandable that, when the target variable object is a variable object that receives input in the operation block, the target variable type of the target variable object can be obtained from the second field. Based on the matching relationship between the target variable type of the target variable object and the reference variable type corresponding to the operation block, it is determined whether to display a prompt message. In a specific implementation, the aforementioned second field can specifically be... Figure 10 The code segment 1000 in the second code block.
[0230] Furthermore, under different circumstances, the corresponding fields for type matching can be obtained from the second code block mentioned above, and the variable type obtained from the corresponding field can be compared with the reference type corresponding to the operation block.
[0231] In the event of a mismatch, the information style of the aforementioned target prompt may include, but is not limited to, one or more of the following: text style, image style, video style, etc., to indicate that the current variable object does not match the variable type corresponding to the operation block.
[0232] In one specific implementation, when any block area in the above-mentioned operation block 1200 has been dragged into the corresponding block, the operation block 1200 will require the two input types to match, that is, Boolean variables can only be connected to Boolean values, and numeric variables can only be connected to numeric values. Incorrect type connections are not allowed. In other words, numeric values cannot be assigned to Boolean variables, and Boolean values cannot be assigned to numeric variables.
[0233] For example Figure 13 In the process of dragging the numerical tile 1304 to the second tile area in the first operation tile 1302, since the variable type corresponding to the numerical tile 1302 is "numerical", and the first operation tile 1302 has already matched the variable object of the "Boolean value" type, the border of the numerical tile 1304 can be highlighted as a target prompt message to indicate that the current numerical match has failed and it cannot be dragged to the second tile area of the first operation tile 1302;
[0234] Another example Figure 14 As shown, when Boolean value block 1404 is dragged to the second block area of the second operation block 1402, since the variable type corresponding to Boolean value block 1402 is "Boolean value", and the second operation block 1402 has already matched a variable object of type "numerical value", the border of Boolean block 1404 can be highlighted as a target prompt message to indicate that the current numerical value matching has failed and it cannot be dragged to the second block area of the second operation block 1402;
[0235] Understandably, when the input of the first block area of the operation block is dragged into a value of a certain type, then the "Any Variable" input of the "Set Variable Block" will only accept variable types that match that value type.
[0236] like Figure 15 As shown, when an "arbitrary value" input in the first block area of the first operation block 1502 is dragged into a Boolean variable, only Boolean variables can be reconnected to the "arbitrary variable" input, while numeric variables and string variables cannot be connected. For example, when the "numeric variable 1" in the second variable block 1504 is dragged to the first block area, the "numeric variable 1" in the second variable block 1504 is highlighted, indicating that the current dragging operation cannot be completed. Similarly, when an "arbitrary value" input in the first block area of the second operation block 1504 is dragged into a numeric variable, only numeric variables can be reconnected to the "arbitrary variable" input, while Boolean variables and string variables cannot be connected. For example, when the "boolean variable 1" in the first variable block 1508 is dragged to the first block area, the "numeric variable 1" in the first variable block 1508 is highlighted, indicating that the current dragging operation cannot be completed.
[0237] Furthermore, when the operation block is specifically a computation block, the type matching of the logical execution variable object can also be performed according to the above implementation method, and the operation result of the interactive operation in the visual programming interface can be determined based on the type matching result.
[0238] For example Figure 16 In the visual programming interface shown, in response to selecting the "Function" control from the first menu bar 1602 and then selecting the "Mathematics" control from the corresponding second menu bar 1604, operation blocks corresponding to various mathematical calculation controls are displayed in the second operation area 1606. When the first operation block is selected as the target operation block, in response to dragging the operation block to the first operation area 1608, operation block 1610 can be displayed in the first operation area 1608. This operation block 1610 includes two interactive block areas, where the first block area is filled with variable blocks or values indicating the first calculation object, and the second block area is filled with variable blocks or values indicating the second calculation object.
[0239] Furthermore, such as Figure 17As shown, in the third operation block 1302 used to indicate addition calculations, the nature of its object operation determines that it can only accept variable objects of numeric type. Therefore, in response to dragging the second variable block 1704 to the first block area, the drag result "Numerical Variable 1" can be displayed in the first block area of the third operation block 1702; since the second variable block 1704 cannot accept Boolean type variables as the objects of its addition calculations, in response to dragging the first variable block 1706 to the second block area, the first variable block 1706 is highlighted to indicate that Boolean type variable blocks cannot be dragged to the block area in the third operation block 1702.
[0240] Understandably, in this implementation, the mathematical operation block also has strict requirements on the type of input variables, accepting only numeric variables and not Boolean / string variables. This avoids the incorrect use of Boolean / string variables where numerical calculations are required, thus preventing type errors.
[0241] In an optional implementation, after determining the drag result of the drag operation based on the matching relationship between the reference variable type and the second code block, the method further includes:
[0242] S1, if the drag operation fails, retrieve the third code block that matches the reference variable type, where the third code block is used to describe the variable attribute information of the candidate variable object;
[0243] S2, based on the third code block, displays candidate variable blocks in the visual programming interface.
[0244] It is understood that in this embodiment, if the drag-and-drop interaction cannot be completed due to type mismatch, candidate variable blocks can be displayed in the visual programming interface, wherein the variable type corresponding to the candidate variable block matches the reference variable type corresponding to the operation block.
[0245] Optionally, the third code block mentioned above may be a code block corresponding to a variable block that has not yet been created; in another optional manner, the third code block mentioned above may also be a code block corresponding to a variable block that has already been created.
[0246] In visual programming environments, users frequently construct program logic through drag-and-drop operations. In this implementation, if the drag operation fails due to a mismatch in the variable type of the tile, a third code block can be searched in a preset code block set based on the reference variable type corresponding to the operated tile. This third code block describes a variable tile that matches the aforementioned reference variable type. If the search is successful, candidate variable tiles can be displayed based on this third code block.
[0247] Optionally, the candidate variable tiles can be displayed in ways including, but not limited to, highlighting, displaying floating prompts, or creating a new tile on the interface. The user can then view the candidate variable tiles and decide whether to use the predicted tile. If the user chooses to accept the current candidate variable tile, it can remain displayed in the visual programming interface. If the current candidate variable tile is not selected, its display can be canceled; alternatively, the prediction result can be recorded, and the tile prediction algorithm can be improved based on the current prediction result.
[0248] like Figure 18 As shown, when a Boolean variable is dragged into the first block area of the first operation block 1802 from the "Any Value" input, only Boolean variables can be reconnected to the "Any Variable" input, while numeric variables and string variables cannot be connected. For example, when the second variable block 1804 "Numerical Variable 1" is dragged to the first block area, the second variable block 1804 "Numerical Variable 1" is highlighted to indicate that the current drag operation cannot be completed; at the same time, the first variable block 1806, as a candidate variable block, is displayed to the right of the second variable block 1804 in a dashed line style. The first variable block 1806 can be a variable block corresponding to a pre-created Boolean type variable object.
[0249] For example Figure 19 As shown, when the "Any Value" input in the first block area of the first operation block 1902 is dragged into a Boolean variable, and when the "Numerical Variable 1" of the second variable block 1904 is dragged to the first block area, the "Numerical Variable 1" of the second variable block 1904 is highlighted to indicate that the current drag operation cannot be completed; at the same time, the third variable block 1906, as a candidate variable block, is displayed on the right side of the second variable block 1904 in a dashed line style. The third variable block 1906 can be a variable block corresponding to a Boolean type variable object that has not yet been created.
[0250] Through the above-described embodiments of this application, in the event that the drag operation fails, a third code block matching the reference variable type is obtained; based on the third code block, candidate variable blocks are displayed in the visual programming interface. In the event that the user fails to drag the block, the accurate block can be predicted and displayed, so as to facilitate the user to quickly select the variable block of the correct type of variable object, thereby improving the programming efficiency of the visual programming operation.
[0251] In one alternative implementation, after updating the first code block to the second code block based on the variable description information carried by the variable creation operation, the method further includes:
[0252] S1, in response to the variable editing operation on the target variable block in the visual programming interface, obtain the variable editing information indicated by the variable editing operation;
[0253] S2, update the third field in the second code block according to the variable editing information, where the third field is used to indicate the variable identification information of the target variable object.
[0254] The following combination Figure 7 This section describes an operation for editing variable objects within a visual programming interface. For example... Figure 7 As shown, in response to a long press operation on the variable tile 712 displayed in the second operation area 706, which indicates a Boolean variable object, an editing window 710 can be displayed in the first operation area 708. The editing window 710 further displays the variable name of the current variable object, "Boolean Variable 1". It is understood that, in response to a trigger operation with the "Edit" control, an editing operation can be performed on the variable name "Boolean Variable 1", such as a renaming operation. Correspondingly, as... Figure 10 As shown, in the second code block corresponding to "Boolean variable 1", the "name" field in code segment 1002 can be modified and adjusted in response to the editing operation.
[0255] In one optional implementation, updating the first code block to the second code block based on the variable description information carried by the variable creation operation includes:
[0256] Case 1: When the variable creation operation is the first variable creation operation, the third field in the first code block is updated according to the variable identification information included in the variable description information to obtain the second code block. The variable type corresponding to the first variable creation operation is determined from multiple preset variable types.
[0257] It is understood that the above implementation method can be a variable object creation operation performed based on a preset variable type, thereby directly obtaining a first code block that matches the type, and updating the first code block based on the identification information obtained during the creation operation to obtain a second code block used to indicate the completion of the creation of the target variable object.
[0258] Scenario 2: When the variable creation operation is the second variable creation operation, the first code block is updated to the fourth code block according to the variable identification information and variable combination information included in the variable description information. Here, the variable type corresponding to the second variable creation operation is a user-defined variable type, and the variable combination information is used to indicate at least one data type carried in the target variable.
[0259] In this embodiment, the user can also define a new variable type and determine a fourth code block to indicate the variable object of the custom variable type based on the variable combination information and variable identification information included in the custom variable type.
[0260] The following combination Figure 20 Specify an optional custom variable object. For example... Figure 20 The interface shown creates a variable object of type "Custom Creature". This variable object has three attribute values: "Health" (value 1), "Energy" (value 2), and "Speed" (value 3). Each of these three attribute values corresponds to a numeric variable. Furthermore, it can be further customized based on... Figure 20 The variable addition control 2002 in the interface shown allows you to further add numeric variable objects to the object properties of the currently defined variable object. Correspondingly, you can... Figure 10 The code block shown adds descriptive information to the "mutator" (attached attribute) that corresponds to the object attribute represented by the variable object mentioned above.
[0261] It is understandable that in the process of performing variable type matching based on custom variables, it is necessary to determine the matching result of each variable object in the variable combination information corresponding to the custom variable based on its respective variable type, and to complete the variable object matching operation when multiple variable objects in the variable combination information meet the type matching result.
[0262] The following describes a complete implementation of this application. This implementation can run on hardware devices that support web browsers, such as personal computers, tablets, and smartphones. Users can access applications based on the Blockly visual programming library through these devices.
[0263] In this application embodiment, different types of variable blocks can be predefined based on the Blockly open-source graphical programming library to display variable blocks (blocks) used to represent different variable objects in the visual programming interface; in addition, all variable information can be stored based on the MobX framework to perform real-time judgment and management of variable status and type during variable operations in the visual interface; furthermore, a variable management interface can be provided based on the React framework.
[0264] It's worth noting that Blockly is an open-source graphical programming library that allows users to build programs by dragging and dropping graphical programming blocks without writing code directly. These blocks represent different programming constructs, such as loops, conditional statements, and function calls, which can be combined to create more complex program logic. MobX is a powerful and easy-to-use JavaScript state management library based on reactive programming principles. It automatically tracks state changes and triggers UI updates when the state changes. React is an open-source JavaScript library focused on building high-performance, composable user interfaces. It uses componentization and virtual DOM technologies, making the development and maintenance of single-page applications simpler and more efficient. React has a large community support and can seamlessly integrate with various front-end libraries and frameworks, providing cross-platform application development capabilities.
[0265] In this application implementation, Blockly provides the functionality of visual programming and variable blocks, MobX is responsible for managing variable information, and React is responsible for building and rendering the user interface.
[0266] The following describes how to implement UI rendering based on React. This implementation uses the following key components to create the entire UI:
[0267] VariablePanel: This is the main container component, which displays the entire variable panel, containing all other child components such as VariableTab and VariableList.
[0268] VariableTab (Variable Menu Component): This component represents a two-level menu, divided into multiple tabs based on the variable type. Each tab corresponds to a specific variable type, such as integer, floating-point number, string, boolean value, list, etc. Users can view and manipulate variables of specific types by clicking on different tabs.
[0269] VariableList (Variable List Component): This component displays a list of variables of the corresponding type in each VariableTab. Each item in the list represents a block corresponding to a variable and displays the name of the variable.
[0270] VariableBtn (Variable Control): This component acts as a button, used to trigger specific operations in the variable management interface, such as creating, editing, or deleting variables.
[0271] VariablePopup: This component is a pop-up window used to edit or delete existing variables. VariablePopup appears when the user clicks on a variable block in VariableList.
[0272] The following combination Figure 3 The structural relationships of the above components in React are explained below. When "Variable Controls" is selected in the first menu bar 302, the area enclosed by the second menu bar 304 and the second operation area 306 is the display area corresponding to the VariablePanel component. Within the display area corresponding to the VariablePanel component, two lists are further included. The first list corresponds to the second menu bar 304 and is used to indicate the corresponding operation controls for various variable objects, triggering the display of the variable list corresponding to each variable object. The second list corresponds to the second operation area 306, which displays the object list of variable objects under the currently selected variable type, along with the variable blocks corresponding to each variable object. Furthermore, under the VariablePanel component, two VariableBtn controls are further included. The first control in the second operation area 306 is used to create new Boolean variable objects; the second control is used to create new Boolean group objects.
[0273] Furthermore, such as Figure 7 In response to a trigger operation on the variable block 712, the editing window 710 corresponds to the aforementioned VariablePopup component, which further includes two VariableBtn components, specifically including an editing control and a deletion control.
[0274] The above implementation methods can provide users with a convenient and easy-to-use variable management interface, thereby making it easier to create and maintain Blockly-based applications, and thus improving the programming efficiency of Blockly-based visual programming.
[0275] Furthermore, in the process of storing and managing all variable information based on the MobX framework, the object operations performed on variable objects can be abstracted into at least four types: First, creating variables: allowing users to create variables of different types, such as integers, floating-point numbers, strings, booleans, lists, etc. Typically, users need to specify a unique name for the variable so that it can be referenced in the program; Second, modifying variables: allowing users to change the name of a variable; Third, deleting variables: allowing users to delete variables that are no longer needed from the program; Fourth, displaying variables: displaying all currently created variables and their related information.
[0276] Based on the abstract results of the object operations performed on the variable object described above, the basic data structure of the variable object can be further abstracted. That is, the basic data structure of the variable can contain the variable's id, name, and type. Among them, the "id" field is used to store the variable id information of string type, the "name" field is used to store the variable name information of string type, and the "type" field is used to store the variable type, such as Boolean (Boolean value), Number (array), or String (string).
[0277] Simultaneously, a class named VariableStore is created based on MobX, containing a variable array (variables) for storing and managing all variable information. This class also provides interfaces for creating variables (addVariable), deleting variables (deleteVariable), and renaming variables (renameVariable). The specific methods corresponding to these interfaces can be found in the aforementioned embodiments.
[0278] Furthermore, the implementation process, which includes Blockly providing visual programming and variable building block functionality, MobX managing variable information, and React building and rendering the user interface, can further include:
[0279] S1 allows users to create, edit, or delete variables through an interface developed using React components.
[0280] S2, React components update the variable information of user operations to the MobX state management library for storage through the Controller (object manager) logic class.
[0281] S3, React components automatically update the interface based on state changes in the MobX library, displaying the latest variable information.
[0282] The following combination Figure 21 , Figure 22 A complete implementation sequence of this application is described.
[0283] The following combination Figure 6 Regarding the above Figure 5 , Figure 3 The implementation process of the interaction process will be explained. For example... Figure 6 As shown, in this embodiment, the interactive objects involved include a user interface, a variable controller for providing variable object management operations, and an object array VariableStore for storing array elements corresponding to variable objects.
[0284] Before performing visual programming operations, the object array first executes S2100 to initialize the object array Variables;
[0285] Next, in response to Figure 5 In the second menu bar 504, the user interface executes S2102 to request the variable controller to obtain the list of Boolean variables; the variable controller executes S2104 to obtain the array object of Boolean type through the getAllVariables('Boolean') method.
[0286] Next, S2106 is executed to filter out array objects of Boolean value type; it is understood that at the current stage in this embodiment, Boolean variable objects have not yet been created, so the object array is executed to the variable controller in S2108, returning an empty set;
[0287] The user interface receives the return result from the variable controller, executes S2110, and in response to the return of an empty array, the list is displayed as empty; subsequently, the visual programming interface can display as follows: Figure 5 As shown.
[0288] Next, in response to Figure 5 The creation control 514 in the middle triggers the user interface to execute S2111, creating a boolean variable;
[0289] The variable controller executes S2112, calling the method addVariable({id:'1',name:'Boolean variable 1',type:'Boolean'}), to add array elements; then, the object array executes S2114, updating the object array Variables = [{id:'1',name:'Boolean variable 1',type:'Boolean'}]; and then executes S2116, returning the update result;
[0290] Furthermore, the variable controller executes S2118 to obtain an array object of Boolean type through the getAllVariables('Boolean') method; the object array executes S2120 and S2122 to filter out the array object of Boolean type; and returns the filtering result ({id:'1',name:'Boolean variable 1',type:'Boolean'}).
[0291] The user interface receives the return result from the variable controller, executes S2124, and in response to the return of a new Boolean variable, displays a Boolean variable block. Furthermore, the interface displays as follows: Figure 3As shown, the variable tile corresponding to the created Boolean variable object is displayed in the second operation area 3021. At the same time, a superscript "①" is further displayed on the "Boolean value" control in the second menu bar 304 to indicate that the number of created variable objects of the Boolean value type is 1.
[0292] Similarly, in the process of creating a new variable object of the numerical type, steps S2126 to S2150 can be executed, and the interaction and processing logic are roughly similar to the processing logic involved in the above steps S2102 to S2124.
[0293] Next, in response to performing edit and delete operations on "Numerical Variable 1" in the visual programming interface, the corresponding steps are as shown in Figure 21 2202 to 2230.
[0294] In response to the edit operation on "Numerical Variable 1" based on the edit window, the user interface executes S2202 to rename "Numerical Variable 1" to "Number 1"; the variable controller executes S2204 to modify the variable name through the renameVariable('2', 'Number 1') method (i.e., the array element edit interface); the object array executes S2206 to find the object array Variables = [{id: '1', name: 'Numerical Variable 1', type: 'Number'}]; S22022 returns the search result, and the search is successful;
[0295] Next, the variable controller executes S2210 to call the method getAllVariables('Number') (i.e., the array element acquisition interface); the object array executes S2212 to filter out the array objects of the numerical type; after the variable name editing in the array elements is completed, S2212 returns the edit result ({id: '1', name: 'Number 1', type: 'Number'}); in the user interface, as in step S2214, in response to returning a new numerical variable, the interface displays an edited numerical variable tile;
[0296] It can be understood that after completing the above variable name editing operation of the numerical variable, further based on the trigger operation of the delete control, execute Figure 22In step S2216, the value "1" is deleted; the variable controller executes S2218, calling the method deleteVariable('2') (i.e., the array element deletion interface); after the object array completes the deletion operation, S2220 is executed to search the object array Variables = [{id:'1',name:'Boolean variable 1',type:'Boolean'}] (i.e., only Boolean variables remain in the current object array); further, S2222 is executed, returning the deletion result Variables;
[0297] The variable controller continues to execute S2224, calling the method getAllVariables('Number') (i.e., the array element retrieval interface); the object array executes S2226, filtering out variables with type = 'Number'; it is understandable that the current object array no longer includes array elements of numeric type, so S2228 is executed, returning the filtered result []; the variable controller executes S2230 to the user interface, returning an empty array (there are currently no array elements), and the list is displayed as empty.
[0298] Through the above-described embodiments of this application, by introducing types to variable objects, it can be ensured that users use the correct variable types when programming, thereby avoiding program failures or unexpected results caused by type errors. This makes Blockly-based applications more robust and reliable; furthermore, introducing variable types can make the code more readable, allowing developers to clearly understand the type and purpose of variables when reviewing the code. This helps improve code maintainability and increases the efficiency of performing programming operations based on a visual programming interface.
[0299] In the above implementation, by providing a user-friendly interface for creating and managing different types of variables, users can clearly identify the types of variables during use. This reduces the complexity and difficulty of programming, allowing users to focus more on implementing program logic. Furthermore, by introducing variable types and providing a user-friendly variable management interface, the above implementation makes programming education more intuitive and easier to understand, improving the readability and comprehensibility of the visual programming process.
[0300] Finally, in the above embodiments of this application, by providing a unified variable management interface, users can quickly create, edit, and delete variables. This helps improve development efficiency, enabling users to complete the development of Blockly-based applications more quickly.
[0301] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the present invention is not limited to the described order of actions, because according to the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to the present invention.
[0302] According to another aspect of the present invention, an apparatus for manipulating object variables for implementing the above-described object variable manipulation method is also provided. For example... Figure 23 As shown, the device includes:
[0303] The acquisition unit 2302 is configured to acquire the target variable type indicated by the variable object operation in response to a variable object operation received in the visual programming interface, wherein the visual programming interface is configured to receive interactive operations to generate program content matching the interactive operations, and the interactive operations include the variable object operation.
[0304] The determining unit 2304 is used to determine at least one target variable operation interface that matches the variable object operation from the variable operation interface set, wherein the variable operation interface set includes multiple variable operation interfaces.
[0305] Operation unit 2306 is used to perform at least one object operation on a variable object set according to at least one target variable operation interface and the target variable type, wherein the variable object set is used to store object information of at least one variable object created according to the visual programming interface, and the variable object is displayed as a variable block style in the visual programming interface.
[0306] In some embodiments, the above-mentioned operation unit 2306 includes: a generation module, configured to, when the variable object operation is a variable creation operation, generate a target array element matching the target variable object based on the variable identification information indicated by the variable creation operation and the type description information used to indicate the type of the target variable; and an adding module, configured to add the target array element to an object array used to indicate the set of variable objects, wherein each array element in the object array is used to indicate a variable object.
[0307] In some embodiments, the determining unit 2304 includes: a first determining module, configured to determine an array element adding interface matching the variable creation operation from the variable operation interface set, wherein the variable operation interface set includes the array element adding interface, and the array element adding interface is configured to generate the array element matching the variable object according to the variable identification information and type description information indicated by the variable creation operation.
[0308] In some embodiments, the above-mentioned object variable manipulation device further includes: an editing unit, configured to, in response to receiving a variable editing operation performed on the target variable object in a visual programming interface, determine an array element editing interface matching the variable editing operation from the variable operation interface set, wherein the variable operation interface set includes the array element editing interface; and perform an element editing operation on the target array element according to the variable editing information carried in the variable editing operation and the array element editing interface to obtain the updated target array element.
[0309] In some embodiments, the above-mentioned object variable manipulation device further includes: a display unit, configured to determine an array element acquisition interface from the variable operation interface set when the variable creation control is displayed on the variable preview page of the visual programming interface, wherein the variable creation control is used to detect the variable creation operation, the variable preview page is used to display a variable object of type the target variable type, and the variable operation interface set includes the array element acquisition interface; and to acquire a first code block corresponding to each of the at least one first array element when at least one first array element is found in the object array according to the array element acquisition interface and the target variable type, wherein the first array element matches a first variable object of the target variable type, and the first code block is used to display a first variable block in the visual programming interface to indicate the first variable object.
[0310] In some embodiments, the above-mentioned object variable manipulation device includes: a deletion unit, configured to: obtain a second variable identifier indicated by the variable deletion operation when the variable object operation is a variable deletion operation; determine an array element deletion interface matching the variable deletion operation from the variable operation interface set, wherein the variable operation interface set includes the array element deletion interface; and delete a second array element matching the second variable object from the variable object set according to the second variable identifier and the array element deletion interface, wherein the second variable identifier is used to indicate the second variable object.
[0311] In some embodiments, the above-described object variable manipulation device further includes: a code block generation unit, configured to, when the variable object operation is a variable creation operation, obtain a first code block matching the target variable type, wherein the first code block is used to describe the variable attribute information of the variable object; and update the first code block to a second code block according to the variable description information carried by the variable creation operation, wherein the second code block is used to display a target variable tile matching the target variable object on the visual programming interface, and the variable description information includes the variable identification information.
[0312] In some embodiments, the code block generation unit further includes: a prompting module, configured to, in response to dragging the target variable block to a block area associated with the operation block in the visual programming interface, obtain a reference variable type matching the operation block, wherein the operation block is used to generate a variable operation code block associated with a variable object, and the reference variable type is a variable type matching the variable operation code block; and determine the dragging result of the dragging operation based on the matching relationship between the reference variable type and the second code block.
[0313] In some embodiments, the above-described prompting module is configured to: when the target variable object is a variable object to be input in the operation block, obtain a first variable type from a first field in the second code block, wherein the first field is used to indicate the variable type that allows the target variable object to be input; display target prompt information when the first variable type and the reference variable type do not match; when the target variable object is a variable object that accepts input in the operation block, obtain the target variable type from a second field in the second code block, wherein the second field is used to indicate the target variable type of the target variable object; display target prompt information when the target variable type and the reference variable type do not match; wherein the target prompt information is used to indicate that the drag operation failed.
[0314] In some embodiments, the code block generation unit is further configured to: obtain a third code block matching the reference variable type in the event that the drag operation fails, wherein the third code block is used to describe the variable attribute information of the candidate variable object; and display the candidate variable block in the visual programming interface according to the third code block.
[0315] In some embodiments, the code block generation unit is further configured to: in response to a variable editing operation on the target variable block in the visual programming interface, obtain variable editing information indicated by the variable editing operation; and update a third field in the second code block according to the variable editing information, wherein the third field is used to indicate variable identification information of the target variable object.
[0316] In some embodiments, the code block generation unit is configured to: when the variable creation operation is a first variable creation operation, update the third field in the first code block according to the variable identification information included in the variable description information to obtain the second code block, wherein the variable type corresponding to the first variable creation operation is determined from a plurality of preset variable types; when the variable creation operation is a second variable creation operation, update the first code block to a fourth code block according to the variable identification information and variable combination information included in the variable description information, wherein the variable type corresponding to the second variable creation operation is a custom variable type, and the variable combination information is used to indicate at least one data type carried in the target variable.
[0317] Optionally, in this embodiment, the implementation of each of the above-mentioned unit modules can be referred to the above-mentioned method embodiments, which will not be repeated here.
[0318] According to another aspect of the present invention, an electronic device for implementing the above-described method for operating object variables is also provided. This electronic device may be... Figure 24 The terminal device or server shown. This embodiment uses this electronic device as an example for illustration. Figure 24 As shown, the electronic device includes a memory 2402 and a processor 2404. The memory 2402 stores a computer program, and the processor 2404 is configured to execute the steps in any of the above method embodiments via the computer program.
[0319] Optionally, in this embodiment, the aforementioned electronic device may be located in at least one of a plurality of network devices in a computer network.
[0320] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:
[0321] S1, in response to a variable object operation received in the visual programming interface, obtain the target variable type indicated by the variable object operation, wherein the visual programming interface is used to receive interactive operations to generate program content matching the interactive operations, and the interactive operations include the variable object operation;
[0322] S2, from the set of variable operation interfaces, determine at least one target variable operation interface that matches the operation of the variable object, wherein the set of variable operation interfaces includes multiple variable operation interfaces;
[0323] S3, perform at least one object operation on the variable object set according to at least one target variable operation interface and the target variable type, wherein the variable object set is used to store object information of at least one variable object created according to the visual programming interface, and the variable object is displayed as a variable block style in the visual programming interface.
[0324] Alternatively, as those skilled in the art will understand, Figure 24 The structure shown is for illustrative purposes only. Electronic devices can also be smartphones (such as Android phones, iOS phones, etc.), tablets, PDAs, mobile internet devices (MIDs), PADs, and other terminal devices. Figure 24 This does not limit the structure of the aforementioned electronic devices or electronic equipment. For example, electronic devices or electronic equipment may also include components that are more... Figure 24 The more or fewer components shown (such as network interfaces, etc.), or having the same Figure 24 The different configurations shown.
[0325] The memory 2402 can be used to store software programs and modules, such as program instructions / modules corresponding to the operation methods and devices for object variables in this embodiment of the invention. The processor 2404 executes various functional applications and data processing by running the software programs and modules stored in the memory 2402, thereby implementing the above-mentioned operation methods for object variables. The memory 2402 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 2402 may further include memory remotely located relative to the processor 2404, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Specifically, the memory 2402 may be used, but is not limited to, to store information such as the operation information of various elements and object variables in the scene. As an example, such as... Figure 24 As shown, the memory 2402 may include, but is not limited to, the acquisition unit 2302, the determination unit 2304, and the operation unit 2306 in the object variable operation device. Furthermore, it may include, but is not limited to, other module units in the object variable operation device, which will not be elaborated upon in this example.
[0326] Optionally, the transmission device 2406 described above is used to receive or send data via a network. Specific examples of the network described above may include wired networks and wireless networks. In one example, the transmission device 2406 includes a Network Interface Controller (NIC), which can be connected to other network devices and routers via a network cable to communicate with the Internet or a local area network. In another example, the transmission device 2406 is a radio frequency (RF) module, used for wireless communication with the Internet.
[0327] In addition, the aforementioned electronic device also includes: a display 2408 for displaying a virtual scene in the interface; and a connection bus 2410 for connecting various module components in the aforementioned electronic device.
[0328] In other embodiments, the aforementioned terminal device or server can be a node in a distributed system, wherein the distributed system can be a blockchain system, which is a distributed system formed by connecting multiple nodes through network communication. The nodes can form a peer-to-peer network, and any form of computing device, such as a server, terminal, or other electronic device, can become a node in the blockchain system by joining this peer-to-peer network.
[0329] According to one aspect of this application, a computer program product is provided, comprising a computer program / instructions containing program code for performing the methods shown in the flowchart. In such embodiments, the computer program can be downloaded and installed from a network via a communication component, and / or installed from a removable medium. When the computer program is executed by a central processing unit, it performs various functions provided in embodiments of this application.
[0330] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0331] According to one aspect of this application, a computer-readable storage medium is provided, wherein a processor of a computer device reads computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, causing the computer device to perform the operation method of the object variable described above.
[0332] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:
[0333] S1, in response to a variable object operation received in the visual programming interface, obtain the target variable type indicated by the variable object operation, wherein the visual programming interface is used to receive interactive operations to generate program content matching the interactive operations, and the interactive operations include the variable object operation;
[0334] S2, from the set of variable operation interfaces, determine at least one target variable operation interface that matches the operation of the variable object, wherein the set of variable operation interfaces includes multiple variable operation interfaces;
[0335] S3, perform at least one object operation on the variable object set according to at least one target variable operation interface and the target variable type, wherein the variable object set is used to store object information of at least one variable object created according to the visual programming interface, and the variable object is displayed as a variable block style in the visual programming interface.
[0336] Optionally, in this embodiment, those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a computer-readable storage medium, which may include: flash drive, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0337] If the integrated units in the above embodiments are implemented as software functional units and sold or used as independent products, they can be stored in the aforementioned computer-readable storage medium. Based on this understanding, the technical solution of the present invention, 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 one or more computer devices (which may be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention.
[0338] In the above embodiments of the present invention, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0339] In the several embodiments provided in this application, it should be understood that the disclosed client can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units described above 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 through some interfaces, indirect coupling or communication connection between units or modules, and may be electrical or other forms.
[0340] The units described above 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.
[0341] Furthermore, the functional units in the various embodiments of the present invention 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.
[0342] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method for manipulating object variables, characterized in that, include: In response to a variable object operation received in a visual programming interface, the target variable type indicated by the variable object operation is obtained, wherein the visual programming interface is used to receive interactive operations to generate program content matching the interactive operations, the interactive operations including the variable object operation; From the set of variable operation interfaces, at least one target variable operation interface matching the operation of the variable object is determined, wherein the set of variable operation interfaces includes multiple variable operation interfaces. At least one object operation is performed on a set of variable objects according to at least one target variable operation interface and the target variable type, wherein the set of variable objects is used to store object information of at least one variable object created according to the visual programming interface, and the variable object is displayed as a variable block style in the visual programming interface; The step of responding to a variable object operation received in the visual programming interface and obtaining the variable type indicated by the variable object operation further includes: if the variable object operation is a variable creation operation, obtaining a first code block matching the target variable type, wherein the first code block is used to describe the variable attribute information of the variable object; updating the first code block to a second code block according to the variable description information carried by the variable creation operation, wherein the second code block is used to display a target variable tile matching the target variable object in the visual programming interface, and the variable description information includes variable identification information; In response to dragging the target variable block to the block area associated with the operation block in the visual programming interface, a reference variable type matching the operation block is obtained, wherein the operation block is used to generate a variable operation code block associated with the variable object, and the reference variable type is a variable type matching the variable operation code block; If the target variable object is the variable object to be input in the operation block, the first variable type is obtained from the first field in the second code block, wherein the first field is used to indicate the variable type that is allowed to be obtained as input from the target variable object; if the first variable type and the reference variable type do not match, a target prompt message is displayed. If the target variable object is a variable object that accepts input in the operation block, the target variable type is obtained from the second field in the second code block, wherein the second field is used to indicate the target variable type of the target variable object; if the target variable type and the reference variable type do not match, a target prompt message is displayed. The target prompt information is used to indicate that the drag operation failed.
2. The method according to claim 1, characterized in that, The step of performing at least one object operation on the variable object collection based on at least one target variable operation interface and the target variable type includes: When the variable object operation is a variable creation operation, a target array element matching the target variable object is generated based on the variable identification information indicated by the variable creation operation and the type description information used to indicate the type of the target variable. The target array element is added to the object array used to indicate the set of variable objects, wherein each array element in the object array is used to indicate a variable object.
3. The method according to claim 2, characterized in that, The determination of at least one target variable operation interface matching the variable object operation from the set of variable operation interfaces includes: From the set of variable operation interfaces, an array element addition interface matching the variable creation operation is determined, wherein the set of variable operation interfaces includes the array element addition interface, and the array element addition interface is used to generate the array element matching the variable object according to the variable identification information and type description information indicated by the variable creation operation.
4. The method according to claim 2, characterized in that, After adding the target array element to the object array used to indicate the collection of variable objects, the method further includes: In response to receiving a variable editing operation performed on the target variable object in the visual programming interface, an array element editing interface matching the variable editing operation is determined from the set of variable operation interfaces, wherein the set of variable operation interfaces includes the array element editing interface; Based on the variable editing information carried in the variable editing operation and the array element editing interface, an element editing operation is performed on the target array element to obtain the updated target array element.
5. The method according to claim 2, characterized in that, Before generating the target array element matching the target variable object based on the variable identifier information indicated by the variable creation operation and the type description information indicating the type of the target variable, when the variable object operation is a variable creation operation, the method further includes: When the variable creation control is displayed on the variable preview page in the visual programming interface, the array element acquisition interface is determined from the variable operation interface set. The variable creation control is used to detect the variable creation operation, the variable preview page is used to display variable objects of type the target variable type, and the variable operation interface set includes the array element acquisition interface. When at least one first array element is found in the object array based on the array element retrieval interface and the target variable type, a first code block corresponding to each of the at least one first array element is obtained, wherein the first array element matches a first variable object of the target variable type, and the first code block is used to display a first variable block in the visual programming interface to indicate the first variable object.
6. The method according to claim 2, characterized in that, After adding the target array element to the object array used to indicate the collection of variable objects, the method further includes: In response to a variable deletion operation received in the visual programming interface, a second variable identifier indicated by the variable deletion operation is obtained, wherein the variable object operation includes the variable deletion operation; From the set of variable operation interfaces, determine the array element deletion interface that matches the variable deletion operation, wherein the set of variable operation interfaces includes the array element deletion interface; Based on the second variable identifier and the array element deletion interface, the second array element matching the second variable object is deleted from the variable object set, wherein the second variable identifier is used to indicate the second variable object.
7. The method according to claim 1, characterized in that, After updating the first code block to the second code block based on the variable description information carried by the variable creation operation, the method further includes: If the drag operation fails, a third code block matching the reference variable type is obtained, wherein the third code block is used to describe the variable attribute information of the candidate variable object; The candidate variable blocks are displayed in the visual programming interface according to the third code block.
8. The method according to claim 1, characterized in that, After updating the first code block to the second code block based on the variable description information carried by the variable creation operation, the method further includes: In response to a variable editing operation on the target variable block in the visual programming interface, obtain variable editing information indicated by the variable editing operation; The third field in the second code block is updated according to the variable editing information, wherein the third field is used to indicate the variable identification information of the target variable object.
9. The method according to claim 1, characterized in that, The step of updating the first code block to the second code block based on the variable description information carried by the variable creation operation includes: When the variable creation operation is a first variable creation operation, the third field in the first code block is updated according to the variable identification information included in the variable description information to obtain the second code block, wherein the variable type corresponding to the first variable creation operation is determined from multiple preset variable types; When the variable creation operation is a second variable creation operation, the first code block is updated to a fourth code block according to the variable identification information and variable combination information included in the variable description information. The variable type corresponding to the second variable creation operation is a custom variable type, and the variable combination information is used to indicate at least one data type carried in the target variable.
10. A device for manipulating object variables, characterized in that, include: An acquisition unit is configured to, in response to a variable object operation received in a visual programming interface, acquire the target variable type indicated by the variable object operation, wherein the visual programming interface is configured to receive interactive operations to generate program content matching the interactive operations, and the interactive operations include the variable object operation. The determining unit is used to determine at least one target variable operation interface that matches the operation of the variable object from the set of variable operation interfaces, wherein the set of variable operation interfaces includes multiple variable operation interfaces. An operation unit is configured to perform at least one object operation on a set of variable objects according to at least one target variable operation interface and the target variable type, wherein the set of variable objects is used to store object information of at least one variable object created according to the visual programming interface, and the variable object is displayed as a variable block style in the visual programming interface; A code block generation unit is configured to, when the variable object operation is a variable creation operation, obtain a first code block matching the target variable type, wherein the first code block is used to describe the variable attribute information of the variable object; and update the first code block to a second code block according to the variable description information carried by the variable creation operation, wherein the second code block is used to display a target variable tile matching the target variable object on the visual programming interface, and the variable description information includes variable identification information. The code block generation unit further includes: a prompting module, used to respond to dragging the target variable block to a block area associated with the operation block in the visual programming interface, and to obtain a reference variable type matching the operation block, wherein the operation block is used to generate a variable operation code block associated with the variable object, and the reference variable type is a variable type matching the variable operation code block; When the target variable object is a variable object to be input in the operation block, a first variable type is obtained from the first field in the second code block, wherein the first field is used to indicate the variable type that allows the target variable object to be obtained as input; if the first variable type and the reference variable type do not match, a target prompt message is displayed; when the target variable object is a variable object that accepts input in the operation block, the target variable type is obtained from the second field in the second code block, wherein the second field is used to indicate the target variable type of the target variable object; if the target variable type and the reference variable type do not match, a target prompt message is displayed; wherein the target prompt message is used to indicate that the drag operation failed.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein the program, when executed, performs the method according to any one of claims 1 to 9.
12. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, they implement the steps of the method according to any one of claims 1 to 9.
13. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to execute the method described in any one of claims 1 to 9 through the computer program.
Citation Information
Patent Citations
Variable operation method and device in graphical programming tool
CN111736822A
Visual programming method, device, equipment, medium and program product
CN118444903A