JenovaSDK API Reference
Developed by Hamid.Memar (MemarDesign™ LLC.)
 
Loading...
Searching...
No Matches
Helpers Utilities

Functions

bool IsEditor ()
 Checks if the code is running in the editor.
 
bool IsGame ()
 Checks if the code is running as a game build.
 
EngineMode GetEngineMode ()
 Retrieves the current engine mode.
 
godot::NodeGetNodeByPath (const godot::String &nodePath)
 Gets a Node in the scene tree by the given path.
 
godot::NodeFindNodeByName (godot::Node *parent, const godot::String &name)
 Finds a Node recursively by its name.
 
StringPtr GetNodeUniqueID (godot::Node *node)
 Generates a Unique ID string for a given node.
 
godot::SceneTreeGetTree ()
 Retrieves the current SceneTree.
 
double GetTime ()
 Gets the current engine time in seconds.
 
void Alert (StringPtr format,...)
 Displays a system alert message using C-style string formatting.
 
godot::String Format (StringPtr format,...)
 Formats text using C-style string formatting.
 
godot::String Format (WideStringPtr format,...)
 Formats text using C-style wide-string formatting.
 
void Output (StringPtr format,...)
 Outputs a message to the engine terminal using C-style string formatting.
 
void Output (WideStringPtr format,...)
 Outputs a message to the engine terminal using C-style wide-string formatting.
 
void DebugOutput (StringPtr format,...)
 Outputs a message to the debug console such as Visual Studio or DebugView using C-style string formatting.
 
void DebugOutput (WideStringPtr format,...)
 Outputs a message to the debug console such as Visual Studio or DebugView using C-style wide-string formatting.
 
StringPtr GetCStr (const godot::String &godotStr)
 Converts a Godot string to a C-style string.
 
WideStringPtr GetWCStr (const godot::String &godotStr)
 Converts a Godot String to a C-style wide-string.
 
ObjectPtr GetObjectPointer (NativePtr obj)
 Casts a native pointer to an ObjectPtr. This function is used to get a Variant representation of any Object, allowing it to be passed across scripts.
 
bool SetClassIcon (const godot::String &className, const godot::Ref< godot::Texture2D > iconImage)
 Sets a custom icon for a registered extension class in the editor.
 
double MatchScaleFactor (double inputSize)
 Matches editor UI scaling factor to a given input size.
 
godot::Error CreateSignalCallback (godot::Object *object, const godot::String &signalName, FunctionPtr callbackPtr)
 Creates a signal connection with a function pointer callback.
 
bool CreateDirectoryMonitor (const godot::String &directoryPath)
 Registers a directory for monitoring changes using Asset Monitor.
 
bool CreateFileMonitor (const godot::String &filePath)
 Registers a file for monitoring changes using Asset Monitor.
 
bool RegisterFileMonitorCallback (FileSystemCallback callbackPtr)
 Registers a callback for file system monitoring. Registered callback will receive a FileSystemEvent as a parameter.
 
bool UnregisterFileMonitorCallback (FileSystemCallback callbackPtr)
 Unregisters a file monitor callback.
 
bool ReloadJenovaRuntime (RuntimeReloadMode reloadMode)
 
void CreateCheckpoint (const godot::String &checkPointName)
 Creates a high-resolution performance checkpoint.
 
double GetCheckpointTime (const godot::String &checkPointName)
 Gets the elapsed time of a high-resolution performance checkpoint since its initiation.
 
void DeleteCheckpoint (const godot::String &checkPointName)
 Deletes a high-resolution performance checkpoint.
 
double GetCheckpointTimeAndDispose (const godot::String &checkPointName)
 Gets the elapsed time of a high-resolution performance checkpoint since its initiation and removes it afterwards.
 
godot::String GetPackageRepositoryPath (bool globalize=false)
 Gets the Jenova package repository path. This function is intended for use in add-ons and tools.
 
bool RegisterRuntimeCallback (RuntimeCallback callbackPtr)
 Registers a Jenova Runtime callback. This function is intended for use in add-ons and tools. Registered callback will receive a RuntimeEvent as a parameter.
 
bool UnregisterRuntimeCallback (RuntimeCallback callbackPtr)
 Unregisters a Jenova Runtime callback.
 

Detailed Description

This collection of functions is designed to provide essential functionality to ease the development with many useful helpers.

Function Documentation

◆ IsEditor()

bool IsEditor ( )

Checks if the code is running in the editor.

Returns
true if running inside the editor, false otherwise.

◆ IsGame()

bool IsGame ( )

Checks if the code is running as a game build.

Returns
true if running in a non-editor environment.

◆ GetEngineMode()

EngineMode GetEngineMode ( )

Retrieves the current engine mode.

Returns
Current engine mode game is running as.

◆ GetNodeByPath()

godot::Node * GetNodeByPath ( const godot::String & nodePath)

Gets a Node in the scene tree by the given path.

Parameters
nodePathThe path of the node to get.
Returns
Pointer to the Node if found, nullptr otherwise.

◆ FindNodeByName()

godot::Node * FindNodeByName ( godot::Node * parent,
const godot::String & name )

Finds a Node recursively by its name.

Parameters
parentThe parent Node to search under.
nameThe name of the node to find.
Returns
Pointer to the Node if found, nullptr otherwise.

◆ GetNodeUniqueID()

StringPtr GetNodeUniqueID ( godot::Node * node)

Generates a Unique ID string for a given node.

Parameters
nodeThe node to get the Unique ID of.
Returns
The Unique ID string based on the node path MD5.

◆ GetTree()

godot::SceneTree * GetTree ( )

Retrieves the current SceneTree.

Returns
Pointer to the SceneTree if available, nullptr otherwise.

◆ GetTime()

double GetTime ( )

Gets the current engine time in seconds.

Returns
Current engine time in seconds as a double.

◆ Alert()

void Alert ( StringPtr format,
... )

Displays a system alert message using C-style string formatting.

Parameters
formatThe format string of the message.
argsThe variable arguments to use in the message.

◆ Format() [1/2]

godot::String Format ( StringPtr format,
... )

Formats text using C-style string formatting.

Parameters
formatThe format string to use.
argsThe variable arguments to use in the format string.
Returns
The formatted string.

◆ Format() [2/2]

godot::String Format ( WideStringPtr format,
... )

Formats text using C-style wide-string formatting.

Parameters
formatThe format string to use.
argsThe variable arguments to use in the format string.
Returns
The formatted wide string.

◆ Output() [1/2]

void Output ( StringPtr format,
... )

Outputs a message to the engine terminal using C-style string formatting.

Parameters
formatThe format string of the message.
argsThe variable arguments to use in the message.

◆ Output() [2/2]

void Output ( WideStringPtr format,
... )

Outputs a message to the engine terminal using C-style wide-string formatting.

Parameters
formatThe format string of the message.
argsThe variable arguments to use in the message.

◆ DebugOutput() [1/2]

void DebugOutput ( StringPtr format,
... )

Outputs a message to the debug console such as Visual Studio or DebugView using C-style string formatting.

Parameters
formatThe format string of the message.
argsThe variable arguments to use in the message.

◆ DebugOutput() [2/2]

void DebugOutput ( WideStringPtr format,
... )

Outputs a message to the debug console such as Visual Studio or DebugView using C-style wide-string formatting.

Parameters
formatThe format string of the message.
argsThe variable arguments to use in the message.

◆ GetCStr()

StringPtr GetCStr ( const godot::String & godotStr)

Converts a Godot string to a C-style string.

Parameters
godotStrThe Godot String to convert.
Returns
The C-style string representation of the Godot string.

◆ GetWCStr()

WideStringPtr GetWCStr ( const godot::String & godotStr)

Converts a Godot String to a C-style wide-string.

Parameters
godotStrThe Godot string to convert.
Returns
The wide C-style string representation of the Godot string.

◆ GetObjectPointer()

ObjectPtr GetObjectPointer ( NativePtr obj)

Casts a native pointer to an ObjectPtr. This function is used to get a Variant representation of any Object, allowing it to be passed across scripts.

Parameters
objThe native object pointer to get the object pointer of.
Returns
The object pointer of the native object as Variant.

◆ SetClassIcon()

bool SetClassIcon ( const godot::String & className,
const godot::Ref< godot::Texture2D > iconImage )

Sets a custom icon for a registered extension class in the editor.

Parameters
classNameThe name of the extension class to set the icon for.
iconImageThe icon image to use, supports all driven classes from Texture2D.
Returns
true if the icon was set successfully, false otherwise.

◆ MatchScaleFactor()

double MatchScaleFactor ( double inputSize)

Matches editor UI scaling factor to a given input size.

Parameters
inputSizeThe input size to match the editor scale factor to.
Returns
The matched UI scale factor.

◆ CreateSignalCallback()

godot::Error CreateSignalCallback ( godot::Object * object,
const godot::String & signalName,
FunctionPtr callbackPtr )

Creates a signal connection with a function pointer callback.

Parameters
objectThe object to create the callback for.
signalNameThe name of the signal to create the callback for.
callbackPtrThe callback function pointer to use, Check FunctionPtr.
Returns
OK if the callback was created successfully, Error otherwise.

◆ CreateDirectoryMonitor()

bool CreateDirectoryMonitor ( const godot::String & directoryPath)

Registers a directory for monitoring changes using Asset Monitor.

Parameters
directoryPathThe path of the directory to monitor.
Returns
true if the monitor was created successfully, false otherwise.

◆ CreateFileMonitor()

bool CreateFileMonitor ( const godot::String & filePath)

Registers a file for monitoring changes using Asset Monitor.

Parameters
filePathThe path of the file to monitor.
Returns
true if the monitor was created successfully, false otherwise.

◆ RegisterFileMonitorCallback()

bool RegisterFileMonitorCallback ( FileSystemCallback callbackPtr)

Registers a callback for file system monitoring. Registered callback will receive a FileSystemEvent as a parameter.

Example of FileSystemCallback implementation:

void OnConfigFileChange(const godot::String& targetPath, const FileSystemEvent& fsEvent)
{
// On File Modified
if (fsEvent == FileSystemEvent::Modified)
{
...
}
}
Note
Parameter targetPath is the path of the directory/file that has been changed.
Parameters
callbackPtrThe callback function pointer to register.
Returns
true if the callback was registered successfully, false otherwise.

◆ UnregisterFileMonitorCallback()

bool UnregisterFileMonitorCallback ( FileSystemCallback callbackPtr)

Unregisters a file monitor callback.

Parameters
callbackPtrThe callback function pointer to unregister.
Returns
true if the callback was unregistered successfully, false otherwise.

◆ ReloadJenovaRuntime()

bool ReloadJenovaRuntime ( RuntimeReloadMode reloadMode)
Not Implemented Yet, DO NOT USE!

Reloads the Jenova runtime.

Parameters
reloadModeThe reload mode to use.
Returns
true if the runtime was reloaded successfully, false otherwise.

◆ CreateCheckpoint()

void CreateCheckpoint ( const godot::String & checkPointName)

Creates a high-resolution performance checkpoint.

Parameters
checkPointNameThe name of the checkpoint to create.

◆ GetCheckpointTime()

double GetCheckpointTime ( const godot::String & checkPointName)

Gets the elapsed time of a high-resolution performance checkpoint since its initiation.

Parameters
checkPointNameThe name of the checkpoint to get the time of.
Returns
Elapsed time of the checkpoint in milliseconds.

◆ DeleteCheckpoint()

void DeleteCheckpoint ( const godot::String & checkPointName)

Deletes a high-resolution performance checkpoint.

Parameters
checkPointNameThe name of the checkpoint to delete.

◆ GetCheckpointTimeAndDispose()

double GetCheckpointTimeAndDispose ( const godot::String & checkPointName)

Gets the elapsed time of a high-resolution performance checkpoint since its initiation and removes it afterwards.

Parameters
checkPointNameThe name of the checkpoint to get the time of and dispose.
Returns
Elapsed time of the checkpoint in milliseconds.

◆ GetPackageRepositoryPath()

godot::String GetPackageRepositoryPath ( bool globalize = false)

Gets the Jenova package repository path. This function is intended for use in add-ons and tools.

Parameters
globalizeIf true the returned path will be absolute; if not, it will be localized as res://...
Returns
The package repository path containing Jenova Packages.

◆ RegisterRuntimeCallback()

bool RegisterRuntimeCallback ( RuntimeCallback callbackPtr)

Registers a Jenova Runtime callback. This function is intended for use in add-ons and tools. Registered callback will receive a RuntimeEvent as a parameter.

Example of RuntimeCallback implementation:

void OnRuntimeEvent(const RuntimeEvent& runtimeEvent, void* dataPtr, size_t dataSize)
{
// On Runtime Started
if (runtimeEvent == RuntimeEvent::Started)
{
...
}
}
Parameters
callbackPtrThe callback function to use.
Returns
true if the callback was registered successfully, false otherwise.

◆ UnregisterRuntimeCallback()

bool UnregisterRuntimeCallback ( RuntimeCallback callbackPtr)

Unregisters a Jenova Runtime callback.

Parameters
callbackPtrThe callback function to remove.
Returns
true if the callback was unregistered successfully, false otherwise.