예제 #1
0
 def __init__( self, *args, **kwargs ):
     GameNodePath.__init__( self, *args, **kwargs )
     
     # Find the index of the 'name' property so we can add position, 
     # rotation and scale properties immediately after it.
     i = self.attributes.index( self.FindProperty( 'name' ) )
     
     # Add attributes for position, rotation and scale. These are 
     # implemented editor side only as we only need a matrix to xform the 
     # NodePath; they are for the user's benefit only.
     self.AddAttributes( Attr( 'Position', pm.Vec3, NP.getPos, NP.setPos, w=False ), index=i + 1 )
     self.AddAttributes( 
         Attr( 'X', float, NP.getX, NP.setX, w=False ),
         Attr( 'Y', float, NP.getY, NP.setY, w=False ),
         Attr( 'Z', float, NP.getZ, NP.setZ, w=False ),
         parent='Position'
     )
     
     self.AddAttributes( Attr( 'Rotation', pm.Vec3, NP.getHpr, NP.setHpr, w=False ), index=i + 2 )
     self.AddAttributes( 
         Attr( 'H', float, NP.getH, NP.setH, w=False ),
         Attr( 'P', float, NP.getP, NP.setP, w=False ),
         Attr( 'R', float, NP.getR, NP.setR, w=False ),
         parent='Rotation'
     )
     
     self.AddAttributes( Attr( 'Scale', pm.Vec3, NP.getScale, NP.setScale, w=False ), index=i + 3 )
     self.AddAttributes( 
         Attr( 'Sx', float, NP.getSx, NP.setSx, w=False ),
         Attr( 'Sy', float, NP.getSy, NP.setSy, w=False ),
         Attr( 'Sz', float, NP.getSz, NP.setSz, w=False ),
         parent='Scale'
     )
예제 #2
0
 def __init__( self, *args, **kwargs ):
     GameNodePath.__init__( self, *args, **kwargs )
     
     # Find the index of the 'name' property so we can add position, 
     # rotation and scale properties immediately after it.
     i = self.attributes.index( self.FindProperty( 'name' ) )
     
     # Add attributes for position, rotation and scale. These are 
     # implemented editor side only as we only need a matrix to xform the 
     # NodePath; they are for the user's benefit only.
     self.AddAttributes( Attr( 'Position', pm.Vec3, NP.getPos, NP.setPos, w=False ), index=i + 1 )
     self.AddAttributes( 
         Attr( 'X', float, NP.getX, NP.setX, w=False ),
         Attr( 'Y', float, NP.getY, NP.setY, w=False ),
         Attr( 'Z', float, NP.getZ, NP.setZ, w=False ),
         parent='Position'
     )
     
     self.AddAttributes( Attr( 'Rotation', pm.Vec3, NP.getHpr, NP.setHpr, w=False ), index=i + 2 )
     self.AddAttributes( 
         Attr( 'H', float, NP.getH, NP.setH, w=False ),
         Attr( 'P', float, NP.getP, NP.setP, w=False ),
         Attr( 'R', float, NP.getR, NP.setR, w=False ),
         parent='Rotation'
     )
     
     self.AddAttributes( Attr( 'Scale', pm.Vec3, NP.getScale, NP.setScale, w=False ), index=i + 3 )
     self.AddAttributes( 
         Attr( 'Sx', float, NP.getSx, NP.setSx, w=False ),
         Attr( 'Sy', float, NP.getSy, NP.setSy, w=False ),
         Attr( 'Sz', float, NP.getSz, NP.setSz, w=False ),
         parent='Scale'
     )
예제 #3
0
 def __init__( self, *args, **kwargs ):
     NodePath.__init__( self, *args, **kwargs )
     
     pAttr = Attr( 'Box' )
     pAttr.children.extend( 
         [
             NPOAttr( 'Width', float, 'width' ),
             NPOAttr( 'Depth', float, 'depth' ),
             NPOAttr( 'Height', float, 'height' ),
             NPOAttr( 'Origin', pm.Point3, 'origin' )
         ]
     )
     self.attributes.append( pAttr )
예제 #4
0
 def __init__( self, *args, **kwargs ):
     NodePath.__init__( self, *args, **kwargs )
     
     pAttr = Attr( 'Sphere' )
     pAttr.children.extend( 
         [
             NPOAttr( 'Radius', float, 'radius' ),
             NPOAttr( 'NumSegs', int, 'numSegs' ),
             NPOAttr( 'Degrees', int, 'degrees' ),
             NPOAttr( 'Axis', pm.Vec3, 'axis' ),
             NPOAttr( 'Origin', pm.Point3, 'origin' )
         ]
     )
     self.attributes.append( pAttr )
예제 #5
0
 def SetupNodePath( self ):
     GameNodePath.SetupNodePath( self )
     
     if self.geo is not None:
         self.geo.copyTo( self.data )
         
     if self.pickable:
         self.data.setPythonTag( TAG_PICKABLE, self.pickable )
예제 #6
0
 def Duplicate( self ):
     dupeNp = NodePath.Duplicate( self )
     
     # Duplicate the primtive NodePathObject to the duplicated NodePath.
     pyObj = PrimitiveNPO.Get( self.data )
     dupePyObj = copy.copy( pyObj )
     dupePyObj.np = dupeNp
     dupeNp.setPythonTag( PrimitiveNPO.pyTagName, dupePyObj )
     return dupeNp
예제 #7
0
 def OnDuplicate( self, origNp, dupeNp ):
     GameNodePath.OnDuplicate( self, origNp, dupeNp )
     
     wrpr = base.game.nodeMgr.Wrap( origNp )
     cnnctns = base.scene.GetOutgoingConnections( wrpr )
     for cnnctn in cnnctns:
         newCnnctn = copy.copy( cnnctn )
         newCnnctn.Connect( self.data )
     
     self.data.setPythonTag( TAG_MODIFIED, origNp.getPythonTag( TAG_MODIFIED ) )
     
예제 #8
0
 def GetChildren( self ):
     """
     Return a list of wrappers for the children of this NodePath, ignoring
     those NodePaths tagged with TAG_IGNORE (like editor only geometry).
     """
     children = [
         cWrpr 
         for cWrpr in GameNodePath.GetChildren( self ) 
         if not cWrpr.data.getPythonTag( TAG_IGNORE )
     ]
     return children
예제 #9
0
 def GetAttrib( self ):
     """
     If this node is a child of a model root, make sure to add its position
     in the hierarchy to the attrib dictionary.
     """
     attrib = GameNodePath.GetAttrib( self )
     
     if self.GetModified():
         attrib['path'] = self.GetPath()
         
     return attrib
예제 #10
0
 def __init__( self, *args, **kwargs ):
     GameNodePath.__init__( self, *args, **kwargs )
     
     # Add attributes for position, rotation and scale. These are
     # implemented editor side only as we only need a matrix to xform the
     # node. These are provided for the user's benefit only.
     pAttr = self.FindAttribute( 'nodePath' )
     attr = Attr( 'Position', pm.Vec3, NP.getPos, NP.setPos, w=False )
     attr.children.extend( 
         [
             Attr( 'X', float, NP.getX, NP.setX, w=False ),
             Attr( 'Y', float, NP.getY, NP.setY, w=False ),
             Attr( 'Z', float, NP.getZ, NP.setZ, w=False )
         ]
     )
     pAttr.children.append( attr )
     
     attr = Attr( 'Rotation', pm.Vec3, NP.getHpr, NP.setHpr, w=False )
     attr.children.extend( 
         [
             Attr( 'H', float, NP.getH, NP.setH, w=False ),
             Attr( 'P', float, NP.getP, NP.setP, w=False ),
             Attr( 'R', float, NP.getR, NP.setR, w=False )
         ]
     )
     pAttr.children.append( attr )
      
     attr = Attr( 'Scale', pm.Vec3, NP.getScale, NP.setScale, w=False )
     attr.children.extend( 
         [
             Attr( 'Sx', float, NP.getSx, NP.setSx, w=False ),
             Attr( 'Sy', float, NP.getSy, NP.setSy, w=False ),
             Attr( 'Sz', float, NP.getSz, NP.setSz, w=False )
         ]
     )
     pAttr.children.append( attr )
예제 #11
0
 def Destroy( self ):
     PrimitiveNPO.Break( self.data )
     NodePath.Destroy( self )