Dali 3D User Interface Engine
Namespaces | Classes | Functions
Dali::Scripting Namespace Reference

Utilities for scripting support. More...

Namespaces

namespace  anonymous_namespace{scripting.cpp}
 

Classes

struct  StringEnum
 Structure which stores an enumeration and its string equivalent. More...
 

Functions

bool EnumStringToInteger (const char *const value, const StringEnum *const table, unsigned int tableCount, unsigned int &integerEnum)
 Find the enum as an integer from the table. More...
 
unsigned int FindEnumIndex (const char *value, const StringEnum *table, unsigned int tableCount)
 Find the given enum index from the table. More...
 
ColorMode GetColorMode (const std::string &value)
 Takes a string and returns the appropriate color mode. More...
 
std::string GetColorMode (ColorMode value)
 Takes a color mode and returns the appropriate string equivalent. More...
 
PositionInheritanceMode GetPositionInheritanceMode (const std::string &value)
 Takes a string and returns the appropriate position inheritance mode. More...
 
std::string GetPositionInheritanceMode (PositionInheritanceMode value)
 Takes a position inheritance mode and returns the string equivalent. More...
 
DrawMode::Type GetDrawMode (const std::string &value)
 Takes a string and returns the appropriate draw mode. More...
 
std::string GetDrawMode (DrawMode::Type value)
 Takes a draw-mode and returns the string equivalent. More...
 
Vector3 GetAnchorConstant (const std::string &value)
 Takes a string and returns the appropriate anchor-point or parent-origin constant. More...
 
Image NewImage (const Property::Value &property)
 Creates object with data from the property value map. More...
 
ShaderEffect NewShaderEffect (const Property::Value &property)
 Creates object with data from the property value map. More...
 
Actor NewActor (const Property::Map &map)
 Creates an actor with the date from the property value map. More...
 
void CreatePropertyMap (Actor actor, Property::Map &map)
 Creates a Property::Map from the actor provided. More...
 
void CreatePropertyMap (Image image, Property::Map &map)
 Creates a Property::Map from the image provided. More...
 
void NewAnimation (const Property::Map &map, Dali::AnimationData &outputAnimationData)
 Creates description data required to create an Animation object from a property map. More...
 
template<typename T >
bool GetEnumeration (const char *value, const StringEnum *table, unsigned int tableCount, T &result)
 Chooses the appropriate enumeration for the provided string from the given table. More...
 
template<typename T >
const char * GetEnumerationName (T value, const StringEnum *table, unsigned int tableCount)
 Chooses the appropriate string for the provided enumeration from the given table. More...
 
template<typename T >
const char * GetLinearEnumerationName (T value, const StringEnum *table, unsigned int tableCount)
 Chooses the appropriate string for the provided enumeration from the given table. More...
 

Detailed Description

Utilities for scripting support.

Function Documentation

DALI_IMPORT_API void Dali::Scripting::CreatePropertyMap ( Actor  actor,
Property::Map &  map 
)
DALI_IMPORT_API void Dali::Scripting::CreatePropertyMap ( Image  image,
Property::Map &  map 
)
DALI_IMPORT_API bool Dali::Scripting::EnumStringToInteger ( const char *const  value,
const StringEnum *const  table,
unsigned int  tableCount,
unsigned int &  integerEnum 
)

Find the enum as an integer from the table.

.12

Parameters
[in]valueThe string equivalent (case-insensitive, comma separate to OR values).
[in]tableA pointer to an array with the enumeration to string equivalents.
[in]tableCountNumber of items in the array.
[out]integerEnumThe value of the enum.
Returns
true if one or more enums in value.

Definition at line 206 of file scripting.cpp.

References Dali::Scripting::anonymous_namespace{scripting.cpp}::CompareEnums(), DALI_LOG_ERROR, Dali::Scripting::StringEnum::string, and Dali::Scripting::StringEnum::value.

Referenced by GetEnumeration(), UtcDaliScriptingEnumStringToIntegerInvalidEnumN(), UtcDaliScriptingEnumStringToIntegerInvalidEnumP(), UtcDaliScriptingEnumStringToIntegerN(), and UtcDaliScriptingEnumStringToIntegerP().

Here is the call graph for this function:

Here is the caller graph for this function:

DALI_IMPORT_API unsigned int Dali::Scripting::FindEnumIndex ( const char *  value,
const StringEnum *  table,
unsigned int  tableCount 
)

Find the given enum index from the table.

Parameters
[in]valueThe string equivalent (case-insensitive).
[in]tableA pointer to an array with the enumeration to string equivalents.
[in]tableCountNumber of items in the array.
Returns
The index of the enumeration. If enumeration is not found, logs an error and returns tableCount.

Definition at line 258 of file scripting.cpp.

References Dali::Scripting::anonymous_namespace{scripting.cpp}::CompareEnums(), DALI_LOG_ERROR, and Dali::Scripting::StringEnum::string.

Referenced by UtcDaliScriptingFindEnumIndexN().

Here is the call graph for this function:

Here is the caller graph for this function:

DALI_IMPORT_API Vector3 Dali::Scripting::GetAnchorConstant ( const std::string &  value)

Takes a string and returns the appropriate anchor-point or parent-origin constant.

Parameters
[in]valueThe input string
Returns
The corresponding anchor-point or parent-origin constant.

Definition at line 338 of file scripting.cpp.

References Dali::Scripting::anonymous_namespace{scripting.cpp}::ANCHOR_CONSTANT_TABLE_COUNT, Dali::Scripting::anonymous_namespace{scripting.cpp}::CompareEnums(), Dali::Scripting::anonymous_namespace{scripting.cpp}::AnchorValue::name, and Dali::Scripting::anonymous_namespace{scripting.cpp}::AnchorValue::value.

Referenced by NewActor(), Dali::Toolkit::Internal::SetupActor(), and UtcDaliScriptingGetAnchorConstant().

Here is the call graph for this function:

Here is the caller graph for this function:

DALI_IMPORT_API ColorMode Dali::Scripting::GetColorMode ( const std::string &  value)

Takes a string and returns the appropriate color mode.

Parameters
[in]valueThe input string
Returns
The corresponding color-mode.

Definition at line 279 of file scripting.cpp.

References Dali::Scripting::anonymous_namespace{scripting.cpp}::COLOR_MODE_TABLE, Dali::Scripting::anonymous_namespace{scripting.cpp}::COLOR_MODE_TABLE_COUNT, and Dali::USE_OWN_MULTIPLY_PARENT_ALPHA.

Referenced by Dali::Internal::Actor::GetDefaultProperty(), Dali::Internal::Actor::SetDefaultProperty(), and UtcDaliScriptingGetColorMode().

Here is the caller graph for this function:

DALI_IMPORT_API std::string Dali::Scripting::GetColorMode ( ColorMode  value)

Takes a color mode and returns the appropriate string equivalent.

Parameters
[in]valueThe color mode
Returns
The corresponding string.

Definition at line 288 of file scripting.cpp.

References Dali::Scripting::anonymous_namespace{scripting.cpp}::COLOR_MODE_TABLE, and Dali::Scripting::anonymous_namespace{scripting.cpp}::COLOR_MODE_TABLE_COUNT.

DALI_IMPORT_API DrawMode::Type Dali::Scripting::GetDrawMode ( const std::string &  value)

Takes a string and returns the appropriate draw mode.

Parameters
[in]valueThe input string
Returns
The corresponding draw-mode.

Definition at line 318 of file scripting.cpp.

References Dali::Scripting::anonymous_namespace{scripting.cpp}::DRAW_MODE_TABLE, Dali::Scripting::anonymous_namespace{scripting.cpp}::DRAW_MODE_TABLE_COUNT, and Dali::DrawMode::NORMAL.

Referenced by Dali::Internal::Actor::GetDefaultProperty(), Dali::Internal::Actor::SetDefaultProperty(), and UtcDaliScriptingGetDrawMode().

Here is the caller graph for this function:

DALI_IMPORT_API std::string Dali::Scripting::GetDrawMode ( DrawMode::Type  value)

Takes a draw-mode and returns the string equivalent.

Parameters
[in]valueThe draw-mode.
Returns
The corresponding string.

Definition at line 327 of file scripting.cpp.

References Dali::Scripting::anonymous_namespace{scripting.cpp}::DRAW_MODE_TABLE, and Dali::Scripting::anonymous_namespace{scripting.cpp}::DRAW_MODE_TABLE_COUNT.

template<typename T >
bool Dali::Scripting::GetEnumeration ( const char *  value,
const StringEnum *  table,
unsigned int  tableCount,
T &  result 
)

Chooses the appropriate enumeration for the provided string from the given table.

Parameters
[in]valueThe string equivalent (case-insensitive, comma separate to OR values).
[in]tableA pointer to an array with the enumeration to string equivalents.
[in]tableCountNumber of items in the array.
[out]resultThe enum value
Returns
True if the value was found from the table

Definition at line 84 of file scripting.h.

References EnumStringToInteger().

Here is the call graph for this function:

template<typename T >
const char* Dali::Scripting::GetEnumerationName ( value,
const StringEnum *  table,
unsigned int  tableCount 
)

Chooses the appropriate string for the provided enumeration from the given table.

Parameters
[in]valueThe enumeration.
[in]tableA pointer to an array with the enumeration to string equivalents.
[in]tableCountNumber of items in the array.
Returns
The equivalent enumeration for the given string. Will return NULL if the value does not exist
Note
The caller is NOT responsible for cleaning up the returned pointer as it is statically allocated.

Definition at line 112 of file scripting.h.

References Dali::Scripting::StringEnum::string.

Referenced by UtcDaliScriptingGetEnumerationNameN(), and UtcDaliScriptingGetEnumerationTemplates().

Here is the caller graph for this function:

template<typename T >
const char* Dali::Scripting::GetLinearEnumerationName ( value,
const StringEnum *  table,
unsigned int  tableCount 
)

Chooses the appropriate string for the provided enumeration from the given table.

This is an optimised version that handles enumerations that start at 0 and are linear only.

Parameters
[in]valueThe enumeration.
[in]tableA pointer to an array with the enumeration to string equivalents.
[in]tableCountNumber of items in the array.
Returns
The equivalent enumeration for the given string. Will return NULL if the value does not exist
Note
The caller is NOT responsible for cleaning up the returned pointer as it is statically allocated.

Definition at line 140 of file scripting.h.

References Dali::Scripting::StringEnum::string.

Referenced by UtcDaliScriptingGetLinearEnumerationNameN().

Here is the caller graph for this function:

DALI_IMPORT_API PositionInheritanceMode Dali::Scripting::GetPositionInheritanceMode ( const std::string &  value)

Takes a string and returns the appropriate position inheritance mode.

Parameters
[in]valueThe input string
Returns
The corresponding position-inheritance-mode.

Definition at line 298 of file scripting.cpp.

References Dali::INHERIT_PARENT_POSITION, Dali::Scripting::anonymous_namespace{scripting.cpp}::POSITION_INHERITANCE_MODE_TABLE, and Dali::Scripting::anonymous_namespace{scripting.cpp}::POSITION_INHERITANCE_MODE_TABLE_COUNT.

Referenced by Dali::Internal::Actor::GetDefaultProperty(), Dali::Internal::Actor::SetDefaultProperty(), and UtcDaliScriptingGetPositionInheritanceMode().

Here is the caller graph for this function:

DALI_IMPORT_API std::string Dali::Scripting::GetPositionInheritanceMode ( PositionInheritanceMode  value)

Takes a position inheritance mode and returns the string equivalent.

Parameters
[in]valueThe position-inheritance-mode.
Returns
The corresponding string.

Definition at line 307 of file scripting.cpp.

References Dali::Scripting::anonymous_namespace{scripting.cpp}::POSITION_INHERITANCE_MODE_TABLE, and Dali::Scripting::anonymous_namespace{scripting.cpp}::POSITION_INHERITANCE_MODE_TABLE_COUNT.

DALI_IMPORT_API Actor Dali::Scripting::NewActor ( const Property::Map &  map)

Creates an actor with the date from the property value map.

Parameters
[in]mapThe property value map with the properties (and hierarchy) of the actor required For example:
{
"type": "ImageActor",
"image":
{
"filename":"my-image-path.png"
},
"actors":
[
{
"type":"Actor",
"position":[0,0,0]
}
]
}
Returns
A handle to the newly created actor.

Definition at line 570 of file scripting.cpp.

References Dali::Actor::Add(), Dali::Property::Array(), Dali::TypeInfo::CreateInstance(), DALI_LOG_ERROR, Dali::Actor::DownCast(), Dali::TypeRegistry::Get(), GetAnchorConstant(), Dali::Handle::GetPropertyIndex(), Dali::TypeRegistry::GetTypeInfo(), Dali::Property::INVALID_INDEX, Dali::Actor::SetAnchorPoint(), Dali::Actor::SetParentOrigin(), Dali::Handle::SetProperty(), Dali::Property::STRING, Dali::Property::Value(), and Dali::Property::VECTOR3.

Referenced by Dali::Toolkit::Internal::Popup::SetProperty(), UtcDaliScriptingNewActorChildren(), UtcDaliScriptingNewActorNegative(), and UtcDaliScriptingNewActorProperties().

Here is the call graph for this function:

Here is the caller graph for this function:

DALI_IMPORT_API void Dali::Scripting::NewAnimation ( const Property::Map &  map,
Dali::AnimationData outputAnimationData 
)
DALI_IMPORT_API Image Dali::Scripting::NewImage ( const Property::Value &  property)

Creates object with data from the property value map.

Parameters
[in]propertyThe property value map with the following valid fields:
"filename": type std::string
"loadPolicy" type std::string (enum)
"releasePolicy" type std::string (enum)
"width" type float
"height" type float
"pixelFormat" type std::string (enum)
"fittingMode" type std::string (enum)
"samplingMode" type std::string (enum)
"orientation" type bool
"type" type std::string (FrameBufferImage|BufferImage|ResourceImage(default))
Some fields are optional and some only pertain to a specific type.
Returns
A pointer to a newly created object.

Definition at line 352 of file scripting.cpp.

References b, Dali::Scripting::anonymous_namespace{scripting.cpp}::BUFFER_IMAGE, DALI_LOG_ERROR, Dali::Property::FLOAT, Dali::Scripting::anonymous_namespace{scripting.cpp}::FRAME_BUFFER_IMAGE, Dali::Internal::ImageAttributes::GetFilterMode(), Dali::Internal::ImageAttributes::GetHeight(), Dali::Internal::ImageAttributes::GetOrientationCorrection(), Dali::Internal::ImageAttributes::GetScalingMode(), Dali::Internal::ImageAttributes::GetSize(), Dali::Internal::ImageAttributes::GetWidth(), height, Dali::Scripting::anonymous_namespace{scripting.cpp}::IMAGE_FITTING_MODE_TABLE, Dali::Scripting::anonymous_namespace{scripting.cpp}::IMAGE_FITTING_MODE_TABLE_COUNT, Dali::Internal::IMAGE_LOAD_POLICY_DEFAULT, Dali::Scripting::anonymous_namespace{scripting.cpp}::IMAGE_LOAD_POLICY_TABLE, Dali::Scripting::anonymous_namespace{scripting.cpp}::IMAGE_LOAD_POLICY_TABLE_COUNT, Dali::Internal::IMAGE_RELEASE_POLICY_DEFAULT, Dali::Scripting::anonymous_namespace{scripting.cpp}::IMAGE_RELEASE_POLICY_TABLE, Dali::Scripting::anonymous_namespace{scripting.cpp}::IMAGE_RELEASE_POLICY_TABLE_COUNT, Dali::Scripting::anonymous_namespace{scripting.cpp}::IMAGE_SAMPLING_MODE_TABLE, Dali::Scripting::anonymous_namespace{scripting.cpp}::IMAGE_SAMPLING_MODE_TABLE_COUNT, Dali::Scripting::anonymous_namespace{scripting.cpp}::imageTypeCount, Dali::Property::Map(), Dali::BufferImage::New(), Dali::FrameBufferImage::New(), Dali::Internal::ImageAttributes::New(), Dali::ResourceImage::New(), Dali::Scripting::anonymous_namespace{scripting.cpp}::PIXEL_FORMAT_TABLE, Dali::Scripting::anonymous_namespace{scripting.cpp}::PIXEL_FORMAT_TABLE_COUNT, Dali::Scripting::anonymous_namespace{scripting.cpp}::RESOURCE_IMAGE, Dali::Pixel::RGBA8888, Dali::Internal::ImageAttributes::SetFilterMode(), Dali::Internal::ImageAttributes::SetOrientationCorrection(), Dali::Internal::ImageAttributes::SetScalingMode(), Dali::Internal::ImageAttributes::SetSize(), Dali::Property::Value(), width, Dali::Vector2::x, and Dali::Vector2::y.

Referenced by Dali::Toolkit::Internal::Builder::GetFrameBufferImage(), anonymous_namespace{utc-Dali-Scripting.cpp}::NewBufferImage(), anonymous_namespace{utc-Dali-Scripting.cpp}::NewResourceImage(), Dali::Internal::ShaderEffect::SetDefaultProperty(), Dali::Internal::ImageActor::SetDefaultProperty(), Dali::Toolkit::Internal::TextEditor::SetProperty(), Dali::Toolkit::Internal::TextField::SetProperty(), Dali::Toolkit::Internal::SuperBlurView::SetProperty(), Dali::Toolkit::Internal::Control::Impl::SetProperty(), UtcDaliScriptingNewImage01P(), UtcDaliScriptingNewImage03P(), UtcDaliScriptingNewImage04P(), UtcDaliScriptingNewImage05P(), UtcDaliScriptingNewImage06P(), UtcDaliScriptingNewImage07P(), UtcDaliScriptingNewImage09P(), UtcDaliScriptingNewImage10P(), UtcDaliScriptingNewImageNegative01(), UtcDaliScriptingNewImageNegative02(), UtcDaliScriptingNewImageNegative03(), UtcDaliScriptingNewImageNegative04(), UtcDaliScriptingNewImageNegative05(), UtcDaliScriptingNewImageNegative06(), UtcDaliScriptingNewImageNegative07(), UtcDaliScriptingNewImageNegative08(), UtcDaliScriptingNewImageNegative09(), UtcDaliScriptingNewImageNegative10(), UtcDaliScriptingNewImageNegative12(), UtcDaliScriptingNewImageNegative13(), UtcDaliScriptingNewImageNegative14(), UtcDaliScriptingNewImageNegative15(), and UtcDaliScriptingNewImageNegative16().

Here is the call graph for this function:

Here is the caller graph for this function:

DALI_IMPORT_API ShaderEffect Dali::Scripting::NewShaderEffect ( const Property::Value &  property)

Creates object with data from the property value map.

Parameters
[in]propertyThe property value map with the following valid fields:
// a program can be specified as string or a filename.
// some fields may be ignored depending on the geometry-type
"program": type Map
{
"vertex": type std::string
"fragment": type std::string
"vertexPrefix": type std::string
"fragmentPrefix": type std::string
"textVertex": type std::string
"textFragment": type std::string
"vertexFilename": type std::string
"fragmentFilename": type std::string
"vertexPrefixFilename": type std::string
"fragmentPrefixFilename": type std::string
"textVertexFilename": type std::string
"textFragmentFilename": type std::string
"geometryType": type std::string (enum)
"geometryHints": type std::string (enum)
}
// uniforms must be specified to be registered
"uUniform1": type float,
"uUniform2": type float, etc
Returns
A pointer to a newly created object.

Definition at line 519 of file scripting.cpp.

References Dali::ShaderEffect::COORDINATE_TYPE_DEFAULT, Dali::IntrusivePtr< T >::Get(), Dali::Handle::GetPropertyIndex(), Dali::ShaderEffect::HINT_NONE, Dali::Property::INTEGER, Dali::Property::INVALID_INDEX, Dali::Property::Map(), Dali::Internal::ShaderEffect::New(), Dali::Handle::SetProperty(), Dali::ShaderEffect::SetUniform(), and Dali::Property::Value().

Referenced by Dali::Toolkit::Internal::Builder::GetShaderEffect(), and UtcDaliScriptingNewShaderEffect().

Here is the call graph for this function:

Here is the caller graph for this function:

Dali Docs Home
Read more about Dali