20. September 2023

Data Types in Scene Nodes – 1 Auto Conversion

Scene Nodes offer a number of Data Types for different purposes. In most cases they are straight forward, but especially du to Auto Conversion there are some things that might not be clear on a glance.

Let’s start with an, incomplete, list of how the different data types are converted.

Conversion cases that are especially useful are shown Bold.

Float (Real)

  • Float (Real)
  • Integer – Will be rounded down
  • Vector – All Elements get the value
  • Vector2 – All Elements get the value
  • Vector4 – All Elements get the value
  • String – Will become a string of the numerical value (rounded to three decimals)
  • Color – All Elements get the value
  • ColorA – RGB Elements get the value, A defaults to 1
  • Boolean – <>0 will be interpreted as True, =0 as False
  • Matrix – Will be interpreted as V0/Translation Vector > all Elements get the value
  • Integer – Will be rounded down
  • Vector – All Elements get the value
  • Vector2D – All Elements get the value
  • Vector4D – All Elements get the value
  • String – Will become a string of the numerical value (rounded to three decimals)
  • Color – All Elements get the value
  • ColorA – All Elements get the value
  • Boolean – <>0 will be interpreted as True, =0 as False
  • Matrix – Will be interpreted as V0/Translation Vector > all Elements get the value

Integer

  • Integer
  • Float (Real)
  • Vector – All Elements get the value
  • Vector2D – All Elements get the value
  • Vector4D – All Elements get the value
  • String – Will become a string of the numerical value (rounded to three decimals)
  • Color – All Elements get the value
  • ColorA – RGB Elements get the value, A defaults to 1
  • Boolean – <>0 will be interpreted as True, =0 as False
  • Matrix – Will be interpreted as V0/Translation Vector > all Elements get the value

Vector

  • Vector
  • Float – Length of vector
  • Integer – Length of vector, rounded down
  • Vector2D – First and Second component are used
  • Vector 4D – All Components are used, fourth component defaults to 0
  • String – Components are separated by commas, all components are enclosed in brackets
  • Color – RGB get XYZ
  • ColorA – RGB get XYZ, the A component defaults to 1
  • Boolean – Length of Vector is used, see Float
  • Matrix – Will be used for V0/Translation

Matrix

  • Matrix
  • Float – Length of V0/Translation
  • Vector – V0/Translation is used
  • Vector2D – First and Second component of V0/Translation are used
  • String – Components of V0 are separated by commas and enclosed in brackets
  • Color – V0/Translation is used for RGB

Notes

Especially the use of Integer to control a bool, and vice versa, offers a lot of possibilities.

In the attached scene an explicit conversion of four booleans into a 4 bit binary and a decimal value is shown.

This can for example be used to control a Switch node input based on UI options.

Example-Boolean-Conversion.c4d