IProject interface provides access to a project from the SDK.
- Return the project name.
- Return the runtime the project is set to use - either
"c2" for the legacy C2 runtime or
"c3" for the modern C3 runtime.
- Look up an object class by a case-insensitive string of its name, returning either an IObjectType (for GetObjectTypeByName), an IFamily (for GetFamilyByName), or either (for GetObjectClassByName), or
null if not found.
- CreateObjectType(pluginId, name)
- Add a new object type to the project. Returns a promise that resolves with an IObjectType representing the new object type. See Finding addon IDs to get a list of possible plugin IDs that can be used.
name is the requested name to use for the object type. If the name is free, it will be used directly; however if the name is already in use, Construct will change the name to one which is available. Call
GetName() on the returned IObjectType to determine what name it was assigned.
- Return an IObjectType representing the System plugin, which exists in every project.
- Return an IObjectType representing a single-global plugin in the project. Returns
null if the given plugin ID does not exist, is not a single-global plugin, or the plugin has not been added to the project. See Finding addon IDs to get a list of possible plugin IDs that can be used.
- CreateFamily(name, members)
- Create a new family in the project. name is an optional family name (pass
null to use a default name). members must be an array of IObjectType representing the object types to add to the family. Families must be created with at least one object type, and if they have multiple object types, they must all be from the same kind of plugin (e.g. all Sprites). Returns an IFamily representing the created family.
- Look up a project file by a case-insensitive string of its filename, returning an IProjectFile if found, else
- AddOrReplaceProjectFile(blob, filename, kind = "general")
- Create a new project file in the project, or replace the content of the file if it already exists, using a
Blob for the file content and a string for the filename. The kind defaults to
"general", which causes the file to be placed in the "Files" folder in the Project Bar. Other options are
- Bring up the Import audio dialog to import a list of audio files given in
fileList. This will automatically transcode the audio files to WebM Opus (when supported for the audio formats), which is the main format Construct uses. Prefer importing PCM WAV files to ensure transcoding is supported and is lossless. The file list should be an array of
File; if blobs, then ensure a
name property is assigned to the blob object to indicate the intended filename.
- Make sure a given font name is loaded so it can be used when drawing text. This is necessary for plugins that render text.
- UndoPointChangeObjectInstancesProperty(instances, propertyId)
- Create a new undo point that undoes changes to
instances must be either an IObjectInstance or an array of IObjectInstance. Call this method before changing an instance's property value and the action will be undoable.
Addon SDK Manual
You are here:
Search this manual:
This manual entry was last updated on 16 Nov, 2020 at 17:14