class ColorInterpolator(nodetypes.Children, nodetypes.Interpolator, node.Node): PROTO = 'ColorInterpolator' #Fields keyValue = field.newField('keyValue', 'MFColor', 1, list) key = field.newField('key', 'MFFloat', 1, list) #Events set_fraction = field.newEvent('set_fraction', 'SFFloat', 0) value_changed = field.newEvent('value_changed', 'SFColor', 1)
class Group(nodetypes.Children, nodetypes.Grouping, node.Node): PROTO = 'Group' #Fields bboxCenter = field.newField('bboxCenter', 'SFVec3f', 0, [0.0, 0.0, 0.0]) children = field.newField('children', 'MFNode', 1, list) bboxSize = field.newField('bboxSize', 'SFVec3f', 0, [-1.0, -1.0, -1.0]) #Events removeChildren = field.newEvent('removeChildren', 'MFNode', 0) addChildren = field.newEvent('addChildren', 'MFNode', 0)
class Fog(nodetypes.Fog, nodetypes.Children, node.Node): PROTO = 'Fog' #Fields color = field.newField('color', 'SFColor', 1, [1.0, 1.0, 1.0]) visibilityRange = field.newField('visibilityRange', 'SFFloat', 1, 0.0) fogType = field.newField('fogType', 'SFString', 1, 'LINEAR') #Events set_bind = field.newEvent('set_bind', 'SFBool', 0) isBound = field.newEvent('isBound', 'SFBool', 1)
class Transform(nodetypes.Children, nodetypes.Transforming, node.Node): PROTO = 'Transform' #Fields scale = field.newField('scale', 'SFVec3f', 1, [1.0, 1.0, 1.0]) center = field.newField('center', 'SFVec3f', 1, [0.0, 0.0, 0.0]) bboxCenter = field.newField('bboxCenter', 'SFVec3f', 0, [0.0, 0.0, 0.0]) translation = field.newField('translation', 'SFVec3f', 1, [0.0, 0.0, 0.0]) scaleOrientation = field.newField('scaleOrientation', 'SFRotation', 1, [0.0, 0.0, 1.0, 0.0]) rotation = field.newField('rotation', 'SFRotation', 1, [0.0, 0.0, 1.0, 0.0]) bboxSize = field.newField('bboxSize', 'SFVec3f', 0, [-1.0, -1.0, -1.0]) children = field.newField('children', 'MFNode', 1, list) #Events removeChildren = field.newEvent('removeChildren', 'MFNode', 0) addChildren = field.newEvent('addChildren', 'MFNode', 0) def localMatrices(self, translate=True, scale=True, rotate=True): """Calculate/lookup our local matrices Certain operations want, e.g. just the rotation of an item, so we actually can store 2**3 possible variations of the local matrices. In practice we only see a very small number. returns holder, where holder.data == (forward,inverse) matrix for the local node, each of which can be None """ key = ('local_matrices', translate, scale, rotate) holder = cache.CACHE.getHolder(self, key=key) if holder is None: doConnect = True holder = cache.CACHE.holder(self, None, key=key) mHolder = None else: doConnect = False mHolder = holder.data if mHolder is None: matrix = None fields = [] if translate: fields.append('translation') if scale or rotate: fields.append('center') if scale: fields.append('scale') fields.append('scaleOrientation') if rotate: fields.append('rotation') d = self.__dict__ forward, inverse = transformmatrix.localMatrices( **dict([(k, d.get(k)) for k in fields])) if doConnect: for k in fields: holder.depend(self, k) holder.data = (forward, inverse) return holder
class SphereSensor(nodetypes.Children, nodetypes.PointingSensor, node.Node): PROTO = 'SphereSensor' #Fields enabled = field.newField('enabled', 'SFBool', 1, 1) autoOffset = field.newField('autoOffset', 'SFBool', 1, 1) offset = field.newField('offset', 'SFRotation', 1, [0.0, 1.0, 0.0, 0.0]) #Events rotation_changed = field.newEvent('rotation_changed', 'SFRotation', 1) isActive = field.newEvent('isActive', 'SFBool', 1) trackPoint_changed = field.newEvent('trackPoint_changed', 'SFVec3f', 1)
class VisibilitySensor(nodetypes.Sensor, nodetypes.Children, node.Node): PROTO = 'VisibilitySensor' #Fields enabled = field.newField('enabled', 'SFBool', 1, 1) center = field.newField('center', 'SFVec3f', 1, [0.0, 0.0, 0.0]) size = field.newField('size', 'SFVec3f', 1, [0.0, 0.0, 0.0]) #Events exitTime = field.newEvent('exitTime', 'SFTime', 1) enterTime = field.newEvent('enterTime', 'SFTime', 1) isActive = field.newEvent('isActive', 'SFBool', 1)
class IndexedLineSet(nodetypes.Geometry, node.Node): PROTO = 'IndexedLineSet' #Fields color = field.newField('color', 'SFNode', 1, node.NULL) colorPerVertex = field.newField('colorPerVertex', 'SFBool', 0, 1) colorIndex = field.newField('colorIndex', 'MFInt32', 0, list) coord = field.newField('coord', 'SFNode', 1, node.NULL) coordIndex = field.newField('coordIndex', 'MFInt32', 0, list) #Events set_coordIndex = field.newEvent('set_coordIndex', 'MFInt32', 0) set_colorIndex = field.newEvent('set_colorIndex', 'MFInt32', 0)
class Billboard(nodetypes.Children, nodetypes.Transforming, node.Node): PROTO = 'Billboard' #Fields bboxCenter = field.newField('bboxCenter', 'SFVec3f', 0, [0.0, 0.0, 0.0]) axisOfRotation = field.newField('axisOfRotation', 'SFVec3f', 1, [0.0, 1.0, 0.0]) children = field.newField('children', 'MFNode', 1, list) bboxSize = field.newField('bboxSize', 'SFVec3f', 0, [-1.0, -1.0, -1.0]) #Events removeChildren = field.newEvent('removeChildren', 'MFNode', 0) addChildren = field.newEvent('addChildren', 'MFNode', 0)
class AudioClip(nodetypes.Auditory, nodetypes.TimeDependent, node.Node): PROTO = 'AudioClip' #Fields stopTime = field.newField('stopTime', 'SFTime', 1, 0.0) description = field.newField('description', 'SFString', 1, '') startTime = field.newField('startTime', 'SFTime', 1, 0.0) pitch = field.newField('pitch', 'SFFloat', 1, 1.0) url = field.newField('url', 'MFString', 1, list) loop = field.newField('loop', 'SFBool', 1, 0) #Events duration_changed = field.newEvent('duration_changed', 'SFTime', 1) isActive = field.newEvent('isActive', 'SFBool', 1)
class NavigationInfo(nodetypes.Children, nodetypes.NavigationInfo, node.Node): PROTO = 'NavigationInfo' #Fields speed = field.newField('speed', 'SFFloat', 1, 1.0) avatarSize = field.newField('avatarSize', 'MFFloat', 1, [0.25, 1.6000000000000001, 0.75]) headlight = field.newField('headlight', 'SFBool', 1, 1) type = field.newField('type', 'MFString', 1, ['WALK']) visibilityLimit = field.newField('visibilityLimit', 'SFFloat', 1, 0.0) #Events set_bind = field.newEvent('set_bind', 'SFBool', 0) isBound = field.newEvent('isBound', 'SFBool', 1)
class Collision(nodetypes.Children, nodetypes.Grouping, node.Node): PROTO = 'Collision' #Fields bboxCenter = field.newField('bboxCenter', 'SFVec3f', 0, [0.0, 0.0, 0.0]) collide = field.newField('collide', 'SFBool', 1, 1) proxy = field.newField('proxy', 'SFNode', 0, node.NULL) bboxSize = field.newField('bboxSize', 'SFVec3f', 0, [-1.0, -1.0, -1.0]) children = field.newField('children', 'MFNode', 1, list) #Events removeChildren = field.newEvent('removeChildren', 'MFNode', 0) collideTime = field.newEvent('collideTime', 'SFTime', 1) addChildren = field.newEvent('addChildren', 'MFNode', 0)
class PlaneSensor(nodetypes.Children, nodetypes.PointingSensor, node.Node): PROTO = 'PlaneSensor' #Fields maxPosition = field.newField('maxPosition', 'SFVec2f', 1, [-1.0, -1.0]) enabled = field.newField('enabled', 'SFBool', 1, 1) autoOffset = field.newField('autoOffset', 'SFBool', 1, 1) minPosition = field.newField('minPosition', 'SFVec2f', 1, [0.0, 0.0]) offset = field.newField('offset', 'SFVec3f', 1, [0.0, 0.0, 0.0]) #Events translation_changed = field.newEvent('translation_changed', 'SFVec3f', 1) isActive = field.newEvent('isActive', 'SFBool', 1) trackPoint_changed = field.newEvent('trackPoint_changed', 'SFVec3f', 1)
class Anchor(nodetypes.Children, nodetypes.Grouping, node.Node): PROTO = 'Anchor' #Fields url = field.newField('url', 'MFString', 1, list) description = field.newField('description', 'SFString', 1, '') bboxCenter = field.newField('bboxCenter', 'SFVec3f', 0, [0.0, 0.0, 0.0]) parameter = field.newField('parameter', 'MFString', 1, list) children = field.newField('children', 'MFNode', 1, list) bboxSize = field.newField('bboxSize', 'SFVec3f', 0, [-1.0, -1.0, -1.0]) #Events removeChildren = field.newEvent('removeChildren', 'MFNode', 0) addChildren = field.newEvent('addChildren', 'MFNode', 0)
class CylinderSensor(nodetypes.Children, nodetypes.PointingSensor, node.Node): PROTO = 'CylinderSensor' #Fields minAngle = field.newField('minAngle', 'SFFloat', 1, 0.0) offset = field.newField('offset', 'SFFloat', 1, 0.0) diskAngle = field.newField('diskAngle', 'SFFloat', 1, 0.26200000000000001) enabled = field.newField('enabled', 'SFBool', 1, 1) autoOffset = field.newField('autoOffset', 'SFBool', 1, 1) maxAngle = field.newField('maxAngle', 'SFFloat', 1, -1.0) #Events rotation_changed = field.newEvent('rotation_changed', 'SFRotation', 1) isActive = field.newEvent('isActive', 'SFBool', 1) trackPoint_changed = field.newEvent('trackPoint_changed', 'SFVec3f', 1)
class ProximitySensor(nodetypes.Sensor, nodetypes.Children, node.Node): PROTO = 'ProximitySensor' #Fields enabled = field.newField('enabled', 'SFBool', 1, 1) center = field.newField('center', 'SFVec3f', 1, [0.0, 0.0, 0.0]) size = field.newField('size', 'SFVec3f', 1, [0.0, 0.0, 0.0]) #Events position_changed = field.newEvent('position_changed', 'SFVec3f', 1) enterTime = field.newEvent('enterTime', 'SFTime', 1) exitTime = field.newEvent('exitTime', 'SFTime', 1) orientation_changed = field.newEvent('orientation_changed', 'SFRotation', 1) isActive = field.newEvent('isActive', 'SFBool', 1)
class Viewpoint(nodetypes.Children, nodetypes.Viewpoint, node.Node): PROTO = 'Viewpoint' #Fields jump = field.newField('jump', 'SFBool', 1, 1) position = field.newField('position', 'SFVec3f', 1, [0.0, 0.0, 10.0]) fieldOfView = field.newField('fieldOfView', 'SFFloat', 1, 0.78539800000000004) orientation = field.newField('orientation', 'SFRotation', 1, [0.0, 0.0, 1.0, 0.0]) description = field.newField('description', 'SFString', 0, '') #Events set_bind = field.newEvent('set_bind', 'SFBool', 0) bindTime = field.newEvent('bindTime', 'SFTime', 1) isBound = field.newEvent('isBound', 'SFBool', 1)
class TimeSensor(nodetypes.Sensor, nodetypes.Children, nodetypes.TimeDependent, node.Node): PROTO = 'TimeSensor' #Fields cycleInterval = field.newField('cycleInterval', 'SFTime', 1, 1.0) stopTime = field.newField('stopTime', 'SFTime', 1, 0.0) enabled = field.newField('enabled', 'SFBool', 1, 1) loop = field.newField('loop', 'SFBool', 1, 0) startTime = field.newField('startTime', 'SFTime', 1, 0.0) #Events fraction_changed = field.newEvent('fraction_changed', 'SFFloat', 1) cycleTime = field.newEvent('cycleTime', 'SFTime', 1) isActive = field.newEvent('isActive', 'SFBool', 1) time = field.newEvent('time', 'SFTime', 1)
class MovieTexture(nodetypes.Auditory, nodetypes.Texture, nodetypes.TimeDependent, node.Node): PROTO = 'MovieTexture' #Fields stopTime = field.newField('stopTime', 'SFTime', 1, 0.0) startTime = field.newField('startTime', 'SFTime', 1, 0.0) url = field.newField('url', 'MFString', 1, list) speed = field.newField('speed', 'SFFloat', 1, 1.0) repeatS = field.newField('repeatS', 'SFBool', 0, 1) repeatT = field.newField('repeatT', 'SFBool', 0, 1) loop = field.newField('loop', 'SFBool', 1, 0) #Events duration_changed = field.newEvent('duration_changed', 'SFFloat', 1) isActive = field.newEvent('isActive', 'SFBool', 1)
class Background(nodetypes.Children, nodetypes.Background, node.Node): PROTO = 'Background' #Fields groundAngle = field.newField('groundAngle', 'MFFloat', 1, list) rightUrl = field.newField('rightUrl', 'MFString', 1, list) topUrl = field.newField('topUrl', 'MFString', 1, list) backUrl = field.newField('backUrl', 'MFString', 1, list) groundColor = field.newField('groundColor', 'MFColor', 1, list) leftUrl = field.newField('leftUrl', 'MFString', 1, list) frontUrl = field.newField('frontUrl', 'MFString', 1, list) bottomUrl = field.newField('bottomUrl', 'MFString', 1, list) skyColor = field.newField('skyColor', 'MFColor', 1, [[0.0, 0.0, 0.0]]) skyAngle = field.newField('skyAngle', 'MFFloat', 1, list) #Events set_bind = field.newEvent('set_bind', 'SFBool', 0) isBound = field.newEvent('isBound', 'SFBool', 1)
def eventDecl( self, table, buffer): (tag, left, right, (direction, datatype, name)) = table datatype = getString( datatype, buffer ) addField( self.prototypeStack[-1], field.newEvent( getString(name, buffer), datatype, getString( direction, buffer ) == 'eventOut', ) )
def ScriptEventDecl( self, table, buffer): (tag, left, right, sublist) = table direction, datatype, name = [getString( item,buffer) for item in sublist[:3]] if len(sublist) > 3: mapName = dispatch( self, sublist[3], buffer) else: mapName = None return ( field.newEvent(name, datatype, direction=='eventOut'), mapName, )
class Extrusion(nodetypes.Geometry, node.Node): PROTO = 'Extrusion' #Fields beginCap = field.newField('beginCap', 'SFBool', 0, 1) scale = field.newField('scale', 'MFVec2f', 0, [[1.0, 1.0]]) creaseAngle = field.newField('creaseAngle', 'SFFloat', 0, 0.0) convex = field.newField('convex', 'SFBool', 0, 1) spine = field.newField('spine', 'MFVec3f', 0, [[0.0, 0.0, 0.0], [0.0, 1.0, 0.0]]) crossSection = field.newField( 'crossSection', 'MFVec2f', 0, [[1.0, 1.0], [1.0, -1.0], [-1.0, -1.0], [-1.0, 1.0], [1.0, 1.0]]) ccw = field.newField('ccw', 'SFBool', 0, 1) solid = field.newField('solid', 'SFBool', 0, 1) endCap = field.newField('endCap', 'SFBool', 0, 1) orientation = field.newField('orientation', 'MFRotation', 0, [[0.0, 0.0, 1.0, 0.0]]) #Events set_crossSection = field.newEvent('set_crossSection', 'MFVec2f', 0) set_orientation = field.newEvent('set_orientation', 'MFRotation', 0) set_scale = field.newEvent('set_scale', 'MFVec2f', 0) set_spine = field.newEvent('set_spine', 'MFVec3f', 0)
class IndexedFaceSet(nodetypes.Geometry, node.Node): PROTO = 'IndexedFaceSet' #Fields colorIndex = field.newField('colorIndex', 'MFInt32', 0, list) normal = field.newField('normal', 'SFNode', 1, node.NULL) solid = field.newField('solid', 'SFBool', 0, 1) ccw = field.newField('ccw', 'SFBool', 0, 1) coordIndex = field.newField('coordIndex', 'MFInt32', 0, list) texCoord = field.newField('texCoord', 'SFNode', 1, node.NULL) normalPerVertex = field.newField('normalPerVertex', 'SFBool', 0, 1) color = field.newField('color', 'SFNode', 1, node.NULL) colorPerVertex = field.newField('colorPerVertex', 'SFBool', 0, 1) coord = field.newField('coord', 'SFNode', 1, node.NULL) convex = field.newField('convex', 'SFBool', 0, 1) normalIndex = field.newField('normalIndex', 'MFInt32', 0, list) texCoordIndex = field.newField('texCoordIndex', 'MFInt32', 0, list) creaseAngle = field.newField('creaseAngle', 'SFFloat', 0, 0.0) #Events set_coordIndex = field.newEvent('set_coordIndex', 'MFInt32', 0) set_texCoordIndex = field.newEvent('set_texCoordIndex', 'MFInt32', 0) set_colorIndex = field.newEvent('set_colorIndex', 'MFInt32', 0) set_normalIndex = field.newEvent('set_normalIndex', 'MFInt32', 0)
class TouchSensor(nodetypes.Children, nodetypes.PointingSensor, node.Node): PROTO = 'TouchSensor' #Fields enabled = field.newField('enabled', 'SFBool', 1, 1) #Events isOver = field.newEvent('isOver', 'SFBool', 1) hitTexCoord_changed = field.newEvent('hitTexCoord_changed', 'SFVec2f', 1) hitNormal_changed = field.newEvent('hitNormal_changed', 'SFVec3f', 1) hitPoint_changed = field.newEvent('hitPoint_changed', 'SFVec3f', 1) touchTime = field.newEvent('touchTime', 'SFTime', 1) isActive = field.newEvent('isActive', 'SFBool', 1)
class ElevationGrid(nodetypes.Geometry, node.Node): PROTO = 'ElevationGrid' #Fields zDimension = field.newField('zDimension', 'SFInt32', 0, 0) xSpacing = field.newField('xSpacing', 'SFFloat', 0, 0.0) creaseAngle = field.newField('creaseAngle', 'SFFloat', 0, 0.0) normal = field.newField('normal', 'SFNode', 1, node.NULL) solid = field.newField('solid', 'SFBool', 0, 1) ccw = field.newField('ccw', 'SFBool', 0, 1) texCoord = field.newField('texCoord', 'SFNode', 1, node.NULL) height = field.newField('height', 'MFFloat', 0, list) color = field.newField('color', 'SFNode', 1, node.NULL) colorPerVertex = field.newField('colorPerVertex', 'SFBool', 0, 1) xDimension = field.newField('xDimension', 'SFInt32', 0, 0) zSpacing = field.newField('zSpacing', 'SFFloat', 0, 0.0) normalPerVertex = field.newField('normalPerVertex', 'SFBool', 0, 1) #Events set_height = field.newEvent('set_height', 'MFFloat', 0)
addField( self.prototypeStack[-1], field.newField( getString(name, buffer), datatype, getString(exposure, buffer) == 'exposedField', )) def eventDecl(self, (tag, left, right, (direction, datatype, name)), buffer): datatype = getString(datatype, buffer) addField( self.prototypeStack[-1], field.newEvent( getString(name, buffer), datatype, getString(direction, buffer) == 'eventOut', )) def ScriptEventDecl(self, (tag, left, right, sublist), buffer): direction, datatype, name = [ getString(item, buffer) for item in sublist[:3] ] if len(sublist) > 3: mapName = dispatch(self, sublist[3], buffer) else: mapName = None return ( field.newEvent(name, datatype, direction == 'eventOut'), mapName, )