f
f
Global SectionArticlesBookstoreDictionaryDownloadsDVDsEventsForumsGalleryJob ListingsNewsNewslettersSchools
USER: PASS:  Login  Register

Subscribe
Site Links
Home > Shake > FAQs > Shake SDK FAQ > Nodes and Plugs > How can I determine if my node is selected in... Change background colorChange background colorChange background colorChange background color
Nodes and Plugs Shake SDK FAQ for Shake


Posted On:  06/15/05   By:  admin  

Question:

How can I determine if my node is selected in the node view?

Answer:

The display of image processing nodes in Shake's node view panel is managed by a specialized object called a 'sharing hook' (see NRiSharingHook.h).  Shake assigns a sharing hook object to each image processing node in the node tree when Shake is run in interactive mode.

A registry of all the sharing hook objects in the script is maintained by the NRiSharingHook base class.  To retrieve the sharing hook object assigned to your node, you would call the following:

        NRiSharingHook *sh = NRiSharingHook::find(0,this);

The NRiSharingHook object owns a plug called 'grouped' that is set to 1 when a node is selected and to 0 when a node is unselected.  To determine if your node is currently selected, you would call:

        int isSelected = sh->grouped()->asInt();

Alternately, if you want to modify the selection state of your node, you would set the grouped plug on the sharing hook node to either 0 (not selected) or 1 (selected):

        sh->grouped()->set(1);  // selected

In addition, the NRiSharingHook object has member plugs that store the x and y position of the node in the node view.  They can be retrieved as follows:

        NRiPlug *xpos = sh->xPos();
        NRiPlug *ypos = sh->yPos(); 

Related Learning Tools
Shake Related DVDs

No Results.
Shake Related Books



The Art and Science of Digital Compositing
Global DVDs



Shake: Color Correction and Layers


Sponsors

Sponsor

Contact Us | Post Jobs | Post News | Post Events