Class Limelight::Scene
In: lib/limelight/scene.rb
Parent: Prop

A Scene is a root Prop. Scenes may be loaded onto a Stage. In addition to being a Prop object, Scenes have a few extra attributes and behaviors.

Methods

Included Modules

UI::Api::Scene

External Aliases

visible -> visible?

Attributes

button_groups  [R] 
cast  [R] 
casting_director  [R] 
production  [RW] 
stage  [RW] 
styles  [RW] 
visible  [RW] 

Public Class methods

[Source]

    # File lib/limelight/scene.rb, line 27
27:     def initialize(options={})
28:       path = options.delete(:path) || ""
29:       @root = FileLoader.for_root(path)
30:       super(options)
31:       @button_groups = ButtonGroupCache.new
32:       @prop_index = {}
33:       @cast = Module.new
34: #      illuminate
35:     end

Public Instance methods

Returns a Prop with the specified id. Returns nil id the Prop doesn‘t exist in the Scene.

[Source]

     # File lib/limelight/scene.rb, line 122
122:     def find(id)
123:       return @prop_index[id.to_s]
124:     end

Add the Prop to the index. Provides fast lookup by id.

[Source]

     # File lib/limelight/scene.rb, line 103
103:     def index_prop(prop)
104:       return if prop.id.nil? || prop.id.empty?
105:       indexee = @prop_index[prop.id]
106:       if indexee.nil?
107:         @prop_index[prop.id] = prop
108:       else
109:         raise LimelightException.new("Duplicate id: #{prop.id}") if indexee != prop
110:       end
111:     end

Opens the specified Scene on the Stage currently occupied by this Scene. TODO It doesn‘t quite make sense that a scene loads other scene. It has to replace itself?

[Source]

    # File lib/limelight/scene.rb, line 97
97:     def load(scene_name)
98:       @production.producer.open_scene(scene_name, @stage)
99:     end

Creates the menu bar for the Scene

[Source]

    # File lib/limelight/scene.rb, line 68
68:     def menu_bar
69:       return DSL::MenuBar.build(self) do
70:         menu("File") do
71:           item("Open", :open_chosen_production)
72:           item("Refresh", :reload)
73:         end
74:       end
75:     end

Opens a FileChooser for a new Production. Loads the chosen Production.

[Source]

    # File lib/limelight/scene.rb, line 79
79:     def open_chosen_production
80:       options = { :title => "Open New Limelight Production", :description => "Limelight Production", :directory => @directory }
81:       chosen_file = stage.choose_file(options) { |file| Util.is_limelight_scene?(file) || Util.is_limelight_production?(file) }
82:       if chosen_file
83:         @directory = File.dirname(chosen_file)
84:         open_production(chosen_file)
85:       end
86:     end

Creates a new Producer to open the specified Production.

[Source]

    # File lib/limelight/scene.rb, line 90
90:     def open_production(production_path)
91:       Thread.new { Context.instance.studio.open(production_path) }
92:     end

Returns the path to the root directory of the Scene

[Source]

    # File lib/limelight/scene.rb, line 45
45:     def path
46:       return @root.root
47:     end

Returns the path to the Scene‘s props file

[Source]

    # File lib/limelight/scene.rb, line 51
51:     def props_file
52:       return @root.path_to("props.rb")
53:     end

Returns self. A Scene is it‘s own scene.

[Source]

    # File lib/limelight/scene.rb, line 39
39:     def scene 
40:       return self
41:     end

Returns the path to the Scene‘s props file

[Source]

    # File lib/limelight/scene.rb, line 57
57:     def styles_file
58:       return @root.path_to("styles.rb")
59:     end

Removed the Prop from the index.

[Source]

     # File lib/limelight/scene.rb, line 115
115:     def unindex_prop(prop)      
116:       unindex_child_props(prop)
117:       @prop_index.delete(prop.id) if prop.id
118:     end

[Validate]