WO2023273621A1 - 脚本生成方法、装置、设备及介质 - Google Patents

脚本生成方法、装置、设备及介质 Download PDF

Info

Publication number
WO2023273621A1
WO2023273621A1 PCT/CN2022/091863 CN2022091863W WO2023273621A1 WO 2023273621 A1 WO2023273621 A1 WO 2023273621A1 CN 2022091863 W CN2022091863 W CN 2022091863W WO 2023273621 A1 WO2023273621 A1 WO 2023273621A1
Authority
WO
WIPO (PCT)
Prior art keywords
node
code
data type
script
connection
Prior art date
Application number
PCT/CN2022/091863
Other languages
English (en)
French (fr)
Inventor
马锐锋
黄伟锋
黄晓波
Original Assignee
北京字跳网络技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京字跳网络技术有限公司 filed Critical 北京字跳网络技术有限公司
Publication of WO2023273621A1 publication Critical patent/WO2023273621A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/34Graphical or visual programming
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/447Target code generation

Definitions

  • the present disclosure relates to the field of computer technology, and in particular to a script generation method, device, equipment and media.
  • scripts related to application functions are implemented through code writing by professional technicians, for example, special effects such as "blinking eyes to change makeup” are implemented through scripts.
  • the present disclosure provides a script generation method, the method comprising: obtaining a node connection diagram for realizing the target function; The connection between the node ports generates splicing code representing the call relationship between the nodes; according to the splicing code and the pre-written script code of each node, an object script file corresponding to the target function is generated.
  • An embodiment of the present disclosure also provides a script generation device, the device includes: an acquisition module, configured to acquire a node connection diagram for realizing a target function; a first generation module, configured to The connection between the ports of each node generates the splicing code representing the calling relationship between the nodes; the second generation module is used to generate the script code according to the splicing code and the pre-written script code of each node and the target The target script file corresponding to the function.
  • An embodiment of the present disclosure also provides an electronic device, which includes: a processor; a memory for storing instructions executable by the processor; and the processor, for reading the instruction from the memory.
  • the instructions can be executed, and the instructions are executed to implement the script generation method provided by the embodiment of the present disclosure.
  • the embodiment of the present disclosure also provides a computer-readable storage medium, the storage medium stores a computer program, and the computer program is used to execute the script generation method provided by the embodiment of the present disclosure.
  • the embodiment of the present disclosure also provides a computer program, the program code included in the computer program causes the computer to execute the script generation method provided by the embodiment of the present disclosure when executed by a computer.
  • the script generation scheme provided by the embodiments of the present disclosure can obtain the node connection graph used to realize the target function, and then generate the splicing code representing the calling relationship between the nodes according to the connection between the ports of each node in the node connection graph , finally, generate the target script file corresponding to the target function according to the splicing code and the pre-written script code of each node. Therefore, the encapsulation of the abstract script code is realized through the node connection diagram, and the generation of the target script file based on the visualized node connection diagram realizes the function, which improves the generation efficiency and accuracy of the target script file and reduces the cost of generating the target script file. study cost.
  • FIG. 1 is a schematic flowchart of a script generation method provided by an embodiment of the present disclosure
  • FIG. 2 is a schematic diagram of a node connection diagram provided by an embodiment of the present disclosure
  • FIG. 3 is a schematic diagram of another node connection diagram provided by an embodiment of the present disclosure.
  • FIG. 4 is a schematic flowchart of another script generation method provided by an embodiment of the present disclosure.
  • FIG. 5 is a schematic diagram of a node determination scenario provided by an embodiment of the present disclosure.
  • FIG. 6 is a schematic flowchart of another script generation method provided by an embodiment of the present disclosure.
  • FIG. 7 is a schematic diagram of script generation provided by an embodiment of the present disclosure.
  • FIG. 8 is a schematic diagram of another node connection diagram provided by an embodiment of the present disclosure.
  • FIG. 9 is a schematic flowchart of another script generation method provided by an embodiment of the present disclosure.
  • FIG. 10 is a schematic flowchart of another script generation method provided by an embodiment of the present disclosure.
  • FIG. 11 is a schematic structural diagram of a script generation device provided by an embodiment of the present disclosure.
  • Fig. 12 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure.
  • the term “comprise” and its variations are open-ended, ie “including but not limited to”.
  • the term “based on” is “based at least in part on”.
  • the term “one embodiment” means “at least one embodiment”; the term “another embodiment” means “at least one further embodiment”; the term “some embodiments” means “at least some embodiments.” Relevant definitions of other terms will be given in the description below.
  • this disclosure proposes a node-based visualization method for script generation, in which the nodes encapsulate the corresponding The code, the user can connect the nodes on the visual interface to realize the generation of the script, without mastering the code writing.
  • FIG. 1 is a schematic flow chart of a method for generating a script provided by an embodiment of the present disclosure.
  • the method can be executed by a script generating device, where the device can be implemented by software and/or hardware, and generally can be integrated in an electronic device.
  • the method includes:
  • Step 101 obtaining a node connection graph for realizing a target function.
  • the target function may be any application function that needs to be implemented by a script, for example, a special effect to realize the effect of "blinking and changing clothes".
  • the above-mentioned node connection diagram can include elements such as nodes, node ports, and connections, among which, a node can be regarded as a fixed code package, which is used to provide the target function or a subclass of the target function.
  • ports correspond to nodes, and ports can include input ports and output ports; connections are used to connect different ports on different nodes, connections can be triggered by users, or can be connected through logical identification of target functions, for example, when The business logic of the target function is "Identify whether the user has turned on the camera - if the user turns on the camera, take a picture", then according to the above business logic, in the node corresponding to the sub-function of "Identify whether the user has turned on the camera", the node corresponding to the sub-function of "Take a photo" Connections between nodes' ports.
  • the codes of the corresponding nodes are combined through the connections between the nodes, and the target script file is generated according to the connection logic between the nodes.
  • Step 102 according to the connection between the ports of each node in the node connection diagram, generate splicing code representing the call relationship between each node.
  • each node encapsulates the corresponding execution code
  • the execution code can be regarded as a script code segment, in fact, it can be regarded as an execution function, and the execution function needs to call logic, the call here can be through each The connection between nodes is reflected, wherein, the port corresponding to the connection reflects the calling relationship between each node, and the splicing code representing the calling relationship between each node is generated, which can be understood as the calling code for the execution function.
  • the splicing code representing the calling relationship between each node is generated, and the splicing code is actually the calling code for executing functions between nodes .
  • the splicing code can be a certain detection result port of the node corresponding to the first detection action, which corresponds to the second detection action
  • the calling code corresponding to a trigger port of the node.
  • Step 103 generating an object script file corresponding to the object function according to the splicing code and the pre-written script code of each node.
  • the target script file corresponding to the target function can be generated according to the splicing code and the pre-written script code of each node.
  • the language of the splicing code and the pre-written script code of each node is also detected Whether it matches, if not, convert the splicing code into a code language that matches the pre-written script code of each node.
  • This conversion can be realized through a conversion tool, or can be obtained by querying a preset corresponding relationship.
  • node A and node B are included in the node wiring diagram
  • node A encapsulates the execution code of "detect smile”
  • the corresponding node output ports include “smile detected” and “smile not detected”
  • Node B encapsulates the execution code of "capture image”
  • the corresponding input port is "capture” port
  • the connection between node A and node B is the "smile detected” port of node A and The "shooting" port of node B is connected
  • the splicing code generated between node A and node B is the calling code connecting the "smile detection" port and the "shooting” port, so the splicing between node A and node B
  • the target script file generated by the code and the pre-written script code is a combination of "code for detecting a smile” plus “code for triggering image capture when a smile is detected” plus “code for capturing an image”.
  • the script generation method obtained by the embodiment of the present disclosure obtains the node connection graph used to realize the target function, and then generates the call relationship between each node according to the connection between each node port in the node connection graph.
  • the splicing code and then, according to the splicing code and the pre-written script code of each node, generate the target script file corresponding to the target function. Therefore, through the encapsulation of the abstract script code of the node connection graph, the generation of the target script file based on the visual node connection graph to realize the function improves the generation efficiency and accuracy of the target script file, and reduces the learning of the target script file generation. cost.
  • the above node connection diagram can be visually displayed to the user, so that the user can understand and build the execution logic of the current script without mastering the code.
  • the method further includes:
  • Step 401 in response to a trigger operation on a plurality of node information for realizing a target function, display each node corresponding to each node information on a visualization panel.
  • the node information can be in the form of text, and can also be any identification information that can point to at least one node, such as in the form of letters.
  • the node information points to the identification information of multiple nodes, it can be understood that one node information corresponds to multiple For nodes that implement the same sub-function, for example, if the node information is "monitor sub-function", the corresponding node may be node A that implements the monitor sub-function, and node B that implements the monitor sub-function.
  • the node information database can be constructed in advance, which contains a large number of node information, and each node information can be triggered to select, therefore, in response to the trigger operation of multiple node information that realizes the target function , to display each node corresponding to each node information on the visualization panel.
  • the visualization panel can be regarded as a node container, which is used to display nodes, node ports and node connections.
  • the multiple node information corresponding to the target function may be manually triggered by the user.
  • the user may search for multiple pre-built nodes that realize the target function Name, where the user can enter the trigger in the preset search bar, or call the search bar through other trigger methods, for example, call the search bar by right-clicking, enter the corresponding node name in the search bar, and then respond to For the trigger operation of each node name, each node corresponding to each node name is displayed on the visualization panel.
  • the extended data type of the currently displayed node on the visualization panel that is, there are nodes displayed on the current visualization panel, and the data type corresponding to each node can be changed, and the changeable data type is an extended data type
  • the extended data type can be displayed in the form of a list (for example, the user can modify the data type of the corresponding node to data type A by triggering the data type A in the list), and will not list them here.
  • the data type of the currently displayed node is switched to a node that matches the target data type, that is to say, in this embodiment, the original On the basis of the currently displayed node already displayed, by changing the data type of the currently displayed node, switch to display the node that matches the target data type, so as to realize the acquisition of the node with the target function.
  • the execution function of the currently displayed node 501 is the addition of two numbers in one dimension , if by responding to the trigger operation on the target data type in the extended data type, for example, selecting the target data type "Vector2f", the extended data type of the currently displayed node includes “Vector2f", as shown in Figure 5, in response to the The trigger operation of "Vector2f", the currently displayed node is switched to the node corresponding to the execution function of two-dimensional addition of two numbers, as shown in node 503 in FIG. 5 .
  • the multiple node information of the target function can also be learned according to the pre-learned deep learning model after the target function is determined, that is, input the target function into the pre-built deep learning model, and obtain the output of the deep learning model Therefore, the obtained multiple node information can be displayed to the user. If the user's confirmation operation is obtained, it is considered that the trigger operation for the multiple node information that realizes the target function has been obtained.
  • Step 402 generating a node connection graph in response to triggering operations on connections between ports of each node according to the execution logic of the target function.
  • the user's connection trigger operation between the ports of each node can be received on the visualization panel to generate a node connection diagram, wherein the connection trigger operation can be triggered by the user's finger or through Triggered by a trigger device, the trigger device includes but is not limited to a mouse, a stylus, and the like.
  • the execution logic of the target function is "detect the smile on the face first, and then take an image of the smile on the face"
  • the corresponding connection is to connect the “detect the smile on the face” node to the "shooting” node, where " The execution data of Detect Face Smile” is the connection between the port “smile detected” and the port “captured image” of the "capture” node.
  • node connection diagram on the front-end visual interface only shows each node and the connection between them. If you want to avoid users from manually writing codes, in the embodiment of the present disclosure, the node connection diagram and the script code to match.
  • Step 601 acquire the script code corresponding to the business function.
  • the underlying implementation of the node encapsulates the corresponding execution code, that is, a script fragment. Therefore, in this embodiment, some commonly used script fragments are represented by a node.
  • the script fragment usually corresponds to the atomic function in the function, so as to improve the flexibility of the application.
  • the atomic function can usually be understood as the smallest functional unit of the commonly used sub-function, and the script fragment corresponding to the smallest functional unit is pre-encapsulated, so that there is no need to use it every time Write code, and, because atomic functions are some commonly used sub-functions, the advantages in improving the efficiency of function execution are more obvious.
  • script code can include "and or" judgment code fragments, because “and or” judgments are many Commonly used sub-functions in business functions, the judgment code fragment corresponding to "and or” is usually used as a whole. Therefore, the "and or” function is regarded as an atomic function, and the "and or” judgment code fragment is encapsulated as a node.
  • the "and or” function is regarded as an atomic function, and the "and or” judgment code fragment is encapsulated as a node.
  • multiple script fragments that are not corresponding to the minimum functional unit are usually used together, multiple script fragments can also be packaged into one node.
  • the script fragment is encapsulated as a node.
  • the script code corresponding to the business function is obtained.
  • the business function usually includes a variety of function sets with some of the same atomic functions.
  • the function set includes the target function of this application.
  • the business function is human face
  • the corresponding functions can be "photographing with face recognition”, “beauty makeup with face recognition”, “addition of special effects for face recognition”, etc.
  • the target function can be any one of these functions, that is, you can obtain multiple atomic functions corresponding to the function, and obtain the script code fragment corresponding to the atomic function.
  • Step 602 constructing a node corresponding to the script code for displaying on the visualization panel, wherein the node includes: a node name, at least one input port and/or at least one output port.
  • the nodes displayed on the visualization panel may include node names, at least one input port and/or at least one output port.
  • the input of the input port is used to receive the input parameters of the node. For example, if the input interface is a data type input port, the value received by the input interface is the input parameter of the node, and the output port indicates that the script code corresponding to the node is executed for the input parameter. The return value of the execution result. Then connect the input and output between different nodes in series to represent the calling relationship of the function. The calling relationship corresponds to the splicing code in this embodiment, thus completing the generation of a whole set of script logic.
  • At least one input port includes: a data type input port, and/or, a control type input port
  • at least one output port includes: a data type output port, and/or, a control type output port Ports, among them, the data type port has the distinction of data type, which can include integer, floating point, character, etc., and the corresponding port and data type are consistent.
  • the two nodes with connection relationship restricted by the connection include For the first node and the second node, the data type of the data type output port on the first node is consistent with the data type of the data type input port to be connected on the second node.
  • data input ports can have two sources: user input or output from the previous node. Among them, if there is a connection on the input port, the port no longer accepts user input. The reason is that if user input can still be accepted, there will be ambiguity, that is, it is uncertain whether it is based on the user input or the output of the previous node at this time.
  • the output port represents the output information of the node. That is, in an embodiment of the present disclosure, in order to avoid ambiguity, a data type input port can only be connected to one data type output port, and a data type output port on the first node is connected to one or more data type output ports on the second node. Type input port, a data type input port on the second node can be connected to a data type output port on the first node.
  • control port There is no data type for the control port, and the control port can be either an input port or an output port.
  • the input control port indicates that when the port is triggered, the logic of the node will be executed; similarly, the output control port indicates that the port will trigger the input control port of the next node connected subsequently.
  • control type input port can be connected to one or more control type output ports.
  • logic of "OR” can be used between different output control ports to filter out the connected input control ports.
  • the input parameters of the port for example, when the input control port is "open", if it corresponds to two input parameters, when any one of the input parameters occurs, it can control the execution of "open".
  • the control type output port is connected to the following A control type input port of a node.
  • the logic of "and” can be used between different output control ports to determine the input parameters of the input control ports. For example, when the input control port is "open", if it corresponds to two input parameters , when two of the input parameters occur, the execution of "open” can be controlled. It should be emphasized that there are various scripting languages for the script code fragments encapsulated by nodes. Since the scripts are edited in a node-like visual way, users do not need to know what scripting language is used, and only need to focus on the node functions; in addition , even if the carrier application of the target function has been iterating, there will be situations where the same interface function or parameter changes.
  • the dotted line in the figure represents the structure of the node connection graph corresponding to the script file, that is, the dotted line represents the generation logic of the script file in the node dimension
  • the solid line represents the structure of the execution function corresponding to the script file , that is, the distribution of the solid line is to illustrate the generation logic of the script file in the execution function dimension
  • the node connection diagram is essentially a front-end visual display of the calling relationship of the execution function
  • the logic generated by the script of the target function can actually be regarded as some functions , where the function consists of input parameters, function body, and return value.
  • some commonly used script code fragments can be represented by a node, the input port is used to represent its input parameters, and the output port is used to represent the return value. Then connect the input and output of the node in series, and the splicing code corresponding to the connection represents the calling relationship of the function, thus completing the generation of a whole set of script logic.
  • node A when node A, node B, and node C are included in the node connection graph, the code encapsulated by node A is the detection code corresponding to "facial action detection", and the detected action is "Blink”, there are four output ports of this node, which are "output port after facial motion is detected", “output port after facial motion is not detected”, “output port of facial motion from scratch”, “facial motion From yes to no output port”, node B encapsulates the code of "rectangular frame inclusion relationship judgment", the input ports contained in this node are “trigger input port”, “judgment object input port” and “target area input port”, node C encapsulates the code related to the "value gradient” processing, and the output ports are "start running input port", "pause running input port”, etc.
  • node A's "output port after no facial movement is detected” and node C's "pause Run the input port” connection it means that if the input result is "no blink detected” after executing the code corresponding to node A, then the "value gradient” processing will be suspended, and if the output of node A is “no facial movement detected port” and the “trigger input port” of node B, it means that if the input result is "no blink detected” after executing the code corresponding to node A, then the "rectangular box contains relationship judgment” corresponding to node B
  • the code is triggered to execute, and if "blinking action is not detected", the function of node B will be executed, and the sub-function corresponding to the port will be executed according to the input parameters of "judgment object input port” and “target area input port”, otherwise, even if "Judgement object input port” and “target area input port” have input parameters, and the sub-functions corresponding to the ports are also executed.
  • the script generation method of the embodiment of the present disclosure generates a node connection diagram in a visual way, and the user does not need to master the code writing rules, and the nodes encapsulate the corresponding script fragments, and the corresponding scripts are spliced based on the connections between nodes
  • the corresponding target script can be generated from the fragment, which improves the script generation efficiency, reduces the user's learning cost, and expands the development flexibility of the target function.
  • connection call between nodes is represented by a connection line, and the connection line is mapped to the code layer to represent the splicing code representing the call relationship between the ports of each node.
  • the following is combined with specific The embodiment describes in detail how to generate the splicing code representing the call relationship between nodes according to the port type and the corresponding connection situation.
  • the generation of splicing codes includes:
  • Step 901 perform topological sorting on the node connection graph, and traverse and detect port types of each node in the node connection graph in sequence according to the sorting result.
  • the node connection graph can be sorted from partial order to total order based on topological sorting Sorting, so as to sequentially traverse the port types of each node in the detection node connection diagram according to the sorting results, wherein the port type can be determined according to the name of the port or the pattern type or color of the port, and is not limited here.
  • Step 902 generating splicing codes representing calling relationships between nodes according to port types and corresponding connection conditions.
  • the splicing code representing the calling relationship between each node is generated, that is, in this embodiment, according to the specific port called between each node and the calling relationship of the specific port Generate stitching code.
  • the current node being processed contains a data type input port, then it is detected whether there is a link at the data type input port.
  • node A has a data type output port (serial number 0) connected to the input port of node B (serial number 0)
  • the corresponding generated splicing code is:
  • the invocations of node A and node B are associated through the splicing code, wherein the encapsulation code corresponding to node A and the encapsulation code corresponding to node B are invoked and executed through the splicing code to generate the correspondence between node A and node B target script file.
  • a corresponding splicing code is generated according to the user's input value at the data type input port of the current node.
  • node B still has a data type input port (serial number 1) that is not connected
  • the value input by the user can be used, and the corresponding splicing code generated is:
  • node_b setInput(1, user_input);
  • the output port of the node can be processed. If it is known that the current node contains a control type output port, it is detected whether there is a connection to the control type output port. At this time, only the control type port needs to be processed. That is, if there is no connection, skip it directly, and if there is a connection, generate the corresponding splicing code according to the input port of the downstream node connected to the control type output port of the current node.
  • node A has a control type output port (serial number 1), which is connected to the control input port of node B (serial number 1)
  • the corresponding pseudo code is generated:
  • the code corresponding to the sub-function association: node_a:setTriggerNext t(1,%) indicates when the output of node A Execute when port 1 is triggered, node_b:execute(1) indicates that the object of execution is the function corresponding to input port 1 of B.
  • the nodes in the node connection diagram are manually triggered by the user to connect.
  • For the input port of the node only the port of the data type needs to be processed. The reason is that the input of the data port will depend on the output of the previous one. Then first check whether there is a connection, if not, get the value input by the user, if there is a connection, get the value corresponding to the output port of the opposite end of the connection, and generate the target script file according to the corresponding value.
  • the current node contains a control type output port
  • the script generation method of the embodiment of the present disclosure generates the splicing code between nodes according to the port type of the node, and finally concatenates the execution logic of the node through the splicing code to generate the target script file.
  • the user does not need to master the code writing rules, and further Improved script generation efficiency.
  • the present disclosure also proposes a script generation device.
  • FIG. 11 is a schematic structural diagram of a script generation device provided by an embodiment of the present disclosure.
  • the device can be implemented by software and/or hardware, and generally can be integrated into an electronic device. As shown in Figure 11, the device includes: an acquisition module 1110, a first generation module 1120, and a second generation module 1130, wherein,
  • An acquisition module 1110 configured to acquire a node connection diagram for realizing the target function
  • the first generation module 1120 is used to generate the splicing code representing the call relationship between the nodes according to the connection between the ports of the nodes in the node connection diagram;
  • the second generation module 1130 is configured to generate a target script file corresponding to the target function according to the splicing code and the pre-written script code of each node.
  • the script generation device provided by the embodiments of the present disclosure can execute the script generation method provided by any embodiment of the present disclosure, and has corresponding functional modules and beneficial effects of the execution method. For the sake of brevity, details are not repeated here.
  • each of the above modules may be implemented as an independent physical entity, or may also be implemented by a single entity (for example, a processor (CPU or DSP, etc.), an integrated circuit, etc.).
  • the device may also include a memory that can store various information generated in operation by the device, each module included in the device, programs and data used for operations, data to be transmitted by the communication unit, etc. .
  • the memory can be volatile memory and/or non-volatile memory.
  • memory may include, but is not limited to, random access memory (RAM), dynamic random access memory (DRAM), static random access memory (SRAM), read only memory (ROM), flash memory.
  • RAM random access memory
  • DRAM dynamic random access memory
  • SRAM static random access memory
  • ROM read only memory
  • flash memory flash memory
  • the device may also include a communication unit, which may be used to communicate with other devices.
  • the communication unit may be implemented in an appropriate manner known in the art, which will not be described in detail here.
  • the present disclosure also proposes a computer program product, including computer programs/instructions, which is characterized in that, when the computer program/instructions are executed by a processor, the steps of the script generation method mentioned in the above-mentioned embodiments are implemented .
  • Fig. 12 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure.
  • FIG. 12 shows a schematic structural diagram of an electronic device 1200 suitable for implementing an embodiment of the present disclosure.
  • the electronic device 1200 in the embodiment of the present disclosure may include, but is not limited to, mobile phones, notebook computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Tablet Computers), PMPs (Portable Multimedia Players), vehicle-mounted terminals ( Mobile terminals such as car navigation terminals), wearable electronic devices, etc., and fixed terminals such as digital TVs, desktop computers, smart home devices, etc.
  • the electronic device shown in FIG. 12 is only an example, and should not limit the functions and application scope of the embodiments of the present disclosure.
  • an electronic device 1200 may include a processing device (such as a central processing unit, a graphics processing unit, etc.) 1201, which may be randomly accessed according to a program stored in a read-only memory (ROM) 1202 or loaded from a storage device 1208. Various appropriate actions and processes are executed by programs in the memory (RAM) 1203 . In the RAM 1203, various programs and data necessary for the operation of the electronic device 1200 are also stored.
  • the processing device 1201, ROM 1202, and RAM 1203 are connected to each other through a bus 1204.
  • An input/output (I/O) interface 1205 is also connected to the bus 1204 .
  • the following devices can be connected to the I/O interface 1205: input devices 1206 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; including, for example, a liquid crystal display (LCD), speaker, vibration an output device 1207 such as a computer; a storage device 1208 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1209.
  • the communication means 1209 may allow the electronic device 1200 to perform wireless or wired communication with other devices to exchange data. While FIG. 12 shows electronic device 1200 having various means, it is to be understood that implementing or having all of the means shown is not a requirement. More or fewer means may alternatively be implemented or provided.
  • embodiments of the present disclosure include a computer program product, which includes a computer program carried on a non-transitory computer readable medium, where the computer program includes program code for executing the method shown in the flowchart.
  • the computer program may be downloaded and installed from a network via communication means 1209, or from storage means 1208, or from ROM 1202.
  • the processing device 1201 When the computer program is executed by the processing device 1201, the above-mentioned functions defined in the script generation method of the embodiment of the present disclosure are executed.
  • the above-mentioned computer-readable medium in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two.
  • a computer readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to, electrical connections with one or more wires, portable computer diskettes, hard disks, random access memory (RAM), read-only memory (ROM), erasable Programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above.
  • a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
  • a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave carrying computer-readable program code therein. Such propagated data signals may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing.
  • a computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which can transmit, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device .
  • Program code embodied on a computer readable medium may be transmitted by any appropriate medium, including but not limited to wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
  • the client and the server can communicate using any currently known or future network protocols such as HTTP (HyperText Transfer Protocol, Hypertext Transfer Protocol), and can communicate with digital data in any form or medium
  • HTTP HyperText Transfer Protocol
  • the communication eg, communication network
  • Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), internetworks (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network of.
  • the above-mentioned computer-readable medium may be included in the above-mentioned electronic device, or may exist independently without being incorporated into the electronic device.
  • the above-mentioned computer-readable medium carries one or more programs, and when the above-mentioned one or more programs are executed by the electronic device, the electronic device: acquires a node connection diagram for realizing the target function, and according to the node connection diagram The connection between the ports of each node, and then generate the splicing code representing the calling relationship between each node, and finally, generate the target script file corresponding to the target function according to the splicing code and the pre-written script code of each node. Therefore, through the encapsulation of the abstract script code of the node connection graph, the generation of the target script file based on the visual node connection graph to realize the function improves the generation efficiency and accuracy of the target script file, and reduces the learning of the target script file generation. cost.
  • Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, or combinations thereof, including but not limited to object-oriented programming languages—such as Java, Smalltalk, C++, and Includes conventional procedural programming languages - such as the "C" language or similar programming languages.
  • the program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server.
  • the remote computer can be connected to the user computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (such as through an Internet service provider). Internet connection).
  • LAN local area network
  • WAN wide area network
  • Internet service provider such as AT&T, MCI, Sprint, EarthLink, MSN, GTE, etc.
  • each block in a flowchart or block diagram may represent a module, program segment, or portion of code that contains one or more logical functions for implementing specified executable instructions.
  • the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or they may sometimes be executed in the reverse order, depending upon the functionality involved.
  • each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations can be implemented by a dedicated hardware-based system that performs the specified functions or operations , or may be implemented by a combination of dedicated hardware and computer instructions.
  • the units involved in the embodiments described in the present disclosure may be implemented by software or by hardware. Wherein, the name of a unit does not constitute a limitation of the unit itself under certain circumstances.
  • FPGAs Field Programmable Gate Arrays
  • ASICs Application Specific Integrated Circuits
  • ASSPs Application Specific Standard Products
  • SOCs System on Chips
  • CPLD Complex Programmable Logical device
  • a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device.
  • a machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium.
  • a machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing.
  • machine-readable storage media would include one or more wire-based electrical connections, portable computer discs, hard drives, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, compact disk read only memory (CD-ROM), optical storage, magnetic storage, or any suitable combination of the foregoing.
  • RAM random access memory
  • ROM read only memory
  • EPROM or flash memory erasable programmable read only memory
  • CD-ROM compact disk read only memory
  • magnetic storage or any suitable combination of the foregoing.
  • the present disclosure provides a method for generating a script, including: acquiring a node connection graph for realizing a target function;
  • a target script file corresponding to the target function is generated according to the splicing code and the pre-written script code of each node.
  • the script generation method provided in the present disclosure further includes: in response to a trigger operation on the information of multiple nodes that realize the target function, displaying on the visualization panel that is related to each of the nodes Each node corresponding to the information;
  • the node connection graph is generated in response to triggering operations on connections between ports of the nodes according to the execution logic of the target function.
  • the script generation method in response to a trigger operation on a plurality of node information realizing the target function, displaying information related to each node on a visualization panel
  • the corresponding nodes include:
  • the script generation method provided in the present disclosure further includes:
  • Constructing a node corresponding to the script code for displaying on the visualization panel wherein the node includes: a node name, at least one input port and/or at least one output port.
  • the at least one input port includes: a data type input port, and/or, a control type input port;
  • the at least one output port includes: a data type output port, and/or, a control type output port.
  • Two nodes with a connection relationship include: a first node and a second node, wherein,
  • the data type of the data type output port on the first node is consistent with the data type of the data type input port to be connected on the second node;
  • a data type output port on the first node is connected to one or more data type input ports on the second node, and a data type input port on the second node is connected to the first node A data type output port of ;
  • a control type output port on the first node is connected to a control type input port on the second node, and a control type input port on the second node is connected to one or Multiple control type output ports.
  • a script representing the calling relationship between the nodes is generated Splicing code, including:
  • the splicing code representing the calling relationship between the nodes is generated.
  • the generating splicing code representing the call relationship between the nodes according to the port type and the corresponding connection situation includes:
  • the detection knows that the current node contains a data type input port, then detect whether there is a connection at the data type input port;
  • the script generation method provided in the present disclosure further includes:
  • the current node includes a control type output port, then detecting whether there is a connection at the control type output port;
  • control type output port has a connection, generate a corresponding splicing code according to the input port of the downstream node connected to the control type output port of the current node.
  • the splicing code is converted into a code language that matches the pre-written script code of each node.
  • the present disclosure provides a script generation device, including: an acquisition module, configured to acquire a node connection graph for realizing a target function;
  • the first generation module is used to generate the splicing code representing the call relationship between the nodes according to the connection between the ports of the nodes in the node connection diagram;
  • the second generating module is configured to generate a target script file corresponding to the target function according to the splicing code and the pre-written script code of each node.
  • the script generation device provided in the present disclosure further includes:
  • a display module configured to display on the visualization panel each node corresponding to each node information in response to a trigger operation on a plurality of node information realizing the target function
  • a third generating module configured to generate the node connection graph in response to triggering operations on connections between ports of the nodes according to the execution logic of the target function.
  • the display module is specifically used for:
  • the script generation device provided in the present disclosure further includes:
  • the code acquisition module is used to acquire the script code corresponding to the business function
  • a construction module configured to construct a node corresponding to the script code for displaying on the visualization panel, wherein the node includes: a node name, at least one input port and/or at least one output port.
  • the at least one input port includes: a data type input port, and/or, a control type input port;
  • the at least one output port includes: a data type output port, and/or, a control type output port.
  • Two nodes with a connection relationship include: a first node and a second node, wherein,
  • the data type of the data type output port on the first node is consistent with the data type of the data type input port to be connected on the second node;
  • a data type output port on the first node is connected to one or more data type input ports on the second node, and a data type input port on the second node is connected to the first node A data type output port of ;
  • a control type output port on the first node is connected to a control type input port on the second node, and a control type input port on the second node is connected to one or Multiple control type output ports.
  • the first generation module is specifically configured to:
  • the detection knows that the current node contains a data type input port, then detect whether there is a connection at the data type input port;
  • the script generation device provided in the present disclosure further includes:
  • the first detection module is used to detect whether there is a connection at the control type output port when it is known that the current node includes a control type output port;
  • the fourth generating module is configured to generate a corresponding splicing code according to an input port of a downstream node connected to the control type output port of the current node when there is a connection at the control type output port.
  • the script generation device provided in the present disclosure further includes:
  • the second detection module is used to detect whether the splicing code matches the language of the script code written in advance by each node;
  • a conversion module configured to convert the splicing code into a code language that matches the pre-written script code of each node when there is no match.
  • the present disclosure provides an electronic device, including:
  • the processor is configured to read the executable instruction from the memory, and execute the instruction to implement the script generation method according to any embodiment provided by the present disclosure.
  • the present disclosure provides a computer-readable storage medium, the storage medium stores a computer program, and the computer program is used to execute the computer program described in any embodiment provided by the present disclosure. script generation method.
  • An embodiment of the present disclosure further provides a computer program, the program code included in the computer program enables the computer to implement the method for generating a script as described in any embodiment of the present disclosure when executed by a computer.

Abstract

一种脚本生成方法、装置、设备及介质,其中该方法包括:获取用于实现目标功能的节点连线图(101);根据节点连线图中各节点端口之间的连线,生成表示各节点之间调用关系的拼接代码(102);根据拼接代码以及各节点预先编写的脚本代码生成与目标功能对应的目标脚本文件(103)。

Description

脚本生成方法、装置、设备及介质
相关申请的交叉引用
本申请是以申请号为202110729951.2、申请日为2021年6月29日的中国申请为基础,并主张其优先权,该中国申请的公开内容在此作为整体引入本申请中。
技术领域
本公开涉及计算机技术领域,尤其涉及一种脚本生成方法、装置、设备及介质。
背景技术
随着计算机技术的发展,依托于计算机技术的应用功能的实现成为普遍,比如,在短视频应用的特效功能等。
相关技术中,通过专业的技术人员的代码编写实现有关应用功能的脚本实现,比如,通过脚本实现“眨眼换妆”等特效。
然而,上述应用功能的实现方式中,需要用户掌握代码编写,用户手动编写应用功能的脚本,学习成本较大,脚本生成效率不高。
发明内容
为了解决上述技术问题或者至少部分地解决上述技术问题,本公开提供了一种脚本生成方法,所述方法包括:获取用于实现目标功能的节点连线图;根据所述节点连线图中各节点端口之间的连线,生成表示所述各节点之间调用关系的拼接代码;根据所述拼接代码以及所述各节点预先编写的脚本代码生成与所述目标功能对应的目标脚本文件。
本公开实施例还提供了一种脚本生成装置,所述装置包括:获取模块,用于获取用于实现目标功能的节点连线图;第一生成模块,用于根据所述节点连 线图中各节点端口之间的连线,生成表示所述各节点之间调用关系的拼接代码;第二生成模块,用于根据所述拼接代码以及所述各节点预先编写的脚本代码生成与所述目标功能对应的目标脚本文件。
本公开实施例还提供了一种电子设备,所述电子设备包括:处理器;用于存储所述处理器可执行指令的存储器;所述处理器,用于从所述存储器中读取所述可执行指令,并执行所述指令以实现如本公开实施例提供的脚本生成方法。
本公开实施例还提供了一种计算机可读存储介质,所述存储介质存储有计算机程序,所述计算机程序用于执行如本公开实施例提供的脚本生成方法。
本公开实施例还提供了一种计算机程序,所述计算机程序包括的程序代码在由计算机执行时使得计算机执行如本公开实施例提供的脚本生成方法。
本公开实施例提供的脚本生成方案能够获取用于实现目标功能的节点连线图,根据节点连线图中各节点端口之间的连线,进而,生成表示各节点之间调用关系的拼接代码,最后,根据拼接代码以及各节点预先编写的脚本代码生成与目标功能对应的目标脚本文件。由此,通过节点连线图实现抽象脚本代码的封装,基于可视化的节点连线图实现功能的目标脚本文件的生成,提高了目标脚本文件的生成效率和准确率,降低了目标脚本文件生成的学习成本。
附图说明
结合附图并参考以下具体实施方式,本公开各实施例的上述和其他特征、优点及方面将变得更加明显。贯穿附图中,相同或相似的附图标记表示相同或相似的元素。应当理解附图是示意性的,原件和元素不一定按照比例绘制。
图1为本公开实施例提供的一种脚本生成方法的流程示意图;
图2为本公开实施例提供的一种节点连线图的示意图;
图3为本公开实施例提供的另一种节点连线图的示意图;
图4为本公开实施例提供的另一种脚本生成方法的流程示意图;
图5为本公开实施例提供的一种节点确定的场景示意图;
图6为本公开实施例提供的另一种脚本生成方法的流程示意图;
图7为本公开实施例提供的一种脚本生成的逻辑示意图;
图8为本公开实施例提供的另一种节点连线图的示意图;
图9为本公开实施例提供的另一种脚本生成方法的流程示意图;
图10为本公开实施例提供的另一种脚本生成方法的流程示意图;
图11为本公开实施例提供的一种脚本生成装置的结构示意图;
图12为本公开实施例提供的一种电子设备的结构示意图。
具体实施方式
下面将参照附图更详细地描述本公开的实施例。虽然附图中显示了本公开的某些实施例,然而应当理解的是,本公开可以通过各种形式来实现,而且不应该被解释为限于这里阐述的实施例,相反提供这些实施例是为了更加透彻和完整地理解本公开。应当理解的是,本公开的附图及实施例仅用于示例性作用,并非用于限制本公开的保护范围。
应当理解,本公开的方法实施方式中记载的各个步骤可以按照不同的顺序执行,和/或并行执行。此外,方法实施方式可以包括附加的步骤和/或省略执行示出的步骤。本公开的范围在此方面不受限制。
本文使用的术语“包括”及其变形是开放性包括,即“包括但不限于”。术语“基于”是“至少部分地基于”。术语“一个实施例”表示“至少一个实施例”;术语“另一实施例”表示“至少一个另外的实施例”;术语“一些实施例”表示“至少一些实施例”。其他术语的相关定义将在下文描述中给出。
需要注意,本公开中提及的“第一”、“第二”等概念仅用于对不同的装置、模块或单元进行区分,并非用于限定这些装置、模块或单元所执行的功能的顺序或者相互依存关系。
需要注意,本公开中提及的“一个”、“多个”的修饰是示意性而非限制性的,本领域技术人员应当理解,除非在上下文另有明确指出,否则应该理解为“一个或多个”。
本公开实施方式中的多个装置之间所交互的消息或者信息的名称仅用于说明性的目的,而并不是用于对这些消息或信息的范围进行限制。
为了解决上述提到的,应用功能的脚本生成需要用户掌握代码编写语言等导致学习成本较大的问题,本公开提出了一种节点式的可视化方式进行脚本生 成的方式,其中,节点封装了对应的代码,用户在可视化的界面上连线节点,即可实现脚本的生成,无需掌握代码编写。
下面结合具体的实施例对该脚本生成方法进行介绍。
图1为本公开实施例提供的一种脚本生成方法的流程示意图,该方法可以由脚本生成装置执行,其中该装置可以采用软件和/或硬件实现,一般可集成在电子设备中。如图1所示,该方法包括:
步骤101,获取用于实现目标功能的节点连线图。
其中,目标功能可以是任意需要脚本实现的应用功能,比如,实现“眨眼换装”效果的特效等。
另外,如图2所示,上述节点连线图可以包括节点、节点端口、连线等要素,其中,节点可以看作是一段固定的代码封装,用来提供目标功能或者目标功能中的某个子功能;端口与节点对应,端口可以包括输入端口和输出端口;连线用来连接不同节点上的不同端口,连线可以由用户触发,也可以通过对目标功能的逻辑识别匹配连接,比如,当目标功能的业务逻辑是“识别用户是否打开相机-若是用户打开相机则拍照”,则根据上述业务逻辑在“识别用户是否打开相机”的子功能对应的节点,与“拍照”的子功能对应的节点的端口之间连线。在本实施例中,通过节点之间连线将对应节点的代码组合,根据节点之间的连接逻辑生成目标脚本文件。
步骤102,根据节点连线图中各节点端口之间的连线,生成表示各节点之间调用关系的拼接代码。
正如以上所提到的,每个节点封装了对应的执行代码,该执行代码可以看作是脚本代码段,实际上可以看作是执行函数,而执行函数需要调用逻辑,这里的调用可以通过各个节点之间的连线体现,其中,连线对应的端口体现了各个节点之间的调用关系,生成表示各节点之间调用关系的拼接代码,即可理解为对执行函数的调用代码。
因此,在本实施例中,根据节点连线图中各节点端口之间的连线,生成表示各节点之间调用关系的拼接代码,实质上拼接代码为节点与节点之间执行函数的调用代码。比如,对于两个节点,当这两个节点分别为两个检测动作代码对应的节点时,拼接代码可以为第一个检测动作对应的节点的某个检测结果端 口,与第二个检测动作对应的节点某个触发端口对应的调用代码。
步骤103,根据拼接代码以及各节点预先编写的脚本代码生成与目标功能对应的目标脚本文件。
由于每个节点封装了对应的代码,而拼接代码为节点与节点之间执行函数的调用函数,因此,可根据拼接代码以及各节点预先编写的脚本代码生成与目标功能对应的目标脚本文件。
由此,用户无需编写代码,仅仅需要基于节点之间的连线操作,即可获取对应的脚本,由于节点的端口和节点封装的代码都是预先设置的,因此,保证了脚本的可执行性,并且,提升了脚本生成的效率。
当然,为了保证目标脚本文件的可执行性,还需要保证拼接代码与节点的封装的代码语言一致,即在本公开的一个实施例中,还检测拼接代码与各节点预先编写的脚本代码的语言是否匹配,若是不匹配,则将拼接代码转换成与各节点预先编写的脚本代码匹配的代码语言,该转换可以通过转换工具实现,也可通过查询预先设置的对应关系匹配得到。
举例而言,当节点连线图中包括节点A、节点B时,节点A封装了“检测微笑”的执行代码,对应的节点输出端口包括“检测到微笑”和“没有检测到微笑”端口,节点B封装了“拍摄图像”的执行代码,对应的输入端口为“拍摄”端口,则如图3所示,节点A、节点B之间的连线为节点A的“检测到微笑”端口和节点B的“拍摄”端口相连,则生成的节点A、节点B之间的拼接代码为“检测到微笑”端口和“拍摄”端口相连的调用代码,从而,节点A、节点B之间的拼接代码和预先编写的脚本代码生成的目标脚本文件为“检测微笑代码”加上“当检测到微笑时,触发拍摄图像的调用代码”加上“拍摄图像代码”的组合。
综上,本公开实施例提供的脚本生成方法,获取用于实现目标功能的节点连线图,根据节点连线图中各节点端口之间的连线,进而,生成表示各节点之间调用关系的拼接代码,然后,根据拼接代码以及各节点预先编写的脚本代码生成与目标功能对应的目标脚本文件。由此,通过节点连线图抽象脚本代码的封装,基于可视化的节点连线图实现功能的目标脚本文件的生成,提高了目标脚本文件的生成效率和准确率,降低了目标脚本文件生成的学习成本。
在实际执行过程中,为了便于用户构建对应的连线操作,上述节点连线图可以直观显示给用户,以便于用户在无需掌握代码的情况下,也可以理解并构建当前的脚本的执行逻辑。
在本公开的一个实施例中,如图4所示,该方法还包括:
步骤401,响应于对实现目标功能的多个节点信息的触发操作,在可视化面板上显示与各节点信息对应的各节点。
其中,节点信息可以为文字形式,也可以为字母形式等任意可以指向至少一个节点的标识信息,其中,当节点信息指向多个节点的标识信息时,可以理解为,一个节点信息对应于多个实现同样子功能的节点,比如,节点信息为“监听子功能”,则对应的节点可以为实现监听子功能的节点A,以及实现监听子功能的节点B等。
在本实施例中,可以预先构建节点信息数据库,该节点信息数据库中包含了大量的节点信息,每个节点信息可以被触发选择,因此,响应于对实现目标功能的多个节点信息的触发操作,在可视化面板上显示与各节点信息对应的各节点。
其中,可视化面板可以看作是节点的容器,用于显示节点、节点端口以及节点连线。
在本实施例中,目标功能对应的多个节点信息可以是用户手动触发的,在本实施例中,当节点信息为节点名称时,可以由用户来搜索预先构建的实现目标功能的多个节点名称,其中,用户可以在预设的搜索栏中输入触发,也可以通过其他触发方式召唤搜索栏,比如,通过右键点击的方式召唤搜索栏,在搜索栏输入对应的节点名称,进而,响应于对各节点名称的触发操作,在可视化面板上显示与各节点名称对应的各节点。
在本实施例中,还可以搜索可视化面板上当前显示节点的扩展数据类型,即当前可视化面板上显示有节点,每个节点对应的数据类型是可以更改的,可更改的数据类型为扩展数据类型,在本实施例中,扩展数据类型可以列表等形式展示(例如,用户可以通过触发列表中的数据类型A实现将对应的节点的数据类型修改为数据类型A),在此不再一一列举,进而,响应于对扩展数据类型中目标数据类型的触发操作,将当前显示节点的数据类型切换成与目标数据类 型匹配的节点,也即是说,在本实施例中,可以直接在原有的已经显示的当前显示节点的基础上,通过更改当前显示节点的数据类型,切换显示与目标数据类型匹配的节点,从而实现对目标功能的节点的获取。
举例而言,如图5所示,若是当前显示的节点封装了“加法”代码,对应的数据类型为“Double”,则当前显示的节点501的执行函数是2个数在一维的相加,如果通过响应于对扩展数据类型中目标数据类型的触发操作,例如,选取目标数据类型“Vector2f”,则当前显示的节点的扩展数据类型包括“Vector2f”,如图5所示,响应于对“Vector2f”的触发操作,则当前显示的节点切换为2个数在二维的相加的执行函数对应的节点,如图5中的节点503所示。
在本实施例中,目标功能的多个节点信息也可以是在确定目标功能后,根据预先学习的深度学习模型学习得到的,即将目标功能输入预先构建的深度学习模型,获取该深度学习模型输出的多个节点信息,从而,可以将获取到的多个节点信息显示给用户,若获取到用户的确认操作,则认为获取到对实现目标功能的多个节点信息的触发操作。
步骤402,响应于根据目标功能的执行逻辑对各节点的端口之间的连线触发操作,生成节点连线图。
在本实施例中,在可视化面板上可接收用户对各节点的端口之间的连线触发操作,生成节点连线图,其中,该连线触发操作可以是用户手指触发的,也可以是通过触发设备触发的,该触发设备包括但不限于鼠标、触控笔等。
在本实施例中,也可以根据目标功能的执行逻辑对各节点的端口自动连线生成节点连线图,其中,该执行逻辑限制了各个节点之间具体连接的执行函数的执行顺序等,因此,可以根据该执行逻辑确定出对应的节点连线图。
举例而言,当目标功能的执行逻辑为“先检测人脸微笑,然后对人脸微笑拍摄图像”,在对应的连线为“检测人脸微笑”节点与“拍摄”节点连接,其中,“检测人脸微笑”的执行数据为“检测到微笑”端口与“拍摄”节点的“拍摄图像”端口连接。
需要强调的是,前端可视化界面上的节点连线图仅仅展示出各个节点和其之间的连线,若是想要避免用户手动编写代码,本公开实施例中,还将节点连线图与脚本代码进行对应。
在本实施例中,如图6所示,除了需要在前端生成节点连线图,还需要将节点与脚本代码对应,即该方法还包括:
步骤601,获取与业务功能对应的脚本代码。
在本实施例中,如前所述,节点在底层实现上是封装了对应的执行代码,即一段脚本片段,因此,在本实施例中,将一些常用的脚本片段用一个节点来表示,该脚本片段通常对应于功能中的原子功能,以便于提高应用的灵活性,原子功能通常可以理解为常用子功能的最小功能单元,预先将该最小功能单元对应的脚本片段封装,无需每次使用时编写代码,并且,由于原子功能是一些常用子功能,因此,在提高功能执行效率上的优势更明显,比如,脚本代码可以包括“与或”判断代码片段,则由于“与或”判断是很多业务功能中的常用子功能,“与或”对应的判断代码片段通常被整体使用,因此,将该“与或”功能作为原子功能,将“与或”判断代码片段封装为一个节点。当然,若是多个不是最小功能单元对应的脚本片段通常被一起使用,则也可以将多个脚本片段封装为一个节点。比如,在图像处理场景中,“人脸检测”和“微笑检测”这两个最小功能单元通常被一起使用,因此,可以将“人脸检测”和“微笑检测”这两个最小功能单元对应的脚本片段封装为一个节点。
在本实施例中,获取与业务功能对应的脚本代码,该业务功能通常包含了多种具有部分相同原子功能的功能集合,该功能集合中包括本申请的目标功能,比如,对于业务功能为人脸识别业务来说,其对应的功能可以为“人脸识别拍照”、“人脸识别美妆”、“人脸识别特效添加”等,目标功能可以为其中的任意一个功能,即可以获取与业务功能对应的多个原子功能,获取该原子功能对应的脚本代码片段。
步骤602,构建与脚本代码对应的用于展示在可视化面板上的节点,其中,节点包括:节点名称、至少一个输入端口和/或至少一个输出端口。
可以理解的是,在本实施例中,为了进一步提高操作的直观性,该可视化面板上显示的节点可以包括节点名称、至少一个输入端口和/或至少一个输出端口。输入端口的输入用来接收节点的输入参数,比如,输入接口是数据类型输入端口,则该输入接口接收到的数值为该节点的输入参数,输出端口表示对输入参数执行节点对应的脚本代码后的执行结果的返回值。然后用连线来串联不 同的节点之间的输入和输出,代表函数的调用关系,调用关系对应于本实施例中的拼接代码,从而完成了一整套脚本逻辑的生成。
在本公开的一个实施例中,至少一个输入端口包括:数据类型输入端口、和/或、控制类型输入端口,同样的,至少一个输出端口包括:数据类型输出端口、和/或、控制类型输出端口,其中,数据类型端口存在数据类型的区分,可以包括整型,浮点型,字符型等,相应的端口和数据类型保持一致,比如,当连线限制的具有连接关系的两个节点包括第一节点和第二节点时,第一节点上的数据类型输出端口与第二节点上所需连接的数据类型输入端口的数据类型一致。
在实际执行中,数据输入端口可有两个来源:用户输入或上一个节点的输出。其中,如果输入端口上存在连线,则该端口不再接受用户输入。原因是如果还能接受用户输入,将存在二义性,即此时到底是以用户输入的为准还是上一个节点的输出为准,是不确定的。输出端口表示了该节点的输出信息。即在本公开的一个实施例中,为了避免二义性,数据类型输入端口只能连接一个数据类型输出端口,第一节点上的一个数据类型输出端口连接第二节点上的一个或者多个数据类型输入端口,第二节点上的一个数据类型输入端口则可连接第一节点上的一个数据类型输出端口。
同时,可以理解的是,节点的逻辑执行需要某种途径来触发,就是说需要通知某个节点开始执行其封装的代码逻辑。这种触发方式在本实施例中可以通过控制端口来实现。控制端口没有数据类型之分,控制端口可以是输入端口,也可以是输出端口。输入控制端口表示,当该端口被触发,则开始执行节点的逻辑;相似的,输出控制端口表示,该端口会触发后续连接的下一个节点的输入控制口。
在本实施例中,控制类型输入端口可连接一个或者多个控制类型输出端口,在一些可能的实现方式中,不同的输出控制端口之间可以采用“或”的逻辑筛选出其连接的输入控制端口的入参,比如,当输入控制端口为“开启”,如果其对应了两个入参,当其中任何一个入参发生,都可以控制“开启”的执行,其中,控制类型输出端口连接下一个节点的一个控制类型输入端口。
在另一些可能的实施例中,不同的输出控制端口之间可以采用“和”的逻 辑确定输入控制端口的入参,比如,当输入控制端口为“开启”,如果其对应了两个入参,当其中两个入参发生,才可以控制“开启”的执行。需要强调的是,节点封装的脚本代码片段的脚本语言有多种多样,由于用节点式的可视化方式编辑脚本,对用户来说无需知道具体是用什么脚本语言,只需要关注在节点功能;另外,即使目标功能的载体应用一直在迭代,会存在同样的接口功能或者参数发生变化的情况,这种情况下如果手写代码的话,就需要跟着功能或者参数的变化修改手写代码,维护成本高。通过采用节点式的可视化编程,可以将这种改变维护在节点内,同样是用户无感知;并且,由于用户的编码能力和经验参差不齐,写出来的代码质量无法保证,通过采用节点来做统一的编码封装,可以经过严格的测试,提升代码的执行效率和质量。
如图7所示(图中虚线部分表示与脚本文件对应的节点连线图的架构,即虚线部分是在节点维度说明脚本文件的生成逻辑,实线部分表示与脚本文件对应的执行函数的结构,即实线分布是在执行函数维度说明脚本文件的生成逻辑,节点连线图本质上是执行函数的调用关系的前端可视化的显示),目标功能的脚本生成的逻辑实际上可以看作为一些函数的调用,其中,函数由输入参数、函数体、返回值组成。在本实施例中,根据应用场景,可以将一些常用的脚本代码片段用一个节点来表示,输入端口用来表示其入参,输出端口表示返回值。然后用连线来串联节点的输入和输出,与连线对应的拼接代码代表函数的调用关系,从而完成了一整套脚本逻辑的生成。
以具体场景举例而言,如图8所示,当节点连线图中包括节点A、节点B和节点C时,节点A封装的代码是“面部动作检测”对应的检测代码,检测的动作是“眨眼”,该节点的输出端口有四个,分别为“检测到面部动作后输出端口”、“没有检测到面部动作后输出端口”、“面部动作从无到有输出端口”、“面部动作从有到无输出端口”,节点B封装了“矩形框包含关系判断”的代码,该节点包含的输入端口为“触发输入端口”、“判断对象输入端口”和“目标区域输入端口”,节点C封装了“数值渐变”处理的有关代码,输出端口为“开始运行输入端口”、“暂停运行输入端口”等,若是节点A的“没有检测到面部动作后输出端口”与节点C的“暂停运行输入端口”连线,则意味着若是在执行节点A对应的代码后输入结果为“没有检测到眨眼动作”,则暂停“数值渐变”处 理,若是节点A的“没有检测到面部动作后输出端口”与节点B的“触发输入端口”连线,则意味着若是在执行节点A对应的代码后输入结果为“没有检测到眨眼动作”,则节点B对应的“矩形框包含关系判断”的代码被触发执行,“没有检测到眨眼动作”,则执行节点B的功能,开始根据“判断对象输入端口”和“目标区域输入端口”的入参进行端口对应的子功能的执行,否则,即使“判断对象输入端口”和“目标区域输入端口”有入参,也进行端口对应的子功能的执行。
综上,本公开实施例的脚本生成方法,以可视化的方式生成节点连线图,用户无需掌握代码编写规则,并且节点封装了对应的脚本片片段,基于节点之间的连线拼接对应的脚本片段即可生成对应的目标脚本,提升了脚本的生成效率,降低了用户的学习成本,扩展了目标功能的开发灵活性。
基于上述实施例,不难理解的是,节点与节点之间连接的调用是通过连线表示的,该连线映射到代码层面即为表示各节点端口之间调用关系的拼接代码,下面结合具体的实施例,详细描述如何根据端口类型以及对应的连线情况生成表示各节点之间调用关系的拼接代码。
在本实施例中,如图9所示,拼接代码的生成包括:
步骤901,对节点连线图进行拓扑排序,根据排序结果依次遍历检测节点连线图中各节点的端口类型。
其中,由于节点连线图中的节点与节点之间的连线,构成了节点之间的有向无环图,因此,可以基于拓扑排序采用偏序到全序的方式对节点连线图进行排序,以便于根据排序结果依次遍历检测节点连线图中各节点的端口类型,其中,端口类型可以根据端口的名称或者是端口的图案类型或者颜色等确定,在此不作限制。
步骤902,根据端口类型以及对应的连线情况生成表示各节点之间调用关系的拼接代码。
在本实施例中,根据端口类型以及对应的连线情况生成表示各节点之间调用关系的拼接代码,即在本实施例中,根据各个节点之间调用的具体端口,以及具体端口的调用关系生成拼接代码。
在本公开的一个实施例中,如果检测获知正在处理的当前节点包含数据类 型输入端口,则检测数据类型输入端口是否存在连线。
如果数据类型输入端口存在连线,则根据与当前节点的数据类型输入端口连接的上游节点的输出端口生成相应的拼接代码,即若是上游节点的输出端口与当前节点的数据类型输入端口连接,则表明当前节点的数据类型输入端口依赖于上游节点的输出端口的输出,从而,根据上游节点的输出端口生成相应的拼接代码。
举例而言,假设节点A有一个数据类型输出端口(序号为0)连接到了节点B的输入端口(序号为0),则对应的生成的拼接代码为:
local node_a=new NodeA()//表示拼接代码连接的第一节点为A
local node_b=new NodeB()//表示拼接代码连接的第二节点为B
node_b:setInput(0,node_a:getOutput(0))//表示将节点A的输出端口0与B的输入端口0对应的子功能关联
由此,通过拼接代码将节点A和节点B的调用关联起来,其中,节点A对应的封装代码和节点B对应的封装代码通过该拼接代码被调用执行,以生成节点A和节点B之间对应的目标脚本文件。
在本实施例中,如果数据类型输入端口不存在连线,则根据用户在当前节点的数据类型输入端口的输入值生成相应的拼接代码。
举例而言,假设节点B还有一个数据类型输入端口(序号1)没有连线,则可采用用户输入值,生成的对应的拼接代码为:
local user_input=用户输入值对应的数据对象;
node_b:setInput(1,user_input);
然后,可以处理节点的输出端口,如果获知当前节点包含控制类型输出端口,则检测控制类型输出端口是否存在连线,此时只需要处理控制类型的端口即可。即如果没有连线,则直接跳过,如果有连接,则根据与当前节点的控制类型输出端口连接的下游节点的输入端口生成相应的拼接代码。
举例而言,假设节点A有一个控制类型输出端口(序号1),连接到了节点B的控制输入端口(序号1),则对应的生成伪代码:
local node_a=new NodeA()//表示拼接代码连接的第一节点为A
local node_b=new NodeB()//表示拼接代码连接的第二节点为B
node_a:setTriggerNext(1,node_b:execute(1))。//表示将节点A的输出端口1与B的输入端口1对应的子功能关联,其中,该子功能关联对应的代码中:node_a:setTriggerNext t(1,…)表示的是当节点A的输出端口1被触发时执行,node_b:execute(1)表示的是执行的对象是B的输入端口1对应的功能。
由此,对每个节点都执行以上操作,最后将这些代码统一生成为到一个目标脚本文件,这样就完成了脚本逻辑的可视化编辑。
为了使得本领域的技术人员更加清楚的了解本公开实施例的脚本生成方式,下面结合具体的应用场景举例:
其中,在本实施例中,节点连线图中的节点是用户手动触发连接的,首先对拿到的节点连线图做一次拓扑排序,排好序之后,按顺序依次取每个节点,获取节点对应的脚本代码。然后根据节点的连线,在脚本中生成调用的拼接代码,对于节点输入端口,只需要处理数据类型的端口,其原因是数据端口的输入会依赖上一个的输出。那么首先检查是否有连线,如果没有的话则获取用户输入的值,如果有连线,则获取连线对端的输出端口对应的值,根据该对应的值生成目标脚本文件。
如图10所示,获取到用户连接的节点连线图,对节点连线图中所有的节点进行排序,比如,进行拓扑排序等,根据排序结果依次遍历节点连线图中的节点,首先遍历所有的输入端口,如果检测获知正在处理的当前节点包含数据类型输入端口,则检测数据类型输入端口是否存在连线,如果数据类型输入端口存在连线,则根据与当前节点的数据类型输入端口连接的上游节点的输出端口生成相应的拼接代码,如果数据类型输入端口不存在连线,则根据用户在当前节点的数据类型输入端口的输入值生成相应的拼接代码。
进而,如果获知当前节点包含控制类型输出端口,则检测控制类型输出端口是否存在连线,如果控制类型输出端口存在连线,则根据与当前节点的控制类型输出端口连接的下游节点的输入端口生成相应的拼接代码。
综上,本公开实施例的脚本生成方法,根据节点的端口类型生成节点之间的拼接代码,通过拼接代码将及节点的执行逻辑最终串接生成目标脚本文件,用户无需掌握代码编写规则,进一步提升了脚本生成效率。
为了实现上述实施例,本公开还提出了一种脚本生成装置。
图11为本公开实施例提供的一种脚本生成装置的结构示意图,该装置可由软件和/或硬件实现,一般可集成在电子设备中。如图11所示,该装置包括:获取模块1110、第一生成模块1120、第二生成模块1130,其中,
获取模块1110,用于获取用于实现目标功能的节点连线图;
第一生成模块1120,用于根据节点连线图中各节点端口之间的连线,生成表示各节点之间调用关系的拼接代码;
第二生成模块1130,用于根据拼接代码以及各节点预先编写的脚本代码生成与目标功能对应的目标脚本文件。
本公开实施例所提供的脚本生成装置可执行本公开任意实施例所提供的脚本生成方法,具备执行方法相应的功能模块和有益效果,为简明起见,此处不再赘述。
应注意,上述各个模块仅是根据其所实现的具体功能划分的,而不是用于限制具体的实现方式,例如可以以软件、硬件或者软硬件结合的方式来实现。在实际实现时,上述各个模块可被实现为独立的物理实体,或者也可由单个实体(例如,处理器(CPU或DSP等)、集成电路等)来实现。
此外,尽管未示出,该装置也可以包括存储器,其可以存储由装置、装置所包含的各个模块在操作中产生的各种信息、用于操作的程序和数据、将由通信单元发送的数据等。存储器可以是易失性存储器和/或非易失性存储器。例如,存储器可以包括但不限于随机存储存储器(RAM)、动态随机存储存储器(DRAM)、静态随机存取存储器(SRAM)、只读存储器(ROM)、闪存存储器。当然,存储器可也位于该装置之外。可选地,尽管未示出,但是该装置也可以包括通信单元,其可用于与其它装置进行通信。在一个示例中,通信单元可以被按照本领域已知的适当方式来实现,这里将不再详细描述。为了实现上述实施例,本公开还提出了一种计算机程序产品,包括计算机程序/指令,其特征在于,该计算机程序/指令被处理器执行时实现上述实施例所提到的脚本生成方法的步骤。
图12为本公开实施例提供的一种电子设备的结构示意图。
下面具体参考图12,其示出了适于用来实现本公开实施例中的电子设备1200的结构示意图。本公开实施例中的电子设备1200可以包括但不限于诸如移 动电话、笔记本电脑、数字广播接收器、PDA(个人数字助理)、PAD(平板电脑)、PMP(便携式多媒体播放器)、车载终端(例如车载导航终端)、可穿戴电子设备等等的移动终端以及诸如数字TV、台式计算机、智能家居设备等等的固定终端。图12示出的电子设备仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。
如图12所示,电子设备1200可以包括处理装置(例如中央处理器、图形处理器等)1201,其可以根据存储在只读存储器(ROM)1202中的程序或者从存储装置1208加载到随机访问存储器(RAM)1203中的程序而执行各种适当的动作和处理。在RAM 1203中,还存储有电子设备1200操作所需的各种程序和数据。处理装置1201、ROM 1202以及RAM 1203通过总线1204彼此相连。输入/输出(I/O)接口1205也连接至总线1204。
通常,以下装置可以连接至I/O接口1205:包括例如触摸屏、触摸板、键盘、鼠标、摄像头、麦克风、加速度计、陀螺仪等的输入装置1206;包括例如液晶显示器(LCD)、扬声器、振动器等的输出装置1207;包括例如磁带、硬盘等的存储装置1208;以及通信装置1209。通信装置1209可以允许电子设备1200与其他设备进行无线或有线通信以交换数据。虽然图12示出了具有各种装置的电子设备1200,但是应理解的是,并不要求实施或具备所有示出的装置。可以替代地实施或具备更多或更少的装置。
特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在非暂态计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信装置1209从网络上被下载和安装,或者从存储装置1208被安装,或者从ROM 1202被安装。在该计算机程序被处理装置1201执行时,执行本公开实施例的脚本生成方法中限定的上述功能。
需要说明的是,本公开上述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包 括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本公开中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、RF(射频)等等,或者上述的任意合适的组合。
在一些实施方式中,客户端、服务器可以利用诸如HTTP(HyperText Transfer Protocol,超文本传输协议)之类的任何当前已知或未来研发的网络协议进行通信,并且可以与任意形式或介质的数字数据通信(例如,通信网络)互连。通信网络的示例包括局域网(“LAN”),广域网(“WAN”),网际网(例如,互联网)以及端对端网络(例如,ad hoc端对端网络),以及任何当前已知或未来研发的网络。
上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。
上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该电子设备执行时,使得该电子设备:获取用于实现目标功能的节点连线图,根据节点连线图中各节点端口之间的连线,进而,生成表示各节点之间调用关系的拼接代码,最后,根据拼接代码以及各节点预先编写的脚本代码生成与目标功能对应的目标脚本文件。由此,通过节点连线图抽象脚本代码的封装,基于可视化的节点连线图实现功能的目标脚本文件的生成,提高了目标脚本文件的生成效率和准确率,降低了目标脚本文件生成的学习成本。
可以以一种或多种程序设计语言或其组合来编写用于执行本公开的操作的 计算机程序代码,上述程序设计语言包括但不限于面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。
附图中的流程图和框图,图示了按照本公开各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。
描述于本公开实施例中所涉及到的单元可以通过软件的方式实现,也可以通过硬件的方式来实现。其中,单元的名称在某种情况下并不构成对该单元本身的限定。
本文中以上描述的功能可以至少部分地由一个或多个硬件逻辑部件来执行。例如,非限制性地,可以使用的示范类型的硬件逻辑部件包括:现场可编程门阵列(FPGA)、专用集成电路(ASIC)、专用标准产品(ASSP)、片上系统(SOC)、复杂可编程逻辑设备(CPLD)等等。
在本公开的上下文中,机器可读介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的程序。机器可读介质可以是机器可读信号介质或机器可读储存介质。机器可读介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或 半导体系统、装置或设备,或者上述内容的任何合适组合。机器可读存储介质的更具体示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或快闪存储器)、光纤、便捷式紧凑盘只读存储器(CD-ROM)、光学储存设备、磁储存设备、或上述内容的任何合适组合。
根据本公开的一个或多个实施例,本公开提供了一种脚本生成方法,包括:获取用于实现目标功能的节点连线图;
根据所述节点连线图中各节点端口之间的连线,生成表示所述各节点之间调用关系的拼接代码;
根据所述拼接代码以及所述各节点预先编写的脚本代码生成与所述目标功能对应的目标脚本文件。
根据本公开的一个或多个实施例,本公开提供的脚本生成方法中,还包括:响应于对实现所述目标功能的多个节点信息的触发操作,在可视化面板上显示与各所述节点信息对应的各节点;
响应于根据所述目标功能的执行逻辑对所述各节点的端口之间的连接触发操作,生成所述节点连线图。
根据本公开的一个或多个实施例,本公开提供的脚本生成方法中,所述响应于对实现所述目标功能的多个节点信息的触发操作,在可视化面板上显示与各所述节点信息对应的各节点,包括:
搜索预先构建的实现所述目标功能的多个节点名称,响应于对各所述节点名称的触发操作,在可视化面板上显示与各所述节点名称对应的各节点,和/或,
搜索所述可视化面板上当前显示节点的扩展数据类型,响应于对所述扩展数据类型中目标数据类型的触发操作,将所述当前显示节点切换成与所述目标数据类型匹配的节点。
根据本公开的一个或多个实施例,本公开提供的脚本生成方法中,还包括:
获取与业务功能对应的脚本代码;
构建与所述脚本代码对应的用于展示在所述可视化面板上的节点,其中,所述节点包括:节点名称、至少一个输入端口和/或至少一个输出端口。
根据本公开的一个或多个实施例,本公开提供的脚本生成方法中,所述至 少一个输入端口包括:数据类型输入端口、和/或、控制类型输入端口;
所述至少一个输出端口包括:数据类型输出端口、和/或、控制类型输出端口。
根据本公开的一个或多个实施例,本公开提供的脚本生成方法中,
具有连接关系的两个节点包括:第一节点和第二节点,其中,
所述第一节点上的数据类型输出端口与所述第二节点上所需连接的数据类型输入端口的数据类型一致;
所述第一节点上的一个数据类型输出端口连接所述第二节点上的一个或者多个数据类型输入端口,以及,所述第二节点上的一个数据类型输入端口连接所述第一节点上的一个数据类型输出端口;
所述第一节点上的一个控制类型输出端口连接所述第二节点上的一个控制类型输入端口,以及,所述第二节点上的一个控制类型输入端口连接所述第一节点上的一个或者多个控制类型输出端口。
根据本公开的一个或多个实施例,本公开提供的脚本生成方法中,所述根据所述节点连线图中各节点端口之间的连线,生成表示所述各节点之间调用关系的拼接代码,包括:
对所述节点连线图进行拓扑排序,根据排序结果依次遍历检测所述节点连线图中各节点的端口类型;
根据所述端口类型以及对应的连线情况生成表示所述各节点之间调用关系的拼接代码。
根据本公开的一个或多个实施例,本公开提供的脚本生成方法中,所述根据所述端口类型以及对应的连线情况生成表示所述各节点之间调用关系的拼接代码,包括:
如果检测获知当前节点包含数据类型输入端口,则检测所述数据类型输入端口是否存在连线;
如果所述数据类型输入端口存在连线,则根据与所述当前节点的所述数据类型输入端口连接的上游节点的输出端口生成相应的拼接代码;
如果所述数据类型输入端口不存在连线,则根据用户在所述当前节点的所述数据类型输入端口的输入值生成相应的拼接代码。
根据本公开的一个或多个实施例,本公开提供的脚本生成方法中,还包括:
如果获知所述当前节点包含控制类型输出端口,则检测所述控制类型输出端口是否存在连线;
如果所述控制类型输出端口存在连线,则根据与所述当前节点的所述控制类型输出端口连接的下游节点的输入端口生成相应的拼接代码。
根据本公开的一个或多个实施例,本公开提供的脚本生成方法中,在所述根据所述拼接代码以及所述各节点预先编写的脚本代码生成与所述目标功能对应的目标脚本文件之前,还包括:
检测所述拼接代码与所述各节点预先编写的脚本代码的语言是否匹配;
如果不匹配,则将所述拼接代码转换成与所述各节点预先编写的脚本代码匹配的代码语言。
根据本公开的一个或多个实施例,本公开提供了一种脚本生成装置,包括:获取模块,用于获取用于实现目标功能的节点连线图;
第一生成模块,用于根据所述节点连线图中各节点端口之间的连线,生成表示所述各节点之间调用关系的拼接代码;
第二生成模块,用于根据所述拼接代码以及所述各节点预先编写的脚本代码生成与所述目标功能对应的目标脚本文件。
根据本公开的一个或多个实施例,本公开提供的脚本生成装置中,还包括:
显示模块,用于响应于对实现所述目标功能的多个节点信息的触发操作,在可视化面板上显示与各所述节点信息对应的各节点;
第三生成模块,用于响应于根据所述目标功能的执行逻辑对所述各节点的端口之间的连接触发操作,生成所述节点连线图。
根据本公开的一个或多个实施例,本公开提供的脚本生成装置中,所述显示模块,具体用于:
搜索预先构建的实现所述目标功能的多个节点名称,响应于对各所述节点名称的触发操作,在可视化面板上显示与各所述节点名称对应的各节点,和/或,
搜索所述可视化面板上当前显示节点的扩展数据类型,响应于对所述扩展数据类型中目标数据类型的触发操作,将所述当前显示节点切换成与所述目标数据类型匹配的节点。
根据本公开的一个或多个实施例,本公开提供的脚本生成装置中,还包括:
代码获取模块,用于获取与业务功能对应的脚本代码;
构建模块,用于构建与所述脚本代码对应的用于展示在所述可视化面板上的节点,其中,所述节点包括:节点名称、至少一个输入端口和/或至少一个输出端口。
根据本公开的一个或多个实施例,本公开提供的脚本生成装置中,所述至少一个输入端口包括:数据类型输入端口、和/或、控制类型输入端口;
所述至少一个输出端口包括:数据类型输出端口、和/或、控制类型输出端口。
根据本公开的一个或多个实施例,本公开提供的脚本生成装置中,
具有连接关系的两个节点包括:第一节点和第二节点,其中,
所述第一节点上的数据类型输出端口与所述第二节点上所需连接的数据类型输入端口的数据类型一致;
所述第一节点上的一个数据类型输出端口连接所述第二节点上的一个或者多个数据类型输入端口,以及,所述第二节点上的一个数据类型输入端口连接所述第一节点上的一个数据类型输出端口;
所述第一节点上的一个控制类型输出端口连接所述第二节点上的一个控制类型输入端口,以及,所述第二节点上的一个控制类型输入端口连接所述第一节点上的一个或者多个控制类型输出端口。
根据本公开的一个或多个实施例,本公开提供的脚本生成装置中,所述第一生成模块,具体用于:
如果检测获知当前节点包含数据类型输入端口,则检测所述数据类型输入端口是否存在连线;
如果所述数据类型输入端口存在连线,则根据与所述当前节点的所述数据类型输入端口连接的上游节点的输出端口生成相应的拼接代码;
如果所述数据类型输入端口不存在连线,则根据用户在所述当前节点的所述数据类型输入端口的输入值生成相应的拼接代码。
根据本公开的一个或多个实施例,本公开提供的脚本生成装置中,还包括:
第一检测模块,用于在获知所述当前节点包含控制类型输出端口时,检测 所述控制类型输出端口是否存在连线;
第四生成模块,用于在所述控制类型输出端口存在连线时,根据与所述当前节点的所述控制类型输出端口连接的下游节点的输入端口生成相应的拼接代码。
根据本公开的一个或多个实施例,本公开提供的脚本生成装置中,还包括:
第二检测模块,用于检测所述拼接代码与所述各节点预先编写的脚本代码的语言是否匹配;
转换模块,用于在不匹配时,将所述拼接代码转换成与所述各节点预先编写的脚本代码匹配的代码语言。
根据本公开的一个或多个实施例,本公开提供了一种电子设备,包括:
处理器;
用于存储所述处理器可执行指令的存储器;
所述处理器,用于从所述存储器中读取所述可执行指令,并执行所述指令以实现如本公开提供的任一实施例所述的脚本生成方法。
根据本公开的一个或多个实施例,本公开提供了一种计算机可读存储介质,所述存储介质存储有计算机程序,所述计算机程序用于执行如本公开提供的任一实施例所述的脚本生成方法。
本公开实施例还提供了一种计算机程序,所述计算机程序包括的程序代码在由计算机执行时使得计算机实现如本公开提供的任一实施例所述的脚本生成方法。
以上描述仅为本公开的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本公开中所涉及的公开范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离上述公开构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本公开中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。
此外,虽然采用特定次序描绘了各操作,但是这不应当理解为要求这些操作以所示出的特定次序或以顺序次序执行来执行。在一定环境下,多任务和并行处理可能是有利的。同样地,虽然在上面论述中包含了若干具体实现细节, 但是这些不应当被解释为对本公开的范围的限制。在单独的实施例的上下文中描述的某些特征还可以组合地实现在单个实施例中。相反地,在单个实施例的上下文中描述的各种特征也可以单独地或以任何合适的子组合的方式实现在多个实施例中。
尽管已经采用特定于结构特征和/或方法逻辑动作的语言描述了本主题,但是应当理解所附权利要求书中所限定的主题未必局限于上面描述的特定特征或动作。相反,上面所描述的特定特征和动作仅仅是实现权利要求书的示例形式。

Claims (13)

  1. 一种脚本生成方法,包括:
    获取用于实现目标功能的节点连线图;
    根据所述节点连线图中各节点端口之间的连线,生成表示所述各节点之间调用关系的拼接代码;
    根据所述拼接代码以及所述各节点预先编写的脚本代码生成与所述目标功能对应的目标脚本文件。
  2. 根据权利要求1所述的方法,还包括:
    响应于对实现所述目标功能的多个节点信息的触发操作,在可视化面板上显示与各所述节点信息对应的各节点;
    响应于根据所述目标功能的执行逻辑对所述各节点的端口之间的连接触发操作,生成所述节点连线图。
  3. 根据权利要求2所述的方法,其中,所述响应于对实现所述目标功能的多个节点信息的触发操作,在可视化面板上显示与各所述节点信息对应的各节点,包括:
    搜索预先构建的实现所述目标功能的多个节点名称,响应于对各所述节点名称的触发操作,在可视化面板上显示与各所述节点名称对应的各节点,和/或,
    搜索所述可视化面板上当前显示节点的扩展数据类型,响应于对所述扩展数据类型中目标数据类型的触发操作,将所述当前显示节点切换成与所述目标数据类型匹配的节点。
  4. 根据权利要求2所述的方法,还包括:
    获取与业务功能对应的脚本代码;
    构建与所述脚本代码对应的用于展示在所述可视化面板上的节点,其中,所述节点包括:节点名称、至少一个输入端口和/或至少一个输出端口。
  5. 根据权利要求4所述的方法,其中,
    所述至少一个输入端口包括:数据类型输入端口、和/或、控制类型输入端口;
    所述至少一个输出端口包括:数据类型输出端口、和/或、控制类型输出端 口。
  6. 根据权利要求5所述的方法,其中,具有连接关系的两个节点包括:第一节点和第二节点,其中,
    所述第一节点上的数据类型输出端口与所述第二节点上所需连接的数据类型输入端口的数据类型一致;
    所述第一节点上的一个数据类型输出端口连接所述第二节点上的一个或者多个数据类型输入端口,以及,所述第二节点上的一个数据类型输入端口连接所述第一节点上的一个数据类型输出端口;
    所述第一节点上的一个控制类型输出端口连接所述第二节点上的一个控制类型输入端口,以及,所述第二节点上的一个控制类型输入端口连接所述第一节点上的一个或者多个控制类型输出端口。
  7. 根据权利要求1所述的方法,其中,所述根据所述节点连线图中各节点端口之间的连线,生成表示所述各节点之间调用关系的拼接代码,包括:
    对所述节点连线图进行拓扑排序,根据排序结果依次遍历检测所述节点连线图中各节点的端口类型;
    根据所述端口类型以及对应的连线情况生成表示所述各节点之间调用关系的拼接代码。
  8. 根据权利要求7所述的方法,其中,所述根据所述端口类型以及对应的连线情况生成表示所述各节点之间调用关系的拼接代码,包括:
    如果检测获知当前节点包含数据类型输入端口,则检测所述数据类型输入端口是否存在连线;
    如果所述数据类型输入端口存在连线,则根据与所述当前节点的所述数据类型输入端口连接的上游节点的输出端口生成相应的拼接代码;
    如果所述数据类型输入端口不存在连线,则根据用户在所述当前节点的所述数据类型输入端口的输入值生成相应的拼接代码。
  9. 根据权利要求8所述的方法,还包括:
    如果获知所述当前节点包含控制类型输出端口,则检测所述控制类型输出端口是否存在连线;
    如果所述控制类型输出端口存在连线,则根据与所述当前节点的所述控制 类型输出端口连接的下游节点的输入端口生成相应的拼接代码。
  10. 根据权利要求1-9任一项所述的方法,其中,在所述根据所述拼接代码以及所述各节点预先编写的脚本代码生成与所述目标功能对应的目标脚本文件之前,还包括:
    检测所述拼接代码与所述各节点预先编写的脚本代码的语言是否匹配;
    如果不匹配,则将所述拼接代码转换成与所述各节点预先编写的脚本代码匹配的代码语言。
  11. 一种脚本生成装置,包括:
    获取模块,用于获取用于实现目标功能的节点连线图;
    第一生成模块,用于根据所述节点连线图中各节点端口之间的连线,生成表示所述各节点之间调用关系的拼接代码;
    第二生成模块,用于根据所述拼接代码以及所述各节点预先编写的脚本代码生成与所述目标功能对应的目标脚本文件。
  12. 一种电子设备,包括:
    处理器;
    用于存储所述处理器可执行指令的存储器;
    所述处理器,用于从所述存储器中读取所述可执行指令,并执行所述指令以实现根据权利要求1-10中任一所述的脚本生成方法。
  13. 一种计算机可读存储介质,其中,所述存储介质存储有计算机程序,所述计算机程序用于执行根据权利要求1-10中任一项所述的脚本生成方法。
PCT/CN2022/091863 2021-06-29 2022-05-10 脚本生成方法、装置、设备及介质 WO2023273621A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110729951.2 2021-06-29
CN202110729951.2A CN115543263A (zh) 2021-06-29 2021-06-29 脚本生成方法、装置、设备及介质

Publications (1)

Publication Number Publication Date
WO2023273621A1 true WO2023273621A1 (zh) 2023-01-05

Family

ID=84692466

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/091863 WO2023273621A1 (zh) 2021-06-29 2022-05-10 脚本生成方法、装置、设备及介质

Country Status (2)

Country Link
CN (1) CN115543263A (zh)
WO (1) WO2023273621A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117270838A (zh) * 2023-11-22 2023-12-22 太平金融科技服务(上海)有限公司 一种通用公式脚本的生成方法、装置、设备及介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050039176A1 (en) * 2003-08-13 2005-02-17 Fournie Jonathan P. Graphical programming system and method for creating and managing a scene graph
CN109508298A (zh) * 2018-12-25 2019-03-22 网易(杭州)网络有限公司 图形化的脚本测试方法及系统
CN110674341A (zh) * 2019-09-11 2020-01-10 广州华多网络科技有限公司 特效处理方法、装置、电子设备及存储介质
CN110704043A (zh) * 2019-09-11 2020-01-17 广州华多网络科技有限公司 特效实现方法、装置、电子设备及存储介质
CN111596909A (zh) * 2020-04-02 2020-08-28 珠海沙盒网络科技有限公司 一种可视化编辑树结构游戏逻辑的方法及介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050039176A1 (en) * 2003-08-13 2005-02-17 Fournie Jonathan P. Graphical programming system and method for creating and managing a scene graph
CN109508298A (zh) * 2018-12-25 2019-03-22 网易(杭州)网络有限公司 图形化的脚本测试方法及系统
CN110674341A (zh) * 2019-09-11 2020-01-10 广州华多网络科技有限公司 特效处理方法、装置、电子设备及存储介质
CN110704043A (zh) * 2019-09-11 2020-01-17 广州华多网络科技有限公司 特效实现方法、装置、电子设备及存储介质
CN111596909A (zh) * 2020-04-02 2020-08-28 珠海沙盒网络科技有限公司 一种可视化编辑树结构游戏逻辑的方法及介质

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117270838A (zh) * 2023-11-22 2023-12-22 太平金融科技服务(上海)有限公司 一种通用公式脚本的生成方法、装置、设备及介质
CN117270838B (zh) * 2023-11-22 2024-02-13 太平金融科技服务(上海)有限公司 一种通用公式脚本的生成方法、装置、设备及介质

Also Published As

Publication number Publication date
CN115543263A (zh) 2022-12-30

Similar Documents

Publication Publication Date Title
CN112184738B (zh) 一种图像分割方法、装置、设备及存储介质
CN110321958B (zh) 神经网络模型的训练方法、视频相似度确定方法
CN111897740B (zh) 用户界面的测试方法、装置、电子设备及计算机可读介质
KR102501327B1 (ko) 정보의 병렬처리 방법 및 장치
CN113835992B (zh) 内存泄露的处理方法、装置、电子设备及计算机存储介质
CN113268243B (zh) 内存预测方法及装置、存储介质、电子设备
CN109815448B (zh) 幻灯片生成方法及装置
WO2018153128A1 (zh) 卷积神经网络和用于其的处理方法、装置、系统、介质
KR20210058768A (ko) 객체 라벨링 방법 및 장치
US11818491B2 (en) Image special effect configuration method, image recognition method, apparatus and electronic device
WO2023273621A1 (zh) 脚本生成方法、装置、设备及介质
CN113610034B (zh) 识别视频中人物实体的方法、装置、存储介质及电子设备
WO2022099871A1 (zh) 笔迹数据处理方法、装置及电子设备
US20180336122A1 (en) Generating application flow entities
CN113468344A (zh) 实体关系抽取方法、装置、电子设备和计算机可读介质
WO2024037556A1 (zh) 图像处理方法、装置、设备及存储介质
CN113391811B (zh) 函数编译方法、装置、电子设备及计算机可读存储介质
WO2023231918A1 (zh) 图像处理方法、装置、电子设备及存储介质
WO2023134617A1 (zh) 一种模板选择方法、装置、电子设备及存储介质
CN107908552A (zh) 一种基于链接的测试方法、装置及设备
WO2023098576A1 (zh) 图像处理方法、装置、设备及介质
WO2023035935A1 (zh) 数据处理方法、装置、电子设备和存储介质
CN109542775A (zh) 一种测试脚本的生成和执行方法及装置
CN117667663A (zh) 控件定位路径确定方法、装置、设备、存储介质及产品
WO2022052889A1 (zh) 图像识别方法、装置、电子设备和计算机可读介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22831448

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE