GLSL Hacker
FEATURES DOWNLOAD GALLERY BLOG LEARN



Back to Reference Guide Index

<script> XML node

XML Node Summary

<script
  name=""
  filename=""
  absolute_path="0"
  run_mode="ZOMBIE"
  language="LUA"
  >
  <raw_data />
</script>


<script>

Description

Allows to load and execute scripts (Lua or Python) especially written to interact with scene's nodes using the Lua/python host API.


Attributes

  • name [STRING]: name of this XML node.
  • filename [STRING]: location of the script file relative to the main XML script. Conventions: Lua script files extension: *.lua and Python script files extension: *.py
  • absolute_path [INTEGER]: absolute path (1) or not (0) of the script filename. - Default value = 0
  • run_mode [ENUM]: specifies the working mode of the script - Default value = ZOMBIE - Values = INIT: the script is executed once at the scene initialization. FRAME: the script is executed every frame. ZOMBIE: the script is executed manually (hotkey for example). SIZE: the script is executed when the window's size changes. DRAG_N_DROP: the script is executed after a drag n drop occured. TERMINATE: the script is executed at the end of the demo.
  • language [ENUM]: specifies the language use in the script: PYTHON or LUA - Default value = LUA

Code sample


<script name="init_scene" run_mode="INIT" filename="init.lua" LANGUAGE="LUA" />

<script name="update_scene" run_mode="FRAME" LANGUAGE="LUA" >
<raw_data><![CDATA[
elapsed = gh_utils.get_elapsed_time(ID)
]]></raw_data>
</script>

<script name="resize_scene" run_mode="SIZE" LANGUAGE="LUA" >
<raw_data><![CDATA[
width, height = gh_window.get_size(ID)
]]></raw_data>
</script>


<raw_data>

Description

Allows to integrate the source code of a script directly in the XML code without requiring an external file.

2013-2015 Geeks3D. All Rights Reserved.

.:- G3D Network -:.