NodesMessage Ruels

If you add Data to a Node you should follow Rules to make more clear what kind of Data you added and to avoid

NodesMessage should follow following Rules

 

  1. all Variables wich really belongs to Node (BMEssage)  should start with the String "Node::" inhis FieldName.
  2. all "normal" Varibales should start with lower Case.
  3. all Variables wich contains more then one value (they are like a Object :) ) start with upperCase
  4. all Editors an Plugins wich need to store Data in the Node should start with "MyEditor::" and then do it likewise the Nodedefinition

So the new Struckture of a BMessage Node will look like this:

BMessage Field

Type 

Description 

Node::Data

BMessage

Contains all displayed data  for this node

Node::Font

BMessage 

Contains the font formatting for this node 

Node::Pattern

BMessage 

Contains the hole draw formatting for this node

Node::parentNode Pointer to a BMessage Pointer to the ParentNode if this Node is a Member of a Group

Node::frame 

BRect 

Stores the Size and Position of this Node 

Node::selected 

boolean 

Stores if this node ist currently selected or not 

Node::xRadius

float

Stores the xRadius of the  RoundRect (added and used by GraphEditor) 

Node::yRadius

float 

Stores the yRadius of the  RoundRect (added and used by GraphEditor)

Node::outgoing

Pointer to a BList

The BList contains all outgoing Connections (added and used by GraphEditor) 

Node::incoming

Pointer to a BList 

The BList contains all Incoming Connections (added and used by GraphEditor)

Node::allNodes Pointer to a BList If this Node is a Group, this List contains pointer to all Subnodes
GraphEditor1::Renderer Pointer to Render

Example for a variable added by a Editor.
In this case GraphEditor Added a Pointer to Renderer (used to display this node in the first Instance of GraphEditor)

this

Pointer to itself 

added during the indexprocess (saveprocess)  used to restore pointer to this node (eg. to restore connections)

ProjectConceptor::doc

Pointer to a PDocument

points to the document wich this node belong to

 It is still not perfekt for Example i am not shure if the List of the outgoing Nodes -> Node::outgoing should start with low Case...

An Example of a Node-Message

BMessage('pcOT') {
        Node::Data = BMessage(0x0) {
                Name = string("Node4", 6 bytes)
        }
        ProjectConceptor::doc = (type = 'PNTR')(size = 4)
        Node::frame = BRect(l:411.0, t:294.0, r:511.0, b:374.0)
        Node::Font = BMessage('fOTy') {
                Encoding = int8(0x0 or 0 or '[')
                Face = int16 (0x40 or 64)
                Family = string("DejaVu Sans", 12 bytes)
                Flags = int32(0x0 or 0)
                Rotation = float(0.0000)
                Shear = float(90.0000)
                Size = float(12.0000)
                Spacing = int8(0x0 or 0 or '[')
                Style = string("Book", 5 bytes)
                Color = int32(0xffb5976f or -4876433)
        }
        Node::Pattern = BMessage(0x0) {
                FillColor = int32(0xffbeb498 or -4279144)
                BorderColor = int32(0xff000000 or -16777216)
                PenSize = float(0.0000)
                DrawingMode = int8(0xa or 10 or '[')
                HighColor = int32(0xff000000 or -16777216)
                LowColor = int32(0xff808080 or -8355712)
                Node::Pattern = (type = 'PATN')(size = 8)
        }
        Node::selected = bool(false)
        Node::xRadius = float(7.0000)
        Node::yRadius = float(7.0000)
        GraphEditor0::Renderer = (type = 'PNTR')(size = 4)
        Node::incoming = (type = 'PNTR')(size = 4)
}

 

If you have any sugestion pleas feel free to  contact me.