CreatorAppDev

description: 鍒涘缓妯″瀷绛

Contents:

Creator app for Paraworld

Title Creator app for Paraworld
Author(s) Andy, LiXizhi
Date 2008/1/5, revised 2008.6.15 LiXizhi
File script/kids/3DMapSystemUI/Creator/app_main.lua

Description

CreateObject

  • Map3DSystem.App.Commands.Call("Creation.NormalModel", objParams); where objParams is the object parameters to be created. for more information, please see object_editor

NormalModel

show the creator panel for this category of object
  • Map3DSystem.App.Commands.Call("Creation.NormalModel");

NormalCharacter

show the creator panel for this category of object
  • Map3DSystem.App.Commands.Call("Creation.NormalCharacter");

BuildingComponents

show the creator panel for this category of object
  • Map3DSystem.App.Commands.Call("Creation.BuildingComponents");

UpdatePanels

whenever the selection changed, we need to call following command to update panels.
  • Map3DSystem.App.Commands.Call("Creation.UpdatePanels");

ShowOBB

show or hide the object bounding box. if params is nil, it will toggle display
  • Map3DSystem.App.Commands.Call("Creation.ShowOBB", true);

ShowReport

show or hide the graphics report. if params is nil, it will toggle display
  • Map3DSystem.App.Commands.Call("Creation.ShowReport", true);

modify page

show or hide the modify panel. Modify panel is valid for both character and static model. And they share the same mcml page.
  • show the modify panel: Map3DSystem.App.Commands.Call("Creation.Modify");
  • hide the modify panel: Map3DSystem.App.Commands.Call("Creation.Modify", {bShow=false});

property page

Each scene object may have zero or several property pages, depending on the type of the scene object and applications installed. Normal character has CharPropertyPage defined in CreatorApp. It can be invoked by
  • Map3DSystem.App.Commands.Call("Creation.CharProperty");
Object with replaceable textures(r2) has ObjTexPropertyPage defined in CreatorApp. It can be invoked by
  • Map3DSystem.App.Commands.Call("Creation.ObjTexProperty");

To automatically invoke the appropriate property or modify page(whichever is important) of the currently selected or context menu object. Call below.

  • Map3DSystem.App.Commands.Call("Creation.DefaultProperty"); -- for selected object
  • Map3DSystem.App.Commands.Call("Creation.DefaultProperty", {target="contextmenu"}); -- for context menu object
  • Map3DSystem.App.Commands.Call("Creation.DefaultProperty", {target=""}); -- hide all property page
Above function can be invoked by other applications, since it does not rely on any scene object hook.

db registration insert script INSERT INTO apps VALUES (NULL, 'Creator_GUID', 'Creator', '1.0.0', 'http://www.paraengine.com/apps/Creator_v1.zip', 'YourCompany', 'enUS', 'script/kids/3DMapSystemUI/Creator/IP.xml', '', 'script/kids/3DMapSystemUI/Creator/app_main.lua', 'Creator.MSGProc', 1);

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Creator/app_main.lua");

Member Functions

Creator.OnConnection

requires

create class local Creator = {}; commonlib.setfield("Map3DSystem.App.Creator", Creator);

"selection" or "contextmenu". where to get the object in concern. i.e. local obj = Map3DSystem.obj.GetObjectParams(Map3DSystem.App.Creator.target); Creator.target = "selection";


event handlers

OnConnection method is the obvious point to place your UI (menus, mainbars, tool buttons) through which the user will communicate to the app. This method is also the place to put your validation code if you are licensing the add-in. You would normally do this before putting up the UI. If the user is not a valid user, you would not want to put the UI into the IDE.

  • param app : the object representing the current application in the IDE.
  • param connectMode : type of ConnectMode.

syntax

function Creator.OnConnection(app, connectMode)

parameters

app the object representing the current application in the IDE.
connectMode  

Creator.OnDisconnection

Receives notification that the Add-in is being unloaded.

syntax

function Creator.OnDisconnection(app, disconnectMode)

parameters

app  
disconnectMode  

Creator.OnQueryStatus

This is called when the command's availability is updated When the user clicks a command (menu or mainbar button), the QueryStatus event is fired. The QueryStatus event returns the current status of the specified named command, whether it is enabled, disabled, or hidden in the CommandStatus parameter, which is passed to the msg by reference (or returned in the event handler).

  • param commandName : The name of the command to determine state for. Usually in the string format "Category.SubCate.Name".
  • param statusWanted : what status of the command is queried. it is of type CommandStatusWanted
  • return __ : returns according to statusWanted. it may return an integer by adding values in CommandStatus.

syntax

function Creator.OnQueryStatus(app, commandName, statusWanted)

parameters

app  
commandName The name of the command to determine state for. Usually in the string format "Category.SubCate.Name".
statusWanted  
return returns according to statusWanted. it may return an integer by adding values in CommandStatus.

Creator.OnExec

This is called when the command is invoked.The Exec is fired after the QueryStatus event is fired, assuming that the return to the statusOption parameter of QueryStatus is supported and enabled. This is the event where you place the actual code for handling the response to the user click on the command.

  • param commandName : The name of the command to determine state for. Usually in the string format "Category.SubCate.Name".

syntax

function Creator.OnExec(app, commandName, params)

parameters

app  
commandName The name of the command to determine state for. Usually in the string format "Category.SubCate.Name".
params  

Creator.OnRenderBox

Change and render the 3D world with mcml data that is usually retrieved from the current user's profile page for this application.

syntax

function Creator.OnRenderBox(mcmlData)

parameters

mcmlData  

Creator.Navigate

called when the user wants to nagivate to the 3D world location relavent to this application

syntax

function Creator.Navigate()

Creator.GotoHomepage

called when user clicks to check out the homepage of this application. Homepage usually includes: developer info, support, developer worlds information, app global news, app updates, all community user rating, active users, trade, currency transfer, etc.

syntax

function Creator.GotoHomepage()

Creator.DoQuickAction

called when user clicks the quick action for this application.

syntax

function Creator.DoQuickAction()

Creator.Hook_SceneObjectSelected

"scene" object window hook. we will show object page accordingly.

syntax

function Creator.Hook_SceneObjectSelected(nCode, appName, msg)

parameters

nCode  
appName  
msg  

Creator.ShowDefaultObjectPage

show modify or property panel, whichever is more important to the currently selected object

  • param target : nil or "" or "selection" or "contextmenu". if nil, it default to "selection". It specifies where to get the object in concern. if "", all panels are hidden.

syntax

function Creator.ShowDefaultObjectPage(target)

parameters

| target | nil or "" or "selection" or "contextmenu". if nil, it default to "selection". It specifies where to get the object in concern. if "", all panels are hidden. |

Creator.OnWorldClosed

called whenever a world is being closed.

syntax

function Creator.OnWorldClosed()

Creator.MSGProc


client world database function helpers.


all related messages

APPS can be invoked in many ways: Through app Manager mainbar or menu command or buttons Command Line 3D World installed apps

syntax

function Creator.MSGProc(window, msg)

parameters

window  
msg  

character property page code behind file

Title character property page code behind file
Author(s) LiXizhi
Date 2008/6/14
File script/kids/3DMapSystemUI/Creator/CharPropertyPage.lua

Description

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Creator/CharPropertyPage.lua");
Map3DSystem.App.Creator.CharPropertyPage.UpdatePanelUI()
Map3DSystem.App.Creator.CharPropertyPage.OnAssignAIClick(1, "contextmenu")

Member Functions

CharPropertyPage.DS_Func_NPC

 NPC data source. 
local dsNPC = {
   {Title="鎴戣瀛︿細璇磋瘽", Icon="Texture/3DMapSystem/AppIcons/chat_64.dds", SubTitle="瀛﹁璇? 鐪熶汉閰嶉煶"},
   {Title="闅忔満璧板姩", Icon="Texture/3DMapSystem/AppIcons/Environment_64.dds", SubTitle="鍦ㄥ懆鍥撮殢鏈鸿蛋鍔?},
   {Title="鎴戞槸璺熷眮铏?, Icon="Texture/3DMapSystem/AppIcons/People_64.dds", SubTitle="鑷姩璺熼殢闄勮繎鐨勭帺瀹?},
   {Title="鎴戞槸瀵兼父", Icon="Texture/3DMapSystem/AppIcons/NewWorld_64.dds", SubTitle="鍗忓姪鐜╁鐨勫娓?},
   {Title="鏈ㄥご浜?, Icon="Texture/3DMapSystem/AppIcons/Pet_64.dds", SubTitle="鎴愪负鍘熷湴涓嶅姩鐨勪汉鐗?},
}

data source function for official app.

syntax

function CharPropertyPage.DS_Func_NPC(index)

parameters

index  

CharPropertyPage.OnInit

init

syntax

function CharPropertyPage.OnInit()

CharPropertyPage.UpdatePanelUI

update UI

syntax

function CharPropertyPage.UpdatePanelUI()

CharPropertyPage.OnClose

close panel

syntax

function CharPropertyPage.OnClose()

CharPropertyPage.OnSwitchToObject

take control of the character

syntax

function CharPropertyPage.OnSwitchToObject()

CharPropertyPage.OnChangeCharacterName

whenever the user pressed the change name button

syntax

function CharPropertyPage.OnChangeCharacterName()

CharPropertyPage.OnChangeCharacterSkin

change to the next skin

syntax

function CharPropertyPage.OnChangeCharacterSkin()

CharPropertyPage.OnSaveCharacterProperty

save character to local world db

syntax

function CharPropertyPage.OnSaveCharacterProperty()

CharPropertyPage.OnDeleteCharacter

delete it.

syntax

function CharPropertyPage.OnDeleteCharacter()

CharPropertyPage.OnClickNPLTemplate

user clicks the NPC template.

syntax

function CharPropertyPage.OnClickNPLTemplate(index)

parameters

index  

CharPropertyPage.OnAssignAIClick

called when one of the AI buttons is clicked. see dsNPC table for meaning of the index.

  • param nIndex : behavior type
  • param target : it can be "selection" or "contextmenu" or nil. if nil it is the target set by Map3DSystem.App.Creator.target

syntax

function CharPropertyPage.OnAssignAIClick(nIndex, target)

parameters

nIndex behavior type
target  

creator application main window

Title creator application main window
Author(s) WangTian
Date 2008/5/26
File script/kids/3DMapSystemUI/Creator/Main.lua

Description

Creator application window is upgraded to the new aura look, including: show the window on the side instead of bottom to utilize more screen space show the items in grid view form fit to window size automaticly categories are arranged on the top and left(/right) side of the grid view

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Creator/Main.lua");

Member Functions

Map3DSystem.UI.Creator.ShowMainWnd3

Show the creator main window

syntax

function Map3DSystem.UI.Creator.ShowMainWnd3(bShow)

parameters

bShow  

Map3DSystem.UI.Creator.ShowMainWnd

Show the creator main window

syntax

function Map3DSystem.UI.Creator.ShowMainWnd(bShow)

parameters

bShow  

Map3DSystem.UI.Creator.DestroyMainWnd

destory the main window, usually called when the world is closed

syntax

function Map3DSystem.UI.Creator.DestroyMainWnd()

Map3DSystem.UI.Creator.OnSize

change the main window size, usually called on resolution change

syntax

function Map3DSystem.UI.Creator.OnSize(width, height)

parameters

width  
height  

Map3DSystem.UI.Creator.MSGProc

Message Processor of Creator main control On receive WM_SIZE message it will update the CreationTabGrid control

syntax

function Map3DSystem.UI.Creator.MSGProc(window, msg)

parameters

window  
msg  

Map3DSystem.UI.Creator.OnDeactivate

exit BCS mode and clear miniscenegraph this function is also called when creator desktop is switched off. -- lxz 2008.6.15

syntax

function Map3DSystem.UI.Creator.OnDeactivate()

Map3DSystem.UI.Creator.SwitchCategory

  • param index : 1 normal model 2 BCS 3 normal character

syntax

function Map3DSystem.UI.Creator.SwitchCategory(index)

parameters

| index | 1 normal model 2 BCS 3 normal character |

Map3DSystem.UI.Creator.OnGridItemClick

user clicks an icon in the creation panel.

syntax

function Map3DSystem.UI.Creator.OnGridItemClick(level1index, level2index, itemindex)

parameters

level1index  
level2index  
itemindex  

Map3DSystem.UI.Creator.GetObjParamsFromAsset

[[ @Updated by LXZ 2008.2.8: this function is also used by the asset app to create preview model. get the objParams from an asset description table and its category.

  • param category : the asset category name. such as "BCS_buildingcomponents", "NM_normalmodel", "NC_normalcharacter", "CCS_customizablecharacter", the prefix decides the category. Known category is "BCS_", "NC_","NM_", "CCS_"
  • param item : the asset description table. asset = { ["filename"] = "character/v1/01human/long/long.x", ["Reserved1"] = "0.3", ["text"] = "demo char", ["Reserved3"] = "1", ["Reserved2"] = "1.2", }
  • return __ : objParams table is created. it may return nil.
]]

syntax

function Map3DSystem.UI.Creator.GetObjParamsFromAsset(category, item)

parameters

category the asset category name. such as "BCS_buildingcomponents", "NM_normalmodel", "NC_normalcharacter", "CCS_customizablecharacter", the prefix decides the category. Known category is "BCS_", "NC_","NM_", "CCS_"
item  
| return | objParams table is created. it may return nil. ]] |

object modification page code behind file

Title object modification page code behind file
Author(s) LiXizhi
Date 2008/6/11
File script/kids/3DMapSystemUI/Creator/ObjModifyPage.lua

Description

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Creator/ObjModifyPage.lua");
-- call below to load window
Map3DSystem.App.Commands.Call("File.MCMLWindowFrame", {
   url="script/kids/3DMapSystemUI/Creator/ObjModifyPage.html", name="ObjModifyPage", 
   app_key=Map3DSystem.App.AppKeys["Creator"], 
   isShowTitleBar = false, 
   isShowToolboxBar = false, 
   isShowStatusBar = false, 
   initialWidth = 200, 
   alignment = "Left", 
});
Map3DSystem.App.Creator.ObjModifyPage.UpdatePanelUI()

Member Functions

ObjModifyPage.OnInit

syntax

function ObjModifyPage.OnInit()

ObjModifyPage.UpdatePanelUI

update the tranlation rotation scaling shift reset and canvas UI according to the current selected object

syntax

function ObjModifyPage.UpdatePanelUI()

ObjModifyPage.OnTranslationClick

Event handler: on object translation

syntax

function ObjModifyPage.OnTranslationClick()

ObjModifyPage.OnRotationClick

Event handler: on object rotation

syntax

function ObjModifyPage.OnRotationClick()

ObjModifyPage.OnClose

close panel

syntax

function ObjModifyPage.OnClose()

object texture property page code behind file

Title object texture property page code behind file
Author(s) LiXizhi
Date 2008/6/15
File script/kids/3DMapSystemUI/Creator/ObjTexPropertyPage.lua

Description

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Creator/ObjTexPropertyPage.lua");
Map3DSystem.App.Creator.ObjTexPropertyPage.UpdatePanelUI()

Member Functions

ObjTexPropertyPage.DS_Func_Tex

 NPC data source. 
local dsTex = {
   {Title="鎴戣瀛︿細璇磋瘽", Icon="Texture/3DMapSystem/AppIcons/chat_64.dds", SubTitle="瀛﹁璇? 鐪熶汉閰嶉煶"},
}

data source function for official app.

syntax

function ObjTexPropertyPage.DS_Func_Tex(index)

parameters

index  

ObjTexPropertyPage.UpdatePanelUI

update UI

syntax

function ObjTexPropertyPage.UpdatePanelUI()

ObjTexPropertyPage.OnInit

init

syntax

function ObjTexPropertyPage.OnInit()

ObjTexPropertyPage.OnClose

close panel

syntax

function ObjTexPropertyPage.OnClose()

ObjTexPropertyPage.OnClickTexTemplate

user clicks the NPC template.

syntax

function ObjTexPropertyPage.OnClickTexTemplate(index)

parameters

index  

ObjTexPropertyPage.OnChangeFileUrl

user changes the file url.

syntax

function ObjTexPropertyPage.OnChangeFileUrl(sCtrlName, filename)

parameters

sCtrlName  
filename  

ObjTexPropertyPage.OnOpenFileForModelTexture

open file for model texture

syntax

function ObjTexPropertyPage.OnOpenFileForModelTexture()

ObjTexPropertyPage.OnClickNavTo

use web page texture

syntax

function ObjTexPropertyPage.OnClickNavTo()

ObjTexPropertyPage.OnUndoModelTexture

force using the default replaceable texture for the given model.

syntax

function ObjTexPropertyPage.OnUndoModelTexture()

ObjTexPropertyPage.OnEditModelTexture

let the user painter by himself.

syntax

function ObjTexPropertyPage.OnEditModelTexture()

ObjTexPropertyPage.OnEndEditingTexture

when the user saves an owner draw image

syntax

function ObjTexPropertyPage.OnEndEditingTexture()

ObjTexPropertyPage.OnSaveUserDrawing

when the user saves an owner draw image

syntax

function ObjTexPropertyPage.OnSaveUserDrawing()

Popup Obj modify window

Title Popup Obj modify window
Author(s) LiXizhi
Date 2008/6/14
File script/kids/3DMapSystemUI/Creator/PopupObjModWnd.lua

Description

The UI is on mcml page PopupObjModPage.html

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Creator/PopupObjModWnd.lua");
Map3DSystem.UI.Creator.PopupModWnd.ShowPopupEdit(obj_params)

Member Functions

PopupModWnd.ShowPopupEdit


show a top level popup window for a mouse cursor 3D mesh object
PopupModWnd.Name = "PopupEdit"; function(bIsCancel) or string, -- function to call when edit window closes. PopupEditor_onclose = nil;
  • param obj :_params: a valid object params. More info see objeditor.lua
  • param x :,y: position at which to display the window
  • param onclose : function(bIsCancel) or string, -- function to call when edit window closes.

syntax

function PopupModWnd.ShowPopupEdit(obj_params, x, y, onclose)

parameters

obj _params: a valid object params. More info see objeditor.lua
params  
x  
y  
onclose function(bIsCancel) or string, -- function to call when edit window closes.

Portal3DCanvas

Title Portal3DCanvas
Author(s) Leio
Date 2008/12/11
File script/kids/3DMapSystemUI/Creator/Portal3DCanvas.lua

Description

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Creator/Portal3DCanvas.lua");

Portal3DCanvasView

Title Portal3DCanvasView
Author(s) Leio
Date 2008/12/29
File script/kids/3DMapSystemUI/Creator/Portal3DCanvasView.lua

Description

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Creator/Portal3DCanvasView.lua");

PortalCanvas

Title PortalCanvas
Author(s) Leio
Date 2008/12/11
File script/kids/3DMapSystemUI/Creator/PortalCanvas.lua

Description

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Creator/PortalCanvas.lua");

PortalCanvasView

Title PortalCanvasView
Author(s) Leio
Date 2008/12/29
File script/kids/3DMapSystemUI/Creator/PortalCanvasView.lua

Description

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Creator/PortalCanvasView.lua");

PortalMetasView

Title PortalMetasView
Author(s) Leio
Date 2009/1/4
File script/kids/3DMapSystemUI/Creator/PortalMetasView.lua

Description

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Creator/PortalMetasView.lua");

PortalPage code behind file

Title PortalPage code behind file
Author(s) LiXizhi
Date 2008/9/11
File script/kids/3DMapSystemUI/Creator/PortalPage.lua

Description

create and modify a portal node in the scene.

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Creator/PortalPage.lua");
Map3DSystem.App.Creator.PortalPage.UpdatePanelUI()

Member Functions

PortalPage.OnCreatePortal

create a default portal at current location

syntax

function PortalPage.OnCreatePortal(name, values)

parameters

name  
values  

PortalPage.OnUpdatePortalPoints

update points

syntax

function PortalPage.OnUpdatePortalPoints(name, values)

parameters

name  
values  

PortalSystemPage code behind file

Title PortalSystemPage code behind file
Author(s) LiXizhi
Date 2008/9/11
File script/kids/3DMapSystemUI/Creator/PortalSystemPage.lua

Description

for testing only

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Creator/PortalSystemPage.lua");

Member Functions

PortalSystemPage.NewZoneNode

create a new zone node

syntax

function PortalSystemPage.NewZoneNode(params)

parameters

params  

StaticObjPage code behind file

Title StaticObjPage code behind file
Author(s) Leio
Date 2008/12/30
File script/kids/3DMapSystemUI/Creator/StaticObjPage.lua

Description

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Creator/StaticObjPage.lua");

ZoneListPage code behind file

Title ZoneListPage code behind file
Author(s) Leio
Date 2008/12/11
File script/kids/3DMapSystemUI/Creator/ZoneListPage.lua

Description

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Creator/ZoneListPage.lua");

ZoneNode PortalNode StaticObjNode

Title ZoneNode PortalNode StaticObjNode
Author(s) Leio
Date 2008/12/11
File script/kids/3DMapSystemUI/Creator/ZoneNode.lua

Description

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Creator/ZoneNode.lua");

ZonePage code behind file

Title ZonePage code behind file
Author(s) LiXizhi
Date 2008/9/26
File script/kids/3DMapSystemUI/Creator/ZonePage.lua

Description

for testing only

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Creator/ZonePage.lua");
Map3DSystem.App.Creator.ZonePage.UpdatePanelUI()

Member Functions

ZonePage.OnUpdateZonePlanes

update points

syntax

function ZonePage.OnUpdateZonePlanes(name, values)

parameters

name  
values  

ZoneTemplatePage

Title ZoneTemplatePage
Author(s) Leio
Date 2008/12/29
File script/kids/3DMapSystemUI/Creator/ZoneTemplatePage.lua

Description

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Creator/ZoneTemplatePage.lua");
Topic revision: r1 - 2008-02-29 - LiXizhi
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2022 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback