Package DejaVu :: Package VisionInterface :: Module GeometryNodes :: Class GeometryNode
[hide private]
[frames] | no frames]

Class GeometryNode

source code

                             object --+                
                                      |                
NetworkEditor.itemBase.NetworkItemsBase --+            
                                          |            
        NetworkEditor.itemBase.NetworkItems --+        
                                              |        
            NetworkEditor.items.NetworkNodeBase --+    
                                                  |    
                    NetworkEditor.items.NetworkNode --+
                                                      |
                                                     GeometryNode
Known Subclasses:
Array2DToHeightFieldGeom, AxisNE, BoxNE, Cylinders, DecimateGeom, Ellipsoids, GeomContainer, GeomsFromFile, GlfLabelsNE, IndexedPolygonsNE, IndexedPolylinesNE, OneTexturedQuadNE, Spheres, StickImageNE, StickerNE

Base Class to hold a single geometry, should be only inherited,
never instanciated. it handles naming and parenting.

The geometry nodes handle a list of geometries. When the name changes, 
a new geom is generated. If an empty name is provided, the current geometry 
is deleted.

The parent and children connections reflect the state of the geometry selected 
in the combo box. If the parent or children geoms are currently selected in 
their own node: the connections are present. If the parent or a child is not 
visible (for the selected geometry) the parent port or/and the output port 
contour lines are white (instead of black). Before parenting you can set the 
behaviour of the 'parent' inputport. Right clicking on the port allows you to 
extend the parenting to the sibling geometries present in the node or to all 
the geometries of the node. This behaviour set by right clicking will only 
affect the next parenting. In the same way, deleting the parent connection, 
reparent to 'root' the selected geometry or the sibling geometries or all the 
geometries in the child node (depending on the right click menu choice).

THINGS TO DO TO INHERIT 
(the best is to follow what is done in class IndexedPolygonsNE bellow)
1- inherit :
        class IndexedPolygonsNE(GeometryNode):
2- at the beginning of init, call original init 
   (the 'indexedPolygons' in quotes will be the name of the output port):
        kw['name'] = name
        apply( GeometryNode.__init__, (self, 'indexedPolygons'), kw ) 
3- rearrange ports order after appending additionnal input and output:
        self.rearrangePorts()
4- at the beginning of doit, call original doit:
        GeometryNode.doit(self, name, instanceMatrices, geomOptions, parent)
5- the doit function should really immitate the class IndexedPolygonsNE example 
   (parameters linked to input ports from the base class must be passed as last)
        def doit(self, coords, indices, vnormals=None, colors=None,
        name=None, instanceMatrices=None, geomOptions=None, parent=None):
6- override appendGeometry()
        def appendGeometry(self, name):
            from DejaVu.IndexedPolygons import IndexedPolygons
            self.geoms.append(IndexedPolygons(name))
            return 1 # num of geoms appended
7- don't forget to use the new datatypes
        ip.append(datatype='coord3(0,3)', name='coords')

GeomsFromFile bellow shows how the filename can be use as a director for
the name. It shows also how to append several geoms from one file.

If you want to read a new type of file the best is to add it inside
the appendGeometry of GeomsFromFile



Instance Methods [hide private]
  __init__(self, geomOutputPortName, **kw)
  afterAddingToNetwork(self)
  doit(self, name=None, geoms=None, instanceMatrices=None, geomOptions=None, texture=None, parent=None)
  rearrangePorts(self)
reoder port list for backwards compatibility.
  geom(self)
  removeAndCleanMultipleGeometryies(self, geometryies)
  removeSingleGeomAndReparentChildren(self, geom)
  removeSingleGeom(self, geom)
  removeViewerConnection(self, doNotRemoveThisConnection=None)
  removeViewerConnections(self, doNotRemoveThisConnection=None)
  ensureNameOfNodeAndDescendants(self, obj)
  getIndexFromName(self, name)
returns the index of the geom returns -1 if entry is not in the list
  naming(self, name)
returns True if we need to perform Parenting
  addingEntries(self, name)
  appendGeometry(self, name)
  nodeOnlyGeomRemoval(self, geom)
  parenting(self, parent, geom=None)
prepare the parenting and launch it if applicable it will parent the selectedGeomIndex unless geom is provided
  effectiveParenting(self, lParent, geom=None)
try to reparent geometry, return True upon success after this call the geometry has a valid name it will parent the selectedGeomIndex unless geom is provided
  drawParentAndChildrenConnections(self)
finds the selected children and parent and draws the connections if they are selected in their own node
  setParentConnection(self)
set the parent connection if parent is selected in his own node
  removeParentConnection(self)
  setChildrenConnections(self)
  setPortsOfTheChildrenConnections(self)
  removeChildrenConnections(self)
  rebuildComboBoxList(self)
  reparentGeoms(self, list)
  reparentGeomType(self, type, reparentCurrent=True)
  getViewerConnection(self, node)
  afterDisconnectParent(self, p1)
  afterConnectParent(self, port, conn)
  afterDisconnectChildren(self, p1, p2)
  beforeRemovingFromNetwork(self)
  textureManagement(self, image, textureCoordinates=None)

Inherited from NetworkEditor.items.NetworkNode: addInputPort, addOutputPort, addSpecialPorts, buildNodeIcon, buildSmallIcon, deletePort, deletePortByName, deleteSmallIcon, deselect, editorVisible, getColor, getFont, hideSpecialPorts, isExpanded, refreshInputPortData, resizeIcon, select, setColor, setFont, setModifiedTag, setProgressBar, showSpecialPorts, updatePosXPosY

Inherited from NetworkEditor.items.NetworkNodeBase: addSaveNodeMenuEntries, autoResize, autoResizeX, autoResizeY, buildIcons, checkIfNodeForSavingIsDefined, compareToOrigNodeDescr, computeFunction, configure, cut_cb, delete_cb, edit, editComputeFunction_cb, evalString, getAfterConnectionsSourceCode, getComputeFunctionSourceCode, getConnections, getDescr, getHeaderBlock, getInConnections, getInitBlock, getInputPortByName, getNodeDefinitionSourceCode, getNodeSourceCode, getNodeSourceCodeForDoit, getNodeSourceCodeForInstanciation, getNodeSourceCodeForModifications, getNodeSourceCodeForNode, getNodeSourceCodeForPorts, getNodeSourceCodeForWidgetValue, getNodeSourceCodeForWidgets, getOutConnections, getOutputPortByName, getOutputPortByType, getPortsCreationSourceCode, getSize, getSourceCode, getSpecialInputPortByName, getSpecialOutputPortByName, getStateDefinitionCode, getUniqueNodeName, getWidgetByName, getWidgetsCreationSourceCode, getWidgetsForMaster, getWidthForLabel, getWidthForNodeWidgets, getWidthForPorts, growDown, growRight, hideInNodeWidgets, isMacro, isModified, ischild, move, moveSelectedNodeEnd, outputData, rename, resetModifiedTag, resetTags, safeName, saveSource, saveSource_cb, schedule, scheduleChildren, schedule_cb, setFunction, showInNodeWidgets, startMoveOneNode, toggleNodeExpand_cb, toggleParamPanel_cb, updateCode

Inherited from NetworkEditor.itemBase.NetworkItems: __repr__, afterRemovingFromNetwork, beforeAddingToNetwork, deleteIcon, editNodeMenu, freeze, gettags, hideParamPanel, highlight, introspect, postItemMenu, run, toggleAutoRun_cb, toggleFrozen_cb, unfreeze, unhighlight

Inherited from NetworkEditor.itemBase.NetworkItems (private): _introspectCB

Inherited from NetworkEditor.itemBase.NetworkItemsBase: delEditor, getEditor, setEditor

Inherited from NetworkEditor.itemBase.NetworkItemsBase (private): _setModified, _setOriginal

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__


Properties [hide private]

Inherited from NetworkEditor.itemBase.NetworkItemsBase: editor

Inherited from object: __class__


Method Details [hide private]

__init__(self, geomOutputPortName, **kw)
(Constructor)

source code 
None
Overrides: NetworkEditor.items.NetworkNode.__init__

afterAddingToNetwork(self)

source code 
None
Overrides: NetworkEditor.itemBase.NetworkItems.afterAddingToNetwork

doit(self, name=None, geoms=None, instanceMatrices=None, geomOptions=None, texture=None, parent=None)

source code 
None

rearrangePorts(self)

source code 
reoder port list for backwards compatibility. (old network were saved with port indices instead of port names) the parent and instance matrices ports are created by the base class and therefore appear in position 1 and 2 but should move after the ports created by the subclass. the port 'name' used to be index #4.

geom(self)

source code 
None

removeAndCleanMultipleGeometryies(self, geometryies)

source code 
None

removeSingleGeomAndReparentChildren(self, geom)

source code 
None

removeSingleGeom(self, geom)

source code 
None

removeViewerConnection(self, doNotRemoveThisConnection=None)

source code 
None

removeViewerConnections(self, doNotRemoveThisConnection=None)

source code 
None

ensureNameOfNodeAndDescendants(self, obj)

source code 
None

getIndexFromName(self, name)

source code 
returns the index of the geom returns -1 if entry is not in the list

naming(self, name)

source code 
returns True if we need to perform Parenting

addingEntries(self, name)

source code 
None

appendGeometry(self, name)

source code 
None

nodeOnlyGeomRemoval(self, geom)

source code 
None

parenting(self, parent, geom=None)

source code 
prepare the parenting and launch it if applicable it will parent the selectedGeomIndex unless geom is provided

effectiveParenting(self, lParent, geom=None)

source code 
try to reparent geometry, return True upon success after this call the geometry has a valid name it will parent the selectedGeomIndex unless geom is provided

drawParentAndChildrenConnections(self)

source code 
finds the selected children and parent and draws the connections if they are selected in their own node

setParentConnection(self)

source code 
set the parent connection if parent is selected in his own node

removeParentConnection(self)

source code 
None

setChildrenConnections(self)

source code 
None

setPortsOfTheChildrenConnections(self)

source code 
None

removeChildrenConnections(self)

source code 
None

rebuildComboBoxList(self)

source code 

reparentGeoms(self, list)

source code 
None

reparentGeomType(self, type, reparentCurrent=True)

source code 
None

getViewerConnection(self, node)

source code 
None

afterDisconnectParent(self, p1)

source code 
None

afterConnectParent(self, port, conn)

source code 
None

afterDisconnectChildren(self, p1, p2)

source code 
None

beforeRemovingFromNetwork(self)

source code 
None
Overrides: NetworkEditor.itemBase.NetworkItems.beforeRemovingFromNetwork

textureManagement(self, image, textureCoordinates=None)

source code 
None