[dali_2.2.15] Merge branch 'devel/master' 29/288929/1
authorRichard Huang <r.huang@samsung.com>
Fri, 24 Feb 2023 12:25:14 +0000 (12:25 +0000)
committerRichard Huang <r.huang@samsung.com>
Fri, 24 Feb 2023 12:25:14 +0000 (12:25 +0000)
Change-Id: I01efb5f098660428ccd3128136b121b2b97b71fa

62 files changed:
automated-tests/resources/AnimatedMorphCubeAnimateNonZeroFrame.gltf [new file with mode: 0644]
automated-tests/src/dali-scene3d/utc-Dali-Gltf2Loader.cpp
automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Controller.cpp
automated-tests/src/dali-toolkit/utc-Dali-Builder.cpp
dali-scene3d/internal/common/environment-map-load-task.cpp
dali-scene3d/internal/common/environment-map-load-task.h
dali-scene3d/internal/controls/model/model-impl.cpp
dali-scene3d/internal/controls/model/model-impl.h
dali-scene3d/internal/controls/scene-view/scene-view-impl.cpp
dali-scene3d/public-api/loader/blend-shape-details.cpp
dali-scene3d/public-api/loader/blend-shape-details.h
dali-scene3d/public-api/loader/buffer-definition.cpp
dali-scene3d/public-api/loader/dli-loader.cpp
dali-scene3d/public-api/loader/environment-definition.cpp
dali-scene3d/public-api/loader/gltf2-loader.cpp
dali-scene3d/public-api/loader/material-definition.cpp
dali-scene3d/public-api/loader/mesh-definition.cpp
dali-scene3d/public-api/loader/node-definition.cpp
dali-scene3d/public-api/loader/node-definition.h
dali-scene3d/public-api/loader/scene-definition.cpp
dali-scene3d/public-api/loader/shader-definition.cpp
dali-scene3d/public-api/loader/skinning-details.cpp
dali-scene3d/public-api/loader/skinning-details.h
dali-toolkit/devel-api/builder/base64-encoding.cpp
dali-toolkit/devel-api/builder/base64-encoding.h
dali-toolkit/internal/builder/builder-impl.cpp
dali-toolkit/internal/controls/control/control-data-impl.cpp
dali-toolkit/internal/controls/scene3d-view/scene3d-view-impl.cpp
dali-toolkit/internal/controls/text-controls/text-label-impl.cpp
dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp
dali-toolkit/internal/controls/web-view/web-view-impl.cpp
dali-toolkit/internal/controls/web-view/web-view-impl.h
dali-toolkit/internal/feedback/feedback-style.cpp
dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp
dali-toolkit/internal/text/controller/text-controller-event-handler.cpp
dali-toolkit/internal/text/controller/text-controller-impl.cpp
dali-toolkit/internal/text/controller/text-controller-input-font-handler.cpp
dali-toolkit/internal/text/controller/text-controller-input-font-handler.h
dali-toolkit/internal/text/controller/text-controller-input-properties.cpp
dali-toolkit/internal/text/controller/text-controller-input-properties.h
dali-toolkit/internal/text/controller/text-controller-placeholder-handler.cpp
dali-toolkit/internal/text/controller/text-controller-placeholder-handler.h
dali-toolkit/internal/text/controller/text-controller-relayouter.cpp
dali-toolkit/internal/text/controller/text-controller.cpp
dali-toolkit/internal/text/controller/text-controller.h
dali-toolkit/internal/text/markup-processor/markup-processor-embedded-item.cpp
dali-toolkit/internal/text/markup-processor/markup-processor-font.cpp
dali-toolkit/internal/text/markup-processor/markup-processor-helper-functions.cpp
dali-toolkit/internal/text/rendering/styles/character-spacing-helper-functions.cpp
dali-toolkit/internal/text/rendering/styles/character-spacing-helper-functions.h
dali-toolkit/internal/text/text-effects-style.cpp
dali-toolkit/internal/text/text-font-style.cpp
dali-toolkit/internal/text/text-view-interface.h
dali-toolkit/internal/text/text-view.cpp
dali-toolkit/internal/text/text-view.h
dali-toolkit/internal/transition/transition-base-impl.cpp [changed mode: 0644->0755]
dali-toolkit/internal/transition/transition-impl.cpp
dali-toolkit/internal/visuals/animated-image/rolling-animated-image-cache.cpp
dali-toolkit/internal/visuals/image-visual-shader-factory.cpp
dali-toolkit/internal/visuals/text-visual-shader-factory.cpp
dali-toolkit/public-api/dali-toolkit-version.cpp
packaging/dali-toolkit.spec

diff --git a/automated-tests/resources/AnimatedMorphCubeAnimateNonZeroFrame.gltf b/automated-tests/resources/AnimatedMorphCubeAnimateNonZeroFrame.gltf
new file mode 100644 (file)
index 0000000..08c8daf
--- /dev/null
@@ -0,0 +1,282 @@
+{\r
+  "accessors": [\r
+    {\r
+      "bufferView": 0,\r
+      "componentType": 5126,\r
+      "count": 24,\r
+      "type": "VEC3"\r
+    },\r
+    {\r
+      "bufferView": 1,\r
+      "componentType": 5126,\r
+      "count": 24,\r
+      "type": "VEC4"\r
+    },\r
+    {\r
+      "bufferView": 2,\r
+      "componentType": 5126,\r
+      "count": 24,\r
+      "type": "VEC3",\r
+      "max": [\r
+        0.0100000035,\r
+        0.0100000035,\r
+        0.01\r
+      ],\r
+      "min": [\r
+        -0.0100000044,\r
+        -0.0100000054,\r
+        -0.01\r
+      ]\r
+    },\r
+    {\r
+      "bufferView": 3,\r
+      "componentType": 5126,\r
+      "count": 24,\r
+      "type": "VEC3",\r
+      "name": "thin"\r
+    },\r
+    {\r
+      "bufferView": 4,\r
+      "componentType": 5126,\r
+      "count": 24,\r
+      "type": "VEC3",\r
+      "max": [\r
+        0.0,\r
+        0.01893253,\r
+        0.0\r
+      ],\r
+      "min": [\r
+        0.0,\r
+        0.0,\r
+        0.0\r
+      ],\r
+      "name": "thin"\r
+    },\r
+    {\r
+      "bufferView": 5,\r
+      "componentType": 5126,\r
+      "count": 24,\r
+      "type": "VEC3",\r
+      "name": "thin"\r
+    },\r
+    {\r
+      "bufferView": 6,\r
+      "componentType": 5126,\r
+      "count": 24,\r
+      "type": "VEC3",\r
+      "name": "angle"\r
+    },\r
+    {\r
+      "bufferView": 7,\r
+      "componentType": 5126,\r
+      "count": 24,\r
+      "type": "VEC3",\r
+      "max": [\r
+        0.0,\r
+        0.0198908355,\r
+        0.0\r
+      ],\r
+      "min": [\r
+        0.0,\r
+        0.0,\r
+        0.0\r
+      ],\r
+      "name": "angle"\r
+    },\r
+    {\r
+      "bufferView": 8,\r
+      "componentType": 5126,\r
+      "count": 24,\r
+      "type": "VEC3",\r
+      "name": "angle"\r
+    },\r
+    {\r
+      "bufferView": 9,\r
+      "componentType": 5123,\r
+      "count": 36,\r
+      "type": "SCALAR"\r
+    },\r
+    {\r
+      "bufferView": 10,\r
+      "componentType": 5126,\r
+      "count": 127,\r
+      "type": "SCALAR",\r
+      "max": [\r
+        4.19999743\r
+      ],\r
+      "min": [\r
+        0.03\r
+      ]\r
+    },\r
+    {\r
+      "bufferView": 11,\r
+      "componentType": 5126,\r
+      "count": 254,\r
+      "type": "SCALAR"\r
+    }\r
+  ],\r
+  "animations": [\r
+    {\r
+      "channels": [\r
+        {\r
+          "sampler": 0,\r
+          "target": {\r
+            "node": 0,\r
+            "path": "weights"\r
+          }\r
+        }\r
+      ],\r
+      "samplers": [\r
+        {\r
+          "input": 10,\r
+          "interpolation": "LINEAR",\r
+          "output": 11\r
+        }\r
+      ],\r
+      "name": "Square"\r
+    }\r
+  ],\r
+  "asset": {\r
+    "generator": "glTF Tools for Unity",\r
+    "version": "2.0"\r
+  },\r
+  "bufferViews": [\r
+    {\r
+      "buffer": 0,\r
+      "byteLength": 288\r
+    },\r
+    {\r
+      "buffer": 0,\r
+      "byteOffset": 288,\r
+      "byteLength": 384\r
+    },\r
+    {\r
+      "buffer": 0,\r
+      "byteOffset": 672,\r
+      "byteLength": 288\r
+    },\r
+    {\r
+      "buffer": 0,\r
+      "byteOffset": 960,\r
+      "byteLength": 288\r
+    },\r
+    {\r
+      "buffer": 0,\r
+      "byteOffset": 1248,\r
+      "byteLength": 288\r
+    },\r
+    {\r
+      "buffer": 0,\r
+      "byteOffset": 1536,\r
+      "byteLength": 288\r
+    },\r
+    {\r
+      "buffer": 0,\r
+      "byteOffset": 1824,\r
+      "byteLength": 288\r
+    },\r
+    {\r
+      "buffer": 0,\r
+      "byteOffset": 2112,\r
+      "byteLength": 288\r
+    },\r
+    {\r
+      "buffer": 0,\r
+      "byteOffset": 2400,\r
+      "byteLength": 288\r
+    },\r
+    {\r
+      "buffer": 0,\r
+      "byteOffset": 2688,\r
+      "byteLength": 72\r
+    },\r
+    {\r
+      "buffer": 0,\r
+      "byteOffset": 2760,\r
+      "byteLength": 508\r
+    },\r
+    {\r
+      "buffer": 0,\r
+      "byteOffset": 3268,\r
+      "byteLength": 1016\r
+    }\r
+  ],\r
+  "buffers": [\r
+    {\r
+      "uri": "AnimatedMorphCube.bin",\r
+      "byteLength": 4284\r
+    }\r
+  ],\r
+  "meshes": [\r
+    {\r
+      "primitives": [\r
+        {\r
+          "attributes": {\r
+            "NORMAL": 0,\r
+            "TANGENT": 1,\r
+            "POSITION": 2\r
+          },\r
+          "indices": 9,\r
+          "material": 0,\r
+          "targets": [\r
+            {\r
+              "NORMAL": 3,\r
+              "POSITION": 4,\r
+              "TANGENT": 5\r
+            },\r
+            {\r
+              "NORMAL": 6,\r
+              "POSITION": 7,\r
+              "TANGENT": 8\r
+            }\r
+          ]\r
+        }\r
+      ],\r
+      "weights": [\r
+        0.0,\r
+        0.0\r
+      ],\r
+      "name": "Cube"\r
+    }\r
+  ],\r
+  "materials": [\r
+    {\r
+      "pbrMetallicRoughness": {\r
+        "baseColorFactor": [\r
+          0.6038274,\r
+          0.6038274,\r
+          0.6038274,\r
+          1.0\r
+        ],\r
+        "metallicFactor": 0.0,\r
+        "roughnessFactor": 0.5\r
+      },\r
+      "name": "Material"\r
+    }\r
+  ],\r
+  "nodes": [\r
+    {\r
+      "mesh": 0,\r
+      "rotation": [\r
+        0.0,\r
+        0.7071067,\r
+        -0.7071068,\r
+        0.0\r
+      ],\r
+      "scale": [\r
+        100.0,\r
+        100.0,\r
+        100.0\r
+      ],\r
+      "name": "AnimatedMorphCube"\r
+    }\r
+  ],\r
+  "scene": 0,\r
+  "scenes": [\r
+    {\r
+      "nodes": [\r
+        0\r
+      ]\r
+    }\r
+  ]\r
+}
\ No newline at end of file
index 357d2a8..a485f0f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -55,8 +55,7 @@ namespace
 {
 struct Context
 {
-  ResourceBundle::PathProvider pathProvider = [](ResourceType::Value type)
-  {
+  ResourceBundle::PathProvider pathProvider = [](ResourceType::Value type) {
     return TEST_RESOURCE_DIR "/";
   };
 
@@ -494,8 +493,7 @@ int UtcDaliGltfLoaderSuccessShort(void)
   TestApplication app;
 
   const std::string resourcePath = TEST_RESOURCE_DIR "/";
-  auto              pathProvider = [resourcePath](ResourceType::Value)
-  {
+  auto              pathProvider = [resourcePath](ResourceType::Value) {
     return resourcePath;
   };
 
@@ -503,6 +501,7 @@ int UtcDaliGltfLoaderSuccessShort(void)
   for(auto modelName : {
         "2CylinderEngine",
         "AnimatedMorphCube",
+        "AnimatedMorphCubeAnimateNonZeroFrame",
         "AnimatedMorphSphere",
         "AnimatedTriangle",
         "BoxAnimated",
index 00426ee..a8ec273 100755 (executable)
@@ -863,6 +863,19 @@ int UtcDaliTextControllerCheckBufferIndices(void)
   // Perform a relayout
   controller->Relayout(size);
 
+  // Set the text
+  controller->SetText(text);
+
+  // Set the text size
+  controller->SetDefaultFontSize(10.f, Controller::POINT_SIZE);
+
+  // Tweak some parameters to make the indices to access the text buffer invalid
+  mImpl.mTextUpdateInfo.Clear();
+
+  // Perform a relayout
+  controller->GetHeightForWidth(size.width / 2.f);
+  controller->Relayout(size);
+
   tet_result(TET_PASS);
 
   END_TEST;
index 802f7b4..f332890 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -1774,7 +1774,69 @@ int UtcDaliBase64EncodingP(void)
 
   std::string output;
   DALI_TEST_CHECK(value.Get(output));
-  DALI_TEST_EQUALS(output, "AAAAAAEAAAACAAAAAwAAAAQAAAAFAAAAAAAAAP////8", TEST_LOCATION);
+  DALI_TEST_EQUALS(output, "AAAAAAEAAAACAAAAAwAAAAQAAAAFAAAAAAAAAP////8=", TEST_LOCATION);
+
+  std::cout << "Output data:  " << output << std::endl;
+
+  END_TEST;
+}
+
+int UtcDaliBase64EncodingP2(void)
+{
+  std::vector<uint8_t> data = {0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, std::numeric_limits<uint8_t>::min(), std::numeric_limits<uint8_t>::min(), std::numeric_limits<uint8_t>::min(), std::numeric_limits<uint8_t>::min(), std::numeric_limits<uint8_t>::max(), std::numeric_limits<uint8_t>::max(), std::numeric_limits<uint8_t>::max(), std::numeric_limits<uint8_t>::max()};
+
+  Property::Value value;
+  EncodeBase64PropertyData(value, data);
+
+  std::cout << "Input data:  ";
+  std::ostream_iterator<uint32_t> out_it(std::cout, ", ");
+  std::copy(data.begin(), data.end(), out_it);
+  std::cout << std::endl;
+
+  std::string output;
+  DALI_TEST_CHECK(value.Get(output));
+  DALI_TEST_EQUALS(output, "AAAAAAEAAAACAAAAAwAAAAQAAAAFAAAAAAAAAP////8=", TEST_LOCATION);
+
+  std::cout << "Output data:  " << output << std::endl;
+
+  END_TEST;
+}
+
+int UtcDaliBase64EncodingP3(void)
+{
+  std::string originalData = "Something Longer than 64 ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/==  length is 106";
+  originalData.push_back(-4);
+  originalData.push_back(-7); // some kind of non-ascii.
+  originalData.push_back(0);
+  originalData.push_back(0);
+  originalData.push_back(2);
+  originalData.push_back(2);
+  originalData.push_back(2);
+
+  std::vector<uint8_t> data(originalData.begin(), originalData.end());
+
+  Dali::Property::Value value;
+  EncodeBase64PropertyData(value, data);
+
+  std::cout << "Input data:  ";
+  std::ostream_iterator<uint8_t> out_it(std::cout, ", ");
+  std::copy(data.begin(), data.end(), out_it);
+  std::cout << std::endl;
+
+  std::string           output;
+  Dali::Property::Array array;
+  DALI_TEST_CHECK(value.GetArray());
+  array = *value.GetArray();
+  DALI_TEST_EQUALS(array.Count(), 3, TEST_LOCATION);
+  DALI_TEST_CHECK(array[0].Get(output));
+  std::cout << "first string :  " << output << std::endl;
+  DALI_TEST_EQUALS(output, "U29tZXRoaW5nIExvbmdlciB0aGFuIDY0IEFCQ0RFRkdISUpLTE1OT1BRUlNUVVZX", TEST_LOCATION);
+  DALI_TEST_CHECK(array[1].Get(output));
+  std::cout << "second string : " << output << std::endl;
+  DALI_TEST_EQUALS(output, "WFlaYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXowMTIzNDU2Nzg5Ky89PSAgbGVu", TEST_LOCATION);
+  DALI_TEST_CHECK(array[2].Get(output));
+  std::cout << "third string : " << output << std::endl;
+  DALI_TEST_EQUALS(output, "Z3RoIGlzIDEwNvz5AAACAgI=", TEST_LOCATION);
 
   std::cout << "Output data:  " << output << std::endl;
 
@@ -1793,14 +1855,22 @@ int UtcDaliBase64EncodingN(void)
   DALI_TEST_CHECK(value.Get(output));
   DALI_TEST_EQUALS(output.empty(), true, TEST_LOCATION);
 
+  std::vector<uint8_t> data2;
+  EncodeBase64PropertyData(value, data2);
+
+  DALI_TEST_CHECK(value.Get(output));
+  DALI_TEST_EQUALS(output.empty(), true, TEST_LOCATION);
+
   END_TEST;
 }
 
 template<typename T>
 int b64l(std::vector<T>& data)
 {
-  auto lengthInBytes = 4 * data.size();
-  return ceil(lengthInBytes * 1.33333f);
+  auto lengthInBytes = sizeof(T) * data.size();
+  // base64 encode each 3-byte as 4-byte.
+  // return ceil(lengthInBytes / 3) * 4
+  return (lengthInBytes + 2) / 3 * 4;
 }
 
 int UtcDaliBase64EncodingP02(void)
@@ -1969,6 +2039,10 @@ int UtcDaliBase64DecodingN01(void)
   std::vector<uint32_t> outputData;
   DecodeBase64PropertyData(value, outputData);
   DALI_TEST_EQUALS(outputData.size(), 0, TEST_LOCATION);
+
+  std::vector<uint8_t> outputData2;
+  DecodeBase64PropertyData(value, outputData2);
+  DALI_TEST_EQUALS(outputData2.size(), 0, TEST_LOCATION);
   END_TEST;
 }
 
@@ -1985,6 +2059,10 @@ int UtcDaliBase64DecodingN02(void)
   std::vector<uint32_t> outputData;
   DecodeBase64PropertyData(value, outputData);
   DALI_TEST_EQUALS(outputData.size(), 0, TEST_LOCATION);
+
+  std::vector<uint8_t> outputData2;
+  DecodeBase64PropertyData(value, outputData2);
+  DALI_TEST_EQUALS(outputData2.size(), 0, TEST_LOCATION);
   END_TEST;
 }
 
@@ -2002,3 +2080,33 @@ int UtcDaliBase64DecodingP01(void)
 
   END_TEST;
 }
+
+int UtcDaliBase64DecodingP02(void)
+{
+  tet_infoline("Test decoding string of known data gives expected result");
+
+  std::string          testInput("//////7+/v4DAgEA");
+  std::vector<uint8_t> expectedResults = {0xff, 0xff, 0xff, 0xff, 0xfe, 0xfe, 0xfe, 0xfe, 0x03, 0x02, 0x01, 0x00};
+
+  std::vector<uint8_t> outputData;
+  DecodeBase64PropertyData(Property::Value(testInput), outputData);
+
+  DALI_TEST_EQUALS(std::equal(expectedResults.begin(), expectedResults.end(), outputData.begin()), true, TEST_LOCATION);
+
+  END_TEST;
+}
+
+int UtcDaliBase64DecodingFromString(void)
+{
+  tet_infoline("Test decoding string of known data gives expected result");
+
+  std::string          testInput("//////7+/v4DAgEA");
+  std::vector<uint8_t> expectedResults = {0xff, 0xff, 0xff, 0xff, 0xfe, 0xfe, 0xfe, 0xfe, 0x03, 0x02, 0x01, 0x00};
+
+  std::vector<uint8_t> outputData;
+  DecodeBase64FromString(testInput, outputData);
+
+  DALI_TEST_EQUALS(std::equal(expectedResults.begin(), expectedResults.end(), outputData.begin()), true, TEST_LOCATION);
+
+  END_TEST;
+}
index d230e99..d847f46 100644 (file)
@@ -58,9 +58,9 @@ bool EnvironmentMapLoadTask::HasSucceeded() const
   return mHasSucceeded;
 }
 
-Dali::Scene3D::Loader::EnvironmentMapData& EnvironmentMapLoadTask::GetEnvironmentMap()
+Dali::Texture EnvironmentMapLoadTask::GetLoadedTexture()
 {
-  return mEnvironmentMapData;
+  return (HasSucceeded()) ? mEnvironmentMapData.GetTexture() : Texture();;
 }
 
 } // namespace Internal
index d9a936b..446665c 100644 (file)
@@ -71,10 +71,11 @@ public:
   bool HasSucceeded() const;
 
   /**
-   * Retrieves loaded Environment Map
-   * @return EnvironmentMapData that is loaded from url.
+   * Retrieves loaded Ibl Texture
+   * @return Texture that is loaded from url.
+   * @note Do not call this method in worker thread.
    */
-  Dali::Scene3D::Loader::EnvironmentMapData& GetEnvironmentMap();
+  Dali::Texture GetLoadedTexture();
 
 private:
   // Undefined
index 3345bfc..31e75e5 100644 (file)
 #include <dali-toolkit/internal/controls/control/control-data-impl.h>
 #include <dali-toolkit/internal/graphics/builtin-shader-extern-gen.h>
 #include <dali/devel-api/actors/actor-devel.h>
+#include <dali/integration-api/adaptor-framework/adaptor.h>
 #include <dali/integration-api/debug.h>
 #include <dali/public-api/math/math-utils.h>
 #include <dali/public-api/object/type-registry-helper.h>
 #include <dali/public-api/object/type-registry.h>
-#include <dali/integration-api/adaptor-framework/adaptor.h>
 #include <filesystem>
 
 // INTERNAL INCLUDES
@@ -116,7 +116,8 @@ void ConfigureBlendShapeShaders(
   Dali::Scene3D::Loader::ResourceBundle& resources, const Dali::Scene3D::Loader::SceneDefinition& scene, Actor root, std::vector<Dali::Scene3D::Loader::BlendshapeShaderConfigurationRequest>&& requests)
 {
   std::vector<std::string> errors;
-  auto                     onError = [&errors](const std::string& msg) { errors.push_back(msg); };
+  auto                     onError = [&errors](const std::string& msg)
+  { errors.push_back(msg); };
   if(!scene.ConfigureBlendshapeShaders(resources, root, std::move(requests), onError))
   {
     Dali::Scene3D::Loader::ExceptionFlinger flinger(ASSERT_LOCATION);
@@ -251,13 +252,13 @@ bool Model::GetChildrenFocusable() const
 void Model::SetImageBasedLightSource(const std::string& diffuseUrl, const std::string& specularUrl, float scaleFactor)
 {
   bool needIblReset = false;
-  bool isOnScene = Self().GetProperty<bool>(Dali::Actor::Property::CONNECTED_TO_SCENE);
+  bool isOnScene    = Self().GetProperty<bool>(Dali::Actor::Property::CONNECTED_TO_SCENE);
   if(mDiffuseIblUrl != diffuseUrl)
   {
     mDiffuseIblUrl = diffuseUrl;
     if(mDiffuseIblUrl.empty())
     {
-      needIblReset             = true;
+      needIblReset = true;
     }
     else
     {
@@ -271,7 +272,7 @@ void Model::SetImageBasedLightSource(const std::string& diffuseUrl, const std::s
     mSpecularIblUrl = specularUrl;
     if(mSpecularIblUrl.empty())
     {
-      needIblReset              = true;
+      needIblReset = true;
     }
     else
     {
@@ -284,17 +285,8 @@ void Model::SetImageBasedLightSource(const std::string& diffuseUrl, const std::s
   // we don't need to request to load texture.
   if(needIblReset)
   {
-    if(mIblDiffuseLoadTask)
-    {
-      Dali::AsyncTaskManager::Get().RemoveTask(mIblDiffuseLoadTask);
-      mIblDiffuseLoadTask.Reset();
-    }
-
-    if(mIblSpecularLoadTask)
-    {
-      Dali::AsyncTaskManager::Get().RemoveTask(mIblSpecularLoadTask);
-      mIblSpecularLoadTask.Reset();
-    }
+    ResetResourceTask(mIblDiffuseLoadTask);
+    ResetResourceTask(mIblSpecularLoadTask);
 
     mIblDiffuseDirty          = false;
     mIblSpecularDirty         = false;
@@ -309,11 +301,7 @@ void Model::SetImageBasedLightSource(const std::string& diffuseUrl, const std::s
   {
     if(isOnScene && mIblDiffuseDirty)
     {
-      if(mIblDiffuseLoadTask)
-      {
-        Dali::AsyncTaskManager::Get().RemoveTask(mIblDiffuseLoadTask);
-        mIblDiffuseLoadTask.Reset();
-      }
+      ResetResourceTask(mIblDiffuseLoadTask);
       mIblDiffuseLoadTask = new EnvironmentMapLoadTask(mDiffuseIblUrl, Scene3D::EnvironmentMapType::CUBEMAP, MakeCallback(this, &Model::OnIblDiffuseLoadComplete));
       Dali::AsyncTaskManager::Get().AddTask(mIblDiffuseLoadTask);
       mIblDiffuseDirty = false;
@@ -321,11 +309,7 @@ void Model::SetImageBasedLightSource(const std::string& diffuseUrl, const std::s
 
     if(isOnScene && mIblSpecularDirty)
     {
-      if(mIblSpecularLoadTask)
-      {
-        Dali::AsyncTaskManager::Get().RemoveTask(mIblSpecularLoadTask);
-        mIblSpecularLoadTask.Reset();
-      }
+      ResetResourceTask(mIblSpecularLoadTask);
       mIblSpecularLoadTask = new EnvironmentMapLoadTask(mSpecularIblUrl, Scene3D::EnvironmentMapType::CUBEMAP, MakeCallback(this, &Model::OnIblSpecularLoadComplete));
       Dali::AsyncTaskManager::Get().AddTask(mIblSpecularLoadTask);
       mIblSpecularDirty = false;
@@ -339,10 +323,7 @@ void Model::SetImageBasedLightSource(const std::string& diffuseUrl, const std::s
   }
 
   // If diffuse and specular textures are already loaded, emits resource ready signal here.
-  if(IsResourceReady())
-  {
-    Control::SetResourceReady(false);
-  }
+  NotifyResourceReady();
 }
 
 void Model::SetImageBasedLightTexture(Dali::Texture diffuseTexture, Dali::Texture specularTexture, float scaleFactor)
@@ -493,30 +474,33 @@ bool Model::IsResourceReady() const
 
 void Model::ScaleModel()
 {
-  if(mModelRoot)
+  if(!mModelRoot)
   {
-    float   scale = 1.0f;
-    Vector3 size  = Self().GetProperty<Vector3>(Dali::Actor::Property::SIZE);
-    if(size.x > 0.0f && size.y > 0.0f)
-    {
-      scale = MAXFLOAT;
-      scale = std::min(size.x / mNaturalSize.x, scale);
-      scale = std::min(size.y / mNaturalSize.y, scale);
-    }
-    // Models in glTF and dli are defined as right hand coordinate system.
-    // DALi uses left hand coordinate system. Scaling negative is for change winding order.
-    mModelRoot.SetProperty(Dali::Actor::Property::SCALE, Y_DIRECTION * scale);
+    return;
   }
+
+  float   scale = 1.0f;
+  Vector3 size  = Self().GetProperty<Vector3>(Dali::Actor::Property::SIZE);
+  if(size.x > 0.0f && size.y > 0.0f)
+  {
+    scale = MAXFLOAT;
+    scale = std::min(size.x / mNaturalSize.x, scale);
+    scale = std::min(size.y / mNaturalSize.y, scale);
+  }
+  // Models in glTF and dli are defined as right hand coordinate system.
+  // DALi uses left hand coordinate system. Scaling negative is for change winding order.
+  mModelRoot.SetProperty(Dali::Actor::Property::SCALE, Y_DIRECTION * scale);
 }
 
 void Model::FitModelPosition()
 {
-  if(mModelRoot)
+  if(!mModelRoot)
   {
-    // Loaded model pivot is not the model center.
-    mModelRoot.SetProperty(Dali::Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
-    mModelRoot.SetProperty(Dali::Actor::Property::ANCHOR_POINT, Vector3::ONE - mModelPivot);
+    return;
   }
+  // Loaded model pivot is not the model center.
+  mModelRoot.SetProperty(Dali::Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+  mModelRoot.SetProperty(Dali::Actor::Property::ANCHOR_POINT, Vector3::ONE - mModelPivot);
 }
 
 void Model::CollectRenderableActor(Actor actor)
@@ -550,29 +534,33 @@ void Model::UpdateImageBasedLightTexture()
   for(auto&& actor : mRenderableActors)
   {
     Actor renderableActor = actor.GetHandle();
-    if(renderableActor)
+    if(!renderableActor)
+    {
+      continue;
+    }
+
+    uint32_t rendererCount = renderableActor.GetRendererCount();
+    for(uint32_t i = 0; i < rendererCount; ++i)
     {
-      uint32_t rendererCount = renderableActor.GetRendererCount();
-      for(uint32_t i = 0; i < rendererCount; ++i)
+      Dali::Renderer renderer = renderableActor.GetRendererAt(i);
+      if(!renderer)
       {
-        Dali::Renderer renderer = renderableActor.GetRendererAt(i);
-        if(renderer)
-        {
-          Dali::TextureSet textures = renderer.GetTextures();
-          if(textures)
-          {
-            uint32_t textureCount = textures.GetTextureCount();
-            // EnvMap requires at least 2 texture, diffuse and specular
-            if(textureCount > 2u)
-            {
-              textures.SetTexture(textureCount - OFFSET_FOR_DIFFUSE_CUBE_TEXTURE, currentDiffuseTexture);
-              textures.SetTexture(textureCount - OFFSET_FOR_SPECULAR_CUBE_TEXTURE, currentSpecularTexture);
-            }
-          }
-        }
+        continue;
+      }
+      Dali::TextureSet textures = renderer.GetTextures();
+      if(!textures)
+      {
+        continue;
+      }
+      uint32_t textureCount = textures.GetTextureCount();
+      // EnvMap requires at least 2 texture, diffuse and specular
+      if(textureCount > 2u)
+      {
+        textures.SetTexture(textureCount - OFFSET_FOR_DIFFUSE_CUBE_TEXTURE, currentDiffuseTexture);
+        textures.SetTexture(textureCount - OFFSET_FOR_SPECULAR_CUBE_TEXTURE, currentSpecularTexture);
       }
-      renderableActor.RegisterProperty(Dali::Scene3D::Loader::NodeDefinition::GetIblScaleFactorUniformName().data(), currentIblScaleFactor);
     }
+    renderableActor.RegisterProperty(Dali::Scene3D::Loader::NodeDefinition::GetIblScaleFactorUniformName().data(), currentIblScaleFactor);
   }
 }
 
@@ -627,154 +615,157 @@ void Model::OnModelLoadComplete()
     return;
   }
 
-  mModelRoot = Actor::New();
-  mModelRoot.SetProperty(Actor::Property::COLOR_MODE, ColorMode::USE_OWN_MULTIPLY_PARENT_COLOR);
-
-  BoundingVolume                                      AABB;
-  auto*                                               resources = &(mModelLoadTask->mResources);
-  auto*                                               scene     = &(mModelLoadTask->mScene);
-  Dali::Scene3D::Loader::Transforms                   xforms{Dali::Scene3D::Loader::MatrixStack{}, Dali::Scene3D::Loader::ViewProjection{}};
-  Dali::Scene3D::Loader::NodeDefinition::CreateParams nodeParams{*resources, xforms, {}, {}, {}};
-  uint32_t rootCount = 0u;
-  for(auto iRoot : scene->GetRoots())
-  {
-    resources->GenerateResources(mModelLoadTask->mResourceRefCounts[rootCount]);
-
-    if(auto actor = scene->CreateNodes(iRoot, mModelLoadTask->mResourceChoices, nodeParams))
-    {
-      scene->ConfigureSkeletonJoints(iRoot, resources->mSkeletons, actor);
-      scene->ConfigureSkinningShaders(*resources, actor, std::move(nodeParams.mSkinnables));
-      ConfigureBlendShapeShaders(*resources, *scene, actor, std::move(nodeParams.mBlendshapeRequests));
-
-      scene->ApplyConstraints(actor, std::move(nodeParams.mConstrainables));
-
-      mModelRoot.Add(actor);
-    }
-
-    AddModelTreeToAABB(AABB, *scene, mModelLoadTask->mResourceChoices, iRoot, nodeParams, Matrix::IDENTITY);
-    rootCount++;
-  }
+  CreateModel();
+  mRenderableActors.clear();
+  CollectRenderableActor(mModelRoot);
 
+  auto* resources = &(mModelLoadTask->mResources);
+  auto* scene     = &(mModelLoadTask->mScene);
+  CreateAnimations(*scene);
   if(!resources->mEnvironmentMaps.empty())
   {
     mDefaultDiffuseTexture  = resources->mEnvironmentMaps.front().second.mDiffuse;
     mDefaultSpecularTexture = resources->mEnvironmentMaps.front().second.mSpecular;
   }
 
-  if(!mModelLoadTask->mAnimations.empty())
-  {
-    auto getActor = [&](const Scene3D::Loader::AnimatedProperty& property)
-    {
-      Dali::Actor actor;
-      if(property.mNodeIndex != Scene3D::Loader::INVALID_INDEX)
-      {
-        auto* node = scene->GetNode(property.mNodeIndex);
-        if(node != nullptr)
-        {
-          actor = mModelRoot.FindChildById(node->mNodeId);
-        }
-      }
-      else
-      {
-        actor = mModelRoot.FindChildByName(property.mNodeName);
-      }
-      return actor;
-    };
-
-    mAnimations.clear();
-    for(auto&& animation : mModelLoadTask->mAnimations)
-    {
-      Dali::Animation anim = animation.ReAnimate(getActor);
-
-      mAnimations.push_back({animation.mName, anim});
-    }
-  }
-
-  mRenderableActors.clear();
-  CollectRenderableActor(mModelRoot);
-
   UpdateImageBasedLightTexture();
   UpdateImageBasedLightScaleFactor();
 
-  mNaturalSize = AABB.CalculateSize();
-  mModelPivot  = AABB.CalculatePivot();
-  mModelRoot.SetProperty(Dali::Actor::Property::SIZE, mNaturalSize);
-  Vector3 controlSize = Self().GetProperty<Vector3>(Dali::Actor::Property::SIZE);
-  if(Dali::EqualsZero(controlSize.x) || Dali::EqualsZero(controlSize.y))
-  {
-    Self().SetProperty(Dali::Actor::Property::SIZE, mNaturalSize);
-  }
-
-  FitModelPosition();
-  ScaleModel();
-
   mModelRoot.SetProperty(Dali::Actor::Property::SENSITIVE, mModelChildrenSensitive);
   mModelRoot.SetProperty(Dali::Actor::Property::KEYBOARD_FOCUSABLE, mModelChildrenFocusable);
   mModelRoot.SetProperty(Dali::DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN, mModelChildrenFocusable);
 
   Self().Add(mModelRoot);
-
   Self().SetProperty(Dali::Actor::Property::ANCHOR_POINT, Vector3(mModelPivot.x, 1.0f - mModelPivot.y, mModelPivot.z));
 
   mModelResourceReady = true;
-
-  if(IsResourceReady())
-  {
-    Control::SetResourceReady(false);
-  }
-  mModelLoadTask.Reset();
+  NotifyResourceReady();
+  ResetResourceTask(mModelLoadTask);
 }
 
 void Model::OnIblDiffuseLoadComplete()
 {
-  mDiffuseTexture = (mIblDiffuseLoadTask->HasSucceeded()) ? mIblDiffuseLoadTask->GetEnvironmentMap().GetTexture() : Texture();
+  mDiffuseTexture = mIblDiffuseLoadTask->GetLoadedTexture();
+  ResetResourceTask(mIblDiffuseLoadTask);
   mIblDiffuseResourceReady = true;
   if(mIblDiffuseResourceReady && mIblSpecularResourceReady)
   {
     OnIblLoadComplete();
   }
-  mIblDiffuseLoadTask.Reset();
 }
 
 void Model::OnIblSpecularLoadComplete()
 {
-  mSpecularTexture = (mIblSpecularLoadTask->HasSucceeded()) ? mIblSpecularLoadTask->GetEnvironmentMap().GetTexture() : Texture();
+  mSpecularTexture = mIblSpecularLoadTask->GetLoadedTexture();
+  ResetResourceTask(mIblSpecularLoadTask);
   mIblSpecularResourceReady = true;
   if(mIblDiffuseResourceReady && mIblSpecularResourceReady)
   {
     OnIblLoadComplete();
   }
-  mIblSpecularLoadTask.Reset();
 }
 
 void Model::OnIblLoadComplete()
 {
   UpdateImageBasedLightTexture();
+  NotifyResourceReady();
+}
 
-  if(IsResourceReady())
+void Model::ResetResourceTasks()
+{
+  if(!Dali::Adaptor::IsAvailable())
   {
-    Control::SetResourceReady(false);
+    return;
   }
+  ResetResourceTask(mModelLoadTask);
+  ResetResourceTask(mIblDiffuseLoadTask);
+  ResetResourceTask(mIblSpecularLoadTask);
 }
 
-void Model::ResetResourceTasks()
+void Model::ResetResourceTask(IntrusivePtr<AsyncTask> asyncTask)
 {
-  if(Dali::Adaptor::IsAvailable())
+  if(!asyncTask)
   {
-    if(mModelLoadTask)
+    return;
+  }
+  Dali::AsyncTaskManager::Get().RemoveTask(asyncTask);
+  asyncTask.Reset();
+}
+
+void Model::NotifyResourceReady()
+{
+  if(!IsResourceReady())
+  {
+    return;
+  }
+  Control::SetResourceReady(false);
+}
+
+void Model::CreateModel()
+{
+  mModelRoot = Actor::New();
+  mModelRoot.SetProperty(Actor::Property::COLOR_MODE, ColorMode::USE_OWN_MULTIPLY_PARENT_COLOR);
+
+  BoundingVolume                                      AABB;
+  auto*                                               resources = &(mModelLoadTask->mResources);
+  auto*                                               scene     = &(mModelLoadTask->mScene);
+  Dali::Scene3D::Loader::Transforms                   xforms{Dali::Scene3D::Loader::MatrixStack{}, Dali::Scene3D::Loader::ViewProjection{}};
+  Dali::Scene3D::Loader::NodeDefinition::CreateParams nodeParams{*resources, xforms, {}, {}, {}};
+  uint32_t                                            rootCount = 0u;
+  for(auto iRoot : scene->GetRoots())
+  {
+    resources->GenerateResources(mModelLoadTask->mResourceRefCounts[rootCount]);
+
+    if(auto actor = scene->CreateNodes(iRoot, mModelLoadTask->mResourceChoices, nodeParams))
     {
-      Dali::AsyncTaskManager::Get().RemoveTask(mModelLoadTask);
-      mModelLoadTask.Reset();
+      scene->ConfigureSkeletonJoints(iRoot, resources->mSkeletons, actor);
+      scene->ConfigureSkinningShaders(*resources, actor, std::move(nodeParams.mSkinnables));
+      ConfigureBlendShapeShaders(*resources, *scene, actor, std::move(nodeParams.mBlendshapeRequests));
+
+      scene->ApplyConstraints(actor, std::move(nodeParams.mConstrainables));
+
+      mModelRoot.Add(actor);
     }
-    if(mIblDiffuseLoadTask)
+
+    AddModelTreeToAABB(AABB, *scene, mModelLoadTask->mResourceChoices, iRoot, nodeParams, Matrix::IDENTITY);
+    rootCount++;
+  }
+
+  mNaturalSize = AABB.CalculateSize();
+  mModelPivot  = AABB.CalculatePivot();
+  mModelRoot.SetProperty(Dali::Actor::Property::SIZE, mNaturalSize);
+  Vector3 controlSize = Self().GetProperty<Vector3>(Dali::Actor::Property::SIZE);
+  if(Dali::EqualsZero(controlSize.x) || Dali::EqualsZero(controlSize.y))
+  {
+    Self().SetProperty(Dali::Actor::Property::SIZE, mNaturalSize);
+  }
+  FitModelPosition();
+  ScaleModel();
+}
+
+void Model::CreateAnimations(Dali::Scene3D::Loader::SceneDefinition& scene)
+{
+  if(!mModelLoadTask->mAnimations.empty())
+  {
+    auto getActor = [&](const Scene3D::Loader::AnimatedProperty& property)
     {
-      Dali::AsyncTaskManager::Get().RemoveTask(mIblDiffuseLoadTask);
-      mIblDiffuseLoadTask.Reset();
-    }
-    if(mIblSpecularLoadTask)
+      if(property.mNodeIndex == Scene3D::Loader::INVALID_INDEX)
+      {
+        return mModelRoot.FindChildByName(property.mNodeName);
+      }
+      auto* node = scene.GetNode(property.mNodeIndex);
+      if(node == nullptr)
+      {
+        return Dali::Actor();
+      }
+      return mModelRoot.FindChildById(node->mNodeId);
+    };
+
+    mAnimations.clear();
+    for(auto&& animation : mModelLoadTask->mAnimations)
     {
-      Dali::AsyncTaskManager::Get().RemoveTask(mIblSpecularLoadTask);
-      mIblSpecularLoadTask.Reset();
+      Dali::Animation anim = animation.ReAnimate(getActor);
+      mAnimations.push_back({animation.mName, anim});
     }
   }
 }
index e4f1f08..36e3a9a 100644 (file)
@@ -229,6 +229,31 @@ private:
    */
   void ResetResourceTasks();
 
+  /**
+   * @brief Reset a Resource loading task.
+   */
+  void ResetResourceTask(IntrusivePtr<AsyncTask> asyncTask);
+
+  /**
+   * @brief Request to load a Ibl texture asynchronously
+   */
+  void RequestLoadIblTexture(EnvironmentMapLoadTaskPtr asyncLoadTask, const std::string& url);
+
+  /**
+   * @brief Notify Resource Ready signal.
+   */
+  void NotifyResourceReady();
+
+  /**
+   * @brief Create Model from loaded SceneDefinition.
+   */
+  void CreateModel();
+
+  /**
+   * @brief Create Dali::Animation from loaded AnimationDefinitions.
+   */
+  void CreateAnimations(Dali::Scene3D::Loader::SceneDefinition& scene);
+
 private:
   std::string                    mModelUrl;
   std::string                    mResourceDirectoryUrl;
index 86446d4..a4158e1 100644 (file)
@@ -570,10 +570,9 @@ void SceneView::OnInitialize()
   mRootLayer.SetProperty(Dali::Actor::Property::INHERIT_SCALE, false);
   self.Add(mRootLayer);
 
-  mDefaultCamera = Dali::CameraActor::New();
+  mDefaultCamera = Dali::CameraActor::New3DCamera();
   mDefaultCamera.SetProperty(Dali::Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
   mDefaultCamera.SetProperty(Dali::Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
-  mDefaultCamera.SetNearClippingPlane(1.0f);
   AddCamera(mDefaultCamera);
   UpdateCamera(mDefaultCamera);
 }
@@ -790,7 +789,7 @@ void SceneView::OnSkyboxLoadComplete()
     Control::SetResourceReady(false);
   }
 
-  mSkyboxTexture = (mSkyboxLoadTask->HasSucceeded()) ? mSkyboxLoadTask->GetEnvironmentMap().GetTexture() : Texture();
+  mSkyboxTexture = mSkyboxLoadTask->GetLoadedTexture();
   Shader skyboxShader;
   if(mSkyboxEnvironmentMapType == Scene3D::EnvironmentMapType::CUBEMAP)
   {
@@ -815,7 +814,7 @@ void SceneView::OnSkyboxLoadComplete()
 
 void SceneView::OnIblDiffuseLoadComplete()
 {
-  mDiffuseTexture          = (mIblDiffuseLoadTask->HasSucceeded()) ? mIblDiffuseLoadTask->GetEnvironmentMap().GetTexture() : Texture();
+  mDiffuseTexture          = mIblDiffuseLoadTask->GetLoadedTexture();
   mIblDiffuseResourceReady = true;
   if(mIblDiffuseResourceReady && mIblSpecularResourceReady)
   {
@@ -826,7 +825,7 @@ void SceneView::OnIblDiffuseLoadComplete()
 
 void SceneView::OnIblSpecularLoadComplete()
 {
-  mSpecularTexture          = (mIblSpecularLoadTask->HasSucceeded()) ? mIblSpecularLoadTask->GetEnvironmentMap().GetTexture() : Texture();
+  mSpecularTexture          = mIblSpecularLoadTask->GetLoadedTexture();
   mIblSpecularResourceReady = true;
   if(mIblDiffuseResourceReady && mIblSpecularResourceReady)
   {
index 01601f9..8e0353c 100644 (file)
@@ -32,13 +32,13 @@ namespace Scene3D
 {
 namespace Loader
 {
-const std::string BlendShapes::NUMBER_OF_BLEND_SHAPES("uNumberOfBlendShapes");
-const std::string BlendShapes::UNNORMALIZE_FACTOR("uBlendShapeUnnormalizeFactor");
-const std::string BlendShapes::COMPONENT_SIZE("uBlendShapeComponentSize");
+const char* BlendShapes::NUMBER_OF_BLEND_SHAPES("uNumberOfBlendShapes");
+const char* BlendShapes::UNNORMALIZE_FACTOR("uBlendShapeUnnormalizeFactor");
+const char* BlendShapes::COMPONENT_SIZE("uBlendShapeComponentSize");
 
-const std::string BlendShapes::COMPONENTS("blendShapeComponents");
+const char* BlendShapes::COMPONENTS("blendShapeComponents");
 
-const std::string BlendShapes::WEIGHTS_UNIFORM("uBlendShapeWeight");
+const char* BlendShapes::WEIGHTS_UNIFORM("uBlendShapeWeight");
 
 void BlendShapes::ConfigureProperties(const std::pair<MeshDefinition, MeshGeometry>& mesh, Shader shader, Actor actor)
 {
@@ -46,8 +46,8 @@ void BlendShapes::ConfigureProperties(const std::pair<MeshDefinition, MeshGeomet
 
   char        weightNameBuffer[32];
   char        unnormalizeFactorNameBuffer[64];
-  char* const pWeightName = weightNameBuffer + snprintf(weightNameBuffer, sizeof(weightNameBuffer), "%s", WEIGHTS_UNIFORM.c_str());
-  char* const pFactorName = unnormalizeFactorNameBuffer + snprintf(unnormalizeFactorNameBuffer, sizeof(unnormalizeFactorNameBuffer), "%s", UNNORMALIZE_FACTOR.c_str());
+  char* const pWeightName = weightNameBuffer + snprintf(weightNameBuffer, sizeof(weightNameBuffer), "%s", WEIGHTS_UNIFORM);
+  char* const pFactorName = unnormalizeFactorNameBuffer + snprintf(unnormalizeFactorNameBuffer, sizeof(unnormalizeFactorNameBuffer), "%s", UNNORMALIZE_FACTOR);
   for(const auto& blendShape : mesh.first.mBlendShapes)
   {
     snprintf(pWeightName, sizeof(weightNameBuffer) - (pWeightName - weightNameBuffer), "[%d]", index);
index 168fb09..e2db2a0 100644 (file)
@@ -54,15 +54,15 @@ struct DALI_SCENE3D_API BlendShapes
   };
 
   // shader properties - animatable (uniforms)
-  static const std::string NUMBER_OF_BLEND_SHAPES; ///< Integer number of blend shapes loaded.
-  static const std::string UNNORMALIZE_FACTOR;     ///< Scalar(s) for position components of blend shapes; Version 1.0: float array (1 per blend shape); Version 2.0: single float.
-  static const std::string COMPONENT_SIZE;         ///< Integer offset from one component (positions / normals / tangents) of a blend shape to the next.
+  static const char* NUMBER_OF_BLEND_SHAPES; ///< Integer number of blend shapes loaded.
+  static const char* UNNORMALIZE_FACTOR;     ///< Scalar(s) for position components of blend shapes; Version 1.0: float array (1 per blend shape); Version 2.0: single float.
+  static const char* COMPONENT_SIZE;         ///< Integer offset from one component (positions / normals / tangents) of a blend shape to the next.
 
   // shader properties - read-only (not available as uniforms)
-  static const std::string COMPONENTS; ///< Integer bitmask of the blend shape components that the shader uses; refer to the Components enum.
+  static const char* COMPONENTS; ///< Integer bitmask of the blend shape components that the shader uses; refer to the Components enum.
 
   // actor property (instance) - animatable (uniforms)
-  static const std::string WEIGHTS_UNIFORM; ///< The weight of each blend shape in a float array
+  static const char* WEIGHTS_UNIFORM; ///< The weight of each blend shape in a float array
 
   /**
    * @brief Registers properties based on the mesh definition (and geometry) and identified by the above string constants,
index ee89bdc..1704927 100644 (file)
@@ -38,7 +38,7 @@ static constexpr std::string_view EMBEDDED_DATA_BASE64_ENCODING_TYPE   = "base64
 
 struct BufferDefinition::Impl
 {
-  std::vector<uint8_t>             buffer;
+  std::vector<uint8_t>              buffer;
   std::shared_ptr<Dali::FileStream> stream;
 };
 
@@ -85,9 +85,9 @@ void BufferDefinition::LoadBuffer()
       if(position != std::string::npos)
       {
         position += EMBEDDED_DATA_BASE64_ENCODING_TYPE.length();
-        std::string data = mUri.substr(position);
+        std::string_view data = std::string_view(mUri).substr(position);
         mImpl.get()->buffer.clear();
-        Dali::Toolkit::DecodeBase64PropertyData(data, mImpl.get()->buffer);
+        Dali::Toolkit::DecodeBase64FromString(data, mImpl.get()->buffer);
         mImpl.get()->stream = std::make_shared<Dali::FileStream>(reinterpret_cast<uint8_t*>(mImpl.get()->buffer.data()), mByteLength, FileStream::READ | FileStream::BINARY);
         mIsEmbedded         = true;
       }
index 7eafcb7..8953f1a 100644 (file)
@@ -57,19 +57,18 @@ namespace rs = RendererState;
 
 namespace
 {
-const std::string NODES         = "nodes";
-const std::string SCENES        = "scenes";
-const std::string NODE          = "node";
-const std::string URI           = "uri";
-const std::string URL           = "url";
-const std::string CUSTOMIZATION = "customization";
-const std::string HINTS         = "hints";
-const std::string NAME("name");
-const std::string BLEND_SHAPE_HEADER("blendShapeHeader");
-const std::string BLEND_SHAPES("blendShapes");
-const std::string BLEND_SHAPE_VERSION_1_0("1.0");
-const std::string BLEND_SHAPE_VERSION_2_0("2.0");
-const std::string VERSION("version");
+const char* NODES         = "nodes";
+const char* SCENES        = "scenes";
+const char* NODE          = "node";
+const char* URI           = "uri";
+const char* URL           = "url";
+const char* HINTS         = "hints";
+const char* NAME("name");
+const char* BLEND_SHAPE_HEADER("blendShapeHeader");
+const char* BLEND_SHAPES("blendShapes");
+const char* BLEND_SHAPE_VERSION_1_0("1.0");
+const char* BLEND_SHAPE_VERSION_2_0("2.0");
+const char* VERSION("version");
 
 const char* const SHADOW_MAP_SIZE   = "shadowMapSize";
 const char* const ORTHOGRAPHIC_SIZE = "orthographicSize";
index 9b19610..3dea7c9 100644 (file)
@@ -43,7 +43,7 @@ namespace Loader
 {
 namespace
 {
-const std::string PRE_COMPUTED_BRDF_TEXTURE_FILE_NAME = "brdfLUT.png";
+const char* PRE_COMPUTED_BRDF_TEXTURE_FILE_NAME = "brdfLUT.png";
 }
 
 EnvironmentDefinition::RawData
index 69bcd51..9068b7f 100644 (file)
@@ -47,12 +47,12 @@ namespace
 Dali::Mutex gInitializeMutex;
 Dali::Mutex gReadMutex;
 
-const std::string POSITION_PROPERTY("position");
-const std::string ORIENTATION_PROPERTY("orientation");
-const std::string SCALE_PROPERTY("scale");
-const std::string BLEND_SHAPE_WEIGHTS_UNIFORM("uBlendShapeWeight");
-const std::string MRENDERER_MODEL_IDENTIFICATION("M-Renderer");
-const std::string ROOT_NODE_NAME("RootNode");
+const char* POSITION_PROPERTY("position");
+const char* ORIENTATION_PROPERTY("orientation");
+const char* SCALE_PROPERTY("scale");
+const char* BLEND_SHAPE_WEIGHTS_UNIFORM("uBlendShapeWeight");
+const char* MRENDERER_MODEL_IDENTIFICATION("M-Renderer");
+const char* ROOT_NODE_NAME("RootNode");
 const Vector3     SCALE_TO_ADJUST(100.0f, 100.0f, 100.0f);
 
 const Geometry::Type GLTF2_TO_DALI_PRIMITIVES[]{
@@ -988,6 +988,7 @@ float LoadDataFromAccessors(ConversionContext& context, const gltf2::Accessor& i
 
   LoadDataFromAccessor<float>(context, output.mBufferView->mBuffer.GetIndex(), inputDataBuffer, input.mBufferView->mByteOffset + input.mByteOffset, inputDataBufferSize);
   LoadDataFromAccessor<T>(context, output.mBufferView->mBuffer.GetIndex(), outputDataBuffer, output.mBufferView->mByteOffset + output.mByteOffset, outputDataBufferSize);
+  ApplyAccessorMinMax(input, reinterpret_cast<float*>(inputDataBuffer.begin()));
   ApplyAccessorMinMax(output, reinterpret_cast<float*>(outputDataBuffer.begin()));
 
   return inputDataBuffer[input.mCount - 1u];
@@ -1004,6 +1005,12 @@ float LoadKeyFrames(ConversionContext& context, const gt::Animation::Channel& ch
 
   const float duration = std::max(LoadDataFromAccessors<T>(context, input, output, inputDataBuffer, outputDataBuffer), AnimationDefinition::MIN_DURATION_SECONDS);
 
+  // Set first frame value as first keyframe (gltf animation spec)
+  if(input.mCount > 0 && !Dali::EqualsZero(inputDataBuffer[0]))
+  {
+    keyFrames.Add(0.0f, outputDataBuffer[0]);
+  }
+
   for(uint32_t i = 0; i < input.mCount; ++i)
   {
     keyFrames.Add(inputDataBuffer[i] / duration, outputDataBuffer[i]);
@@ -1020,10 +1027,10 @@ float LoadBlendShapeKeyFrames(ConversionContext& context, const gt::Animation::C
   Vector<float> inputDataBuffer;
   Vector<float> outputDataBuffer;
 
-  const float duration = LoadDataFromAccessors<float>(context, input, output, inputDataBuffer, outputDataBuffer);
+  const float duration = std::max(LoadDataFromAccessors<float>(context, input, output, inputDataBuffer, outputDataBuffer), AnimationDefinition::MIN_DURATION_SECONDS);
 
   char        weightNameBuffer[32];
-  auto        prefixSize    = snprintf(weightNameBuffer, sizeof(weightNameBuffer), "%s[", BLEND_SHAPE_WEIGHTS_UNIFORM.c_str());
+  auto        prefixSize    = snprintf(weightNameBuffer, sizeof(weightNameBuffer), "%s[", BLEND_SHAPE_WEIGHTS_UNIFORM);
   char* const pWeightName   = weightNameBuffer + prefixSize;
   const auto  remainingSize = sizeof(weightNameBuffer) - prefixSize;
   for(uint32_t weightIndex = 0u, endWeightIndex = channel.mSampler->mOutput->mCount / channel.mSampler->mInput->mCount; weightIndex < endWeightIndex; ++weightIndex)
@@ -1035,6 +1042,13 @@ float LoadBlendShapeKeyFrames(ConversionContext& context, const gt::Animation::C
     animatedProperty.mPropertyName = std::string(weightNameBuffer);
 
     animatedProperty.mKeyFrames = KeyFrames::New();
+
+    // Set first frame value as first keyframe (gltf animation spec)
+    if(input.mCount > 0 && !Dali::EqualsZero(inputDataBuffer[0]))
+    {
+      animatedProperty.mKeyFrames.Add(0.0f, outputDataBuffer[weightIndex]);
+    }
+
     for(uint32_t i = 0; i < input.mCount; ++i)
     {
       animatedProperty.mKeyFrames.Add(inputDataBuffer[i] / duration, outputDataBuffer[i * endWeightIndex + weightIndex]);
index bf764ff..58ab65d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -91,9 +91,9 @@ Dali::PixelData LoadImageResource(const std::string& resourcePath,
     if(position != std::string::npos)
     {
       position += EMBEDDED_DATA_BASE64_ENCODING_TYPE.length();
-      std::string          data = textureDefinition.mImageUri.substr(position);
+      std::string_view     data = std::string_view(textureDefinition.mImageUri).substr(position);
       std::vector<uint8_t> buffer;
-      Dali::Toolkit::DecodeBase64PropertyData(data, buffer);
+      Dali::Toolkit::DecodeBase64FromString(data, buffer);
       uint32_t bufferSize = buffer.size();
 
       Dali::Devel::PixelBuffer pixelBuffer = Dali::LoadImageFromBuffer(reinterpret_cast<uint8_t*>(buffer.data()), bufferSize, textureDefinition.mMinImageDimensions, fittingMode, textureDefinition.mSamplingMode, orientationCorrection);
@@ -187,8 +187,7 @@ MaterialDefinition::LoadRaw(const std::string& imagesPath)
 
   // Load textures
   auto iTexture   = mTextureStages.begin();
-  auto checkStage = [&](uint32_t flags)
-  {
+  auto checkStage = [&](uint32_t flags) {
     return iTexture != mTextureStages.end() && MaskMatch(iTexture->mSemantic, flags);
   };
 
@@ -323,7 +322,7 @@ TextureSet MaterialDefinition::Load(const EnvironmentDefinition::Vector& environ
   uint32_t n = 0;
   for(auto& tData : raw.mTextures)
   {
-    auto& pixels  = tData.mPixels;
+    auto&   pixels = tData.mPixels;
     Texture texture;
     if(pixels)
     {
@@ -379,8 +378,7 @@ TextureSet MaterialDefinition::Load(const EnvironmentDefinition::Vector& environ
 
 bool MaterialDefinition::CheckTextures(uint32_t flags) const
 {
-  return std::find_if(mTextureStages.begin(), mTextureStages.end(), [flags](const TextureStage& ts)
-                      { return MaskMatch(ts.mSemantic, flags); }) != mTextureStages.end();
+  return std::find_if(mTextureStages.begin(), mTextureStages.end(), [flags](const TextureStage& ts) { return MaskMatch(ts.mSemantic, flags); }) != mTextureStages.end();
 }
 
 } // namespace Loader
index 3beaf83..b23140f 100644 (file)
 
 // EXTERNAL INCLUDES
 #include <dali/devel-api/adaptor-framework/file-stream.h>
+#include <dali/devel-api/adaptor-framework/pixel-buffer.h>
 #include <dali/integration-api/debug.h>
+#include <dali/public-api/math/compile-time-math.h>
 #include <cstring>
 #include <fstream>
-#include "dali/devel-api/adaptor-framework/pixel-buffer.h"
+#include <type_traits>
 
 namespace Dali
 {
@@ -65,7 +67,7 @@ private:
   uint16_t (*mFunc)(uintptr_t&);
 };
 
-const std::string QUAD("quad");
+const char* QUAD("quad");
 
 ///@brief Reads a blob from the given stream @a source into @a target, which must have
 /// at least @a descriptor.length bytes.
@@ -247,83 +249,90 @@ void GenerateNormals(MeshDefinition::RawData& raw)
   attribs.push_back({"aNormal", Property::VECTOR3, attribs[0].mNumElements, std::move(buffer)});
 }
 
-void GenerateTangentsWithUvs(MeshDefinition::RawData& raw)
+template<bool useVec3, bool hasUvs, typename T = std::conditional_t<useVec3, Vector3, Vector4>, typename = std::enable_if_t<(std::is_same<T, Vector3>::value || std::is_same<T, Vector4>::value)>>
+bool GenerateTangents(MeshDefinition::RawData& raw)
 {
   auto& attribs = raw.mAttribs;
-  DALI_ASSERT_DEBUG(attribs.size() > 2); // positions, normals, uvs
-  IndexProvider getIndex(raw.mIndices.data());
-
-  const uint32_t numIndices = raw.mIndices.empty() ? attribs[0].mNumElements : static_cast<uint32_t>(raw.mIndices.size());
-
-  auto* positions = reinterpret_cast<const Vector3*>(attribs[0].mData.data());
-  auto* uvs       = reinterpret_cast<const Vector2*>(attribs[2].mData.data());
-
-  std::vector<uint8_t> buffer(attribs[0].mNumElements * sizeof(Vector3));
-  auto                 tangents = reinterpret_cast<Vector3*>(buffer.data());
-
-  for(uint32_t i = 0; i < numIndices; i += 3)
+  // Required positions, normals, uvs (if we have). If not, skip generation
+  if(attribs.size() < (2 + static_cast<size_t>(hasUvs)))
   {
-    uint16_t indices[]{getIndex(), getIndex(), getIndex()};
-    Vector3  pos[]{positions[indices[0]], positions[indices[1]], positions[indices[2]]};
-    Vector2  uv[]{uvs[indices[0]], uvs[indices[1]], uvs[indices[2]]};
-
-    float x0 = pos[1].x - pos[0].x;
-    float y0 = pos[1].y - pos[0].y;
-    float z0 = pos[1].z - pos[0].z;
+    return false;
+  }
 
-    float x1 = pos[2].x - pos[0].x;
-    float y1 = pos[2].y - pos[0].y;
-    float z1 = pos[2].z - pos[0].z;
+  std::vector<uint8_t> buffer(attribs[0].mNumElements * sizeof(T));
+  auto                 tangents = reinterpret_cast<T*>(buffer.data());
 
-    float s0 = uv[1].x - uv[0].x;
-    float t0 = uv[1].y - uv[0].y;
+  if constexpr(hasUvs)
+  {
+    IndexProvider  getIndex(raw.mIndices.data());
+    const uint32_t numIndices = raw.mIndices.empty() ? attribs[0].mNumElements : static_cast<uint32_t>(raw.mIndices.size());
 
-    float s1 = uv[2].x - uv[0].x;
-    float t1 = uv[2].y - uv[0].y;
+    auto* positions = reinterpret_cast<const Vector3*>(attribs[0].mData.data());
+    auto* uvs       = reinterpret_cast<const Vector2*>(attribs[2].mData.data());
 
-    float   r = 1.f / (s0 * t1 - t0 * s1);
-    Vector3 tangent((x0 * t1 - t0 * x1) * r, (y0 * t1 - t0 * y1) * r, (z0 * t1 - t0 * z1) * r);
-    tangents[indices[0]] += tangent;
-    tangents[indices[1]] += tangent;
-    tangents[indices[2]] += tangent;
+    for(uint32_t i = 0; i < numIndices; i += 3)
+    {
+      uint16_t indices[]{getIndex(), getIndex(), getIndex()};
+      Vector3  pos[]{positions[indices[0]], positions[indices[1]], positions[indices[2]]};
+      Vector2  uv[]{uvs[indices[0]], uvs[indices[1]], uvs[indices[2]]};
+
+      float x0 = pos[1].x - pos[0].x;
+      float y0 = pos[1].y - pos[0].y;
+      float z0 = pos[1].z - pos[0].z;
+
+      float x1 = pos[2].x - pos[0].x;
+      float y1 = pos[2].y - pos[0].y;
+      float z1 = pos[2].z - pos[0].z;
+
+      float s0 = uv[1].x - uv[0].x;
+      float t0 = uv[1].y - uv[0].y;
+
+      float s1 = uv[2].x - uv[0].x;
+      float t1 = uv[2].y - uv[0].y;
+
+      float   det = (s0 * t1 - t0 * s1);
+      float   r   = 1.f / ((std::abs(det) < Dali::Epsilon<1000>::value) ? (Dali::Epsilon<1000>::value * (det > 0.0f ? 1.f : -1.f)) : det);
+      Vector3 tangent((x0 * t1 - t0 * x1) * r, (y0 * t1 - t0 * y1) * r, (z0 * t1 - t0 * z1) * r);
+      tangents[indices[0]] += T(tangent);
+      tangents[indices[1]] += T(tangent);
+      tangents[indices[2]] += T(tangent);
+    }
   }
 
   auto* normals = reinterpret_cast<const Vector3*>(attribs[1].mData.data());
   auto  iEnd    = normals + attribs[1].mNumElements;
   while(normals != iEnd)
   {
-    *tangents -= *normals * normals->Dot(*tangents);
-    tangents->Normalize();
-
-    ++tangents;
-    ++normals;
-  }
-  attribs.push_back({"aTangent", Property::VECTOR3, attribs[0].mNumElements, std::move(buffer)});
-}
-
-void GenerateTangents(MeshDefinition::RawData& raw)
-{
-  auto& attribs = raw.mAttribs;
-  DALI_ASSERT_DEBUG(attribs.size() > 1); // positions, normals
-
-  auto* normals = reinterpret_cast<const Vector3*>(attribs[1].mData.data());
-
-  std::vector<uint8_t> buffer(attribs[0].mNumElements * sizeof(Vector3));
-  auto                 tangents = reinterpret_cast<Vector3*>(buffer.data());
-
-  auto iEnd = normals + attribs[1].mNumElements;
-  while(normals != iEnd)
-  {
-    Vector3 t[]{normals->Cross(Vector3::XAXIS), normals->Cross(Vector3::YAXIS)};
+    Vector3 tangentVec3;
+    if constexpr(hasUvs)
+    {
+      // Calculated by indexs
+      tangentVec3 = Vector3((*tangents).x, (*tangents).y, (*tangents).z);
+    }
+    else
+    {
+      // Only choiced by normal vector. by indexs
+      Vector3 t[]{normals->Cross(Vector3::XAXIS), normals->Cross(Vector3::YAXIS)};
+      tangentVec3 = t[t[1].LengthSquared() > t[0].LengthSquared()];
+    }
 
-    *tangents = t[t[1].LengthSquared() > t[0].LengthSquared()];
-    *tangents -= *normals * normals->Dot(*tangents);
-    tangents->Normalize();
+    tangentVec3 -= *normals * normals->Dot(tangentVec3);
+    tangentVec3.Normalize();
+    if constexpr(useVec3)
+    {
+      *tangents = tangentVec3;
+    }
+    else
+    {
+      *tangents = Vector4(tangentVec3.x, tangentVec3.y, tangentVec3.z, 1.0f);
+    }
 
     ++tangents;
     ++normals;
   }
-  attribs.push_back({"aTangent", Property::VECTOR3, attribs[0].mNumElements, std::move(buffer)});
+  attribs.push_back({"aTangent", useVec3 ? Property::VECTOR3 : Property::VECTOR4, attribs[0].mNumElements, std::move(buffer)});
+
+  return true;
 }
 
 void CalculateTextureSize(uint32_t totalTextureSize, uint32_t& textureWidth, uint32_t& textureHeight)
@@ -833,7 +842,22 @@ MeshDefinition::LoadRaw(const std::string& modelsPath, BufferDefinition::Vector&
   else if(mTangents.mBlob.mLength != 0 && hasNormals && isTriangles)
   {
     DALI_ASSERT_DEBUG(mTangents.mBlob.mLength == mNormals.mBlob.GetBufferSize());
-    hasUvs ? GenerateTangentsWithUvs(raw) : GenerateTangents(raw);
+    static const std::function<bool(RawData&)> GenerateTangentsFunction[2][2] =
+      {
+        {
+          GenerateTangents<false, false>,
+          GenerateTangents<false, true>,
+        },
+        {
+          GenerateTangents<true, false>,
+          GenerateTangents<true, true>,
+        },
+      };
+    const bool generateSuccessed = GenerateTangentsFunction[mTangentType == Property::VECTOR3][hasUvs](raw);
+    if(!generateSuccessed)
+    {
+      DALI_LOG_ERROR("Failed to generate tangents\n");
+    }
   }
 
   if(mColors.IsDefined())
index b47c203..98405d7 100644 (file)
@@ -61,7 +61,7 @@ void NodeDefinition::Renderable::OnCreate(const NodeDefinition& node, CreatePara
   actor.AddRenderer(renderer);
 }
 
-const std::string NodeDefinition::ORIGINAL_MATRIX_PROPERTY_NAME = "originalMatrix";
+const char* NodeDefinition::ORIGINAL_MATRIX_PROPERTY_NAME = "originalMatrix";
 
 Actor NodeDefinition::CreateActor(CreateParams& params)
 {
index d713ed5..0e9a5d7 100644 (file)
@@ -250,7 +250,7 @@ public: // METHODS
   static std::string_view GetIblYDirectionUniformName();
 
 public: // DATA
-  static const std::string ORIGINAL_MATRIX_PROPERTY_NAME;
+  static const char* ORIGINAL_MATRIX_PROPERTY_NAME;
 
   std::string mName;
   uint32_t    mNodeId = INVALID_INDEX;
index 3241769..f41422e 100644 (file)
@@ -45,7 +45,7 @@ namespace Loader
 {
 namespace
 {
-const std::string JOINT_MATRIX{"jointMatrix"};
+const char* JOINT_MATRIX{"jointMatrix"};
 
 const std::map<Property::Type, Constraint (*)(Actor&, Property::Index)> sConstraintFactory = {
   {Property::Type::BOOLEAN,
@@ -305,7 +305,7 @@ void ConfigureBoneMatrix(const Matrix& ibm, Actor joint, Shader& shader, Index&
 {
   // Register bone transform on shader.
   char propertyNameBuffer[32];
-  snprintf(propertyNameBuffer, sizeof(propertyNameBuffer), "%s[%d]", Skinning::BONE_UNIFORM_NAME.c_str(), boneIdx);
+  snprintf(propertyNameBuffer, sizeof(propertyNameBuffer), "%s[%d]", Skinning::BONE_UNIFORM_NAME, boneIdx);
   DALI_ASSERT_DEBUG(shader.GetPropertyIndex(propertyNameBuffer) == Property::INVALID_INDEX);
   auto propBoneXform = shader.RegisterProperty(propertyNameBuffer, Matrix{false});
 
index 729fa1d..a753155 100644 (file)
@@ -28,9 +28,8 @@ namespace Loader
 {
 namespace
 {
-const std::string SHADER_HINT_OUTPUT_IS_TRANSPARENT("OUTPUT_IS_TRANSPARENT"); ///< Might generate transparent alpha from opaque inputs.
-const std::string SHADER_HINT_MODIFIES_GEOMETRY("MODIFIES_GEOMETRY");         ///< Might change position of vertices, this option disables any culling optimizations.
-
+const char* SHADER_HINT_OUTPUT_IS_TRANSPARENT("OUTPUT_IS_TRANSPARENT"); ///< Might generate transparent alpha from opaque inputs.
+const char* SHADER_HINT_MODIFIES_GEOMETRY("MODIFIES_GEOMETRY");         ///< Might change position of vertices, this option disables any culling optimizations.
 } // namespace
 
 ShaderDefinition::ShaderDefinition(const ShaderDefinition& other)
index 128a19b..e100151 100644 (file)
@@ -27,8 +27,7 @@ namespace Loader
 {
 const unsigned int Skinning::MAX_JOINTS = 64;
 
-const std::string Skinning::BONE_UNIFORM_NAME = "uBone";
-
+const char* Skinning::BONE_UNIFORM_NAME = "uBone";
 } // namespace Loader
 } // namespace Scene3D
 } // namespace Dali
index 78ba38c..d754f0c 100644 (file)
@@ -40,7 +40,7 @@ struct DALI_SCENE3D_API Skinning
   /*
    * @brief Name of bone matrix uniform (array).
    */
-  static const std::string BONE_UNIFORM_NAME;
+  static const char* BONE_UNIFORM_NAME;
 
   Skinning() = delete;
 };
index 2de438a..17b823a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -75,12 +75,13 @@ bool DecodeBase64PropertyData(const Property::Value& value, std::vector<uint32_t
 
   if(GetStringFromProperty(value, encodedString))
   {
-    std::vector<unsigned char> outputTmpData;
-    outputTmpData.reserve(ceil(encodedString.size() * 0.75f));
+    std::vector<uint8_t> outputTmpData;
+    // Output required at least ceil(length * 3 / 4)
+    outputData.reserve((encodedString.size() * 3 + 3) / 4);
     bn::decode_b64(encodedString.begin(), encodedString.end(), std::back_inserter(outputTmpData));
 
     outputData.clear();
-    uint32_t outputSize = outputTmpData.size() / sizeof(uint32_t) + static_cast<uint32_t>(!!(outputTmpData.size() % sizeof(uint32_t)));
+    uint32_t outputSize = (outputTmpData.size() + sizeof(uint32_t) - 1) / sizeof(uint32_t);
     outputData.resize(outputSize);
     // Treat as a block of data
     memcpy(&outputData[0], &outputTmpData[0], outputTmpData.size());
@@ -97,7 +98,8 @@ bool DecodeBase64PropertyData(const Property::Value& value, std::vector<uint8_t>
 
   if(GetStringFromProperty(value, encodedString))
   {
-    outputData.reserve(ceil(encodedString.size() * 0.75f));
+    // Output required at least ceil(length * 3 / 4)
+    outputData.reserve((encodedString.size() * 3 + 3) / 4);
     bn::decode_b64(encodedString.begin(), encodedString.end(), std::back_inserter(outputData));
 
     decoded = true;
@@ -105,6 +107,15 @@ bool DecodeBase64PropertyData(const Property::Value& value, std::vector<uint8_t>
   return decoded;
 }
 
+bool DecodeBase64FromString(const std::string_view& encodedString, std::vector<uint8_t>& outputData)
+{
+  // Output required at least ceil(length * 3 / 4)
+  outputData.reserve((encodedString.size() * 3 + 3) >> 2);
+  bn::decode_b64(encodedString.begin(), encodedString.end(), std::back_inserter(outputData));
+
+  return true; // Always success.
+}
+
 void EncodeBase64PropertyData(Property::Value& value, const std::vector<uint32_t>& inputData)
 {
   std::ostringstream oss;
@@ -114,11 +125,61 @@ void EncodeBase64PropertyData(Property::Value& value, const std::vector<uint32_t
                  std::ostream_iterator<unsigned char>(oss, ""));
 
   std::string encodedString = oss.str();
+
+  // Add padding
+  int paddingLength = (4 - (encodedString.length() % 4)) % 4;
+  if(paddingLength > 0)
+  {
+    while(paddingLength--)
+    {
+      oss << '=';
+    }
+    encodedString = oss.str();
+  }
+
+  if(encodedString.length() > MAX_PROPERTY_STRING_LENGTH)
+  {
+    // cut string up into blocks of MAX_PROPERTY_STRING_LENGTH and store to an array
+    auto numStrings = (encodedString.length() + MAX_PROPERTY_STRING_LENGTH - 1) / MAX_PROPERTY_STRING_LENGTH;
+
+    Property::Array array;
+    for(auto i = 0u; i < numStrings; ++i)
+    {
+      array.PushBack(encodedString.substr(i * MAX_PROPERTY_STRING_LENGTH, MAX_PROPERTY_STRING_LENGTH));
+    }
+    value = array;
+  }
+  else
+  {
+    value = encodedString;
+  }
+}
+
+void EncodeBase64PropertyData(Property::Value& value, const std::vector<uint8_t>& inputData)
+{
+  std::ostringstream oss;
+
+  bn::encode_b64(reinterpret_cast<const uint8_t*>(&inputData[0]),
+                 reinterpret_cast<const uint8_t*>(&inputData[0] + inputData.size()),
+                 std::ostream_iterator<char>(oss, ""));
+
+  std::string encodedString = oss.str();
+
+  // Add padding
+  int paddingLength = (4 - (encodedString.length() % 4)) % 4;
+  if(paddingLength > 0)
+  {
+    while(paddingLength--)
+    {
+      oss << '=';
+    }
+    encodedString = oss.str();
+  }
+
   if(encodedString.length() > MAX_PROPERTY_STRING_LENGTH)
   {
     // cut string up into blocks of MAX_PROPERTY_STRING_LENGTH and store to an array
-    auto numStrings = encodedString.length() / MAX_PROPERTY_STRING_LENGTH +
-                      ((encodedString.length() % MAX_PROPERTY_STRING_LENGTH) != 0);
+    auto numStrings = (encodedString.length() + MAX_PROPERTY_STRING_LENGTH - 1) / MAX_PROPERTY_STRING_LENGTH;
 
     Property::Array array;
     for(auto i = 0u; i < numStrings; ++i)
index c7067ed..566bded 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_BASE64_ENCODING_H
 
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@
 // EXTERNAL INCLUDES
 #include <dali/public-api/common/vector-wrapper.h>
 #include <dali/public-api/object/property.h>
+#include <string_view>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/dali-toolkit-common.h>
@@ -56,6 +57,18 @@ DALI_TOOLKIT_API bool DecodeBase64PropertyData(const Property::Value& value, std
 DALI_TOOLKIT_API bool DecodeBase64PropertyData(const Property::Value& value, std::vector<uint8_t>& outputData);
 
 /**
+ * @brief Parses a std::string_view to retrieve an array of uint8_t data.
+ *
+ * Data can be encoded using the base64 encoding scheme to allow it to be used
+ * in JSON (The property system maps to JSON types).
+ *
+ * @param[in] encodedString The input string to decode
+ * @param[out] outputData The output data block
+ * @return True if a data block was decoded successfully.
+ */
+DALI_TOOLKIT_API bool DecodeBase64FromString(const std::string_view& encodedString, std::vector<uint8_t>& outputData);
+
+/**
  * @brief Convert a block of uint32_t data into a Property::STRING or ARRAY of STRINGs
  * encoded using base64. This allows the data to be mapped to JSON easily.
  *
@@ -64,6 +77,15 @@ DALI_TOOLKIT_API bool DecodeBase64PropertyData(const Property::Value& value, std
  */
 DALI_TOOLKIT_API void EncodeBase64PropertyData(Property::Value& value, const std::vector<uint32_t>& inputData);
 
+/**
+ * @brief Convert a block of uint8_t data into a Property::STRING or ARRAY of STRINGs
+ * encoded using base64. This allows the data to be mapped to JSON easily.
+ *
+ * @param[out] value The value to write data into (to avoid copying).
+ * @param[in] inputData The input
+ */
+DALI_TOOLKIT_API void EncodeBase64PropertyData(Property::Value& value, const std::vector<uint8_t>& inputData);
+
 } // namespace Toolkit
 
 } // namespace Dali
index 517d78f..8b69071 100644 (file)
@@ -70,23 +70,22 @@ namespace
 {
 #define TOKEN_STRING(x) #x
 
-const std::string KEYNAME_ACTORS           = "actors";
-const std::string KEYNAME_ENTRY_TRANSITION = "entryTransition";
-const std::string KEYNAME_EXIT_TRANSITION  = "exitTransition";
-const std::string KEYNAME_INCLUDES         = "includes";
-const std::string KEYNAME_INHERIT          = "inherit";
-const std::string KEYNAME_MAPPINGS         = "mappings";
-const std::string KEYNAME_NAME             = "name";
-const std::string KEYNAME_SIGNALS          = "signals";
-const std::string KEYNAME_STATES           = "states";
-const std::string KEYNAME_STYLES           = "styles";
-const std::string KEYNAME_TEMPLATES        = "templates";
-const std::string KEYNAME_TRANSITIONS      = "transitions";
-const std::string KEYNAME_TYPE             = "type";
-const std::string KEYNAME_VISUALS          = "visuals";
-
-const std::string PROPERTIES            = "properties";
-const std::string ANIMATABLE_PROPERTIES = "animatableProperties";
+const char* KEYNAME_ACTORS           = "actors";
+const char* KEYNAME_ENTRY_TRANSITION = "entryTransition";
+const char* KEYNAME_EXIT_TRANSITION  = "exitTransition";
+const char* KEYNAME_INCLUDES         = "includes";
+const char* KEYNAME_INHERIT          = "inherit";
+const char* KEYNAME_MAPPINGS         = "mappings";
+const char* KEYNAME_SIGNALS          = "signals";
+const char* KEYNAME_STATES           = "states";
+const char* KEYNAME_STYLES           = "styles";
+const char* KEYNAME_TEMPLATES        = "templates";
+const char* KEYNAME_TRANSITIONS      = "transitions";
+const char* KEYNAME_TYPE             = "type";
+const char* KEYNAME_VISUALS          = "visuals";
+
+const char* PROPERTIES            = "properties";
+const char* ANIMATABLE_PROPERTIES = "animatableProperties";
 
 typedef std::vector<const TreeNode*> TreeNodeList;
 
index 23f9204..76de885 100644 (file)
 
 namespace
 {
-const std::string READING_INFO_TYPE_NAME           = "name";
-const std::string READING_INFO_TYPE_ROLE           = "role";
-const std::string READING_INFO_TYPE_DESCRIPTION    = "description";
-const std::string READING_INFO_TYPE_STATE          = "state";
-const std::string READING_INFO_TYPE_ATTRIBUTE_NAME = "reading_info_type";
-const std::string READING_INFO_TYPE_SEPARATOR      = "|";
+const char* READING_INFO_TYPE_NAME           = "name";
+const char* READING_INFO_TYPE_ROLE           = "role";
+const char* READING_INFO_TYPE_DESCRIPTION    = "description";
+const char* READING_INFO_TYPE_STATE          = "state";
+const char* READING_INFO_TYPE_ATTRIBUTE_NAME = "reading_info_type";
+const char* READING_INFO_TYPE_SEPARATOR      = "|";
 } // namespace
 
 namespace Dali
index 77eb533..e93057d 100644 (file)
@@ -36,7 +36,7 @@ namespace
 const char* const IMAGE_BRDF_FILE_NAME = "brdfLUT.png";
 
 // glTF file extension
-const std::string GLTF_EXT(".gltf");
+const char* GLTF_EXT(".gltf");
 
 /**
  * cube map face index
index 8d3c203..14d2de7 100644 (file)
@@ -70,25 +70,25 @@ const unsigned int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::DevelText::DEFAULT
  * The alignment depends on the alignment value of the text label (Use Text::VerticalAlignment enumerations).
  */
 const float VERTICAL_ALIGNMENT_TABLE[Text::VerticalAlignment::BOTTOM + 1] =
-  {
+{
     0.0f, // VerticalAlignment::TOP
     0.5f, // VerticalAlignment::CENTER
     1.0f  // VerticalAlignment::BOTTOM
 };
 
-const std::string TEXT_FIT_ENABLE_KEY("enable");
-const std::string TEXT_FIT_MIN_SIZE_KEY("minSize");
-const std::string TEXT_FIT_MAX_SIZE_KEY("maxSize");
-const std::string TEXT_FIT_STEP_SIZE_KEY("stepSize");
-const std::string TEXT_FIT_FONT_SIZE_KEY("fontSize");
-const std::string TEXT_FIT_FONT_SIZE_TYPE_KEY("fontSizeType");
+const char* TEXT_FIT_ENABLE_KEY("enable");
+const char* TEXT_FIT_MIN_SIZE_KEY("minSize");
+const char* TEXT_FIT_MAX_SIZE_KEY("maxSize");
+const char* TEXT_FIT_STEP_SIZE_KEY("stepSize");
+const char* TEXT_FIT_FONT_SIZE_KEY("fontSize");
+const char* TEXT_FIT_FONT_SIZE_TYPE_KEY("fontSizeType");
 
 #if defined(DEBUG_ENABLED)
 Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, true, "LOG_TEXT_CONTROLS");
 #endif
 
 const Scripting::StringEnum AUTO_SCROLL_STOP_MODE_TABLE[] =
-  {
+{
     {"IMMEDIATE", Toolkit::TextLabel::AutoScrollStopMode::IMMEDIATE},
     {"FINISH_LOOP", Toolkit::TextLabel::AutoScrollStopMode::FINISH_LOOP},
 };
index 862a69c..50d7d3d 100644 (file)
@@ -57,7 +57,7 @@ namespace
 #define GET_LOCALE_TEXT(string) dgettext("dali-toolkit", string)
 #endif
 
-const std::string   TEXT_SELECTION_POPUP_BUTTON_STYLE_NAME("TextSelectionPopupButton");
+const char*   TEXT_SELECTION_POPUP_BUTTON_STYLE_NAME("TextSelectionPopupButton");
 const Dali::Vector4 DEFAULT_OPTION_PRESSED_COLOR(Dali::Vector4(0.24f, 0.72f, 0.8f, 1.0f));
 const float         DEFAULT_OPTION_PRESSED_CORNER_RADIUS = 0.0f;
 const Dali::Vector4 DEFAULT_LABEL_PADDING(Dali::Vector4(24.0f, 24.0f, 14.0f, 14.0f));
@@ -93,8 +93,8 @@ const char* const OPTION_COPY("optionCopy");                 // "Copy" popup opt
 const char* const OPTION_PASTE("optionPaste");               // "Paste" popup option.
 const char* const OPTION_CLIPBOARD("optionClipboard");       // "Clipboard" popup option.
 
-const std::string IDS_LTR("IDS_LTR");
-const std::string RTL_DIRECTION("RTL");
+const char* IDS_LTR("IDS_LTR");
+const char* RTL_DIRECTION("RTL");
 
 BaseHandle Create()
 {
@@ -726,10 +726,10 @@ void TextSelectionPopup::AddPopupOptionsToToolbar(bool showIcons, bool showCapti
   // Whether to mirror the list of buttons (for right to left languages)
   bool mirror = false;
 #if defined(__GLIBC__)
-  char* idsLtr = GET_LOCALE_TEXT(IDS_LTR.c_str());
+  char* idsLtr = GET_LOCALE_TEXT(IDS_LTR);
   if(NULL != idsLtr)
   {
-    mirror = (0 == strcmp(idsLtr, RTL_DIRECTION.c_str()));
+    mirror = (0 == strcmp(idsLtr, RTL_DIRECTION));
 
     if(mirror)
     {
index 6321695..716a151 100755 (executable)
@@ -51,6 +51,7 @@
 
 #include <functional>
 #include <memory>
+#include <unordered_map>
 
 namespace Dali
 {
@@ -89,10 +90,13 @@ DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "loadProgressPercentage",  FLOAT,
 DALI_TYPE_REGISTRATION_END()
 // clang-format on
 
+std::unordered_map<Dali::WebEnginePlugin*, Dali::WeakHandle<Toolkit::WebView>>& GetPluginWebViewTable()
+{
+  static std::unordered_map<Dali::WebEnginePlugin*, Dali::WeakHandle<Toolkit::WebView>> pluginWebViewMap;
+  return pluginWebViewMap;
+}
 } // namespace
 
-std::unordered_map<Dali::WebEnginePlugin*, Dali::WeakHandle<Toolkit::WebView>> WebView::mPluginWebViewMap;
-
 WebView::WebView(const std::string& locale, const std::string& timezoneId)
 : Control(ControlBehaviour(ACTOR_BEHAVIOUR_DEFAULT | DISABLE_STYLE_CHANGE_SIGNALS)),
   mVisual(),
@@ -144,10 +148,10 @@ WebView::~WebView()
 {
   if(mWebEngine)
   {
-    auto iter = mPluginWebViewMap.find(mWebEngine.GetPlugin());
-    if (iter != mPluginWebViewMap.end())
+    auto iter = GetPluginWebViewTable().find(mWebEngine.GetPlugin());
+    if (iter != GetPluginWebViewTable().end())
     {
-      mPluginWebViewMap.erase(iter);
+      GetPluginWebViewTable().erase(iter);
     }
     mWebEngine.Destroy();
   }
@@ -159,7 +163,7 @@ Toolkit::WebView WebView::New()
   Toolkit::WebView handle = Toolkit::WebView(*impl);
   if (impl->GetPlugin())
   {
-    mPluginWebViewMap[impl->GetPlugin()] = handle;
+    GetPluginWebViewTable()[impl->GetPlugin()] = handle;
   }
   impl->Initialize();
   return handle;
@@ -171,7 +175,7 @@ Toolkit::WebView WebView::New(const std::string& locale, const std::string& time
   Toolkit::WebView handle = Toolkit::WebView(*impl);
   if (impl->GetPlugin())
   {
-    mPluginWebViewMap[impl->GetPlugin()] = handle;
+    GetPluginWebViewTable()[impl->GetPlugin()] = handle;
   }
   impl->Initialize();
   return handle;
@@ -183,7 +187,7 @@ Toolkit::WebView WebView::New(uint32_t argc, char** argv)
   Toolkit::WebView handle = Toolkit::WebView(*impl);
   if (impl->GetPlugin())
   {
-    mPluginWebViewMap[impl->GetPlugin()] = handle;
+    GetPluginWebViewTable()[impl->GetPlugin()] = handle;
   }
   impl->Initialize();
   return handle;
@@ -191,8 +195,8 @@ Toolkit::WebView WebView::New(uint32_t argc, char** argv)
 
 Toolkit::WebView WebView::FindWebView(Dali::WebEnginePlugin* plugin)
 {
-  auto iter = mPluginWebViewMap.find(plugin);
-  if (iter != mPluginWebViewMap.end())
+  auto iter = GetPluginWebViewTable().find(plugin);
+  if (iter != GetPluginWebViewTable().end())
   {
     return iter->second.GetHandle();
   }
index fc5d06a..61834a2 100755 (executable)
@@ -25,7 +25,6 @@
 #include <dali/public-api/images/image-operations.h>
 #include <dali/public-api/object/property-notification.h>
 #include <memory>
-#include <unordered_map>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/devel-api/controls/control-accessible.h>
@@ -725,8 +724,6 @@ private:
 
   Dali::Toolkit::WebView::WebViewScreenshotCapturedCallback mScreenshotCapturedCallback;
   Dali::WebEnginePlugin::WebEngineFrameRenderedCallback     mFrameRenderedCallback;
-
-  static std::unordered_map<Dali::WebEnginePlugin*, Dali::WeakHandle<Toolkit::WebView>> mPluginWebViewMap;
 };
 
 } // namespace Internal
index 1e8607e..a5ed3b1 100644 (file)
@@ -94,8 +94,6 @@ struct FeedbackStyleInfo
   SignalFeedbackInfoContainer mSignalFeedbackInfoList;
 };
 
-static const FeedbackStyleInfo DEFAULT_FEEDBACK_STYLE_INFO;
-
 FeedbackStyle::FeedbackStyle()
 {
   mFeedback = Dali::FeedbackPlayer::Get();
@@ -180,6 +178,7 @@ const FeedbackStyleInfo& FeedbackStyle::GetStyleInfo(const std::string& type) co
   }
   else
   {
+    static const FeedbackStyleInfo DEFAULT_FEEDBACK_STYLE_INFO;
     return DEFAULT_FEEDBACK_STYLE_INFO;
   }
 }
index 707aa68..380da05 100644 (file)
@@ -220,7 +220,7 @@ bool KeyboardFocusManager::DoSetCurrentFocusActor(Actor actor)
     {
       if(!parent.GetProperty<bool>(DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN))
       {
-        DALI_LOG_INFO(gLogFilter, Debug::General, "[%s:%d] Parent Actor has KEYBOARD_FOCUSABLE_CHILDREN false\n", __FUNCTION__, __LINE__);
+        DALI_LOG_DEBUG_INFO("Parent Actor has KEYBOARD_FOCUSABLE_CHILDREN false\n");
         return false;
       }
       parent = parent.GetParent();
@@ -228,6 +228,7 @@ bool KeyboardFocusManager::DoSetCurrentFocusActor(Actor actor)
 
     // If developer set focus on same actor, doing nothing
     Actor currentFocusedActor = GetCurrentFocusActor();
+    DALI_LOG_DEBUG_INFO("current focused actor : [%p] new focused actor : [%p]\n", currentFocusedActor.GetObjectPtr(), actor.GetObjectPtr());
     if(actor == currentFocusedActor)
     {
       return true;
@@ -1097,13 +1098,16 @@ void KeyboardFocusManager::OnWindowFocusChanged(Window window, bool focusIn)
 
     // Get Current Focused Actor from window
     Actor currentFocusedActor = GetFocusActorFromCurrentWindow();
-    SetCurrentFocusActor(currentFocusedActor);
-
-    if(currentFocusedActor && (mEnableFocusIndicator == ENABLE))
+    if(currentFocusedActor)
     {
-      // Make sure the focused actor is highlighted
-      currentFocusedActor.Add(GetFocusIndicatorActor());
-      mIsFocusIndicatorShown = SHOW;
+      SetCurrentFocusActor(currentFocusedActor);
+
+      if(mEnableFocusIndicator == ENABLE)
+      {
+        // Make sure the focused actor is highlighted
+        currentFocusedActor.Add(GetFocusIndicatorActor());
+        mIsFocusIndicatorShown = SHOW;
+      }
     }
   }
 }
index 5323d35..f7bd90a 100644 (file)
@@ -39,11 +39,11 @@ Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, true, "LOG_TEXT
 
 DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_TEXT_PERFORMANCE_MARKER, false);
 
-const std::string KEY_C_NAME      = "c";
-const std::string KEY_V_NAME      = "v";
-const std::string KEY_X_NAME      = "x";
-const std::string KEY_A_NAME      = "a";
-const std::string KEY_INSERT_NAME = "Insert";
+const char* KEY_C_NAME      = "c";
+const char* KEY_V_NAME      = "v";
+const char* KEY_X_NAME      = "x";
+const char* KEY_A_NAME      = "a";
+const char* KEY_INSERT_NAME = "Insert";
 
 } // namespace
 
index c483114..7752360 100644 (file)
@@ -51,7 +51,7 @@ Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, true, "LOG_TEXT
 
 constexpr float MAX_FLOAT = std::numeric_limits<float>::max();
 
-const std::string EMPTY_STRING("");
+const char* EMPTY_STRING = "";
 
 } // namespace
 
index a1e6214..f2d49d2 100644 (file)
@@ -131,7 +131,7 @@ void Controller::InputFontHandler::SetInputFontFamily(Controller& controller, co
   }
 }
 
-const std::string& Controller::InputFontHandler::GetInputFontFamily(const Controller& controller)
+std::string Controller::InputFontHandler::GetInputFontFamily(const Controller& controller)
 {
   if(NULL != controller.mImpl->mEventData)
   {
index 2ac7464..bf38a00 100644 (file)
@@ -34,7 +34,7 @@ namespace Text
 struct Controller::InputFontHandler
 {
   static void               SetInputFontFamily(Controller& controller, const std::string& fontFamily);
-  static const std::string& GetInputFontFamily(const Controller& controller);
+  static std::string        GetInputFontFamily(const Controller& controller);
   static void               SetInputFontWeight(const Controller& controller, FontWeight weight);
   static bool               IsInputFontWeightDefined(const Controller& controller);
   static FontWeight         GetInputFontWeight(const Controller& controller);
index f410187..7842d05 100644 (file)
@@ -38,7 +38,7 @@
 
 namespace
 {
-const std::string EMPTY_STRING("");
+const char* EMPTY_STRING = "";
 }
 
 namespace Dali::Toolkit::Text
@@ -116,7 +116,7 @@ void Controller::InputProperties::SetInputShadowProperties(Controller& controlle
   }
 }
 
-const std::string& Controller::InputProperties::GetInputShadowProperties(const Controller& controller)
+std::string Controller::InputProperties::GetInputShadowProperties(const Controller& controller)
 {
   return controller.mImpl->mEventData ? controller.mImpl->mEventData->mInputStyle.shadowProperties : EMPTY_STRING;
 }
@@ -129,7 +129,7 @@ void Controller::InputProperties::SetInputUnderlineProperties(Controller& contro
   }
 }
 
-const std::string& Controller::InputProperties::GetInputUnderlineProperties(const Controller& controller)
+std::string Controller::InputProperties::GetInputUnderlineProperties(const Controller& controller)
 {
   return controller.mImpl->mEventData ? controller.mImpl->mEventData->mInputStyle.underlineProperties : EMPTY_STRING;
 }
@@ -142,7 +142,7 @@ void Controller::InputProperties::SetInputEmbossProperties(Controller& controlle
   }
 }
 
-const std::string& Controller::InputProperties::GetInputEmbossProperties(const Controller& controller)
+std::string Controller::InputProperties::GetInputEmbossProperties(const Controller& controller)
 {
   return controller.mImpl->mEventData ? controller.mImpl->mEventData->mInputStyle.embossProperties : controller.GetDefaultEmbossProperties();
 }
@@ -155,7 +155,7 @@ void Controller::InputProperties::SetInputOutlineProperties(Controller& controll
   }
 }
 
-const std::string& Controller::InputProperties::GetInputOutlineProperties(const Controller& controller)
+std::string Controller::InputProperties::GetInputOutlineProperties(const Controller& controller)
 {
   return controller.mImpl->mEventData ? controller.mImpl->mEventData->mInputStyle.outlineProperties : controller.GetDefaultOutlineProperties();
 }
index b0736f7..9b31d22 100644 (file)
@@ -39,19 +39,19 @@ struct Controller::InputProperties
 
   static void SetInputShadowProperties(Controller& controller, const std::string& shadowProperties);
 
-  static const std::string& GetInputShadowProperties(const Controller& controller);
+  static std::string GetInputShadowProperties(const Controller& controller);
 
   static void SetInputUnderlineProperties(Controller& controller, const std::string& underlineProperties);
 
-  static const std::string& GetInputUnderlineProperties(const Controller& controller);
+  static std::string GetInputUnderlineProperties(const Controller& controller);
 
   static void SetInputEmbossProperties(Controller& controller, const std::string& embossProperties);
 
-  static const std::string& GetInputEmbossProperties(const Controller& controller);
+  static std::string GetInputEmbossProperties(const Controller& controller);
 
   static void SetInputOutlineProperties(Controller& controller, const std::string& outlineProperties);
 
-  static const std::string& GetInputOutlineProperties(const Controller& controller);
+  static std::string GetInputOutlineProperties(const Controller& controller);
 
   static void SetInputModePassword(Controller& controller, bool passwordInput);
 
index da15a43..a0f03a6 100644 (file)
@@ -33,7 +33,7 @@ namespace
 Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, true, "LOG_TEXT_CONTROLS");
 #endif
 
-const std::string EMPTY_STRING("");
+const char* EMPTY_STRING = "";
 
 const char* const PLACEHOLDER_TEXT         = "text";
 const char* const PLACEHOLDER_TEXT_FOCUSED = "textFocused";
@@ -122,7 +122,7 @@ void Controller::PlaceholderHandler::SetPlaceholderFontFamily(Controller& contro
   }
 }
 
-const std::string& Controller::PlaceholderHandler::GetPlaceholderFontFamily(const Controller& controller)
+std::string Controller::PlaceholderHandler::GetPlaceholderFontFamily(const Controller& controller)
 {
   if((NULL != controller.mImpl->mEventData) && (NULL != controller.mImpl->mEventData->mPlaceholderFont))
   {
index c7107c9..3bbf87b 100644 (file)
@@ -39,7 +39,7 @@ struct Controller::PlaceholderHandler
   static void               SetPlaceholderText(Controller& controller, PlaceholderType type, const std::string& text);
   static void               GetPlaceholderText(const Controller& controller, PlaceholderType type, std::string& text);
   static void               SetPlaceholderFontFamily(Controller& controller, const std::string& placeholderTextFontFamily);
-  static const std::string& GetPlaceholderFontFamily(const Controller& controller);
+  static std::string        GetPlaceholderFontFamily(const Controller& controller);
   static void               SetPlaceholderTextFontWeight(Controller& controller, FontWeight weight);
   static bool               IsPlaceholderTextFontWeightDefined(const Controller& controller);
   static FontWeight         GetPlaceholderTextFontWeight(const Controller& controller);
index 8aba938..d323bd8 100644 (file)
@@ -99,6 +99,13 @@ Size Controller::Relayouter::CalculateLayoutSizeOnRequiredControllerSize(Control
 
   if(!isEditable)
   {
+    if(NO_OPERATION != (VALIDATE_FONTS & operationsPending) &&
+       textUpdateInfo.mCharacterIndex == static_cast<CharacterIndex>(-1))
+    {
+      impl.ClearFontData();
+      updateInfoCharIndexBackup = textUpdateInfo.mCharacterIndex;
+    }
+
     impl.UpdateModel(onlyOnceOperations);
 
     // Layout the text for the new width.
index b66cd3c..810cd1a 100644 (file)
@@ -45,7 +45,7 @@ namespace
 Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, true, "LOG_TEXT_CONTROLS");
 #endif
 
-const std::string EMPTY_STRING("");
+const char* EMPTY_STRING = "";
 
 template<typename Type>
 void EnsureCreated(Type*& object)
@@ -538,7 +538,7 @@ void Controller::SetDefaultFontFamily(const std::string& defaultFontFamily)
   }
 }
 
-const std::string& Controller::GetDefaultFontFamily() const
+std::string Controller::GetDefaultFontFamily() const
 {
   return mImpl->mFontDefaults ? mImpl->mFontDefaults->mFontDescription.family : EMPTY_STRING;
 }
@@ -548,7 +548,7 @@ void Controller::SetPlaceholderFontFamily(const std::string& placeholderTextFont
   PlaceholderHandler::SetPlaceholderFontFamily(*this, placeholderTextFontFamily);
 }
 
-const std::string& Controller::GetPlaceholderFontFamily() const
+std::string Controller::GetPlaceholderFontFamily() const
 {
   return PlaceholderHandler::GetPlaceholderFontFamily(*this);
 }
@@ -945,7 +945,7 @@ void Controller::SetDefaultEmbossProperties(const std::string& embossProperties)
   mImpl->mEmbossDefaults->properties = embossProperties;
 }
 
-const std::string& Controller::GetDefaultEmbossProperties() const
+std::string Controller::GetDefaultEmbossProperties() const
 {
   return mImpl->mEmbossDefaults ? mImpl->mEmbossDefaults->properties : EMPTY_STRING;
 }
@@ -956,7 +956,7 @@ void Controller::SetDefaultOutlineProperties(const std::string& outlinePropertie
   mImpl->mOutlineDefaults->properties = outlineProperties;
 }
 
-const std::string& Controller::GetDefaultOutlineProperties() const
+std::string Controller::GetDefaultOutlineProperties() const
 {
   return mImpl->mOutlineDefaults ? mImpl->mOutlineDefaults->properties : EMPTY_STRING;
 }
@@ -1006,7 +1006,7 @@ void Controller::SetInputFontFamily(const std::string& fontFamily)
   InputFontHandler::SetInputFontFamily(*this, fontFamily);
 }
 
-const std::string& Controller::GetInputFontFamily() const
+std::string Controller::GetInputFontFamily() const
 {
   return InputFontHandler::GetInputFontFamily(*this);
 }
@@ -1081,7 +1081,7 @@ void Controller::SetInputShadowProperties(const std::string& shadowProperties)
   InputProperties::SetInputShadowProperties(*this, shadowProperties);
 }
 
-const std::string& Controller::GetInputShadowProperties() const
+std::string Controller::GetInputShadowProperties() const
 {
   return InputProperties::GetInputShadowProperties(*this);
 }
@@ -1091,7 +1091,7 @@ void Controller::SetInputUnderlineProperties(const std::string& underlinePropert
   InputProperties::SetInputUnderlineProperties(*this, underlineProperties);
 }
 
-const std::string& Controller::GetInputUnderlineProperties() const
+std::string Controller::GetInputUnderlineProperties() const
 {
   return InputProperties::GetInputUnderlineProperties(*this);
 }
@@ -1101,7 +1101,7 @@ void Controller::SetInputEmbossProperties(const std::string& embossProperties)
   InputProperties::SetInputEmbossProperties(*this, embossProperties);
 }
 
-const std::string& Controller::GetInputEmbossProperties() const
+std::string Controller::GetInputEmbossProperties() const
 {
   return InputProperties::GetInputEmbossProperties(*this);
 }
@@ -1111,7 +1111,7 @@ void Controller::SetInputOutlineProperties(const std::string& outlineProperties)
   InputProperties::SetInputOutlineProperties(*this, outlineProperties);
 }
 
-const std::string& Controller::GetInputOutlineProperties() const
+std::string Controller::GetInputOutlineProperties() const
 {
   return InputProperties::GetInputOutlineProperties(*this);
 }
@@ -1236,7 +1236,7 @@ void Controller::SetInputStrikethroughProperties(const std::string& strikethroug
   }
 }
 
-const std::string& Controller::GetInputStrikethroughProperties() const
+std::string Controller::GetInputStrikethroughProperties() const
 {
   return (NULL != mImpl->mEventData) ? mImpl->mEventData->mInputStyle.strikethroughProperties : EMPTY_STRING;
 }
index 0a1b057..55953f4 100644 (file)
@@ -829,7 +829,7 @@ public: // Default style & Input style
    *
    * @return The default font family.
    */
-  const std::string& GetDefaultFontFamily() const;
+  std::string GetDefaultFontFamily() const;
 
   /**
    * @brief Sets the placeholder text font family.
@@ -842,7 +842,7 @@ public: // Default style & Input style
    *
    * @return The placeholder text font family
    */
-  const std::string& GetPlaceholderFontFamily() const;
+  std::string GetPlaceholderFontFamily() const;
 
   /**
    * @brief Sets the default font weight.
@@ -1258,7 +1258,7 @@ public: // Default style & Input style
    *
    * @return The emboss's properties string.
    */
-  const std::string& GetDefaultEmbossProperties() const;
+  std::string GetDefaultEmbossProperties() const;
 
   /**
    * @brief Sets the outline's properties string.
@@ -1274,7 +1274,7 @@ public: // Default style & Input style
    *
    * @return The outline's properties string.
    */
-  const std::string& GetDefaultOutlineProperties() const;
+  std::string GetDefaultOutlineProperties() const;
 
   /**
    * @brief Sets the default line spacing.
@@ -1350,7 +1350,7 @@ public: // Default style & Input style
    *
    * @return The input text's font family name.
    */
-  const std::string& GetInputFontFamily() const;
+  std::string GetInputFontFamily() const;
 
   /**
    * @brief Sets the input font's weight.
@@ -1451,7 +1451,7 @@ public: // Default style & Input style
    *
    * @return The shadow's properties string.
    */
-  const std::string& GetInputShadowProperties() const;
+  std::string GetInputShadowProperties() const;
 
   /**
    * @brief Sets the input underline's properties string.
@@ -1467,7 +1467,7 @@ public: // Default style & Input style
    *
    * @return The underline's properties string.
    */
-  const std::string& GetInputUnderlineProperties() const;
+  std::string GetInputUnderlineProperties() const;
 
   /**
    * @brief Sets the input emboss's properties string.
@@ -1483,7 +1483,7 @@ public: // Default style & Input style
    *
    * @return The emboss's properties string.
    */
-  const std::string& GetInputEmbossProperties() const;
+  std::string GetInputEmbossProperties() const;
 
   /**
    * @brief Sets input the outline's properties string.
@@ -1499,7 +1499,7 @@ public: // Default style & Input style
    *
    * @return The outline's properties string.
    */
-  const std::string& GetInputOutlineProperties() const;
+  std::string GetInputOutlineProperties() const;
 
   /**
    * @brief Sets the input strikethrough's properties string.
@@ -1515,7 +1515,7 @@ public: // Default style & Input style
    *
    * @return The strikethrough's properties string.
    */
-  const std::string& GetInputStrikethroughProperties() const;
+  std::string GetInputStrikethroughProperties() const;
 
   /**
    * @brief Set the control's interface.
index 8e9ec06..f39afce 100644 (file)
@@ -35,8 +35,7 @@ namespace Text
 {
 namespace
 {
-const std::string NONE("none");
-const std::string MULTIPLY("multiply");
+const char* MULTIPLY = "multiply";
 } // namespace
 
 void ProcessEmbeddedItem(const Tag& tag, EmbeddedItem& embeddedItem)
index 133d7fa..13afaa0 100644 (file)
@@ -37,9 +37,6 @@ namespace Text
 {
 namespace
 {
-const std::string  FONT_PREFIX("font-");
-const unsigned int FONT_PREFIX_LENGTH      = 5u;
-const unsigned int MIN_FONT_ATTRIBUTE_SIZE = 4u;   ///< The minimum length of any of the possible 'weight', 'width' , 'slant' or 'size' values.
 const unsigned int MAX_FONT_ATTRIBUTE_SIZE = 15u;  ///< The maximum length of any of the possible 'weight', 'width' or 'slant' values.
 const float        PIXEL_FORMAT_64_FACTOR  = 64.f; ///< 64.f is used to convert from point size to 26.6 pixel format.
 } // namespace
index b0ac16b..f7ed507 100644 (file)
@@ -44,23 +44,23 @@ const char        WEB_COLOR_TOKEN('#');
 const char* const HEX_COLOR_TOKEN("0x");
 const char* const ALPHA_ONE("FF");
 
-const std::string BLACK_COLOR("black");
-const std::string WHITE_COLOR("white");
-const std::string RED_COLOR("red");
-const std::string GREEN_COLOR("green");
-const std::string BLUE_COLOR("blue");
-const std::string YELLOW_COLOR("yellow");
-const std::string MAGENTA_COLOR("magenta");
-const std::string CYAN_COLOR("cyan");
-const std::string TRANSPARENT_COLOR("transparent");
-
-const std::string SOLID_UNDERLINE("solid");
-const std::string DASHED_UNDERLINE("dashed");
-const std::string DOUBLE_UNDERLINE("double");
-
-const std::string BEGIN_HORIZONTAL_ALIGNMENT("begin");
-const std::string CENTER_HORIZONTAL_ALIGNMENT("center");
-const std::string END_HORIZONTAL_ALIGNMENT("end");
+const char* BLACK_COLOR("black");
+const char* WHITE_COLOR("white");
+const char* RED_COLOR("red");
+const char* GREEN_COLOR("green");
+const char* BLUE_COLOR("blue");
+const char* YELLOW_COLOR("yellow");
+const char* MAGENTA_COLOR("magenta");
+const char* CYAN_COLOR("cyan");
+const char* TRANSPARENT_COLOR("transparent");
+
+const char* SOLID_UNDERLINE("solid");
+const char* DASHED_UNDERLINE("dashed");
+const char* DOUBLE_UNDERLINE("double");
+
+const char* BEGIN_HORIZONTAL_ALIGNMENT("begin");
+const char* CENTER_HORIZONTAL_ALIGNMENT("center");
+const char* END_HORIZONTAL_ALIGNMENT("end");
 
 } // namespace
 
index b166c99..a65a4f2 100644 (file)
@@ -24,10 +24,6 @@ namespace Toolkit
 {
 namespace Text
 {
-namespace
-{
-static const Vector<CharacterSpacingGlyphRun> EMPTY_CHARACTER_SPACING_GLYPH_RUNS;
-}
 float GetGlyphCharacterSpacing(const GlyphIndex&                       index,
                                const Vector<CharacterSpacingGlyphRun>& characterSpacingGlyphRuns,
                                const float                             modelCharacterSpacing)
@@ -50,14 +46,8 @@ float GetGlyphCharacterSpacing(const GlyphIndex&                       index,
 
   return characterSpacing;
 }
-
-const Vector<CharacterSpacingGlyphRun>& GetEmptyCharacterSpacingGlyphRuns()
-{
-  // This is needed to return a common empty vector for CharacterSpacingGlyphRun
-  return EMPTY_CHARACTER_SPACING_GLYPH_RUNS;
-}
 } // namespace Text
 
 } // namespace Toolkit
 
-} // namespace Dali
\ No newline at end of file
+} // namespace Dali
index 3865b97..a15aa5e 100644 (file)
@@ -44,18 +44,10 @@ namespace Text
 float GetGlyphCharacterSpacing(const GlyphIndex&                       index,
                                const Vector<CharacterSpacingGlyphRun>& characterSpacingGlyphRuns,
                                const float                             modelCharacterSpacing);
-
-/**
- * @brief Create static empty vector and retrun it.
- *
- * @return The reference for the empty character-spacing glyph runs.
- */
-const Vector<CharacterSpacingGlyphRun>& GetEmptyCharacterSpacingGlyphRuns();
-
 } // namespace Text
 
 } // namespace Toolkit
 
 } // namespace Dali
 
-#endif // DALI_TOOLKIT_TEXT_RENDERING_STYLES_CHARACTER_SPACING_HELPER_FUNCTIONS_H
\ No newline at end of file
+#endif // DALI_TOOLKIT_TEXT_RENDERING_STYLES_CHARACTER_SPACING_HELPER_FUNCTIONS_H
index 1428b95..2bf1398 100644 (file)
@@ -35,17 +35,16 @@ namespace Text
 {
 namespace
 {
-const std::string COLOR_KEY("color");
-const std::string OFFSET_KEY("offset");
-const std::string BLUR_RADIUS_KEY("blurRadius");
-const std::string WIDTH_KEY("width");
-const std::string HEIGHT_KEY("height");
-const std::string ENABLE_KEY("enable");
-const std::string TYPE_KEY("type");
-const std::string DASH_WIDTH_KEY("dashWidth");
-const std::string DASH_GAP_KEY("dashGap");
-const std::string TRUE_TOKEN("true");
-const std::string FALSE_TOKEN("false");
+const char* COLOR_KEY = "color";
+const char* OFFSET_KEY = "offset";
+const char* BLUR_RADIUS_KEY = "blurRadius";
+const char* WIDTH_KEY = "width";
+const char* HEIGHT_KEY = "height";
+const char* ENABLE_KEY = "enable";
+const char* TYPE_KEY = "type";
+const char* DASH_WIDTH_KEY = "dashWidth";
+const char* DASH_GAP_KEY = "dashGap";
+const char* TRUE_TOKEN = "true";
 } // namespace
 
 bool ParseShadowProperties(const Property::Map& shadowPropertiesMap,
index ce5e860..f087a1e 100644 (file)
@@ -33,14 +33,13 @@ namespace Text
 {
 namespace
 {
-const std::string STYLE_KEY("style");
-const std::string WEIGHT_KEY("weight");
-const std::string WIDTH_KEY("width");
-const std::string SLANT_KEY("slant");
-const std::string FAMILY_KEY("family");
-const std::string TYPE_KEY("type");
-
-const std::string SYSTEM_TOKEN("system");
+const char* WEIGHT_KEY = "weight";
+const char* WIDTH_KEY = "width";
+const char* SLANT_KEY = "slant";
+const char* FAMILY_KEY = "family";
+const char* TYPE_KEY = "type";
+
+const char* SYSTEM_TOKEN = "system";
 
 } // namespace
 
index 8a23485..24fcfff 100644 (file)
@@ -353,20 +353,6 @@ public:
   virtual const Vector<BoundedParagraphRun>& GetBoundedParagraphRuns() const = 0;
 
   /**
-   * @brief Retrieves the number of character-spacing glyph runs.
-   *
-   * @return The number of character-spacing glyph runs.
-   */
-  virtual Length GetNumberOfCharacterSpacingGlyphRuns() const = 0;
-
-  /**
-   * @brief Retrieves the reference for character-spacing glyph runs.
-   *
-   * @return The reference for character-spacing glyph runs.
-   */
-  virtual const Vector<CharacterSpacingGlyphRun>& GetCharacterSpacingGlyphRuns() const = 0;
-
-  /**
    * @brief Retrieves the strikethrough runs.
    *
    * @param[out] strikethroughRuns Pointer to a buffer where the strikethrough runs are copied.
index e89d434..334d922 100644 (file)
@@ -917,24 +917,14 @@ const Vector<BoundedParagraphRun>& View::GetBoundedParagraphRuns() const
   return mImpl->mLogicalModel->GetBoundedParagraphRuns();
 }
 
-Length View::GetNumberOfCharacterSpacingGlyphRuns() const
-{
-  return (mImpl->mVisualModel) ? mImpl->mVisualModel->GetNumberOfCharacterSpacingGlyphRuns() : 0u;
-}
-
-const Vector<CharacterSpacingGlyphRun>& View::GetCharacterSpacingGlyphRuns() const
-{
-  return (mImpl->mVisualModel) ? mImpl->mVisualModel->GetCharacterSpacingGlyphRuns() : GetEmptyCharacterSpacingGlyphRuns();
-}
-
 float View::GetCharacterSpacing() const
 {
-  return (mImpl->mVisualModel) ? mImpl->mVisualModel->GetCharacterSpacing() : 0.f;
+  return mImpl->mVisualModel->GetCharacterSpacing();
 }
 
 const Character* View::GetTextBuffer() const
 {
-  return (mImpl->mVisualModel) ? mImpl->mLogicalModel->mText.Begin() : nullptr;
+  return mImpl->mLogicalModel->mText.Begin();
 }
 
 const Vector<CharacterIndex>& View::GetGlyphsToCharacters() const
index 893c802..5bf55e1 100644 (file)
@@ -269,16 +269,6 @@ public:
   virtual const Vector<BoundedParagraphRun>& GetBoundedParagraphRuns() const;
 
   /**
-   * @copydoc Dali::Toolkit::Text::ViewInterface::GetNumberOfCharacterSpacingGlyphRuns()
-   */
-  Length GetNumberOfCharacterSpacingGlyphRuns() const override;
-
-  /**
-   * @copydoc Dali::Toolkit::Text::ViewInterface::GetCharacterSpacingGlyphRuns()
-   */
-  const Vector<CharacterSpacingGlyphRun>& GetCharacterSpacingGlyphRuns() const override;
-
-  /**
    * @copydoc Dali::Toolkit::Text::ViewInterface::GetCharacterSpacing()
    */
   float GetCharacterSpacing() const override;
old mode 100644 (file)
new mode 100755 (executable)
index 5a88901..1c3ca66
@@ -36,20 +36,6 @@ namespace Internal
 {
 namespace
 {
-static constexpr float OPACITY_TRANSPARENT = 0.0f;
-
-const Dali::AlphaFunction DEFAULT_ALPHA_FUNCTION(Dali::AlphaFunction::DEFAULT);
-
-const Property::Map PROPERTY_MAP_INDEPENDENT_CONTROL{
-  {Dali::Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER},
-  {Dali::Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER},
-  {Dali::Actor::Property::POSITION_USES_ANCHOR_POINT, true},
-  {Dali::Actor::Property::INHERIT_POSITION, false},
-  {Dali::Actor::Property::INHERIT_ORIENTATION, false},
-  {Dali::Actor::Property::INHERIT_SCALE, false},
-  {Dali::Actor::Property::COLOR_MODE, Dali::ColorMode::USE_OWN_COLOR},
-};
-
 Property::Map GetOriginalProperties(Dali::Toolkit::Control control)
 {
   Property::Map propertyMap;
@@ -69,7 +55,6 @@ Property::Map GetOriginalProperties(Dali::Toolkit::Control control)
 
   return propertyMap;
 }
-
 } // anonymous namespace
 
 TransitionBasePtr TransitionBase::New()
@@ -83,7 +68,7 @@ TransitionBasePtr TransitionBase::New()
 }
 
 TransitionBase::TransitionBase()
-: mAlphaFunction(DEFAULT_ALPHA_FUNCTION),
+: mAlphaFunction(Dali::AlphaFunction::DEFAULT),
   mTimePeriod(TimePeriod(0.0f)),
   mTransitionWithChild(false),
   mMoveTargetChildren(false),
@@ -159,7 +144,14 @@ void TransitionBase::Play()
   targetWorldTransform.GetTransformComponents(targetPosition, targetOrientation, targetScale);
   Vector4 targetColor = DevelActor::GetWorldColor(mTarget);
 
-  mTarget.SetProperties(PROPERTY_MAP_INDEPENDENT_CONTROL);
+  mTarget[Dali::Actor::Property::ANCHOR_POINT]               = AnchorPoint::CENTER;
+  mTarget[Dali::Actor::Property::PARENT_ORIGIN]              = ParentOrigin::CENTER;
+  mTarget[Dali::Actor::Property::POSITION_USES_ANCHOR_POINT] = true;
+  mTarget[Dali::Actor::Property::INHERIT_POSITION]           = false;
+  mTarget[Dali::Actor::Property::INHERIT_ORIENTATION]        = false;
+  mTarget[Dali::Actor::Property::INHERIT_SCALE]              = false;
+  mTarget[Dali::Actor::Property::COLOR_MODE]                 = Dali::ColorMode::USE_OWN_COLOR;
+
   mTarget[Dali::Actor::Property::POSITION]    = targetPosition;
   mTarget[Dali::Actor::Property::SCALE]       = targetScale;
   mTarget[Dali::Actor::Property::ORIENTATION] = targetOrientation;
index 3f78a6f..332c9e0 100644 (file)
@@ -35,11 +35,6 @@ namespace Toolkit
 {
 namespace Internal
 {
-namespace
-{
-const Dali::AlphaFunction DEFAULT_ALPHA_FUNCTION(Dali::AlphaFunction::DEFAULT);
-} // anonymous namespace
-
 TransitionPtr Transition::New(Dali::Toolkit::Control source, Dali::Toolkit::Control destination, bool useDestinationTarget, TimePeriod timePeriod)
 {
   float delaySeconds = timePeriod.delaySeconds;
index f23456c..b6a9ae8 100644 (file)
@@ -43,9 +43,6 @@ Debug::Filter* gAnimImgLogFilter = Debug::Filter::New(Debug::NoLogging, false, "
 #else
 #define LOG_CACHE
 #endif
-
-static constexpr bool ENABLE_ORIENTATION_CORRECTION(true);
-
 } // namespace
 
 namespace Dali
index 728c219..2c98a4f 100644 (file)
@@ -35,12 +35,6 @@ namespace
 {
 const Vector4 FULL_TEXTURE_RECT(0.f, 0.f, 1.f, 1.f);
 
-// global string variable to caching complate vertex shader
-static std::string gVertexShader;
-
-// global string variable to caching complate fragment shader (no atlas)
-static std::string gFragmentShaderNoAtlas;
-
 const int NATIVE_SHADER_TYPE_OFFSET = VisualFactoryCache::ShaderType::NATIVE_IMAGE_SHADER - VisualFactoryCache::ShaderType::IMAGE_SHADER;
 
 // enum of required list when we select shader
@@ -279,6 +273,8 @@ Shader ImageVisualShaderFactory::GetShader(VisualFactoryCache& factoryCache, con
 
 std::string_view ImageVisualShaderFactory::GetVertexShaderSource()
 {
+  // static string variable to cache complete vertex shader
+  static std::string gVertexShader;
   if(gVertexShader.empty())
   {
     gVertexShader = Dali::Shader::GetVertexShaderPrefix() + SHADER_IMAGE_VISUAL_SHADER_VERT.data();
@@ -289,6 +285,8 @@ std::string_view ImageVisualShaderFactory::GetVertexShaderSource()
 
 std::string_view ImageVisualShaderFactory::GetFragmentShaderSource()
 {
+  // static string variable to cache complete fragment shader (no atlas)
+  static std::string gFragmentShaderNoAtlas;
   if(gFragmentShaderNoAtlas.empty())
   {
     gFragmentShaderNoAtlas = Dali::Shader::GetFragmentShaderPrefix() + SHADER_IMAGE_VISUAL_SHADER_FRAG.data();
index 5a2eba8..5f9b04b 100644 (file)
@@ -30,12 +30,6 @@ namespace Internal
 {
 namespace
 {
-// global string variable to caching complate vertex shader
-static std::string gVertexShader;
-
-// global string variable to caching complate fragment shader (no atlas)
-static std::string gFragmentShaderNoAtlas;
-
 // enum of required list when we select shader
 enum class TextVisualRequireFlag : uint32_t
 {
index 7b52284..3b6a6fc 100644 (file)
@@ -29,7 +29,7 @@ namespace Toolkit
 {
 const unsigned int TOOLKIT_MAJOR_VERSION = 2;
 const unsigned int TOOLKIT_MINOR_VERSION = 2;
-const unsigned int TOOLKIT_MICRO_VERSION = 14;
+const unsigned int TOOLKIT_MICRO_VERSION = 15;
 const char* const  TOOLKIT_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
index 38e80df..f6ebe63 100644 (file)
@@ -1,6 +1,6 @@
 Name:       dali2-toolkit
 Summary:    Dali 3D engine Toolkit
-Version:    2.2.14
+Version:    2.2.15
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0 and BSD-3-Clause and MIT