How do child/parent nodes work in Godot?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Patagorithm

I apologize if this question is silly. I’m extremely new to Godot (and programming in general), and I’ve just managed to wrap my head around object-oriented programming.

The inheritance tree when it comes to the class of nodes makes sense to me. (Node2D < CanvasItem < Node < Object, that sort of thing.) No problem there.

However, I’m having trouble wrapping my head around parent-child relationships between nodes in the scene tree. Because clearly a child node doesn’t inherit the class of its parent or anything. It does seem to be…maybe not “inheriting,” but affected in some way by the transforms, visibility, and so on of its parent. If that sort of thing were as far as it went, I think I’d be okay (it seems similar to how “parenting” works in Blender).
It also seems to have some sort of file-system folder sort of thing going on, which I can also understand for purely organizational reasons. (Like how you can in a script treat the node tree like a file path, sort of.)

But then there are some nodes that say they require a certain child and/or parent to function at all. I don’t understand at all what’s going on here. Do certain nodes just need to talk to other nodes, and have built in “if I have that node as a child, I’m using it” sorts of things going on? Or is there some sort of inherent “this node is MY CHILD/PARENT, and therefore…something!” And why would a node require a child to work at all? I’m so confused.

Scenes as a whole seem to just be a root node with some children, so is any parent node basically just a scene (except not officially called one and maybe missing some of the instance-functionality that comes with it)?

TL,DR: What do parent nodes get from children, and what do child nodes get from parents? Is it only stuff like transforms, visibility, existing-in-the-scene-tree, etc.? Or is there more? I’d appreciate as complete a list as possible. Thanks so much!

:bust_in_silhouette: Reply From: SQBX

Here’s the documentation for Nodes in Godot. Most of the top part discusses how children and parents work.

Though the things you talked about (concerning parents and children) in your question description were all of the main points, and there’s not much more other than that for the most part.