WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 02-03-2016, 07:21 AM
Seadna Seadna is offline
Member
 
Join Date: Nov 2015
Posts: 40
Question Highlighter tool on nodes in model

Hi folks,

I'm really struggling with this one.

I have a large model imported with many nodes. I want to be able to highlight the objects in the model with the highlighter tool.

From the looks of the sample code i need to set the items that are selectable by the highlighter tool.

What i'm trying to do (instead of manually entering hundreds of items) is pull the list of nodes using tool.setItems(Model.getNodeNames()) but this does not work at all.

I have also tried using tool.setItems(','.join(Model.getNodeNames())) to remove the single quotation marks but it still generates an error:

Code:
Traceback (most recent call last):
  File "C:\Program Files\WorldViz\Vizard5\python\vizact.py", line 3183, in _callGroup
    val = e.call(arg)
  File "C:\Program Files\WorldViz\Vizard5\python\vizact.py", line 2949, in _callStatic
    return func(*args,**kwargs)
  File "C:\Program Files\WorldViz\Vizard5\python\tools\highlighter.py", line 627, in _intersectBoundingBox
    bs = item.getBoundingSphere(viz.ABS_GLOBAL)
AttributeError: 'str' object has no attribute 'getBoundingSphere'
Reply With Quote
  #2  
Old 02-04-2016, 02:35 AM
Seadna Seadna is offline
Member
 
Join Date: Nov 2015
Posts: 40
Question

I'm trying something different. I certainly cannot figure out how to get the highlighter to highlight sub-nodes (so far).

Can I use the pick function instead? How can I use pick() when wearing an Oculus Rift? I can use it with my mouse on screen in the tutorial but when combined with my vizconnect configuration on Oculus I do not have a mouse pointer. Can i do this with an arrow similar to the laser pointer tool? How can this be implemented is there any example code?

As usual any help is much appreciated!
Reply With Quote
  #3  
Old 02-04-2016, 04:11 AM
Erikvdb Erikvdb is offline
Member
 
Join Date: May 2013
Posts: 63
Highlighter works, you just need to declare the sub-nodes as objects.

Code:
gallery = viz.addChild('gallery.ive')
nodes = {}

for name in gallery.getNodeNames():
    node = gallery.getChild(name) #create child object
    nodes[node] = name #store in dict with its name

from tools import highlighter
tool = highlighter.Highlighter()
tool.setItems(nodes.keys())

def onHighlight(e):
    if e.new in nodes:
        print '{} is highlighted'.format(nodes[e.new])

viz.callback(highlighter.HIGHLIGHT_EVENT,onHighlight)
There might be an easier way to get the node name from the selected object so you don't need to store it in a dictionary, but hey.
Reply With Quote
  #4  
Old 02-04-2016, 04:14 AM
Seadna Seadna is offline
Member
 
Join Date: Nov 2015
Posts: 40
Thanks Erik,

I will try this after lunch!
Reply With Quote
  #5  
Old 02-05-2016, 05:31 AM
Seadna Seadna is offline
Member
 
Join Date: Nov 2015
Posts: 40
Thanks again Erik, this works great.

Do you know how I can get this to print the sub-node name?
Reply With Quote
  #6  
Old 02-11-2016, 05:17 AM
Erikvdb Erikvdb is offline
Member
 
Join Date: May 2013
Posts: 63
I don't understand your question, printing the name of the pointed-at sub-node is literally the only thing the script I posted does!?
Reply With Quote
Reply

Tags
error, highlighter, list, node, tool

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using highlighter tool with wand Samuli Vizard 2 09-24-2015 12:50 PM
How to get all the Drawables in a model as Nodes pankaj bansal Vizard 2 01-02-2013 10:30 AM
3ds Exported .IVE Model mirrors movement of Mainview Felix Vizard 9 05-18-2012 09:17 AM
Change model alpha and memory leak hosier Vizard 2 06-25-2009 10:55 AM
Internal nodes of loaded model files? dtidrow Vizard 2 05-12-2009 08:55 AM


All times are GMT -7. The time now is 07:56 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC