Managing Scripts
In this chapter you'll learn about managing scripts in the Jenova ecosystem.
Script Management
Script Management is a simple yet important part of programming pipeline. Let's dive into different aspects of managing your C++ Scripts.
Creation/Attachment
Using File System
To Create a new C++ Script using file system, Simply right-click inside FileSystem and pick Create New >
Script... to open Create Script window, Select C++ Script from Language list and click on Create button.
Using Inspector
To Create a new C++ Script using inspector, Select a node, Head to the Script value at bottom of inspector panel, Click on the arrow beside script slot and select New Script... to open Create Script window, Select C++ Script from Language list and click on Create button.
Using Scene Tree
To Create a new C++ script using scene hierarchy, Right-click on a node and then select Attach Script to open Attach Node Script window, Select C++ Script from Language list and click on Create button.
Assignment
To assign a C++ Script to a node simply drag and drop it from FileSystem over your node in SceneTree or script slot in Inspector.
Templates
Jenova provides support for Script Templates based on the node class type. Templates are very useful to reduce the time for repeated code structures, Script Templates will be accessible from the engine's native Create Script window.
Script Template System also provides script templates tailored to the selected interpreter backend. For example, if you're using the NitroJIT backend script templates will adapt to ensure compatibility with NitroJIT. Similarly, if you're using the Meteora backend script templates will adapt to be compatible with Meteora. Additionally, script templates can be universal ensuring compatibility with all backends.
You can create your own templates by placing them at res://Jenova/Templates
with proper format and new templates can be installed from the Package Manager, To add a new template place the C++ file inside related directory and create a .json
file with same name as script.
Here's how script metadata looks like :
{
"Category": "Inherited",
"Backend": "Meteora",
"Inherit": "Node",
"Name": "Node Base",
"Description": "Base Node Script (Meteora)",
"Author": "Hamid.Memar",
"Version": 1.0
}
Operations
You can rename or move C++ Scripts at anytime, But remember, By changing name of a script or moving it unique identifier of your script will change and you need to clean solution and rebuild it again, Also If you're using External editors such as Visual Studio, You will need to re-export your project.
Do not modify the codebase directly from Visual Studio. This includes adding, renaming, or deleting C++, header, resource and project files in a generated Visual Studio solution. Instead, apply changes in Godot and re-export the project.
Built-in Scripts
Jenova supports built-in scripts similar to GDScript, Allowing you to embed C++ scripts directly inside Nodes without relying on the filesystem.
To create a built-in script simply right-click on a Node
in scene tree and then select Attach Script to open Attach Node Script window, Check Built-in Script and click on Create button.
Script Types
Jenova C++ Scripts can be used in different ways. Here are the different types currently available in the ecosystem.
Active Scripts
Active Scripts are C++ scripts assigned to a Node
in an active scene. These scripts contain a C++ Script Instance and can expose Properties, Resources, References and Documentation to the engine. They are useful for programming game logic and exposing events.
Tool Scripts are also active scripts.
Passive Scripts
Passive Scripts are C++ scripts not assigned to any Node
nor active in any scene. They are useful for creating Nested Extensions, External Functions, Utilities, and Exporting Functions for third-party libraries.
Header Scripts are also passive scripts.
Hybrid Scripts
Hybrid Scripts are C++ scripts using both active and passive context, Learn more about Hybrid Scripts Here.
Script Manager
Script Manager is not Implemented Yet.