File: example.py

package info (click to toggle)
darkradiant 3.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 41,080 kB
  • sloc: cpp: 264,743; ansic: 10,659; python: 1,852; xml: 1,650; sh: 92; makefile: 21
file content (17 lines) | stat: -rw-r--r-- 800 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Set the command name so that DarkRadiant recognises this file
__commandName__ = 'Example' # should not contain spaces
__commandDisplayName__ = 'Nice display name for the menus' # should not contain spaces

# The actual algorithm called by DarkRadiant is contained in the execute() function
def execute():
	shader = GlobalShaderSystem.getShaderForName('bc_rat')
	print(shader.getName())

	# the "Global*" variables like GlobalShaderSystem are already exposed to this scripts
	# The rest needs to imported from the darkradiant module and referred to by the prefix "dr"
	import darkradiant as dr
	GlobalDialogManager.createMessageBox('Example Box', str(e), dr.Dialog.ERROR).run()

# __executeCommand__ evaluates to true after DarkRadiant has successfully initialised
if __executeCommand__:
	execute()