SetWorldEditorViewProjection view,projection[,span#][,active]
Parameters
|
view - live World Editor view handle projection - projection kind: 1: perspective 2: orthographic span# (optional) - horizontal orthographic extent in world units, 0.002 to 200000; 24 (default) active (optional) - whether this view draws pointer/marquee overlays; True (default) |
Description
|
Sets the projection used by live rendering and picking. Requires the host capability view.orthographic.v1; simultaneous views require view.multiple.v1. Each view keeps its own camera and projection. FreeWorldEditorView releases only that view's presentation target. Selection highlights remain visible in all views; active controls only the pointer overlay. Handles are context-owned and reject stale or wrong-kind values. For the full story, see the Debug World Editor guide. Requires Extended mode. See also: SetWorldEditorViewCamera, CreateWorldEditorView, WorldEditorSessionCapabilities. |
Example
; OpenWorldEditorSession Example - launch this Extended program from DebugWorld. Const EVENT_GADGET_ACTION=$401 Const EVENT_WINDOW_CLOSE=$803 Function SessionArgument$() command$=CommandLine$():position=Instr(Lower(command),"--session") If position=0 Then Return "" position=position+9 While position<=Len(command) And Mid(command,position,1)=" ":position=position+1:Wend If Mid(command,position,1)=Chr(34) Then finish=Instr(command,Chr(34),position+1) Return Mid(command,position+1,finish-position-1) EndIf Return Mid(command,position) End Function descriptor$=SessionArgument() If descriptor="" Then RuntimeError "This custom editor must be launched by DebugWorld" session=OpenWorldEditorSession(descriptor) If session=0 Then RuntimeError WorldEditorSessionError() window=CreateWindow("Custom World Editor",100,100,800,520,0,15) canvas=CreateCanvas(0,38,ClientWidth(window),ClientHeight(window)-38,window) SetGadgetLayout canvas,1,1,1,1 pauseButton=CreateButton("Pause",8,6,90,27,window) continueButton=CreateButton("Continue",106,6,90,27,window) projectionButton=CreateButton("Orthographic",204,6,120,27,window) view=CreateWorldEditorView(session,canvas) SetWorldEditorViewCamera view,0,3,-8,.2,0,5 projection=1 SetWorldEditorViewProjection view,projection,24,True running=True:request=0 While running event=WaitEvent(16) If event=EVENT_WINDOW_CLOSE Then running=False If event=EVENT_GADGET_ACTION And EventSource()=projectionButton Then projection=3-projection SetWorldEditorViewProjection view,projection,24,True If projection=1 Then SetGadgetText projectionButton,"Orthographic" Else SetGadgetText projectionButton,"Perspective" EndIf If event=EVENT_GADGET_ACTION And request=0 Then payload=CreateJsonObject() If EventSource()=pauseButton Then request=SendWorldEditorRequest(session,"pause",payload) If EventSource()=continueButton Then request=SendWorldEditorRequest(session,"continue",payload) FreeJson payload EndIf If request<>0 And WorldEditorRequestState(request)>=WORLD_EDITOR_REQUEST_SUCCEEDED Then FreeWorldEditorRequest request:request=0 EndIf state=WorldEditorSessionState(session) If state=WORLD_EDITOR_SESSION_CLOSED Or state=WORLD_EDITOR_SESSION_FAILED Then running=False RenderWorldEditorView view Wend If request<>0 Then CancelWorldEditorRequest request:FreeWorldEditorRequest request FreeWorldEditorView view CloseWorldEditorSession session FreeGadget window End
Index