PainterPlugin { // starts a timer that will trigger the 'onTick' callback at regular interval // 启动一个计时器,该计时器将定期触发“ on tick”回调 tickIntervalMS: -1// -1 禁用(默认值)
// starts a JSON server on the given port: // 在给定的端口上启动json服务器 // you send javascript that will be evaluated and you get the result in JSON format //您发送将被评估的javascript,并以json格式获取结果 jsonServerPort: -1// -1 禁用(默认值)
Component.onCompleted: { // Called after the object has been instantiated. // 在实例化对象之后调用。 // This can be used to execute script code at startup, // 可用于在启动时执行脚本代码, // once the full QML environment has been established. // 现已建立完整的qml环境 alg.log.info("Component.onCompleted") }
onTick: { // Do something at each tick, depending on tickIntervalMS value // 在每个滴答声中有一些东西,具体取决于滴答间隔ms值 alg.log.info("onTick") }
onConfigure: { // Do something when the user request the plugin configuration panel // 当用户请求插件配置面板时执行某些操作 alg.log.info("onConfigure") }
onApplicationStarted: { // Called when the application is started // 启动应用程序时调用 alg.log.info("onApplicationStarted") }
onNewProjectCreated: { // Called when a new project is created, before the onProjectOpened callback // 在创建新项目时调用,在on project打开回调之前调用 alg.log.info("onNewProjectCreated") }
onProjectOpened: { // Called when the project is fully loaded // 在项目完全加载时调用 alg.log.info("onProjectOpened") }
onProjectAboutToClose: { // Called before project unload // 在项目卸载之前调用 alg.log.info("onProjectAboutToClose") }
onProjectAboutToSave: function(destinationUrl) { // Called before a save, 'destination_url' parameter contains the save destination // 在保存之前调用,“目标网址”参数包含保存目标 alg.log.info("onProjectAboutToSave: "+destinationUrl) }
onProjectSaved: { // Called after the project was saved // 项目保存后调用 alg.log.info("onProjectSaved") }
onComputationStatusChanged: function(isComputing) { // Called when the state of the engine computing stacks content change. // 当引擎计算堆栈的状态更改内容时调用。 // If the stack content is computed, 'isComputing' parameter will be false // 如果计算堆栈内容,则“正在计算”参数为false alg.log.info("onComputationStatusChanged: "+isComputing) }
onExportAboutToStart: function(maps) { // Called just before the export process starts. // 在导出过程开始之前调用。 // 'maps' is the list of filepaths expected to be written. // “映射”是预期要写入的文件路径的列表。 alg.log.info("onExportAboutToStart: ") for (var stackName in maps) { alg.log.info(stackName); for (var filePath in maps[stackName]) { alg.log.info(maps[stackName][filePath]); } }
// Example: // Open the 'PreviewSphere' sample, set 'C:/tmp' as export path, choose 'png' as export // 打开“预览球”示例,将“ c:/ tmp”设置为导出路径,选择“ png”作为导出 // format and select the 'PBR MetalRough' config, the example above will output: // 格式化并选择“ pbr metal raw”配置,以上示例将输出:
// Please note the 'Opacity' and 'Emissive' maps are not listed here because they // 请注意,此处未列出“不透明”和“发射”地图,因为它们 // can not be exported with this sample while the actual export will warn about it. // 不能与该样品一起出口,但实际出口会发出警告。 }
onExportFinished: function(status, maps) { // Called right after the export process ends. // 在导出过程结束后立即调用 // 'status' is the error status returned by the process. Available values are: // “状态”是进程返回的错误状态。,可用值为: // - Export.Status_Ok // - Export.Status_Warn // - Export.Status_Error // - Export.Status_Canceled // 'maps' is the list of filepaths effectively exported. // “映射”是有效导出的文件路径的列表。 alg.log.info("onExportFinished: ") if (status != Export.Status_Ok) { alg.log.error("Export failed.") } else { for (var stackName in maps) { alg.log.info(stackName); for (var filePath in maps[stackName]) { alg.log.info(maps[stackName][filePath]); } } } }
}
Plugin meta data: Information about the plugin can be provided by creating a plugin.json file in the plugin directory. Available properties are: 可以通过在plugin目录中创建一个plugin.json文件来提供有关该插件的信息。,可用属性为: description: plugin description, displayed in the plugin about dialog. url: project homepage, displayed in the plugin about dialog. Warning, the scheme is mandatory to create a clickable link. version: plugin version. license: plugin license. min_api_version: required minimal scripting API version. Example:
1 2 3 4 5 6
{ "description": "This is a sample plugin", "url": "https://www.allegorithmic.com", "version": "0.1.0", "license": "<a href=\"https://opensource.org/licenses/MIT\">MIT</a>" }