Public Member Functions | Properties | Events | List of all members
Project Interface Reference

More...

Public Member Functions

Brush CreateBrush (string name, BrushLibrary parent, BrushTypeEnum brushType)
 
Node CreateComponentNode (string name, Node parent, ComponentType componentType)
 
DataSource CreateDataSource (string name, DataSourceType dataSourceType)
 
NodeComponent CreateNodeComponent (string name, NodeComponentHost parent, NodeComponentType nodeComponentType)
 Creates a node component to the specified parent. More...
 
ProjectItem CreateProjectItem (Type projectItemType, string name, ProjectItem parent)
 Creates a project item. More...
 
CreateProjectItem< T > (string name, ProjectItem parent)
 Creates a project item. More...
 
RenderPass CreateRenderPass (string name, AbstractComposer parent, RenderPassType renderPassType)
 
ProjectItem GetProjectItem (string projectItemPath)
 Gets a project item. More...
 
bool IsAbstract (Type projectItemType)
 

Properties

ProjectItem ActiveComposition [get]
 
AnimationClipLibrary AnimationClipLibrary [get]
 
AnimationLibrary AnimationLibrary [get]
 
ApplicationConfigurationResourceFileDirectory ApplicationDirectory [get]
 
Asset3DImportSourceDirectory Asset3DImportSourceDirectory [get]
 
BinaryShaderFormatLibrary BinaryShaderFormatLibrary [get]
 
BrushLibrary BrushLibrary [get]
 Gets the Brushes library which stores brushes used in a Kanzi Studio project. More...
 
ComponentTypeLibrary ComponentTypeLibrary [get]
 
ComposerLibrary ComposerLibrary [get]
 Gets the Composers library which stores composers and render passes used in a Kanzi Studio project. More...
 
DataSourceLibrary DataSourceLibrary [get]
 
DataSourceTypeLibrary DataSourceTypeLibrary [get]
 
EnginePluginLibrary EnginePluginLibrary [get]
 
FontDirectory FontDirectory [get]
 
GenericResourceFileDirectory GenericResourceFileDirectory [get]
 
ImageDirectory ImageDirectory [get]
 
MaterialLibrary MaterialLibrary [get]
 
MaterialTypeLibrary MaterialTypeLibrary [get]
 
MeshLibrary MeshLibrary [get]
 
NodeComponentTypeLibrary NodeComponentTypeLibrary [get]
 
PageTransitionCollectionLibrary PageTransitionCollectionLibrary [get]
 
PipelineItemLibrary PipelineItemLibrary [get]
 
PrefabLibrary PrefabLibrary [get]
 Gets the Prefabs library which contains the prefabs used in a Kanzi Studio project. More...
 
ProjectReferenceLibrary ProjectReferenceLibrary [get]
 
PropertyTypeLibrary PropertyTypeLibrary [get]
 Gets the Property Types library which stores all property types you create in a Kanzi Studio project. More...
 
RenderPassTypeLibrary RenderPassTypeLibrary [get]
 
Screen Screen [get]
 Gets the Screen node in a Kanzi Studio project. More...
 
ShaderSourceDirectory ShaderSourceDirectory [get]
 
ShortcutLibrary ShortcutLibrary [get]
 
StateManagerLibrary StateManagerLibrary [get]
 Gets the State Manager library which stores state managers used in a Kanzi Studio project. More...
 
StyleLibrary StyleLibrary [get]
 Gets the Styles library which stores styles used in a Kanzi Studio project. More...
 
TagLibrary TagLibrary [get]
 Gets the Tags library which stores tags used in a Kanzi Studio project. More...
 
TextureLibrary TextureLibrary [get]
 Gets the Textures library which stores textures used in a Kanzi Studio project. More...
 
TimelineSequenceLibrary TimelineSequenceLibrary [get]
 
TrajectoryLibrary TrajectoryLibrary [get]
 

Events

EventHandler ActiveCompositionChanged
 

Detailed Description

Create and access nodes and resources. Use the functions in this class to create nodes and resources in a project and to access the resources in resource libraries in a project.

Member Function Documentation

NodeComponent CreateNodeComponent ( string  name,
NodeComponentHost  parent,
NodeComponentType  nodeComponentType 
)

Creates a node component to the specified parent.

The available types can be found from project.NodeComponentTypeLibrary.

ProjectItem CreateProjectItem ( Type  projectItemType,
string  name,
ProjectItem  parent 
)

Creates a project item.

Use this function to create Kanzi nodes and resources.

Parameters
projectItemTypeThe type of the item.
nameThe name of the item.
parentThe parent item of the item you create with this function.
Returns
The item you create with this function.
See also
ChildContainer.GenerateUniqueChildName, CreateProjectItem<T>(string, ProjectItem), GetProjectItem
T CreateProjectItem< T > ( string  name,
ProjectItem  parent 
)

Creates a project item.

Use this function to create Kanzi nodes and resources.

Template Parameters
TThe type of the item you want to create with this function.
Parameters
nameThe name of the item.
parentThe parent item of the item you create with this function.
Returns
The item you create with this function.
See also
ChildContainer.GenerateUniqueChildName, CreateProjectItem(Type, string, ProjectItem), GetProjectItem

Examples

To create a function which creates an Empty Node 2D:

// This example shows how you can create a function which creates an Empty Node 2D node as a child node of the node,
// location of which you pass as a parameter. For example, you can prompt the user to provide the path of the parent node,
// or use the GetProjectItem function to get the parent node.
private Node2D CreateEmptyNode2D(Node2D parentNode)
{
// Create an Empty Node 2D node. You use the Project as a factory.
// The first parameter defines the name of the node. Use the GenerateUniqueChildName function,
// because the names of sibling nodes must be unique. The second parameter defines the location
// of the parent node of the Empty Node 2D node you create. You pass this parameter to the
// CreateEmptyNode2D function when you call it.
var emptyNode2D = studio.Project.CreateProjectItem<EmptyNode2D>(parentNode.GenerateUniqueChildName("Empty Node 2D"), parentNode);
// Make the Empty Node 2D 300 pixels high by setting its Layout Height property.
emptyNode2D.Set(emptyNode2D.PropertyTypes.NodeHeight, 300.0f);
// Make the Empty Node 2D 400 pixels wide by setting its Layout Width property.
emptyNode2D.Set(emptyNode2D.PropertyTypes.NodeWidth, 400.0f);
return emptyNode2D;
}
Type Constraints
T :ProjectItem 
ProjectItem GetProjectItem ( string  projectItemPath)

Gets a project item.

For example, use this function to get a node in the scene graph and then add child nodes to it, or add, set, and modify the values of the node properties.

Parameters
projectItemPathThe path to the project item you want to get.
Returns
The project item at the path you pass to the function.

Examples

To get a project item:

public void Execute(PluginCommandParameter parameter)
{
// Get the RootPage node in the scene graph.
var rootNode = studio.Project.GetProjectItem("Screens/Screen/RootPage");
}

Property Documentation

BrushLibrary BrushLibrary
get

Gets the Brushes library which stores brushes used in a Kanzi Studio project.

After you get the library, you can access and create resources in that library.

The Brushes library in a Kanzi Studio project.

See also
ProjectItem.GetChild(string), ProjectItem.GetChild<T>(string), CreateProjectItem<T>(string, ProjectItem), CreateProjectItem(Type, string, ProjectItem)

Examples

To get a brush from the Brushes library:

public void Execute(PluginCommandParameter parameter)
{
// Get the Brushes library which stores brushes used in a Kanzi Studio project.
var brushesLibrary = studio.Project.BrushLibrary;
// Get the DefaultBackground texture brush from the Brushes library.
var defaultBackground = brushesLibrary.GetItemByName("DefaultBackground");
}
ComposerLibrary ComposerLibrary
get

Gets the Composers library which stores composers and render passes used in a Kanzi Studio project.

After you get the library, you can access and create resources in that library.

The Composers library in a Kanzi Studio project.

See also
ProjectItem.GetChild(string), ProjectItem.GetChild<T>(string), CreateProjectItem<T>(string, ProjectItem), CreateProjectItem(Type, string, ProjectItem)

Examples

To create a render pass in the Composers library:

public void Execute(PluginCommandParameter parameter)
{
// Get the Composers library which stores composers and render passes used in a Kanzi Studio project.
var composersLibrary = studio.Project.ComposerLibrary;
// Create a render pass named MyRenderPass in the Composers library.
var renderPass = studio.Project.CreateProjectItem<LegacyRenderPass>(
composersLibrary.GenerateUniqueChildName("MyRenderPass"),
composersLibrary);
}
PrefabLibrary PrefabLibrary
get

Gets the Prefabs library which contains the prefabs used in a Kanzi Studio project.

After you get the library, you can access and create prefabs.

The Prefabs library in a Kanzi Studio project.

See also
CreateProjectItem<T>(string, ProjectItem), CreateProjectItem(Type, string, ProjectItem), GetProjectItem(string), CreateComponentNode(string, Node, ComponentType), ResourceReference<T>

Examples

To create a prefab in the Prefabs library and instantiate it:

public void Execute(PluginCommandParameter parameter)
{
// Get the Prefabs library which stores all the prefabs in a Kanzi Studio project.
var prefabsLibrary = studio.Project.PrefabLibrary;
// In the Prefabs library create a prefab template which can hold 3D nodes.
// For 2D nodes you have to create a 2D prefab template.
var myPrefabTemplate = studio.Project.CreateProjectItem<Node3DPrefabTemplate>(
prefabsLibrary.GenerateUniqueChildName("Prefab Template"), prefabsLibrary);
// Create an Empty Node 3D node as the root node of the prefab.
var rootNode = studio.Project.CreateProjectItem<EmptyNode>(
myPrefabTemplate.GenerateUniqueChildName("Empty Node 3D"), myPrefabTemplate);
// Get a component type for the Button 3D node.
var componentType = studio.Project.ComponentTypeLibrary.GetComponentType("Kanzi.Button3D");
// Use the component type you just created to create the Button 3D node.
var button = studio.Project.CreateComponentNode("Button 3D", rootNode, componentType);
// Get the node where you want to instantiate the prefab you just created.
var instantiateHere = studio.Project.GetProjectItem("Screens/Screen/RootPage/Viewport 2D/Scene");
// Create the Prefab Placeholder node which instantiates the prefab in the scene graph.
var prefabInstance = studio.Project.CreateProjectItem<Node3DPrefabPlaceholder>(
instantiateHere.GenerateUniqueChildName("Placeholder"), instantiateHere);
// Create a resource reference from the prefab template which you want to instantiate.
var reference = new ResourceReference<Node3DPrefabTemplate>(myPrefabTemplate);
// Instantiate the prefab you created by setting the Node3DPrefabPlaceholderTemplate property
// to the prefab template reference you created in the previous line.
prefabInstance.Set(prefabInstance.PropertyTypes.Node3DPrefabPlaceholderTemplate, reference);
}

Gets the Property Types library which stores all property types you create in a Kanzi Studio project.

After you get the library, you can access and create resources in that library.

The Property Types library in a Kanzi Studio project.

See also
PluginInterface.PropertyTypeLibrary.CreateProperty(System.Type, string, string, string), PluginInterface.PropertyTypeLibrary.ProjectPropertyTypes

Examples

To create your own property type of the integer data type:

public void Execute(PluginCommandParameter parameter)
{
// Get the Property Types library which stores all property types you create in a Kanzi Studio project.
var propertyTypesLibrary = studio.Project.PropertyTypeLibrary;
// Create an integer property type in the Property Types library and set:
// - Name to MyIntProperty
// - Name as it is shown in Kanzi Studio to My Int Property
// - Category in which Kanzi Studio shows the property type to My Properties
// - Lowest value to 0
// - Highest value to 9000
// - The amount by which the property can change to 10
var myIntProperty = studio.Project.PropertyTypeLibrary.CreateIntProperty(
propertyTypesLibrary.GenerateUniqueChildName("MyIntProperty"),
"My Int Property",
"My Properties",
0,
9000,
10);
}

To get all property types in the Property Types library:

public void Execute(PluginCommandParameter parameter)
{
// Get the Property Types library which stores all property types you create in a Kanzi Studio project.
var propertyTypesLibrary = studio.Project.PropertyTypeLibrary;
foreach (Property property in propertyTypesLibrary.ProjectPropertyTypes)
{
// Print the name of all properties which you can remove to the Kanzi Studio Log window.
studio.Log(property.Name);
}
}

Gets the Screen node in a Kanzi Studio project.

The Screen node is the root node of the scene graph in Kanzi.

The Screen node.

See also
PluginInterface.Screen.RootNode2D

Examples

To get the Screen node:

public void Execute(PluginCommandParameter parameter)
{
// Get the Screen node.
var screen = studio.Project.Screen;
// Add the Screen Color property to the Screen node.
screen.AddProperty(screen.PropertyTypes.ScreenClearColor);
}
StateManagerLibrary StateManagerLibrary
get

Gets the State Manager library which stores state managers used in a Kanzi Studio project.

After you get the library, you can access and create state managers in that library.

The State Manager library in a Kanzi Studio project.

See also
StateGroup, State, StateObject, StateTransition, StateBase

Examples

To create a state manager with a state group, state, and a state object in the State Managers library:

public void Execute(PluginCommandParameter parameter)
{
// Get the State Managers library which stores state managers used in a Kanzi Studio project.
var stateManagerLibrary = studio.Project.StateManagerLibrary;
// Create a state manager named MyStateManager in the State Managers library.
var myStateManager = studio.Project.CreateProjectItem<StateManager>(
stateManagerLibrary.GenerateUniqueChildName("MyStateManager"), stateManagerLibrary);
// Create a state group named MyStateGroup in the MyStateManager state manager.
var myStateGroup = studio.Project.CreateProjectItem<StateGroup>(
myStateManager.GenerateUniqueChildName("MyStateGroup"),
myStateManager);
// Create a state named MyState in the MyStateGroup state group.
var myState = studio.Project.CreateProjectItem<State>(
myStateGroup.GenerateUniqueChildName("MyState"),
myStateGroup);
// Create a state object named MyStateObject in MyState state.
var myStateObject = studio.Project.CreateProjectItem<StateObject>(
myState.GenerateUniqueChildName("MyStateObject"),
myState);
}

To get a state manager from the State Managers library:

public void Execute(PluginCommandParameter parameter)
{
// Get the State Managers library which stores state managers used in a Kanzi Studio project.
var stateManagerLibrary = studio.Project.StateManagerLibrary;
// Create a state manager named MyStateManager in the State Managers library.
studio.Project.CreateProjectItem<StateManager>(stateManagerLibrary.GenerateUniqueChildName("MyStateManager"), stateManagerLibrary);
// Get a state manager named MyStateManager from the State Managers library.
var myStateManager = stateManagerLibrary.GetItemByName("MyStateManager");
}
StyleLibrary StyleLibrary
get

Gets the Styles library which stores styles used in a Kanzi Studio project.

After you get the library, you can access and create resources in that library.

The Styles library in a Kanzi Studio project.

See also
ProjectItem.GetChild(string), ProjectItem.GetChild<T>(string), CreateProjectItem<T>(string, ProjectItem), CreateProjectItem(Type, string, ProjectItem)

Examples

To create a named style in the Styles library:

public void Execute(PluginCommandParameter parameter)
{
// Get the Styles library which stores styles used in a Kanzi Studio project.
var stylesLibrary = studio.Project.StyleLibrary;
// Create a named style named MyNamedStyle in the Styles library.
var myNamedStyle = studio.Project.CreateProjectItem<StyleItem>(
stylesLibrary.GenerateUniqueChildName("MyNamedStyle"), stylesLibrary);
}

To create a typed style in the Styles library:

public void Execute(PluginCommandParameter parameter)
{
// Get the Styles library which stores styles used in a Kanzi Studio project.
var stylesLibrary = studio.Project.StyleLibrary;
// Create a named style named MyTypedStyle in the Styles library.
var myTypedStyle = studio.Project.CreateProjectItem<StyleItem>(
stylesLibrary.GenerateUniqueChildName("MyTypedStyle"), stylesLibrary);
// Convert the named style you just created to a typed style
myTypedStyle.Set(myTypedStyle.PropertyTypes.StyleType, StyleTypeEnum.GENERIC);
}

To get a style from the Styles library:

public void Execute(PluginCommandParameter parameter)
{
// Get the Styles library which stores styles used in a Kanzi Studio project.
var stylesLibrary = studio.Project.StyleLibrary;
// Create a named style named MyNamedStyle in the Styles library.
studio.Project.CreateProjectItem<StyleItem>(stylesLibrary.GenerateUniqueChildName("MyNamedStyle"), stylesLibrary);
// Get the named style named MyNamedStyle from the Styles library.
var myNamedStyle = stylesLibrary.GetItemByName("MyNamedStyle");
}
TagLibrary TagLibrary
get

Gets the Tags library which stores tags used in a Kanzi Studio project.

After you get the library, you can access and create resources in that library.

The Tags library in a Kanzi Studio project.

See also
ProjectItem.GetChild(string), ProjectItem.GetChild<T>(string), CreateProjectItem<T>(string, ProjectItem), CreateProjectItem(Type, string, ProjectItem)

Examples

To get a tag from the Tags library:

public void Execute(PluginCommandParameter parameter)
{
// Get the Tags library which stores tags used in a Kanzi Studio project.
var tagsLibrary = studio.Project.TagLibrary;
// Get the default tag Transparent from the Tags library.
var tagTransparent = tagsLibrary.GetItemByName("Transparent");
}

To create a tag in the Tags library:

public void Execute(PluginCommandParameter parameter)
{
// Get the Tags library which stores tags used in a Kanzi Studio project.
var tagsLibrary = studio.Project.TagLibrary;
// Create a tag named MyTag in the Tags library.
var tag = studio.Project.CreateProjectItem<Tag>(tagsLibrary.GenerateUniqueChildName("MyTag"), tagsLibrary);
}
TextureLibrary TextureLibrary
get

Gets the Textures library which stores textures used in a Kanzi Studio project.

After you get the library, you can access and create resources in that library.

The Textures library in a Kanzi Studio project.

See also
ProjectItem.GetChild

Examples

To get a texture from the Textures library:

public void Execute(PluginCommandParameter parameter)
{
// Get the Textures library which stores all the textures in a Kanzi Studio project.
var texturesLibrary = studio.Project.TextureLibrary;
// Get the DefaultTexture texture from the Textures library.
var defaultTexture = texturesLibrary.GetItemByName("Default Texture");
}