Class: Vizcore::CLISupport::SceneValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/vizcore/cli/scene_validator.rb

Overview

Validates scene DSL files without starting the realtime server.

Defined Under Namespace

Classes: Issue, Result

Constant Summary collapse

BUILTIN_SHADERS =
Vizcore::LayerCatalog::BUILTIN_SHADERS
MAPPING_SOURCE_KINDS =
%i[
  amplitude frequency_band fft_spectrum onset kick snare hihat beat beat_confidence beat_pulse beat_count bpm
].freeze
FREQUENCY_BANDS =
%i[sub low mid high].freeze
SUPPORTED_BLEND_MODES =
Vizcore::LayerCatalog::BLEND_MODES
SUPPORTED_POST_EFFECTS =
Vizcore::LayerCatalog::POST_EFFECTS
SUPPORTED_VJ_EFFECTS =
Vizcore::LayerCatalog::VJ_EFFECTS
SUPPORTED_SHAPE_KINDS =
%i[circle line rect polygon polyline path star].freeze

Instance Method Summary collapse

Constructor Details

#initialize(scene_file:, loader: Vizcore::DSL::Engine.method(:load_file), shader_resolver: Vizcore::DSL::ShaderSourceResolver.new) ⇒ SceneValidator

Returns a new instance of SceneValidator.



44
45
46
47
48
# File 'lib/vizcore/cli/scene_validator.rb', line 44

def initialize(scene_file:, loader: Vizcore::DSL::Engine.method(:load_file), shader_resolver: Vizcore::DSL::ShaderSourceResolver.new)
  @scene_file = scene_file
  @loader = loader
  @shader_resolver = shader_resolver
end

Instance Method Details

#callObject



50
51
52
53
54
55
56
57
58
# File 'lib/vizcore/cli/scene_validator.rb', line 50

def call
  definition = load_definition
  Result.new(definition: definition, issues: validate_definition(definition))
rescue StandardError => e
  Result.new(
    definition: nil,
    issues: [Issue.new(severity: :error, message: "failed to load scene: #{e.message}")]
  )
end