background

Used for Background operations.
For returning and setting background mapping layer data, refer to the background_layer class.


xshade
scene
background

List of Methods

append_background_layer Appends a background layer
background_layer Returns the reference of the background layer of the specified number
calculate_background_color Calculates the background color
load Loads background settings from a file
move_down_background_layer Moves the background layer of the specified index down the specified number of hierarchy levels
move_up_background_layer Moves the background layer of the specified index up the specified number of hierarchy levels
save Saves the background settings to a file

List of Properties

active_layer The number of the selected layer
lighting_intensity_factor The coefficient of the lighting intensity
lower_base_color The base color of the lower hemisphere
number_of_background_layers The number of background layers
upper_base_color The base color of the upper hemisphere




Method Details

append_background_layer

Appends a background layer.
Return value :
  background_layer object
See also :
  background_layer

xshade.scene().background.append_background_layer()

background_layer

Returns the reference of the background layer of the specified number.
Return value :
  background_layer object
Arguments :
  int : the background layer number : If the specified layer does not exist an exception is thrown
See also :
  number_of_background_layers The number of background layers
  background_layer

#Output blend mode of background_layer object number 0
print xshade.scene().background.background_layer(0).blend_mode 

calculate_background_color

Calculates the background color beyond the specified line of sight.
Return value :
  rgb
Arguments :
  vec3 : The line of sight direction from the center of the background hemisphere. When the Y direction is positive this is the upper hemisphere; when negative, the lower hemisphere.

print xshade.scene().background.calculate_background_color([0.5, 1.0, 0.2])

load

Loads background settings from a file.
Arguments :
  file_path : the file name
See also :
  save

#Load sample.shdbgr to the background settings
dialog = xshade.create_dialog_with_uuid()
file_path = dialog.ask_path(True, '*.shdbgr|shdbgr')
xshade.scene().background.load(file_path)

move_down_background_layer

Moves the background layer of the specified index down the specified number of hierarchy levels.
Arguments :
  int : amount to move
Arguments :
  int : the background layer index
See also :
  move_up_background_layer

#Move background layer of index 2 (internal index 1) down 3 layers
xshade.scene().background.move_down_background_layer(3,1)


move_up_background_layer

Moves the background layer of the specified index up the specified number of hierarchy levels.
Arguments :
  int : amount to move
Arguments :
  int : the background layer index
See also :
  move_down_background_layer

#Move background layer of index 2 (internal index 1) up 3 layers
xshade.scene().background.move_up_background_layer(3,1)

save

Saves the background settings to a file.
Arguments :
  file_path : the file name
See also :
  load

#Save background settings to sample.shdbgr
dialog = xshade.create_dialog_with_uuid()
file_path = dialog.ask_path(False, '*.shdbgr|shdbgr')
xshade.scene().background.save(file_path)

Property Details

active_layer

The number of the selected layer.

  • Get
  • Set

Type :
  int

print xshade.scene().background.active_layer

lighting_intensity_factor

The coefficient of the lighting intensity.

  • Get
  • Set

Type :
  float

print xshade.scene().background.lighting_intensity_factor

lower_base_color

The base color of the lower hemisphere.

  • Get
  • Set

Type :
  rgb

print xshade.scene().background.lower_base_color

number_of_background_layers

The number of background layers.

  • Get
  • Set

Type :
  int

print xshade.scene().background.number_of_background_layers

upper_base_color

The base color of the upper hemisphere.

  • Get
  • Set

Type :
  rgb

print xshade.scene().background.upper_base_color