StringSourceScript

From K-3D

Jump to: navigation, search

Description

String source that uses a script to create the output value
Plugin Status:Stable
Categories:All Plugins, Stable Plugins, Script Plugins, String Plugins

Metadata

Name Value

Properties

Label Description Type Script Name
Script Script source code k3d::string_t script
Output String Output string k3d::string_t output_string


Example Code:

mydata is the name of a user property that we added to our scripted node, it is connected to a property on another node (e.g. the Z property of Orientation) so that we can generate text that contains the name and value of the connected property, which could then be used by Annotation2D to display the information in the 3D viewport. This is a handy way of building a HUD (Heads Up Display) for groups of properties you wish to track in real time.

  #python
  
  p = Node.get_property("mydata")
  s = Document.get_dependency(p)
  
  if s:
         Output = s.name() + ": " + str(p.pipeline_value())
  else:
         Output = str(p.pipeline_value())