Lua Selection Observer / Metadata Display

Seeing design metadata immersively can improve the experience and effectiveness of Design Review and other use-cases.

This is a code snippet that as written would be implemented on any user interface label or button with a Text property. It observes the local user's selection when it changes, constructs a string containing some metadata values (from an attribute table) and puts it in the user interface.

vrAddMetaNodeObserver("selectionobserver", "GroupMember", {
  nodeParentChanged = function(meta, node, oldParent, newParent)
    if newParent and newParent:type() == "ViewSelectionContainer" then
      print(node:getName() .. " selected")
        local meta = node.Link.Metadata
        __Self.Text = "Designer: " .. meta.DESIGNER .. "\nPart Name: " .. meta.PART_NAME
    elseif oldParent and oldParent:type() == "ViewSelectionContainer" then
      print(node:getName() .. " deselected")
      __Self.Text = ""

Ericka is the author of this solution article.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.