Merge "Update README.md for automated-tests" into tizen
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Tue, 24 Mar 2015 14:39:15 +0000 (07:39 -0700)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Tue, 24 Mar 2015 14:39:15 +0000 (07:39 -0700)
13 files changed:
build/tizen/configure.ac
build/tizen/plugins/Makefile.am
dali-toolkit/public-api/dali-toolkit-version.cpp
packaging/dali-toolkit.spec
plugins/dali-script-v8/docs/content/actor.js
plugins/dali-script-v8/docs/content/animation.js
plugins/dali-script-v8/docs/content/shader-effect.js
plugins/dali-script-v8/src/actors/actor-api.cpp
plugins/dali-script-v8/src/actors/actor-wrapper.h
plugins/dali-script-v8/src/dali-wrapper.cpp
plugins/dali-script-v8/src/shader-effects/shader-effect-api.cpp
plugins/dali-script-v8/src/shader-effects/shader-effect-wrapper.cpp
plugins/dali-script-v8/src/utils/v8-utils.cpp

index a36e0a8..1e94aa3 100644 (file)
@@ -46,25 +46,29 @@ AC_ARG_ENABLE([debug],
               [enable_debug=$enableval],
               [enable_debug=no])
 
-# option for JavaScript plugin
-AC_ARG_ENABLE(javascript,
+# option to build JavaScript plugin
+# configure settings and output
+# --enable-javascript        // enable_javascript = yes
+# --enable-javascript=yes    // enable_javascript = yes
+# --enable-javascript=no     // enable_javascript = no
+# --disable-javascript       // enable_javascript = no
+#  no setting                // enable_javascript = automatic ( enable if v8 present)
+AC_ARG_ENABLE([javascript],
               [AC_HELP_STRING([--enable-javascript],
-                              [Enable JavaScript plugin])] ,
-               [enable_javascript=yes],
-               [enable_javascript=no])
+               [Enable JavaScript plugin])] ,
+               [enable_javascript=$enableval],
+               [enable_javascript=automatic])
+
 
 if test "x$enable_debug" = "xyes"; then
   DALI_TOOLKIT_CFLAGS="$DALI_TOOLKIT_CFLAGS -DDEBUG_ENABLED"
-  DALI_SCRIPTV8_CFLAGS="$DALI_TOOLKIT_CFLAGS -DDEBUG_ENABLED"
 fi
 
 if test "x$enable_debug" = "xno" -a "x$enable_exportall" = "xno"; then
   DALI_TOOLKIT_CFLAGS="$DALI_TOOLKIT_CFLAGS -fvisibility=hidden -DHIDE_DALI_INTERNALS"
-  DALI_SCRIPTV8_CFLAGS="$DALI_TOOLKIT_CFLAGS -fvisibility=hidden -DHIDE_DALI_INTERNALS"
 fi
 
-#set a variable for the makefile to conditionally compile the plugin
-AM_CONDITIONAL([ENABLE_JAVASCRIPT_PLUGIN], [test x$enable_javascript = xyes])
+
 
 
 # Tizen Profile options
@@ -86,11 +90,37 @@ else
   dataReadOnlyDir=${prefix}/share/dali/
 fi
 
+# v8 version 4+ requires c++11
+PKG_CHECK_MODULES(V8, v8 = 3.32.7, [ pkg_check_v8=yes ],  [ pkg_check_v8=no  ] )
+
+# Rules for building JavaScript plugin
+# If enable_javascript=yes and v8 installed = build javascript
+# If enable_javascript=automatic and v8 installed = build javascript
+# If enable_javascript=yes and v8 not installed = throw an error
+build_javascript_plugin=no
+if test x$enable_javascript = xyes; then
+  if test x$pkg_check_v8 = xno; then
+    [build_javascript_plugin=no]
+    AC_MSG_ERROR("V8 not found or incorrect version installed")
+    AC_MSG_NOTICE("To disable building of JavaScript plugin use --disable-javascript")
+  else
+    [build_javascript_plugin=yes]
+    AC_MSG_NOTICE(V8 library found. Building DALi JavaScript plugin)
+  fi
+fi
+if test x$enable_javascript = xautomatic && test x$pkg_check_v8 = xyes; then
+  [build_javascript_plugin=yes]
+  AC_MSG_NOTICE( V8 library found. Automatic building of JavaScript plugin. Use  use --disable-javascript to disable)
+fi
+
+
+#set a variable for the makefile to force compile the JAvaSplugin
+AM_CONDITIONAL([ENABLE_JAVASCRIPT_PLUGIN], [test x$build_javascript_plugin = xyes])
+
 AC_SUBST(dataReadWriteDir)
 AC_SUBST(dataReadOnlyDir)
 AC_SUBST(DALI_TOOLKIT_CFLAGS)
-AC_SUBST(DALI_SCRIPTV8_CFLAGS)
-AC_SUBST(DALI_SCRIPTV8_LIBS)
+
 
 # Specify the include directory for development headers
 #devincludepath=${includedir}/dali/internal
@@ -119,7 +149,7 @@ Configuration
 -------------
   Prefix:                           $prefix
   Debug Build:                      $enable_debug
-  JavaScript support (V8 required)  $enable_javascript
+  JavaScript support (V8 required)  $build_javascript_plugin
   Profile:                          $dali_profile
   Data Dir (Read/Write):            $dataReadWriteDir
   Data Dir (Read Only):             $dataReadOnlyDir
index d80dd67..1ca51e4 100644 (file)
@@ -20,7 +20,6 @@ plugin_src_dir = ../../../plugins
 
 include ../../../plugins/dali-script-v8/file.list
 
-DALI_SCRIPTV8_LIBS="-lv8 -lpthread"
 
 lib_LTLIBRARIES = libdali-script-plugin-v8.la
 
@@ -46,16 +45,16 @@ libdali_script_plugin_v8_la_CXXFLAGS = -DDALI_COMPILATION \
                             -DDALI_DATA_READ_ONLY_DIR="\"${dataReadOnlyDir}\"" \
                             $(DALI_CFLAGS) \
                             $(DLOG_CFLAGS) \
-                            $(DALI_SCRIPTV8_CFLAGS) \
                             -I../../.. \
                             $(script_plugin_v8_includes) \
+                            $(V8_CFLAGS) \
                             -Werror -Wall
 
 libdali_script_plugin_v8_la_LIBADD = \
                             $(DALICORE_LIBS) \
                             $(DALI_LIBS) \
                             $(DLOG_LIBS) \
-                            $(DALI_SCRIPTV8_LIBS)
+                            $(V8_LIBS)
 
 libdali_script_plugin_v8_la_LDFLAGS = \
                            -rdynamic
index 78fc9df..89d0637 100644 (file)
@@ -31,7 +31,7 @@ namespace Toolkit
 
 const unsigned int TOOLKIT_MAJOR_VERSION = 1;
 const unsigned int TOOLKIT_MINOR_VERSION = 0;
-const unsigned int TOOLKIT_MICRO_VERSION = 33;
+const unsigned int TOOLKIT_MICRO_VERSION = 34;
 const char * const TOOLKIT_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
index d2a0dc4..1fa1829 100644 (file)
@@ -1,6 +1,6 @@
 Name:       dali-toolkit
 Summary:    The OpenGLES Canvas Core Library Toolkit
-Version:    1.0.33
+Version:    1.0.34
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0
index 7bd5b20..b2ea595 100644 (file)
@@ -119,7 +119,7 @@ function OnPressed( actor, touchEvent )
   
   var anim = new dali.Animation( 4 );
   var rotation = new dali.Rotation( 90, 0, 0 ); // pitch, yaw, roll
-  anim.animateBy( actor, "rotation", rotation );
+  anim.animateBy( actor, "orientation", rotation );
   anim.play();
   return true;
 }
index ec587fe..33c64f8 100644 (file)
@@ -68,8 +68,8 @@ myActor2.position=[ 100,0,-2000];  // x = 100, y = 0 , z = -2000
 function createAnimation() {
   
   var startRotation = new dali.Rotation(180, -180, 0);
-  myActor1.rotation = startRotation;
-  myActor2.rotation = startRotation;
+  myActor1.orientation = startRotation;
+  myActor2.orientation = startRotation;
   
   dali.stage.add( myActor1 );
   dali.stage.add( myActor2 );
@@ -90,7 +90,7 @@ function createAnimation() {
   var endRotation = new dali.Rotation(0,0,0);
   
   animOptions.alpha = "easeInOutSine";
-  anim.animateTo(myActor1, "rotation", endRotation, animOptions);
+  anim.animateTo(myActor1, "orientation", endRotation, animOptions);
   
   // Delay the myActor2  by  a second
   animOptions.delay = 0.0;
@@ -99,7 +99,7 @@ function createAnimation() {
   
   //  rotate back to correct orientation
   animOptions.alpha = "easeInOutSine";
-  anim.animateTo(myActor2, "rotation", endRotation, animOptions);
+  anim.animateTo(myActor2, "orientation", endRotation, animOptions);
 
   return anim;
 }
@@ -209,7 +209,7 @@ var shaderAnim = createShaderAnimation( shaderEffect, color,zoom, duration, dela
   
 // also rotate the imageActor 90 degrees at the same time.
 var rotation = new dali.Rotation(90,0,0,1);
-shaderAnim.animateTo(imageActor, "rotation", rotation, { alpha:"linear", duration:duration, delay:delay });
+shaderAnim.animateTo(imageActor, "orientation", rotation, { alpha:"linear", duration:duration, delay:delay });
 
 
 shaderAnim.play();
index eedfafa..98e9c17 100644 (file)
@@ -5,7 +5,13 @@
 
 Shader effects provide a visual effect for actors.
 
-For a Custom shader you can provide the vertex and fragment shader code as strings.
+You can create a type-registered shader effect by its type name.
+```
+// create a new shader effect
+var shader = new dali.ShaderEffect("BlindEffect");
+```
+
+Alternatively you can create a Custom shader by providing the vertex and fragment shader code as strings.
 Each shader is provided with default uniforms and attributes.
 For a vertex shader this part contains the following code:
 ```
@@ -238,7 +244,7 @@ imageActor.setCullFace( dali.CULL_FACE_DISABLE ); // disable face culling so we
 dali.stage.add( imageActor );
   
 // start it of tilted around the y-axis
-imageActor.rotation=new dali.Rotation(90, 0, 1, 0);
+imageActor.orientation=new dali.Rotation(90, 0, 1, 0);
   
 var twistEffect = createTwistEffect();
 imageActor.setShaderEffect( twistEffect );
index 4027a1b..d068554 100644 (file)
@@ -557,7 +557,7 @@ void ActorApi::RotateBy( const v8::FunctionCallbackInfo<v8::Value>& args )
   bool found( false );
   Property::Value rotation = V8Utils::GetPropertyValueParameter( PARAMETER_0, found, isolate, args );
 
-  if( rotation.GetType() != Property::ORIENTATION )
+  if( rotation.GetType() != Property::ROTATION )
   {
     DALI_SCRIPT_EXCEPTION( isolate, "Rotation parameter missing" );
     return;
index 79381ba..76eee47 100644 (file)
@@ -52,8 +52,7 @@ public:
     MESH_ACTOR   =3,
     LAYER_ACTOR  =4,
     CAMERA_ACTOR =5,
-    LIGHT_ACTOR  =6,
-    TEXT_VIEW    =7
+    TEXT_VIEW    =6
   };
 
   /**
index 55df482..1bb2dfc 100644 (file)
@@ -183,7 +183,7 @@ void DaliWrapper::CreateContext( )
   // Context = multiple contexts can exist in a given Isolate, and share data between contexts
   v8::Handle<v8::Context> context  = v8::Context::New( mIsolate, NULL, global);
 
-  mGlobalObjectTemplate.Reset( mIsolate,  global); 
+  mGlobalObjectTemplate.Reset( mIsolate,  global);
 
   mContext.Reset( mIsolate, context);
 }
@@ -192,10 +192,16 @@ void DaliWrapper::Initialize()
 {
   if( !mIsolate )
   {
-    v8::V8::Initialize();
     v8::V8::InitializeICU();
+
+    v8::V8::Initialize();
+
+    // default isolate removed from V8 version 3.27.1 and beyond.
+    mIsolate = v8::Isolate::New();
+    mIsolate->Enter();
+
     v8::V8::SetFatalErrorHandler( FatalErrorCallback );
-    mIsolate = v8::Isolate::GetCurrent();
+
   }
   // if context is null, create it and add dali object to the global object.
   if( mContext.IsEmpty())
index 74762f2..d7bd2a5 100644 (file)
@@ -19,6 +19,9 @@
 // CLASS HEADER
 #include "shader-effect-api.h"
 
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/type-registry.h>
+
 // INTERNAL INCLUDES
 #include <v8-utils.h>
 #include <shader-effects/shader-effect-wrapper.h>
@@ -187,14 +190,12 @@ ShaderEffect GetShaderEffect( v8::Isolate* isolate, const v8::FunctionCallbackIn
  */
 ShaderEffect ShaderEffectApi::New(  v8::Isolate* isolate, const v8::FunctionCallbackInfo< v8::Value >& args )
 {
-
-
   v8::HandleScope handleScope( isolate );
 
-  ShaderParameters shaderParams;
-
   if( args[0]->IsObject() )
   {
+    ShaderParameters shaderParams;
+
     v8::Local<v8::Object > obj = args[0]->ToObject();
 
     v8::Local<v8::Value> geometryTypeValue = obj->Get(v8::String::NewFromUtf8( isolate, "geometryType"));
@@ -245,9 +246,39 @@ ShaderEffect ShaderEffectApi::New(  v8::Isolate* isolate, const v8::FunctionCall
       }
       shaderParams.ProcessHintsArray( hintsArray );
     }
+
+    return shaderParams.NewShader();
   }
-  return shaderParams.NewShader();
+  else
+  {
+    ShaderEffect effect;
+
+    bool found( false );
+    std::string typeName = V8Utils::GetStringParameter( PARAMETER_0, found, isolate, args );
+    if( !found )
+    {
+      DALI_SCRIPT_EXCEPTION( isolate, "string parameter missing" );
+    }
+    else
+    {
+      // create a new shader effect based on type, using the type registry.
+      Dali::TypeInfo typeInfo = Dali::TypeRegistry::Get().GetTypeInfo( typeName );
+      if( typeInfo ) // handle, check if it has a value
+      {
+        Dali::BaseHandle handle = typeInfo.CreateInstance();
+        if( handle )
+        {
+          effect = ShaderEffect::DownCast( handle );
+        }
+      }
+      else
+      {
+        DALI_SCRIPT_EXCEPTION(isolate,"Unknown shader effect type");
+      }
+    }
 
+    return effect;
+  }
 }
 
 ShaderEffect ShaderEffectApi::GetShaderEffectFromParams( int paramIndex,
index 04ae5fa..89f4ebe 100644 (file)
@@ -126,8 +126,11 @@ void ShaderEffectWrapper::NewShaderEffect( const v8::FunctionCallbackInfo< v8::V
   }
   Dali::ShaderEffect shaderEffect = ShaderEffectApi::New( isolate, args );
 
-  v8::Local<v8::Object> localObject = WrapShaderEffect( isolate, shaderEffect );
-  args.GetReturnValue().Set( localObject );
+  if(shaderEffect)
+  {
+    v8::Local<v8::Object> localObject = WrapShaderEffect( isolate, shaderEffect );
+    args.GetReturnValue().Set( localObject );
+  }
 }
 
 
index 1d73b9c..d9fbc7e 100644 (file)
@@ -332,7 +332,7 @@ bool GetBooleanValue( v8::Isolate* isolate, const v8::Local<v8::Value>& value )
   else if (value->IsBooleanObject() )
   {
     const v8::Local<v8::BooleanObject> object = v8::Local<v8::BooleanObject>::Cast(value);
-    return object->ValueOf();
+    return object->BooleanValue();
   }
   DALI_SCRIPT_EXCEPTION(isolate, "no bool found");
   return false;