X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=docs%2Fcontent%2Fshared-javascript-and-cpp-documentation%2Fscript-json-specification.md;h=599e6ceb180fee36073164e711a6a2523519888d;hb=5f77331dd43fc3cf8b0fa7c5d4407575dc280982;hp=f6887cb8d2e2e4d7f733383ebd7958ac5835c9bf;hpb=f3da11c2818c6d17706fbb2417f21b602b3190f5;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/docs/content/shared-javascript-and-cpp-documentation/script-json-specification.md b/docs/content/shared-javascript-and-cpp-documentation/script-json-specification.md index f6887cb..599e6ce 100644 --- a/docs/content/shared-javascript-and-cpp-documentation/script-json-specification.md +++ b/docs/content/shared-javascript-and-cpp-documentation/script-json-specification.md @@ -82,7 +82,7 @@ The JSON format deviates from the formal JSON specification and allows C style c ## Includes {#includes} -The "includes" section is an array of filenames to be merged in order to +The "includes" section is an array of file names to be merged in order to create a final in memory JSON tree. The merge process will walk key, value attributes from the root JSON @@ -121,10 +121,10 @@ The constants section supports sub-string and full property replacement. }, // ... // { // - "type":"ImageActor" // An DALi type or a template name + "type":"ImageView" // An DALi type or a template name "image": // { // - "filename":"{IMAGES}b.jpg" // Image filename substring replacement + "url":"{IMAGES}b.jpg" // Image filename substring replacement }, // "size": "{SIZE}" // } // Property replacement @@ -171,12 +171,12 @@ an optional actor sub hierarchy. { // "basic-text": // The template name { // - "type":"ImageActor", // Concrete DALi Type/Class to create + "type":"ImageView", // Concrete DALi Type/Class to create "styles":["base-style"], // Style list to apply "name":"image", // } "image": // } property name : value { // } - "filename":"{IMAGES}/b.jpg" // + "url":"{IMAGES}/b.jpg" // }, // "parentOrigin": "CENTER" // ... // @@ -255,7 +255,7 @@ Builder.AnimateTo("light-theme", myActor, TimePeriod(0, 10)); ~~~ When applied to an actor tree the actors are referenced by name. Names -are not unique in Dali. +are not unique in DALi. When a style is applied in code DALi will perform a depth first search stopping with the first matching name. @@ -357,52 +357,6 @@ animation property. } // ~~~ -## Shaders {#shaders} - -The shader section of the JSON file defines a library of shader effect -instances that are created on demand. - -The shaders are referred to by name from the template, style, stage or -animation sections. - -Multiple actors can set the same shader as the name refers to a single -instance. - -Similarly one named shader instance can be set to several actors and can -be animated by one animation. - -~~~ - { // - "shaderEffects": // Shader Effect section - { // - "myshader1": // Shader instance name - { // - "program": // - { // Prefixs are placed before DALi uniforms. - "vertexPrefix": "", // (Useful for \#defines.) - "vertex":"", // Glsl vertex program - "fragmentPrefix": "", - "fragment": "", // Glsl fragment program. - "geometryType": "GEOMETRY_TYPE_IMAGE", // Geometry type(see DALi documentation) - }, - "geometryHints": "HINT_NONE": // Geometry hints (see DALi documentation) - "gridDensity": 0, // Grid density(see DALi documentation) - "image": - { - "filename": "" // Effect image available as a second texture unit. - } - }, - ... - }, - "stage": - [{ - "type": "ImageActor", - "effect": "myshader1", - ... - }] - } -~~~ - At least one of the vertex or fragment fields is mandatory. All other fields are optional will use internal defaults. @@ -415,48 +369,55 @@ Shader uniforms can be animated as if they are properties of the actor. When the animation is created from code (or from a signal) the property name search begins on the actor, if it isn't found the search continues -on the attached shader object. +on the attached renderer, and then on the attached shader object. The actor property names and shader uniform names must not clash for the -uniform to animate correctly. The convention in DALi is to prepend -uniforms with 'u'. +uniform to animate correctly. + +The actor needs to register the uniform properties as custom animatable +properties. ~~~ - { \\ - "animations": \\ Animation library - { \\ - "rotate": \\ An Animation named rotate - { \\ - "duration": 10, \\ - "properties": \\ Properties changed in this animation - [ \\ - { - "actor":"image", \\ Actor found by name from the stage - "property":"uTranslate", \\ Uniform name specified as if it is a - \\ property of the object. - "value":[10, 20], - ... - }, - ... - ] - }, - "shaderEffects": - { - "myshader1": - { - \\ Shader program with uniform - "program": {...} \\ "uTranslate" - } - }, - "actors": - [ - { - "name": "image", - "effect": "myshader1" \\ Actor using shader effect instance - \\ "myshader1" - } - ] +{ + "animations": + { + "rotate": \\ An Animation named rotate + { + "properties": \\ Properties changed in this animation + [ + { + "actor": "image", \\ Actor found by name from the stage + "property": "uTranslate", \\ Uniform name specified as if it is a property of the object + "value": [10, 20], \\ Target value of uniform + ... + } + ] + }, + ... + }, + "stage": + [ + { + "type": "ImageView", + "name": "image", \\ Name of the actor + ... + "image": + { + ... + "shader": \\ ImageView has a shader property where we can set a custom shader + { + "vertexShader": "..." \\ Vertex shader with uniform "uTranslate" + } + }, + "animatableProperties": \\ Custom properties that the actor needs to register + { + "uTranslate": [0, 0] \\ The name should match the uniform we want to animate + }, + ... }, + ... + ] +} ~~~ ## Stage {#stage} @@ -464,7 +425,7 @@ uniforms with 'u'. The stage section supports the immediate creation of actors at the time the JSON is loaded. -The stage is a tree of actors that can be added to Dali's stage object. +The stage is a tree of actors that can be added to DALi's stage object. ~~~ // C++ @@ -486,7 +447,7 @@ builder.addActors( dali.stage.getRootLayer() ); "stage": \\ Stage Section Number [ \\ An array of actors { - "type": "ImageActor", + "type": "ImageView", ... "actors": \\ Each actor can have children \\ creating a tree @@ -507,7 +468,7 @@ builder.addActors( dali.stage.getRootLayer() ); # Actor and Control Properties {#actorprop} -Each control has a set of supported properties documented in the "Dali +Each control has a set of supported properties documented in the "DALi UI Control Specification". Please refer to the above document for further information about specific