Solved Adding Custom Tree to TreeView.

Seeing from the examples for the TreeView in the cinema4dsdk and Tree View Made Simple I noticed that there is used only cinema4d objects or materials to build the tree. I want to build a treeview where I can have my custom trees like.

  • CustomParent1
    • object1
    • object2
  • CustomParent2
    • object3
    • object4

Is there any example online which is supposed to do what I am looking for. If not can I have some directions on how to start this.
Thank you.

If you want your items to behave like GeListNode, you either have to create a custom node that implements linked-list behaviour or - what I recommend - use GeListNode or Baselist2D directly. Another approach - but that highly depends on your goal - would be to use NodeData plugins.
I tend to use them just as list nodes and give them "payload", since they are just representations inside the TreeView and already come with all functionality that you need. Plus: You get the same functionality as with all other objects that derive from them within Cinema 4D.

@mp5gosu Thank you for your reply.
If I may ask you, can you please provide any example that you have done to build the treeview using NodeData plugins or a custom node?
I am trying to implement a custom node for this one but since this is my first time building a tree view it seems a bit difficult as a beginning :disappointed:

For custom nodes, check this thread here:

For using GeListNodes, etc. I currently don't have a minimal example. But let me try to bump you in the right direction.

The TreeViewCustomGui uses a root object. This root is so to say a "container" that holds your list structure. This can be anything - you are then responsible to handle all the actions within the TreeViewFunctions, like GetNext(), GetDown() and so on. It is entirely up to you what you deliver to these functions. This level of abstraction comes with great flexibility.

If you want to go for GeListNode, the following may work for you:
Create a GeListHead - this is your root.
Fill this root with GeListNodes as you desire.
Then, hand the root over to your TreeViewCustomGui via SetRoot()
And now, in the TreeViewFunctions, all you have to do is handle the nodes.

So, if you can go a bit into detail, we should be able to pinpoint a solution.

If you have any questions, I'll be happy to help. :)

edit: By the way, you may want to start with BaseList2D instead of GeListNode since it already has SetName() / GetName() implemented and also supports selection bits. This is a bit easier to start off if you want to experiment.

I see.
This was very helpful. Thank you so much @mp5gosu. I am setting this as solved for now, maybe I will come back for more help here :smile:
Thank you again.

Hi @Ogers,

beside self-explanatori @mp5gosu's answer I suggest also to look at:

which were recently discussed in the forum and are nicely detailed with related snippets.

Best, Riccardo

EDIT: fixed first link!

Hello @r_gigante the first link does not seem to exist.
Thank you for your reply.

@mp5gosu I have one last question.
on the thread for custom nodes that you mentioned above there was a file which was posted from Niklas.
Since this file was not there anymore and most probably it was a full code of what I am asking for, can it be that you or someone else might have that file somehow?
That would be a great help.
Thank you.