Addons

From Light Forge Wiki
Jump to: navigation, search

Contents

Introduction

The Lightforge API allows you to create new tools, new input and output methods, automate complex operations, and much more.

Lightforge addons are written in IronPython. IronPython is an open-source implementation of the Python programming language which is tightly integrated with the .NET Framework. It allows you to use both .Net and Python libraries and allows very tight integration between Lightforge and addons. For more information on IronPython you can visit www.ironpython.net. For more information on Python in general you can visit www.python.org/doc/.

Your First Addon

To create an addon go to Addon Menu and click Addon Settings. You will find a button labeled Addon Folder. Clicking this will open up the Lightforge addon folder.

In this folder create a new folder named "Hello World".

Open the Hello World folder and create a new file named base.py. Open this file with your preferred Python editor, or Notepad if you have none.

Type the code:

def onExecute():
	print("Hello World!")

Save the script, and return to Lightforge.

In the Addon Settings dialog click "Reload Addons", and if all went well, your addon will appear.

Click the check box next to the Hello World addon to enable it, then close the Addon Settings Dialog.

In the Addon menu the Hello World addon should be visible. Clicking on it will run the addon.

Now in the Window menu click "Console", this will open up the python console and you should see the text "Hello World!"


Congratulations! You've made an addon!

Where To Go From Here

I would suggest investigating the API and seeing what all there is to do. Also be sure to check out the Sample Addons.

Addon Structure

The file structure of a Lightforge addon is very simple. It consists of a folder with at least one required script file named base.py, and optionally a xml file named addonInfo.xml.

base.py

This is the entry point for your addon. It's the script file that Lightforge interacts with directly.

addonInfo.xml

This xml file gives Lightforge additional information about your addon. This info will appear in the Addon Settings panel.

The addonInfo.xml file can contain the following information:

Author

The author of the addon.

Version

The current version number.

Website

A website associated with this addon.

Support

An email address or website for providing addon support.

XML Structure

<addonInfo>
	<author>Visual Sorcery</author>
	<version>1.0.0</version>
	<website>http://www.visualsorcery.com/</website>
	<support>support@visualsorcery.com</support>
</addonInfo>

Classes

API

This class contains all access for working with Lightforge.

API

Addon

This class gives you access to information about your addon.

Addon

Sample Addons

On this page you can find sample code for learning how to create addons. Sample Addons

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox