GUI Dialog
Recently basic GUI support has been added to PyPRP. And when we say basic we really mean it. All you can make for now are static image GUIs.
Creating the GUI Dialog
First you need to create a plane for the GUI Dialog and correctly uv map your GUI's texture onto it.
Next you add a camera to the scene. Position the camera so that it points towards the plane and occupies the amount of screen that you want it to (by looking through your camera in the Blender 3D window to make your final positioning of the plane and camera).Keep your plane within the inner dotted line of the camera view.
Once you've got the camera situated right, you then rotate it 180 degrees so that it points away from of the plane.
This will have the effect of "mirroring" your texture in game, so, to correct this, we now select your plane, go into edit mode and open a UV editor window, select all the plane's uvs and choose from the menu: UVs > Mirror > X Axis. In Blender, your texture will now look mirrored, but once in Uru it will be the correct way around. This is particularly important if your GUI contains writing of any kind.
Then add this AlcScript:
<Camera>: type: guicamera name: <Camera> camera: hither: 0.5 yon: 1000 dialog: name: <plane object> camera: posteffectmod:<Camera> modal: true transparent: 0
The name of the plane object should be the name you want the GUI to be.
Cyan usually places GUIs in their own pages so you may want to do that as well.
Activating the GUI Dialog
You also need a clickable to activate the GUI. This clickable must be a different object than the GUI plane. You have two options here.
- Duplicate the GUI plane and use this duplicate as your clickable. If you gave the GUI its own page make sure the clickable is NOT in that page by removing its page_num text property. Hide the original GUI plane plus its camera somewhere the player cannot see it. Make sure to keep the relative positions of the plane and its camera or you'll be back at step one! The duplication method has the advantage that you can make the GUI object larger and more detailed than the clickable model.
- Or create an invisible clickable at the location of the GUI plane. Making an object invisible can be done with the following AlcScript:
<clickable object>: visual: render: false
Regardless of which method you followed you now need to add the this AlcScript to the clickable:
<clickable object>: logic: modifiers: - tag: ModDialog cursor: poised flags: - localelement activators: - type: objectinvolume remote: <click region> triggers: - any conditions: - type: activator activators: - type: picking - type: objectinbox satisfied: true actions: - type: pythonfile ref: $PythDialog actions: - type: pythonfile tag: PythDialog pythonfile: file: xDialogToggle parameters: - type: activator ref: logicmod:$ModDialog - type: skip - type: skip - type: string value: <plane object>
Exiting the GUI Dialog
For now we can only exit the GUI dialog by pressing Escape or Backspace.
The normal method to exit a GUI dialog is by mouse click. This requires a clickoff plane which is in fact a large invisible GUI button encompassing the entire GUI camera view.
Unfortunately GUI buttons are not yet implemented. Those of you familiar with libPlasma may be able to hack a pfGUIButtonMod into a GUI dialog from scratch (or rather from a Cyan example). If you are going to try this the hard way be sure to give your button the id 99 for this is the id that Python needs to exit the GUI.