Animation data acquisition method and device
By analyzing and processing the animation data of the first carrier version, obtaining the original animation data containing the animation frames and rendering parameters, and applying it to the application of the second carrier version, the inefficiency problem of manually redeveloping the animation data is solved, and efficient animation data acquisition and application is achieved.
Patent Information
- Application Number
- CN202111355450.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-16
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2041-11-16
AI Technical Summary
When developing different carrier versions of an application, it is necessary to manually redevelop animation data that is consistent with the content of the developed version but has different formats, which is inefficient and prone to omissions.
By obtaining reference animation data of the target application of the first carrier version, multiple target sub-images and attribute information are parsed and obtained, the original animation data containing the animation frame and rendering parameters are obtained based on this information, and the configuration file of the target application of the second carrier version is configured using the data.
It realizes automatic acquisition of animation data suitable for the second carrier version without manual redevelopment, which improves the efficiency and perfection of animation data acquisition.
Smart Images

Figure CN114049416B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method for acquiring animation data. The present application also relates to an animation data acquisition device, a computing device, and a computer-readable storage medium. Background Art
[0002] With the development of technology, the carriers of application programs have become diversified. For example, the carrier may be a personal computer (PC), a mobile terminal, etc. Therefore, there is a demand for developing application programs with the same functions for different carriers.
[0003] In the related art, an application is usually developed for one carrier first, and when the application of the carrier version meets certain conditions, for example, the download rate reaches a threshold, another carrier version of the application is developed.
[0004] However, different carriers have different format requirements for the resources used by the application. For example, for the resources used to generate animations in the application: animation data, the format requirement for the PC side is Sprite Wizard (SPR, Sprite Wizard, a collection of pictures with multiple angles and multiple actions) format, and the format requirement for the mobile terminal is Prefab (description file of objects in the virtual scene) format suitable for Unity (a development tool for 2D and 3D content). Therefore, when developing another carrier version of an application, developers are required to manually redevelop animation data with the same content as the developed version of the application but in a different format, which is inefficient and prone to omissions. Therefore, a more efficient solution needs to be provided. Summary of the invention
[0005] In view of this, the embodiment of the present application provides an animation data acquisition method to solve the technical defects existing in the prior art. The embodiment of the present application also provides an animation data acquisition device, a computing device, and a computer-readable storage medium.
[0006] According to a first aspect of an embodiment of the present application, there is provided an animation data acquisition method, which is applied to a development platform of a target application of a second carrier version, comprising:
[0007] Obtain reference animation data of a target application of a first carrier version;
[0008] Parsing the reference animation data according to a first development rule, and obtaining a plurality of target sub-images and attribute information of the reference animation data based on the parsing result, wherein the first development rule is a rule for developing a target application of the first carrier version;
[0009] Based on the attribute information and the plurality of target sub-images, obtaining original animation data including animation frames and rendering parameters;
[0010] The original animation data is used to configure a configuration file of the target application of the second carrier version, wherein the configuration file is used to render the animation frames according to the rendering parameters in the configuration file when the target application of the second carrier version is called, and obtain and display the target animation.
[0011] According to a second aspect of an embodiment of the present application, there is provided an animation data acquisition device, which is applied to a development platform of a target application of a second carrier version, and includes:
[0012] The original animation data acquisition module is configured to acquire reference animation data of a target application of a first carrier version; parse the reference animation data according to a first development rule, and acquire multiple target sub-images and attribute information of the reference animation data based on the parsing result, wherein the first development rule is a rule for developing the target application of the first carrier version; and acquire original animation data including animation frames and rendering parameters based on the attribute information and the multiple target sub-images;
[0013] The animation data configuration module is configured to use the original animation data to configure a configuration file of the target application of the second carrier version, wherein the configuration file is used to render the animation frames according to the rendering parameters in the configuration file when the target application of the second carrier version is called, and obtain and display the target animation.
[0014] Optionally, the original animation data acquisition module is further configured to:
[0015] Calling an interface that satisfies the first development rule to process the reference animation data and obtain a byte stream of the reference animation data;
[0016] Extracting pixel data and color data of each reference frame and attribute information of the reference animation data from the byte stream;
[0017] According to the color data of each reference frame, the pixel data of the reference frame is restored to texture data, and each texture data is added to the image matrix corresponding to the texture data to obtain the multiple target sub-images.
[0018] Optionally, the original animation data acquisition module is further configured to:
[0019] Adding each texture data to an image matrix corresponding to the texture data respectively to obtain a plurality of first image matrices, and determining a redundant matrix in the plurality of first image matrices;
[0020] The redundant matrices in the plurality of first image matrices are deleted to obtain the plurality of target sub-images.
[0021] Optionally, the original animation data acquisition module is further configured to:
[0022] Extracting direction information of each texture data from the byte stream;
[0023] According to the direction information, the texture data having a directionally symmetrical relationship among the texture data are determined as a pair of first texture data, and the texture data having no directionally symmetrical relationship among the texture data are determined as second texture data;
[0024] Adding each second texture data to the image matrix corresponding to the second texture data respectively to obtain a plurality of first sub-images;
[0025] Add one of each pair of first texture data to the image matrix corresponding to the first texture data to obtain a plurality of second sub-images, and obtain a third sub-image having a direction opposite to the second sub-image according to the direction information corresponding to each second sub-image;
[0026] The plurality of first sub-images, the plurality of second sub-images and each third sub-image are determined as the plurality of target sub-images.
[0027] Optionally, the original animation data acquisition module is further configured to:
[0028] Determine the multiple target sub-images as the animation frames respectively, and determine the attribute information as the rendering parameters;
[0029] Splicing the animation frames to obtain at least one target parent image;
[0030] The target parent image is integrated according to the rendering parameters to obtain the original animation data.
[0031] Optionally, the original animation data acquisition module is further configured to:
[0032] Determining the image type of each animation frame;
[0033] Concatenates animation frames of the same image type into a target parent image with a preset resolution.
[0034] Optionally, the attribute information includes a playback order of each animation frame;
[0035] The original animation data acquisition module is further configured as follows:
[0036] Determining a target playback order of the target parent images according to the playback order of each animation frame in each target parent image;
[0037] According to the target playback order, the target parent images are sorted to obtain the original animation data.
[0038] Optionally, the original animation data acquisition module is further configured to:
[0039] Respectively obtain the position information of each animation frame in the target parent image to which the animation frame belongs;
[0040] Determine the position information and the sorted target parent images as the original animation data;
[0041] Among them, the location information is used when the target application of the second carrier version is called, and according to the location information in the configuration file, the animation frame is obtained and rendered from the sorted target parent images to obtain and display the target animation.
[0042] Optionally, the animation data configuration module is further configured to:
[0043] Encapsulating the original animation data into a component;
[0044] Add the component to the configuration file to obtain the configuration file of the target application of the second carrier version.
[0045] According to a third aspect of an embodiment of the present application, a computing device is provided, including:
[0046] Memory and processor;
[0047] The memory is used to store computer executable instructions, and the processor implements the steps of the animation data acquisition method when executing the computer executable instructions.
[0048] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, which stores computer-executable instructions, and when the instructions are executed by a processor, the steps of the animation data acquisition method are implemented.
[0049] The solution provided by the present application is that the development platform of the target application of the second carrier version obtains the reference animation data of the target application of the first carrier version; according to the first development rule, the reference animation data is parsed, and based on the parsing result, multiple target sub-images and attribute information of the reference animation data are obtained; based on the attribute information and the multiple target sub-images, the original animation data including animation frames and rendering parameters are obtained; and the configuration file of the target application of the second carrier version is configured using the original animation data. Among them, the first development rule is a rule for developing the target application of the first carrier version. Therefore, according to the first development rule, the reference animation data can be parsed, so that based on the parsing result, multiple target sub-images and attribute information of the reference animation data can be obtained. Among them, the target sub-image can reflect the picture content of the animation obtained using the reference animation data, and the attribute information can reflect the rendering parameters of the animation obtained using the reference animation data. Therefore, based on the attribute information and the multiple target sub-images, the original animation data including animation frames and rendering parameters can be obtained; and it can be ensured that the animation content reflected by the original animation data and the reference animation data are consistent. On this basis, the original animation data is equivalent to data not restricted by the carrier, so the development platform of the target application of the second carrier version can use the original animation data, and the configured configuration file can be recognized by the target application of the second carrier version. Therefore, when the target application of the second carrier version is called, the animation frames can be rendered according to the rendering parameters of the original animation data in the configuration file to obtain and display the target animation. Therefore, this solution is equivalent to using the reference animation data of the target application of the first carrier version to automatically obtain animation data that can be directly used by the target application of the second carrier version, without the need to manually redevelop the animation data, thereby improving the efficiency and completeness of animation data acquisition. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 is a flow chart of a method for acquiring animation data provided by an embodiment of the present application;
[0051] Figure 2 is a flow chart of a method for acquiring animation data provided by another embodiment of the present application;
[0052] Figure 3 This is an example diagram of the data flow process in an application example of an animation data acquisition method provided in an embodiment of the present application;
[0053] Figure 4 It is a structural schematic diagram of an animation data acquisition device provided by an embodiment of the present application;
[0054] Figure 5 It is a structural block diagram of a computing device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0055] Many specific details are described in the following description to facilitate a full understanding of the present application. However, the present application can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of the present application, so the present application is not limited by the specific implementation disclosed below.
[0056] The terms used in one or more embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of the present application. The singular forms of "a", "said" and "the" used in one or more embodiments of the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of the present application refers to and includes any or all possible combinations of one or more associated listed items.
[0057] It should be understood that, although the terms first, second, etc. may be used to describe various information in one or more embodiments of the present application, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of the present application, the first may also be referred to as the second, and similarly, the second may also be referred to as the first.
[0058] First, the terms involved in one or more embodiments of the present invention are explained.
[0059] Prefab: A description file in Unity that describes the game objects in the scene. It is equivalent to a configuration file and can be stored in the Assets folder for easy reuse in other scenes.
[0060] Prefab: In Unity, a prefab can be used to store an object, including all components of the object and all its sub-objects.
[0061] Byte stream: A data stream composed of bytes, used to process binary data.
[0062] Portable Network Graphics (PNG): A bitmap format that uses a lossless compression algorithm, with the characteristics of high compression ratio and small generated file size.
[0063] Texture Packer: A tool that combines several resource images into one large image.
[0064] Meta: A text document written in YAML (Yet Another Markup Language), suitable for Unity.
[0065] TextureImporter: An editing tool used in Unity to obtain Meta files.
[0066] Extensible Markup Language (XML): A markup language used to mark electronic documents to make them structured. XML is suitable for World Wide Web transmission, providing a unified method to describe and exchange structured data that is independent of applications or vendors. It is a cross-platform, content-dependent technology in the Internet environment.
[0067] In the present application, a method for acquiring animation data is provided. The present application also relates to an animation data acquisition device, a computing device, and a computer-readable storage medium, which are described in detail one by one in the following embodiments.
[0068] Figure 1 A flowchart of a method for acquiring animation data according to an embodiment of the present application is shown, which is applied to a development platform of a target application of a second carrier version, and specifically includes the following steps:
[0069] S102, obtaining reference animation data of a target application of a first carrier version.
[0070] In a specific application, the target application of the first carrier version refers to an application for which at least the animation data has been developed for the first carrier. In one case, in order to reduce the waste of computing resources, the above step S102 can be performed when there is a need to develop the target application of the second carrier version. The target application of the first carrier version and the target application of the second carrier version can at least display the same animation. The carrier refers to a computing device on which any application is installed. For example, the carrier can be a personal computer, a mobile terminal, a smart wearable device, etc. The reference animation data refers to the data used to render the animation in the resource data used by the target application of the first carrier version.
[0071] Furthermore, there may be multiple ways to obtain the reference animation data of the target application of the first carrier version. Exemplarily, the reference animation data of the target application of the first carrier version submitted by the developer may be received, or the reference animation data of the target application of the first carrier version may be searched from a database. Furthermore, the specific form of the reference animation data depends on the first carrier. For example, if the first carrier is a personal computer, the reference animation data is an SPR file; if the first carrier is a mobile terminal, the reference animation data is a Prefab file. Among them, the database may be a database for storing resources of the target application of the first carrier version. This is all reasonable, and any method that can obtain the reference animation data of the target application of the first carrier version can be used in this application, and this embodiment does not limit this.
[0072] S104, parsing the reference animation data according to the first development rule, and obtaining attribute information of a plurality of target sub-images and the reference animation data based on the parsing result, wherein the first development rule is a rule for developing a target application of a first carrier version.
[0073] In a specific application, according to the first development rule, there can be multiple ways to parse the reference animation data. Exemplarily, the first interface of the first platform can be called to parse the reference animation data. The first platform is a platform for developing a target application of the first carrier version, and the first interface is a calling interface of a function in the first platform that can parse the reference animation data into a byte stream or an image. Alternatively, exemplarily, a preset parsing model can be used to parse the reference animation data. The preset parsing model is a model that is pre-established using the development language of the second platform and conforms to the first development rule. The second platform is a development platform for the target application of the second carrier version.
[0074] Furthermore, based on the parsing results, there can be multiple ways to obtain multiple target sub-images and attribute information of reference animation data. Exemplarily, when the parsing results are multiple images and rendering parameters, the multiple images can be used as multiple target sub-images, and the rendering parameters can be used as attribute information of reference animation data. Or, exemplarily, when the parsing result is a byte stream, the pixel data and color data of each reference frame, as well as the attribute information of the reference animation data, can be extracted from the parsing result; and then the pixel data and color data of the reference frame can be used to obtain multiple target sub-images. For ease of understanding and reasonable layout, the second example will be specifically described in the form of an optional embodiment.
[0075] S106, obtaining original animation data including animation frames and rendering parameters based on the attribute information and the multiple target sub-images.
[0076] In a specific application, there may be multiple ways to obtain the original animation data including animation frames and rendering parameters based on the attribute information and multiple target sub-images. Exemplarily, the attribute information may be used as rendering parameters, and the multiple target sub-images may be used as animation frames to obtain the original animation data. Alternatively, exemplary, the attribute information may be used as rendering parameters, and the multiple target sub-images may be subjected to specified processing to obtain animation frames, thereby obtaining the original animation data. The specified processing is used to reduce the cost of obtaining the original animation data, and / or to reduce the subsequent rendering cost according to the configuration file. For ease of understanding and reasonable layout, the second example will be specifically described in the form of an optional embodiment.
[0077] S108, using the original animation data, configuring a configuration file of the target application of the second carrier version, wherein the configuration file is used to render animation frames according to rendering parameters in the configuration file when the target application of the second carrier version is called, and obtain and display the target animation.
[0078] In a specific application, the form of the configuration file of the target application of the second carrier version depends on the second carrier. For example, if the second carrier is a mobile terminal, the configuration file may be a Prefab; if the second carrier is a personal computer, the configuration file may be an SPR file. In order to facilitate understanding and reasonable layout, the configuration method of the configuration file and the method of obtaining the target animation are described in detail in the form of optional embodiments.
[0079] In the solution provided by the present application, the first development rule is a rule for developing a target application of the first carrier version. Therefore, according to the first development rule, the reference animation data can be parsed, so that multiple target sub-images and attribute information of the reference animation data can be obtained based on the parsing results. Among them, the target sub-image can reflect the picture content of the animation obtained using the reference animation data, and the attribute information can reflect the rendering parameters of the animation obtained using the reference animation data. Therefore, based on the attribute information and multiple target sub-images, the original animation data including the animation frame and the rendering parameters can be obtained; and it can be ensured that the animation content reflected by the original animation data and the reference animation data are consistent. On this basis, the original animation data is equivalent to data not restricted by the carrier. Therefore, the development platform of the target application of the second carrier version can use the original animation data, and the configured configuration file can be recognized by the target application of the second carrier version. Therefore, when the target application of the second carrier version is called, the animation frame can be rendered according to the rendering parameters of the original animation data in the configuration file, and the target animation can be obtained and displayed. Therefore, this solution is equivalent to using the reference animation data of the target application of the first carrier version to automatically obtain animation data that can be directly used by the target application of the second carrier version, without manually redeveloping the animation data, thereby improving the efficiency and perfection of animation data acquisition.
[0080] In an optional implementation, the above-mentioned configuration of the configuration file of the target application of the second carrier version by using the original animation data may specifically include the following steps:
[0081] Encapsulate raw animation data as components;
[0082] Add the component to the configuration file to obtain the configuration file of the target application of the second carrier version.
[0083] If the second carrier is a mobile terminal, the configuration file can be pre-made in Unity. In this way, when the target application of the second carrier version is running, objects in the target application, such as virtual animals and virtual scenes, can be displayed through animation to ensure that they have dynamic effects.
[0084] This embodiment encapsulates the original animation data into components, and then adds the components to the configuration file, which can ensure that the target application of the second carrier version can call the animation data smoothly. In addition, the form of the configuration file facilitates the subsequent update and maintenance of the animation data.
[0085] In an optional implementation, the above-mentioned parsing the reference animation data according to the first development rule and obtaining the attribute information of the multiple target sub-images and the reference animation data based on the parsing result may specifically include the following steps:
[0086] Calling an interface that satisfies the first development rule to process the reference animation data and obtain a byte stream of the reference animation data;
[0087] Extracting pixel data and color data of each reference frame and attribute information of reference animation data from the byte stream;
[0088] According to the color data of each reference frame, the pixel data of the reference frame is restored to texture data, and each texture data is added to the image matrix corresponding to the texture data to obtain a plurality of target sub-images.
[0089] In a specific application, the byte stream of the reference animation data may include two parts: a header and a non-header. The header records color data and attribute information, and the non-header records pixel data of each reference frame. The reference frame refers to the animation frame in the animation of the target application of the first carrier version. The color data may include all the color data of the reference frame, or the color data omitted in the reference frame. Texture data is used to characterize the content of the image, such as a pattern. The image matrix refers to the matrix formed by the pixels of the image, so by adding the texture data to the image matrix corresponding to the texture data, multiple target sub-images can be obtained.
[0090] In one case, in order to expand the scope of application of the animation data acquisition method provided in the embodiment of the present application and reduce resource occupation, the above-mentioned image matrix can be a matrix of an image in PNG format. In this way, it can be ensured that multiple target sub-images are images in PNG format.
[0091] This embodiment obtains the target sub-image and attribute information through the byte stream, which is equivalent to parsing the reference animation data as the basic byte stream to obtain richer information compared to directly parsing the image. In this way, even if the reference animation data has adjusted the color and pixels of the image, the target sub-image with rich texture can still be obtained, thereby improving the quality and accuracy of the animation frames obtained subsequently.
[0092] In an optional implementation, the above-mentioned adding each texture data to the image matrix corresponding to the texture data to obtain multiple target sub-images may specifically include the following steps:
[0093] Adding each texture data to an image matrix corresponding to the texture data to obtain a plurality of first image matrices, and determining a redundant matrix in the plurality of first image matrices;
[0094] Redundant matrices in the plurality of first image matrices are deleted to obtain a plurality of target sub-images.
[0095] In specific applications, there may be multiple ways to determine redundant matrices in multiple first image matrices. Exemplarily, multiple repeated matrices with the same content may be determined from multiple first image matrices, and a specified number of matrices in the multiple repeated matrices may be determined as redundant matrices. Alternatively, exemplary, performance parameters of the second carrier may be obtained, and a target frame number may be determined from a pre-established correspondence between the performance parameters and the frame number; multiple repeated matrices with the same content may be determined from multiple first image matrices, and a target frame number of matrices in the multiple repeated matrices may be determined as redundant matrices. The performance parameters may specifically be memory performance, processor performance, display device resolution, and the like of the second carrier.
[0096] Any method that can determine a redundant matrix in a plurality of first image matrices can be used in the present application, and this embodiment does not impose any limitation on this.
[0097] This embodiment achieves the effect of frame extraction by deleting redundant matrices in a plurality of first image matrices, which can reduce the occupation of computing resources, thereby further improving the efficiency of acquiring animation data, and can also reduce the occupation of storage resources.
[0098] In an optional implementation, the above-mentioned adding each texture data to the image matrix corresponding to the texture data to obtain multiple target sub-images may specifically include the following steps:
[0099] Extract the direction information of each texture data from the byte stream;
[0100] According to the direction information, the texture data having a directionally symmetrical relationship among the texture data are determined as a pair of first texture data, and the texture data having no directionally symmetrical relationship among the texture data are determined as second texture data;
[0101] Adding each second texture data to the image matrix corresponding to the second texture data respectively to obtain a plurality of first sub-images;
[0102] Add one of each pair of first texture data to the image matrix corresponding to the first texture data to obtain a plurality of second sub-images, and obtain a third sub-image having a direction opposite to the second sub-image according to the direction information corresponding to each second sub-image;
[0103] The plurality of first sub-images, the plurality of second sub-images and each third sub-image are determined as a plurality of target sub-images.
[0104] In specific applications, the content presented by the animation usually involves direction. For example, the direction of movement of a character, the direction of travel of a vehicle, and so on. Therefore, the byte stream of the reference animation data usually includes direction information of each texture data. Moreover, the content presented by the animation is specifically texture data. Therefore, the above-mentioned direction information is used to characterize the direction of the texture data. The direction information can be set according to specific needs. For example, the direction information can be four directions: up, down, left, and right, or it can be further subdivided into more than four directions according to angles. Texture data with a directional symmetry relationship are mirror images of each other. Therefore, according to the direction information corresponding to each second sub-image, a third sub-image with a direction opposite to that of the second sub-image can be obtained. Specifically, the texture data in the image matrix of the second sub-image can be mirror-swapped; or, the second sub-image can be mirror-flipped. This is all reasonable.
[0105] This embodiment achieves the effect of directional multiplexing by acquiring a third sub-image with a direction opposite to that of the second sub-image according to the directional information corresponding to each second sub-image. Therefore, the acquisition efficiency of animation data can be further improved.
[0106] For ease of understanding, the following Figure 2 As an example, the animation data acquisition method provided in the embodiment of the present application is further described. Figure 2 FIG. 1 is a flowchart of a method for acquiring animation data provided by another embodiment of the present application. The method may include the following steps:
[0107] S202: Acquire reference animation data of a target application of a first carrier version.
[0108] S204, parsing the reference animation data according to the first development rule, and obtaining attribute information of a plurality of target sub-images and the reference animation data based on the parsing result, wherein the first development rule is a rule for developing a first carrier version of the target application.
[0109] The above S202 to S204 are consistent with the present application Figure 1 S102 to S104 of the embodiment are the same steps and will not be described in detail. Figure 1 Embodiment and Figure 1 Description of alternative embodiments.
[0110] S206: Determine the plurality of target sub-images as animation frames respectively, and determine the attribute information as rendering parameters.
[0111] The attribute information may specifically include frame interval, playback order of animation frames, and the like.
[0112] S208, stitching the animation frames to obtain at least one target parent image.
[0113] In a specific application, splicing each animation frame to obtain at least one target parent image may include: inputting each animation frame into the TexturePacker tool to obtain at least one target parent image. Alternatively, directly splicing each animation frame to obtain at least one target parent image. Wherein, when splicing multiple images, the TexturePacker tool may determine the arrangement position of each image in the spliced target image according to the resolution of each image and the resolution of the target image, and in accordance with the principle that the redundant pixels reach the preset conditions. Wherein, the redundant pixels refer to transparent pixels added to the splicing result in order to ensure that the splicing result of each image reaches the resolution of the target image. The fewer the redundant pixels, the less storage resources the target parent image occupies, and the more it meets the preset conditions. Exemplarily, the preset condition may be that the number of transparent pixels is less than the number threshold. Similarly, when splicing each animation frame directly, the same method as the TexturePacker tool may also be adopted. Using the TexturePacker tool to obtain the target parent image is conducive to improving the efficiency of obtaining animation data and reducing development costs.
[0114] S210, integrating the target parent image according to the rendering parameters to obtain original animation data.
[0115] In a specific application, according to the rendering parameters, the target parent images are integrated to obtain the original animation data, which can be multiple. Exemplarily, when the rendering parameters include the division information of the animation segments, the target parent images with the same division information can be divided into a group to obtain the original animation data. Or, exemplarily, when the rendering parameters include object identifiers, the target parent images with the same object identifier can be divided into a group to obtain the original animation data. Or, exemplarily, when the rendering parameters include the playback order of the animation frames, the target parent images can be sorted according to the playback order to obtain the original animation data. For ease of understanding and reasonable layout, the third example will be specifically described in the form of an optional embodiment later.
[0116] Any method of integrating the target parent image according to the rendering parameters to obtain the original animation data can be used in this application, and this embodiment does not limit this.
[0117] S212, using the original animation data, configure a configuration file of the target application of the second carrier version, wherein the configuration file is used to render animation frames according to rendering parameters in the configuration file when the target application of the second carrier version is called, and obtain and display the target animation.
[0118] The above S212 and this application Figure 1 S108 of the embodiment is the same step and will not be described in detail. Figure 1 Embodiment and Figure 1Description of alternative embodiments.
[0119] This embodiment ensures that the animation frames of the original animation data are assembled in the form of a target parent image by splicing the target sub-images, that is, the animation frames. On this basis, when the target application of the second carrier version is called, the target application can use one rendering thread to process the target parent image for rendering according to the rendering parameters, thereby realizing the processing of multiple animation frames. In this way, there is no need to call multiple rendering threads, or call threads multiple times to process multiple animation frames respectively, thereby improving rendering efficiency.
[0120] In an optional implementation, the above-mentioned splicing of the animation frames to obtain at least one target parent image may specifically include the following steps:
[0121] Determine the image type of each animation frame;
[0122] Concatenates animation frames of the same image type into a target parent image with a preset resolution.
[0123] In a specific application, the image type of each animation frame can be multiple. Exemplarily, the image type of each animation frame can be divided according to the difference of the object to which the content in the animation frame belongs. For example, the animation frames can be divided according to the different virtual characters to which the content in the animation frame belongs, and the animation frames belonging to the same virtual character can be divided into the same image type. Alternatively, exemplary, the image type of each animation frame can be divided according to the difference of the animation clip. For example, the image type of the animation frames belonging to the same animation clip is the same. Alternatively, exemplary, the image type of each animation frame can be divided according to the difference of the direction information of the animation frame. For example, the image type of each animation frame of the same direction information of a certain object is the same.
[0124] This embodiment splices animation frames of the same image type into a target parent image with a preset resolution, which can reduce the frequent switching of target parent images during subsequent rendering, thereby reducing image jitter and rendering costs.
[0125] In an optional implementation, the attribute information includes the playback order of each animation frame;
[0126] Accordingly, the above-mentioned step of integrating the target parent image according to the rendering parameters to obtain the original animation data may specifically include the following steps:
[0127] Determine the target playback order of the target parent images according to the playback order of each animation frame in each target parent image;
[0128] According to the playback order of each target, the parent images of each target are sorted to obtain the original animation data.
[0129] In a specific application, according to the playback order of each animation frame in each target parent image, the method of determining the target playback order of the target parent image may include: determining the playback order of the animation frame with the earliest playback order in the target parent image as the target playback order of the target parent image.
[0130] This embodiment sorts each target parent image according to the target playback order to obtain the original animation data, which can ensure that the target parent images can be obtained in sequence from the configuration file for rendering during subsequent rendering. There is no need to determine the playback order during rendering, thereby improving rendering efficiency.
[0131] In an optional implementation manner, the above-mentioned obtaining of original animation data may specifically include the following steps:
[0132] Respectively obtain the position information of each animation frame in the target parent image to which the animation frame belongs;
[0133] The position information and the sorted target parent images are determined as original animation data;
[0134] The location information is used when the target application of the second carrier version is called, and according to the location information in the configuration file, animation frames are obtained and rendered from the sorted target parent images to obtain and display the target animation.
[0135] In specific applications, there may be multiple ways to obtain the position information of each animation frame in the target parent image to which the animation frame belongs. Exemplarily, the position information of the animation frame in the target parent image may be recorded and stored in the process of obtaining the target parent image. In this way, the stored position information may be directly read. Exemplarily, when the second carrier is a mobile terminal, the TextureImporter tool may be used to record the above position information in a Meta file. Alternatively, exemplarily, in the process of obtaining the target parent image, a position tag may be added to the animation frame according to the position information of the animation frame in the target parent image. In this way, the position information of the animation frame may be obtained by reading the position tag of the animation frame.
[0136] This embodiment determines the position information of each animation frame in the target parent image to which the animation frame belongs and the sorted target parent images as the original animation data. This can ensure that when the target application of the second carrier version is called, the animation frames can be accurately obtained and rendered from the sorted target parent images based on the position information in the configuration file, thereby improving rendering accuracy.
[0137] The following combination Figure 3 , taking the application of the animation data acquisition method provided in this application as an example, the animation data acquisition method is further described. Figure 3This is an example diagram of the data flow process in an application example of an animation data acquisition method provided by an embodiment of the present application, which specifically includes the following flow process:
[0138] The reference animation data is processed into texture data; the texture data is processed into a target sub-image; the target sub-image is processed into a target parent image; the target parent image is processed into original animation data; the original animation data is processed into a configuration file.
[0139] Specifically, take the first carrier as a personal computer and the second carrier as a mobile terminal as an example. The reference animation data can be parsed into a byte stream, and texture data (texture) can be obtained through the byte stream. The texture data is restored to obtain multiple target sub-images, such as multiple PNG images. Use Texture Packer to splice multiple target sub-images to obtain a target parent image. The target parent image is sorted to obtain the original animation data, wherein the original animation data can also include a Meta file that records the position information of the animation frame in the target parent image. In addition, the above-mentioned position information can also be recorded in an XML file. The configuration file obtained using the original animation data can specifically be a Prefab file.
[0140] Corresponding to the above method embodiment, the present application also provides an embodiment of an animation data acquisition device, Figure 4 FIG. 1 is a schematic diagram showing the structure of an animation data acquisition device provided by an embodiment of the present application. Figure 4 As shown, a development platform for a target application program applied to a second carrier version, the device comprises:
[0141] The original animation data acquisition module 402 is configured to acquire reference animation data of a target application of a first carrier version; parse the reference animation data according to a first development rule, and acquire multiple target sub-images and attribute information of the reference animation data based on the parsing result, wherein the first development rule is a rule for developing the target application of the first carrier version; and acquire original animation data including animation frames and rendering parameters based on the attribute information and the multiple target sub-images;
[0142] The animation data configuration module 404 is configured to use the original animation data to configure a configuration file of the target application of the second carrier version, wherein the configuration file is used to render the animation frames according to the rendering parameters in the configuration file when the target application of the second carrier version is called, and obtain and display the target animation.
[0143] In the solution provided by the present application, the first development rule is a rule for developing a target application of the first carrier version. Therefore, according to the first development rule, the reference animation data can be parsed, so that multiple target sub-images and attribute information of the reference animation data can be obtained based on the parsing results. Among them, the target sub-image can reflect the picture content of the animation obtained using the reference animation data, and the attribute information can reflect the rendering parameters of the animation obtained using the reference animation data. Therefore, based on the attribute information and multiple target sub-images, the original animation data including the animation frame and the rendering parameters can be obtained; and it can be ensured that the animation content reflected by the original animation data and the reference animation data are consistent. On this basis, the original animation data is equivalent to data not restricted by the carrier. Therefore, the development platform of the target application of the second carrier version can use the original animation data, and the configured configuration file can be recognized by the target application of the second carrier version. Therefore, when the target application of the second carrier version is called, the animation frame can be rendered according to the rendering parameters of the original animation data in the configuration file, and the target animation can be obtained and displayed. Therefore, this solution is equivalent to using the reference animation data of the target application of the first carrier version to automatically obtain animation data that can be directly used by the target application of the second carrier version, without manually redeveloping the animation data, thereby improving the efficiency and perfection of animation data acquisition.
[0144] In an optional implementation, the original animation data acquisition module 402 is further configured to:
[0145] Calling an interface that satisfies the first development rule to process the reference animation data and obtain a byte stream of the reference animation data;
[0146] Extracting pixel data and color data of each reference frame and attribute information of the reference animation data from the byte stream;
[0147] According to the color data of each reference frame, the pixel data of the reference frame is restored to texture data, and each texture data is added to the image matrix corresponding to the texture data to obtain the multiple target sub-images.
[0148] In an optional implementation, the original animation data acquisition module 402 is further configured to:
[0149] Adding each texture data to an image matrix corresponding to the texture data respectively to obtain a plurality of first image matrices, and determining a redundant matrix in the plurality of first image matrices;
[0150] The redundant matrices in the plurality of first image matrices are deleted to obtain the plurality of target sub-images.
[0151] In an optional implementation, the original animation data acquisition module 402 is further configured to:
[0152] Extracting direction information of each texture data from the byte stream;
[0153] According to the direction information, the texture data having a directionally symmetrical relationship among the texture data are determined as a pair of first texture data, and the texture data having no directionally symmetrical relationship among the texture data are determined as second texture data;
[0154] Adding each second texture data to the image matrix corresponding to the second texture data respectively to obtain a plurality of first sub-images;
[0155] Add one of each pair of first texture data to the image matrix corresponding to the first texture data to obtain a plurality of second sub-images, and obtain a third sub-image having a direction opposite to the second sub-image according to the direction information corresponding to each second sub-image;
[0156] The plurality of first sub-images, the plurality of second sub-images and each third sub-image are determined as the plurality of target sub-images.
[0157] In an optional implementation, the original animation data acquisition module 402 is further configured to:
[0158] Determine the multiple target sub-images as the animation frames respectively, and determine the attribute information as the rendering parameters;
[0159] Splicing the animation frames to obtain at least one target parent image;
[0160] The target parent image is integrated according to the rendering parameters to obtain the original animation data.
[0161] In an optional implementation, the original animation data acquisition module 402 is further configured to:
[0162] Determining the image type of each animation frame;
[0163] Concatenates animation frames of the same image type into a target parent image with a preset resolution.
[0164] In an optional implementation, the attribute information includes a playback order of each animation frame;
[0165] The original animation data acquisition module 402 is further configured to:
[0166] Determining a target playback order of the target parent images according to the playback order of each animation frame in each target parent image;
[0167] According to the target playback order, the target parent images are sorted to obtain the original animation data.
[0168] In an optional implementation, the original animation data acquisition module 402 is further configured to:
[0169] Respectively obtain the position information of each animation frame in the target parent image to which the animation frame belongs;
[0170] Determine the position information and the sorted target parent images as the original animation data;
[0171] Among them, the location information is used when the target application of the second carrier version is called, and according to the location information in the configuration file, the animation frame is obtained and rendered from the sorted target parent images to obtain and display the target animation.
[0172] In an optional implementation, the animation data configuration module 404 is further configured to:
[0173] Encapsulating the original animation data into a component;
[0174] Add the component to the configuration file to obtain the configuration file of the target application of the second carrier version.
[0175] The above is a schematic scheme of an animation data acquisition device of the present embodiment. It should be noted that the technical scheme of the animation data acquisition device and the technical scheme of the animation data acquisition method mentioned above belong to the same concept. For details not described in detail in the technical scheme of the animation data acquisition device, please refer to the description of the technical scheme of the animation data acquisition method mentioned above. In addition, each component in the device embodiment should be understood as a functional module that must be established to implement each step of the program flow or each step of the method, and each functional module is not an actual functional division or separation definition. The device claim defined by such a group of functional modules should be understood as a functional module architecture that mainly implements the solution through the computer program recorded in the specification, and should not be understood as a physical device that mainly implements the solution through hardware.
[0176] Figure 5 The block diagram of a computing device according to an embodiment of the present application is shown. The components of the computing device 500 include but are not limited to a memory 510 and a processor 520. The processor 520 is connected to the memory 510 via a bus 530, and the database 550 is used to store data.
[0177] The computing device 500 also includes an access device 540 that enables the computing device 500 to communicate via one or more networks 560. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 540 may include one or more of any type of network interface (e.g., a network interface card (NIC)) of wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a world-wide interoperability for microwave access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, a near field communication (NFC) interface, and the like.
[0178] In one embodiment of the present application, the above components of the computing device 500 and Figure 5 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Figure 5 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of the present application. Those skilled in the art may add or replace other components as needed.
[0179] The computing device 500 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or PC. The computing device 500 may also be a mobile or stationary server.
[0180] The processor 520 is used to execute computer executable instructions of the animation data acquisition method.
[0181] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the above animation data acquisition method belong to the same concept, and the details not described in detail in the technical scheme of the computing device can be referred to the description of the technical scheme of the above animation data acquisition method.
[0182] An embodiment of the present application further provides a computer-readable storage medium storing computer instructions, which are used in the animation data acquisition method when executed by a processor.
[0183] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the above-mentioned animation data acquisition method belong to the same concept, and the details not described in detail in the technical scheme of the storage medium can be referred to the description of the technical scheme of the above-mentioned animation data acquisition method.
[0184] The above describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0185] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc.
[0186] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described action sequence, because according to the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0187] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0188] The preferred embodiments of the present application disclosed above are only used to help explain the present application. The optional embodiments do not describe all the details in detail, nor do they limit the invention to the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the present application. The present application selects and specifically describes these embodiments in order to better explain the principles and practical applications of the present application, so that those skilled in the art can understand and use the present application well. The present application is only limited by the claims and their full scope and equivalents.
Claims
1. A method for acquiring animation data, characterized in that: The development platform for target applications for the second carrier version includes: Obtain reference animation data of a target application of a first carrier version; According to the first development rule, the reference animation data is parsed, and based on the parsing result, a plurality of target sub-images and attribute information of the reference animation data are obtained, wherein the first development rule is a rule for developing the target application of the first carrier version, and the parsing result is a byte stream; the obtaining of the plurality of target sub-images and attribute information of the reference animation data based on the parsing result includes: extracting pixel data and color data of each reference frame and attribute information of the reference animation data from the parsing result, and obtaining the plurality of target sub-images using the pixel data and color data of each reference frame, wherein the reference frame refers to an animation frame in the animation of the target application of the first carrier version; Based on the attribute information and the plurality of target sub-images, obtaining original animation data including animation frames and rendering parameters; The original animation data is used to configure a configuration file of the target application of the second carrier version, wherein the configuration file is used to render the animation frames according to the rendering parameters in the configuration file when the target application of the second carrier version is called, and obtain and display the target animation.
2. The method according to claim 1, characterized in that The step of parsing the reference animation data according to the first development rule and obtaining a plurality of target sub-images and attribute information of the reference animation data based on the parsing result includes: Calling an interface that satisfies the first development rule to process the reference animation data and obtain a byte stream of the reference animation data; The step of obtaining a plurality of target sub-images by using the pixel data and color data of each reference frame comprises: According to the color data of each reference frame, the pixel data of the reference frame is restored to texture data, and each texture data is added to the image matrix corresponding to the texture data to obtain the multiple target sub-images.
3. The method according to claim 2, characterized in that The step of respectively adding each texture data to an image matrix corresponding to the texture data to obtain the plurality of target sub-images includes: Adding each texture data to an image matrix corresponding to the texture data respectively to obtain a plurality of first image matrices, and determining a redundant matrix in the plurality of first image matrices; The redundant matrices in the plurality of first image matrices are deleted to obtain the plurality of target sub-images.
4. The method according to claim 2, characterized in that: The step of respectively adding each texture data to an image matrix corresponding to the texture data to obtain the plurality of target sub-images includes: Extracting direction information of each texture data from the byte stream; According to the direction information, the texture data having a directionally symmetrical relationship among the texture data are determined as a pair of first texture data, and the texture data having no directionally symmetrical relationship among the texture data are determined as second texture data; Adding each second texture data to the image matrix corresponding to the second texture data respectively to obtain a plurality of first sub-images; Add one of each pair of first texture data to the image matrix corresponding to the first texture data to obtain a plurality of second sub-images, and obtain a third sub-image having a direction opposite to the second sub-image according to the direction information corresponding to each second sub-image; The plurality of first sub-images, the plurality of second sub-images and each third sub-image are determined as the plurality of target sub-images.
5. The method according to any one of claims 1 to 4, characterized in that: The obtaining of original animation data including animation frames and rendering parameters based on the attribute information and the plurality of target sub-images comprises: Determine the multiple target sub-images as the animation frames respectively, and determine the attribute information as the rendering parameters; Splicing the animation frames to obtain at least one target parent image; The target parent image is integrated according to the rendering parameters to obtain the original animation data.
6. The method according to claim 5, characterized in that The step of splicing the animation frames to obtain at least one target parent image includes: Determining the image type of each animation frame; Concatenates animation frames of the same image type into a target parent image with a preset resolution.
7. The method according to claim 6, characterized in that The attribute information includes the playback order of each animation frame; The step of integrating the target parent image according to the rendering parameters to obtain the original animation data includes: Determining a target playback order of the target parent images according to the playback order of each animation frame in each target parent image; According to the target playback order, the target parent images are sorted to obtain the original animation data.
8. The method according to claim 7, characterized in that The obtaining of the original animation data comprises: Respectively obtain the position information of each animation frame in the target parent image to which the animation frame belongs; Determine the position information and the sorted target parent images as the original animation data; Among them, the location information is used when the target application of the second carrier version is called, and according to the location information in the configuration file, the animation frame is obtained and rendered from the sorted target parent images to obtain and display the target animation.
9. The method according to any one of claims 1 to 4 and 6 to 8, characterized in that The step of configuring a configuration file of a target application of a second carrier version by using the original animation data includes: Encapsulating the original animation data into a component; Add the component to the configuration file to obtain the configuration file of the target application of the second carrier version.
10. An animation data acquisition device, characterized in that: The development platform for target applications for the second carrier version includes: The original animation data acquisition module is configured to acquire reference animation data of a target application of a first carrier version; parse the reference animation data according to a first development rule, and obtain multiple target sub-images and attribute information of the reference animation data based on the parsing result, wherein the first development rule is a rule for developing the target application of the first carrier version, and the parsing result is a byte stream; the obtaining of multiple target sub-images and attribute information of the reference animation data based on the parsing result includes: extracting pixel data and color data of each reference frame and attribute information of the reference animation data from the parsing result, and obtaining multiple target sub-images using the pixel data and color data of each reference frame, wherein the reference frame refers to an animation frame in the animation of the target application of the first carrier version; and obtaining original animation data including animation frames and rendering parameters based on the attribute information and the multiple target sub-images; The animation data configuration module is configured to use the original animation data to configure a configuration file of the target application of the second carrier version, wherein the configuration file is used to render the animation frames according to the rendering parameters in the configuration file when the target application of the second carrier version is called, and obtain and display the target animation.
11. A computing device, characterized in that: include: Memory and processor; The memory is used to store computer executable instructions, and the processor is used to execute the computer executable instructions to implement the steps of the animation data acquisition method according to any one of claims 1 to 9.
12. A computer-readable storage medium storing computer instructions, characterized in that: When the computer instructions are executed by a processor, the steps of the animation data acquisition method described in any one of claims 1 to 9 are implemented.
Citation Information
Patent Citations
Animation display method and device, electronic equipment and storage medium
CN110136230A