Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    C++ SDK activeobject.cpp <-- highlight text on select item

    Cinema 4D SDK
    c++ 2023
    2
    4
    597
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ymoonY
      ymoon
      last edited by

      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.

      2023-03-09_064328.png

      1 Reply Last reply Reply Quote 0
      • ManuelM
        Manuel
        last edited by Manuel

        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 the link 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

        MAXON SDK Specialist

        MAXON Registered Developer

        ymoonY 1 Reply Last reply Reply Quote 0
        • ymoonY
          ymoon @Manuel
          last edited by

          @manuel
          Thank you for your help. It's what I wanted. It works as expected. Best "Manuel"
          2023-03-09_202908.png

          Now we are going to modify it so that drag and drop is possible. I can ask for help again. thank you

          1 Reply Last reply Reply Quote 0
          • ManuelM
            Manuel
            last edited by

            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

            MAXON SDK Specialist

            MAXON Registered Developer

            1 Reply Last reply Reply Quote 0
            • First post
              Last post