vrml.node
Base-class for scenegraph nodes
Requires Python 2.2.x, as it makes
extensive use of properties
Functions
prototype(
name
,
fields
= ()
,
sceneGraph
= None
,
externalURL
= None
,
baseClasses
= (<class 'vrml.node.PrototypedNode'>, <class 'vrml.node.Node'>)
)
Build a new prototype class
- name
- string name
- fields
- sequence of vrml.field objects
- sceneGraph
- the source scenegraph for prototyped nodes
- externalURL
- MFString URL or None
- baseClasses
- base classes for the new class
Classes
(Restricted) MFNode field-type-definition
baseSFNode
exposedField SFNode SFNode <bound method SFNode
fset(
self
,
client
,
value
,
notify
= 1
)
Set the client's value for this property
- notify
- if true send a notification event
The MFNode tries to update the value's root
attribute to point to the root of the client
*iff* the value doesn't currently point at
a valid root. (That is, it only updates root
if there is no current root). This is done
without sending notify events.
Base-class for SFNode-type fields
The optionally restricted SFNode field type
allows a node to hold a reference to another node
within the directed acyclic graph.
There are two primary attributes:
- requiredTypes
- a type or tuple of types that are acceptable as values for the field
- allowNULL
- whether to allow the NULL node as a value for the field
fset(
self
,
client
,
value
,
notify
= 1
)
Set the client's value for this property
- notify
- if true send a notification event
The SFNode tries to update the value's root
attribute to point to the root of the client
*iff* the value doesn't currently point at
a valid root. (That is, it only updates root
if there is no current root). This is done
without sending notify events.
A generic scene graph node
Unlike earlier versions of the library,
this implementation of the Node class is
basically a regular python class. This is
possible because it uses the python 2.2.x
property/descriptor API extensively.
Technically this is a multiple-hierarchy DAG
node, as there can be any number of node
children attributes, and nodes may appear
multiple times in the hierarchy.
Attributes of note:
" DEF" field
a simple string field which stores the
DEF name of a node instance
" scenegraph" attribute
pointer to the node's implementation
scenegraph (at the moment, this is not
actually used for anything)
" PROTO" attribute
stores the PROTO name of the node
externalURL attribute
stores the MFString url for the node's
externproto definition if appropriate
toString method
convenience access to the lineariser
to give VRML97-formatted representation of
the node
DEF
exposedField SFString DEF
externalURL
exposedField MFString externalURL []
rootSceneGraph
exposedField RootScenegraphNode SFNode NULL
__init__(
self
,
**
namedarguments
)
Initialise the node with appropriate named args
All properties/attributes must be specified with
named arguments, and the property/attribute must
exist within the Node's class/prototype.
This will raise AttributeError/ValueError/TypeError
if the values or the property names are inappropriate.
Note that all Node objects have the attribute/property
exposedField SFString DEF ""
defined. You may therefore specify a DEF name by
passing it as a named argument.
NULL SFNode value
There should only be a single NULL instance for
any particular system. It should, for all intents and
purposes just sit there inertly
class PrototypedNode(
object
):
Prototyped node mix-in
Note the presence of a " scenegraph" property
for the node created below (due to mutual dependencies).
This is filled by the instantiate method to provide the
actual implementation of the node.
scenegraph
exposedField SFNode SFNode NULL
__init__(
self
,
*
arguments
,
**
namedarguments
)
Initialise the node with appropriate named args
Also attempts to instantiate the sub-node scenegraph
for the PrototypedNode
class RootScenegraphNode(
WeakSFNode
):
(Restricted) SFNode type
This is the publically available SFNode type,
a sub-class of _SFNode and field.Field
Weak-referenced SFNode field-type