Kanzi 3.9.16
FileSystemProjectItem Interface Reference

Access resource files such as images, shader source files, and 3D assets. More...

Inheritance diagram for FileSystemProjectItem:
[legend]
Collaboration diagram for FileSystemProjectItem:
[legend]

Properties

string FileSystemParentDirectory [get]
 Gets the path to the directory in which a resource file is stored.
 
string FileSystemPath [get]
 Gets the full path to a resource file.
 
- Properties inherited from ProjectItem
IEnumerable< ProjectItem > Children [get]
 Gets all child items of a project item.
 
string IconLocation [get]
 
object IconModifier [get, set]
 
string InvalidityReason [get]
 
bool IsDeleted [get]
 
bool IsDisposed [get]
 
bool IsHidden [get, set]
 
bool IsReadOnly [get, set]
 
bool IsValidState [get]
 
string KzbUrl [get]
 Gets the kzb URL of a project item.
 
string Name [get, set]
 Gets or sets the name of a project item.
 
ProjectItem Parent [get, set]
 
string Path [get]
 
Project Project [get]
 Gets the project in which this item is located.
 
Type ProjectItemType [get]
 
PropertyTypeLibrary PropertyTypeLibrary [get]
 Gets the Property Types library of the project of this item which stores all property types you create in a Kanzi Studio project.
 
ProjectItemProperties PropertyTypes [get]
 
object this[Property property] [get, set]
 
object this[string propertyName] [get, set]
 
string ToolTip [get]
 
string TypeDisplayName [get]
 Gets the type of a project item.
 
- Properties inherited from PropertyContainer
IEnumerable< Property > Properties [get]
 Gets the properties in a project item or node component.
 

Additional Inherited Members

- Public Member Functions inherited from ProjectItem
void AddProperty (Property property)
 Adds a property to an item.
 
void AddProperty (string propertyName)
 Adds a property to an item.
 
void BeginBatchModification (string batchName)
 
bool CanAddProperty (Property property)
 Checks whether Kanzi Studio allows you to add a specific property to an item.
 
bool CanAddProperty (string propertyName)
 Checks whether Kanzi Studio allows you to add a specific property to an item.
 
void CommitBatchModification ()
 
bool Delete ()
 Deletes a project item.
 
void DeregisterThumbnailUser (object user)
 Deregisters a registerd thumbnail user.
 
IEnumerable< Property > GetAddableProperties ()
 Gets a list of properties which you can add to an item.
 
T GetAncestor< T > ()
 Gets the nearest item of given type in the parent tree.
 
ProjectItem GetChild (string childName)
 Gets the child item of the current item with the given name.
 
T GetChild< T > (string childName)
 Gets the child item of the current item with the given name and type.
 
int GetChildIndex (ProjectItem child)
 
IEnumerable< Property > GetContextProperties ()
 
IEnumerable< Property > GetFixedProperties ()
 
IEnumerable< Property > GetFrequentlyAddedProperties ()
 
ProjectItem GetProjectItemByPath (string path)
 
string GetRelativeProjectPathTo (ProjectItem anotherItem)
 
IEnumerable< Property > GetRemovableProperties ()
 Gets a list of properties which you can remove from an item.
 
BitmapSource GetThumbnail (int width, int height, bool showChildren, bool showFullScreen, Node contextNode)
 Gets the thumbnail image for a project item.
 
BitmapSource GetThumbnail (int width, int height, bool showChildren, bool showFullScreen, Node contextNode, float[] letterboxColorRGBA)
 Gets the thumbnail image for a project item.
 
IEnumerable< ProjectItem > GetTreeItemsAsList ()
 Enumerates the items under this ProjectItem including this item itself, children, and grand children.
 
bool HasProperty (Property property)
 Checks whether an item has a specific property.
 
bool HasProperty (string propertyName)
 Checks whether an item has a specific property.
 
bool IsPropertyReadOnly (Property property)
 
void RegisterThumbnailUser (object user, uint width, uint height, bool showChildren, bool showFullScreen, Node contextNode)
 Registers a user for the thumbnail images for a project item.
 
void RemoveProperty (Property property)
 Removes a property from an item.
 
void RemoveProperty (string propertyName)
 Removes a property from an item.
 
void SetChildIndex (ProjectItem child, int index)
 
void SetPropertyReadOnlyStatus (Property property, bool? value)
 
void UpdateValidity ()
 Recalculates the validity the item.
 
- Public Member Functions inherited from PropertyContainer
object Get (Property property)
 Gets the value of a property.
 
object Get (string propertyName)
 Gets the value of a property.
 
T Get< T > (TypedProperty< T > property)
 Gets the value of a property.
 
void Set (string propertyName, object value)
 Sets the value of a property.
 
void Set< T > (TypedProperty< T > property, T value)
 Sets the value of a property.
 
- Public Member Functions inherited from ChildContainer
string GenerateUniqueChildName (string defaultName)
 Generates a unique name.
 
string GetInvalidityReasonOfNewName (string newName)
 Returns the reason why the passed name is not valid.
 
- Events inherited from ProjectItem
EventHandler< CollectionChangedEventArgs< ProjectItem > > ChildCollectionChanged
 
EventHandler< DeletedEventArgs > Deleted
 
EventHandler< DeletedEventArgs > Deleting
 
EventHandler< CollectionChangedEventArgs< ProjectItem > > DescendantChildCollectionChanged
 
EventHandler< DeletedEventArgs > DescendantDeleted
 
EventHandler< DynamicPropertyChangedEventArgs > DescendantDynamicPropertyChanged
 
EventHandler< ParentChangedEventArgs > DescendantParentChanged
 
EventHandler< CollectionChangedEventArgs< string > > DescendantPropertyCollectionChanged
 
EventHandler< ProjectItemEventArgs > Disposing
 
EventHandler< DynamicPropertyChangedEventArgs > DynamicPropertyChanged
 
EventHandler< ParentChangedEventArgs > ParentChanged
 
EventHandler< PathChangedEventArgs > PathChanged
 
EventHandler< DynamicPropertyChangedEventArgs > PreviewDescendantDynamicPropertyChanged
 
EventHandler< DynamicPropertyChangedEventArgs > PreviewDynamicPropertyChanged
 
EventHandler< CollectionChangedEventArgs< string > > PropertyCollectionChanged
 
EventHandler< ReplaceEventArgs > Replacing
 
EventHandler ThumbnailChanged
 
EventHandler ValidityChanged
 

Detailed Description

Access resource files such as images, shader source files, and 3D assets.

Resource file items are project items that represent the files in the resource file directories of the project directory.

Property Documentation

◆ FileSystemParentDirectory

string FileSystemParentDirectory
get

Gets the path to the directory in which a resource file is stored.

See also
Project.ImageDirectory

Examples

To get the path to the Images directory of a Kanzi Studio project:

public void Execute(PluginCommandParameter parameter)
{
// Get the Images directory which contains the image files in a Kanzi Studio project.
var imageDirectory = studio.ActiveProject.ImageDirectory;
// Get an image file in the Images directory.
var imageFile = imageDirectory.Children.OfType<ImageFile>().First();
// Print the path to the Images directory to the Kanzi Studio Log window.
studio.Log("The image files of this project are stored in " + imageFile.FileSystemParentDirectory);
}

◆ FileSystemPath

string FileSystemPath
get

Gets the full path to a resource file.

See also
Project.ShaderSourceDirectory, Project.MaterialTypeLibrary, Project.MaterialLibrary

Examples

To create a function that creates a material type from vertex and fragment shaders:

// Create a function that creates a Material Type and takes as its input the paths to the files
// that contain the vertex and fragment shaders for this material type.
private void CreateMaterialType(string name, string vertexShaderPath, string fragmentShaderPath)
{
// Create a Material Type in the Library > Materials and Textures > Material Types library.
var materialTypeLibrary = studio.ActiveProject.MaterialTypeLibrary;
var materialType = studio.ActiveProject.CreateProjectItem<MaterialType>(
materialTypeLibrary.GenerateUniqueChildName(name), materialTypeLibrary);
// Set the material type you created to use the vertex shader that you pass to the function.
// Read the content of the file which contains the vertex shader code that you want to use.
// To use this function, in the class library file that implements the PluginCommand interface
// add the using directive for the System.IO namespace.
string vertexShaderSource = File.ReadAllText(vertexShaderPath);
// Get the vertex shader of the material type you created.
// Get the vertex shader source file.
var vertexShaderSourceFile = vertexShader.Get(vertexShader.PropertyTypes.ShaderSourceFile);
// Get the path to the vertex shader source file.
{
// Replace the content of the existing vertex shader with the vertex shader you pass to the function.
}
// Set the material type you created to use the fragment shader you pass to the function.
// Use the same approach you used to set the vertex shader.
var fragmentShaderSourceFile = fragmentShader.Get(fragmentShader.PropertyTypes.ShaderSourceFile);
{
}
// Create a material which uses the material type you created.
var materialLibrary = studio.ActiveProject.MaterialLibrary;
var material = studio.ActiveProject.CreateProjectItem<Material>(
materialLibrary.GenerateUniqueChildName(name + "Material"), materialLibrary);
material.Set(material.PropertyTypes.MaterialType, materialType);
}