BlockSceneRoot

The BlockSceneRoot class describes the root scene object of a block.

Example

//==============================================================================
// The following example demonstrates how to set/get boolean value to/from Block instance
//
// Project setup:
// - Insert a plane
// - Add a Block and instantiate an instance
// - Edit the Block
//   - Insert a plane in the Block
//   - Add a boolean input and a boolean output
//   - Connect the input patch to visible patch of the plane
//==============================================================================

// Load in the required modules
const Scene = require('Scene');

// Enable async/await in JS [part 1]
(async function() {
  // Locate the plane and block in the Scene
  const [plane, block] = await Promise.all([
    Scene.root.findFirst('plane0'),
    Scene.root.findFirst('block0')
  ]);

  //==============================================================================
  // Switch visibility of a plane by setting/getting boolean value of Block
  //==============================================================================

  // Observed plane in the Block switches its visibility by setting the input value between true and false
  await block.inputs.setBoolean('input', true /* or false or BoolSignal */);

  // Observed plane0 switches its visibility when change value of Block output
  plane.hidden = await block.outputs.getBoolean('output');

// Enable async/await in JS [part 2]
})();

Properties

PropertyDescription
inputs
(get) inputs: BlockInstanceInputs
(set) (Not Available)


Returns an object encapsulating all input setters for the Block Instance.
outputs
(get) outputs: BlockInstanceOutputs
(set) (Not Available)


Returns an object encapsulating all outputs getters for the Block Instance.

Methods

MethodDescription
getBooleanOutput
getBooleanOutput(name: String): BoolSignal


Returns a BoolSignal for a named Block output.
getColorOutput
getColorOutput(name: String): ColorSignal


Returns a ColorSignal for a named Block output.
getPixelPointOutput
getPixelPointOutput(name: String): Point2DSignal


Returns a Point2DSignal for a named Block output.
getPointOutput
getPointOutput(name: String): PointSignal


Returns a PointSignal for a named Block output.
getScalarOutput
getScalarOutput(name: String): ScalarSignal


Returns a ScalarSignal for a named Block output.
getShaderOutput
getShaderOutput(name: String): ShaderSignal


Returns a ShaderSignal for a named Block output.
getStringOutput
getStringOutput(name: String): StringSignal


Returns a StringSignal for a named Block output.
getVectorOutput
getVectorOutput(name: String): VectorSignal


Returns a VectorSignal for a named Block output.
setBooleanInput
setBooleanInput(name: String, signal: BoolSignal): void


Binds a BoolSignal to a named Block input.
setColorInput
setColorInput(name: String, signal: ColorSignal): void


Binds a ColorSignal to a named Block input.
setPixelPointInput
setPixelPointInput(name: String, signal: Point2DSignal): void


Binds a Point2DSignal to a named Block input.
setPointInput
setPointInput(name: String, signal: PointSignal): void


Binds a PointSignal to a named Block input.
setScalarInput
setScalarInput(name: String, signal: ScalarSignal): void


Binds a ScalarSignal to a named Block input.
setShaderInput
setShaderInput(name: String, signal: ShaderSignal): void


Binds a ShaderSignal to a named Block input.
setStringInput
setStringInput(name: String, signal: StringSignal): void


Binds a StringSignal to a named Block input.
setVectorInput
setVectorInput(name: String, signal: VectorSignal): void


Binds a VectorSignal to a named Block input.