C++ SDK activeobject.cpp <-- highlight text on select item
-
Hi & Hello....
I am studying the C++ SDK examples.
This is a question about activeobject.cpp.
I want to highlight text on item selection as shown in the picture.
Any help would be appreciated. Thanks. -
Hi,
When you want to display object in a Treeview form , you must override the TreeviewFunctions. This will define the way your treeview is supposed to work, display the next element, the child etc.
In this case, the one that is important is the function
IsSelected
. This function must return true if the object is selected. In the activeObject project, the tree is composed of DebugNode. Looking at the structure we can guess that we must use thelink
variable to retrieve the scene object this node is refering to.We must be careful to filter out the objects from which we want to retrieve the
BIT_ACTIVE
value. It will not be defined on all objects. By default it will return true and make all node selected.virtual Bool IsSelected(void* root, void* userdata, void* obj) { // Retrieve the object in the scene this node represent. DebugNode* node = static_cast<DebugNode*>(obj); BaseList2D* link = static_cast < BaseList2D*>( node->link->GetLinkAtom(nullptr)); // If the object linked is an BaseObject or a BaseMaterial, check its active state. if (link && (link->IsInstanceOf(Obase) || link->IsInstanceOf(Mbase))) return link->GetBit(BIT_ACTIVE); // For all other node, return false. return false; }
Cheers,
Manuel -
@manuel
Thank you for your help. It's what I wanted. It works as expected. Best "Manuel"
Now we are going to modify it so that drag and drop is possible. I can ask for help again. thank you
-
Hi,
there is this thread where Maxime is talking about drag and drop.
If you have any question about it, please open a new thread. We like to keep question separated.
Cheers,
Manuel