Collecting scripts in a distributed scripting environment

Methods and apparatus, including computer program products, implement techniques for collecting scripts associated with graphics objects in a hierarchical arrangement of objects. A plurality of scripts are identified by traversing a hierarchical arrangement of graphics objects in a distributed scripting environment. The hierarchical arrangement includes one or more objects having associated scripts. The identified scripts are collected in a data structure.

BACKGROUND

The present invention relates to processing scripts associated with objects in a hierarchical arrangement of objects.

A graphical composition can be represented as a hierarchical arrangement of graphics objects representing elements of the composition. Graphics objects can include objects that represent text, images or graphics in a graphical composition. Graphics objects that represent text can include both dynamic and static text objects. Dynamic text objects include text objects whose contents can change based on user input. Dynamic text objects can be used to implement a form field that accepts user input. Static text objects include text objects whose contents may not be changed based on user input. Static text objects can include text headings and simple typed text. Both static and dynamic text objects, as well as images and graphics, can be animated or decorated in the graphical composition. Objects in a graphical composition can have properties that can be manipulated using commands or methods. Objects with the same properties and behaviors are grouped into classes. An object in a hierarchical arrangement of objects can include other objects. Each object in the hierarchical arrangement can be identified by a unique absolute name that identifies the object by its position in the hierarchical arrangement.

Objects in a graphical composition can be animated by triggering changes in the associated properties and behaviors based on keyframes, events, or states. Keyframes can be used to change the properties or behaviors associated with an object as the object progresses along the timeline. A frame represents a point of time in the timeline for the object. A keyframe is a frame specifying the value for an object property or for an object behavior. Events can be caused by user action or by system-based events. Each object in a graphical composition can also have associated states. States associated with an object can be predefined system states or custom states defined as part of the graphical composition. A change in the state of an object can be triggered by user events, or by interaction with other objects in the graphical composition.

Scripts are instructions that can operate on objects to modify the properties or behaviors of the object. Scripts can be used to control how the objects included in the graphical composition respond to user events. Scripts can also be used to control the interaction of an object in the graphical composition with other objects in the graphical composition. In a hierarchical arrangement of objects, scripts can be associated with individual objects in the hierarchical arrangement. Scripts can also be associated with a triggering condition such that the script is executed when the triggering condition is satisfied.

FIG. 1illustrates an example of the operation of a script printing tool in a monolithic scripting environment. The monolithic scripting environment includes a hierarchical arrangement of objects, and all the scripts associated with the objects are stored together in a file. As shown, an object_root100has an associated script S(_root)140. The object_root100has two children A105and E110, with corresponding associated scripts S(A)145and S(E)150. Object A105has three children B115, C120, and D125, each having a corresponding associated script S(B)155, S(C)160, and S(D)165. Object E has a child F130, and F has a child G135. The script S(F)170is associated with object F130, and the script S(G)175is associated with object G135. In the exemplary scripting environment, the scripts associated with the objects can be stored in a single script file180. A script printing tool185can operate by translating the single script file180to an output script file format190, and printing the scripts in the order in which they appear in the script file180.

FIG. 2illustrates an example of a script printing tool operating in a distributed scripting environment. In a distributed scripting environment, the scripts can be generated separately for each object in the hierarchy and scripts can be accessed separately for each object. Unlike the monolithic scripting environment, scripts in a distributed scripting environment typically are not stored together and all the scripts associated with the objects in the hierarchy typically can not be accessed at the same time. Adobe® LiveMotion® software, available from Adobe Systems Incorporated, of San Jose, Calif., is an example of software providing a distributed scripting environment where the scripts can be generated and accessed only for the selected object in the hierarchical arrangement. The example inFIG. 2includes a hierarchical arrangement of objects that is similar to that inFIG. 1. Scripts associated with the objects can be distributed through the hierarchical arrangement instead of being stored together as in the monolithic scripting environment ofFIG. 1. A script printing tool280operating in this scripting environment can include a selector285to select the script associated with a particular object currently selected by the user. The script for the selected object is communicated to an output file format290. In this scripting environment the script printing tool is operable to individually print the scripts associated with the selected object to the output file.

SUMMARY OF THE INVENTION

In general, in one aspect, the invention provides methods and apparatus, including computer program products, for collecting the scripts associated with graphics objects in a hierarchical arrangement of objects. The techniques include identifying a plurality of scripts by traversing a hierarchical arrangement of graphics objects in a distributed scripting environment_that includes one or more objects having associated scripts, and collecting the identified scripts in a data structure.

Advantageous implementations of the invention include one or more of the following features. Collecting the scripts can include ordering the scripts within the data structure. The scripts can each have an associated type and ordering the scripts can include grouping the scripts into groups of scripts based on the associated types. The scripts can be triggered by associated triggering conditions, and the type associated with each script can correspond to the triggering condition associated with the script. Ordering the scripts can include arranging the scripts within the groups of scripts based on the objects associated with the scripts. Collecting the scripts can include writing the data structure to a text file or an HTML file. The data structure can include a name identifying the file containing the hierarchical arrangement of objects. Each object in the hierarchical collection of graphics objects can have a unique identifier, and the data structure can include for each script the unique identifier for the object associated with the script. The data structure can include a time stamp associated with the script. In general, in another aspect, the invention provides a data structure tangibly embodied in an information carrier for storing scripts associated with graphics objects in a distributed scripting environment. The data structure includes a file identifier identifying a file containing a hierarchical arrangement of graphics objects. The data structure also includes one or more ordered script sections storing scripts associated with objects in the hierarchical arrangement.

Advantageous implementations of the invention can include one or more of the following features. The scripts can each have an associated type, and each ordered script section can include scripts having the same associated type. Each ordered script section can include scripts ordered based on the object associated with the script.

The invention can be implemented to realize one or more of the following advantages. The dispersed scripts associated with objects in a hierarchical arrangement are collected into a single data structure. The scripts are ordered within the data structure based on the type of script. Scripts of each type are further sorted within the data structure based on the objects associated with the scripts. The data structure used to collect the scripts transforms the object hierarchy into a presentable hierarchy by identifying and classifying the hierarchy. Presenting all the scripts in a single data structure, and sorting the scripts by the type of script and the object, facilitates debugging. The data structure used to collect all the scripts in the hierarchy can also be used as an input to other applications that require the scripts.

The details of one or more implementations of the invention are set forth in the accompanying drawings and the description below. Further features, aspects, and advantages of the invention will become apparent from the description, the drawings, and the claims.

DETAILED DESCRIPTION

FIG. 3shows a distributed scripting environment according to one aspect of the invention. The distributed scripting environment includes a hierarchical arrangement of objects. Scripts associated with the objects can be distributed through the hierarchical arrangement, instead of being stored together as in the monolithic scripting environment ofFIG. 1. As shown, an object_root300has an associated script S(_root)340. The object_root300has two children A305and E310, with corresponding associated scripts S(A)345and S(E)350. Object A305has three children B315, C320, and D325, each having a corresponding associated script S(B)355, S(C)360, and S(D)365. Object E has a child F330, and F has a child G335. The script S(F)370is associated with object F330, and the script S(G)375is associated with object G335. The scripts associated with the objects in this environment can also be distributed in different files for the individual objects included in the graphical composition. A script collection tool380can collect all the scripts associated with the objects in the hierarchical arrangement and store them in a single script data structure385.

FIG. 4is a flow diagram illustrating a method of collecting scripts in a distributed scripting environment. The method can be performed by the script collection tool380(FIG. 3). The script collection tool380starts traversing the hierarchical arrangement of objects by identifying a first object to be visited in the hierarchy (step400), and by visiting the identified object (step405). All the scripts associated with the object are collected and stored in a data structure (step410). The script collection tool380checks to determine if all the objects in the hierarchical arrangement have been visited (step415). If all the objects have not been visited, the script collection tool380identifies the next object to be visited in the hierarchical arrangement (step420). Control then passes back to step405and the identified object is visited. If all the objects in the hierarchical arrangement have been visited, the collection process ends and all the scripts have been collected (step425). In one implementation of the disclosed method, visiting the identified object in step405includes checking whether there are any scripts associated with the identified object, and the scripts are collected and stored in the data structure only if there are associated scripts for the identified object. In the implementation illustrated inFIG. 4, the script collection tool380is configured to collect and organize all scripts for all objects in the object hierarchy. Alternatively, the script collection tool380can be configured to provide for user input specifying one or more objects and/or script types, and to collect only scripts for specified objects and/or of specified types.

The scripts associated with an object in the hierarchical arrangement can be grouped into separate types. In one implementation, the type of a script is based on the triggering condition that triggers the execution of the script. Triggering conditions for a script can include, for example, keyframes, states, or events. In alternative implementations, the scripts can be grouped based on the object associated with the script.FIG. 5shows an example of a scripting environment in which the scripts associated with the objects can be classified into three types—keyframe scripts500, event handler scripts505, and state change scripts510. A keyframe script500is associated with a specific frame in a timeline associated with an object. An event handler script505is a script that is triggered as a result of a user action or system-based event. A state change script510is associated with defined states of an object. The state change script510is executed each time the object changes to the state to which the script is added.

FIG. 6illustrates one example of the organization of the script data structure385(FIG. 3) used by the script collection tool380to store scripts associated with individual objects in a hierarchical arrangement. The script data structure can include the absolute file name605for the file that contains the hierarchical arrangement of objects. The script data structure can also include separate sections for each type of script that may be associated with the objects. The script collection tool can group the scripts associated with objects based on the type of script, so that a particular type of script is stored in a corresponding section in the script data structure. In one implementation, the script data structure can store event handler scripts in an event handler script section610that contains only event handler scripts, keyframe scripts in a keyframe script section615that contains only keyframe scripts, and state scripts in a state script section620that contains only state scripts.

Scripts can also be grouped based on the objects associated with the scripts, such that all the scripts associated with an object appear together in the script data structure. In addition, scripts of a particular type can be grouped such that all the scripts associated with a given object appear together in the script data structure385.FIG. 7illustrates the organization of an exemplary event handler script section610(FIG. 6). As shown, the event handler script section610includes an event handler script header700. The event handler script header700can be a text string that identifies the section as an event handler script section. The event handler script section610also includes separate object event handler sections705for each object in the hierarchy. The object event handler sections705include an identifier for the object710that is associated with the scripts in that section. The identifier for the object710can be a name that uniquely identifies the object in the hierarchy. In one implementation, the name of the object can be the hierarchical path name for the object in the hierarchy. The object event handler sections705can also include one or more event sections715. Each event section615for an object can include the name of a triggering event720and the script725associated with the triggering event. Separate event sections715can be used to list different event scripts associated with the same object.

In the exemplary event handler script section illustrated inFIG. 7, the event handler script header700is followed by an object event handler section for OBJECT_1705. The event handler section for OBJECT_1705includes an absolute name for OBJECT_1, followed by event sections for each event that triggers the execution of a script. In the example, the event section for EVENT_1includes an identifier for EVENT_1720, and the script725triggered by the occurrence of EVENT_1. The event section for EVENT_1is followed by event section for other events associated with OBJECT_1. The object event handler section for OBJECT_1is followed by object event handler sections for other objects in the hierarchy.

FIG. 8illustrates the organization of an exemplary keyframe script section615(FIG. 6). Keyframe scripts are associated with a specific frame in the timeline associated with the object. The keyframe script section615includes a keyframe script header800. The keyframe script header800can be a text string that identifies the section as a keyframe script section. The keyframe script section also includes separate keyframe sections805for each object in the hierarchy. The object keyframe sections805, can include an identifier of the object810associated with the scripts in that section. The identifier of the object810can be a name that can be used to uniquely identify the object in the hierarchical arrangement of objects. The object keyframe sections805can also include one or more time sections815. Each time section815for an object can include a time header820, specifying the specific frame in the timeline that is associated with the script, and the corresponding keyframe script825to be executed. Scripts associated with different frames in the timeline can be listed in different time sections.

In the exemplary keyframe script section illustrated inFIG. 8, the keyframe script header800is followed by an object keyframe section for OBJECT_1805. The object keyframe section for OBJECT_1805includes an absolute name for OBJECT_1, followed by time sections for each frame having an associated keyframe script in the timeline for OBJECT_1. In the example, the time section815for TIME_0includes a time header for TIME_0820and the script825that is executed when TIME_0is reached. The time section for TIME_0is followed by time sections for other keyframe scripts associated with OBJECT_1. The object keyframe section for OBJECT_1is followed by object keyframe sections for other objects in the hierarchy.

FIG. 9illustrates the organization of an exemplary state script section620(FIG. 6). The state script section620includes a state script header900. The state script header900, can be a text string that identifies a section as a state script section. The state script section620also includes separate object state sections905for each object in the hierarchy. The object state sections905can include an identifier of the object910that is associated with the state scripts in that section. The identifier of the object910can be a name that can be used to uniquely identify the object in the hierarchy. The object state sections905can also include one or more state sections915. Each state section915for an object can include the name of a triggering state920and the script925associated with the triggering state. Separate state sections915can be used to list different state scripts associated with the same object.

In the exemplary state script section illustrated inFIG. 9, the state script header900is followed by an object state section for OBJECT_1905. The state section for OBJECT_1905includes an absolute name for OBJECT_1, followed by state sections for each state that triggers the execution of a script. In the example, the state section for STATE_1includes the name of STATE_1920, and the script925that is triggered when OBJECT_1is in STATE_1. The state section for STATE_1is followed by state sections for other triggering states associated with OBJECT_1. The object state section for OBJECT_1is followed by object state sections for other objects in the hierarchy.

FIG. 10is a flow diagram illustrating a method of collecting scripts associated with objects in a hierarchical arrangement of objects. The method can be implemented by the operation of the script collection tool380(FIG. 3). The script collection tool can collect scripts of all types that are associated with the objects in the hierarchical arrangement of objects. The entry point for the script collection tool is a request to collect all the scripts associated with the objects in a hierarchical arrangement (step1000). The script collection tool can operate one script type at a time by collecting all the scripts of a particular type before collecting scripts of other types. The scripts are collected one script type at a time by setting a matching script type to be a type of script that has not been collected yet (step1005). The script collection tool then collects all scripts in the hierarchical arrangement that have the same type as the matching type (step1010). After all the scripts that are of the same type as the matching type have been collected (step1010), the script collection tool checks to see if there are any remaining script types that have not been collected (step1015). If all types of scripts have been collected the script collection for the hierarchical arrangement is complete (step1020). If all types of scripts have not been collected the matching type is set to the next type of script that needs to be collected and the script collection process is repeated (step1025).

FIG. 11is a flow diagram illustrating a method for collecting scripts of a specific matching type in the hierarchical arrangement of objects (step1110). The method starts when a request to collect the scripts of a matching type is received (step1100). Each object in the hierarchy is visited by recursively traversing the hierarchical arrangement of objects (step1105). The scripts associated with each object visited during the recursive traversal are inspected to determine if the visited object has any scripts of the matching type associated with the object (step1110). If there are no scripts of the matching type associated with the object, control goes back to step1105and the next object is visited. If there are scripts of the matching type associated with the object during step1110, all the scripts of the matching type associated with the object are collected (step1115). An identifier for the visited object, such as an absolute object name, is derived and stored (step1120). All scripts of the matching type collected during step1115are also stored (step1125). Following step1125, control returns to step1105, and the next object in the hierarchical arrangement is visited.

The script collection tool can also be used to provide a script printing tool by printing the script data structure to a text file. Such a script printing tool can facilitate debugging the scripts by making all the scripts in a distributed scripting environment available in a single text file or an HTML file. The data structure produced by the script collection tool can also be used to provide input to a graphic design tool that operates on the scripts associated with the objects in a graphical composition.

This invention has been described in terms of particular embodiments. Nevertheless, it will be understood that various modifications may be made without departing from the spirit and scope of the invention. For instance, the steps of the invention can be performed in a different order and still achieve desirable results. Accordingly, other embodiments are within the scope of the following claims.