示例#1
0
    def loadMeshAndObject(self, human):
        import files3d
        import guicommon
        import getpath
        
        import inspect  # temp code to log calling routines
        log.debug("loadMeshAndObject called by: %s", inspect.stack()[1][3])
        
        name = self.obj_file
        if isinstance(name, bytes):
            name = name.decode('utf-8')
                                  
        name = getpath.getSysPath(name)
        mesh = files3d.loadMesh(name, maxFaces = self.max_pole)
        if not mesh:
            log.error("loadMeshAndObject failed to load %s", name)
            log.error("The meshname is %s", name)

        log.debug("Now the path has been extended to %s", name)
        mesh.priority = self.z_depth           # Set render order
        mesh.setCameraProjection(0)             # Set to model camera

        obj = self.object = guicommon.Object(mesh, human.getPosition())
        obj.proxy = self
        obj.material = self.material
        obj.setRotation(human.getRotation())
        obj.setSolid(human.solid)    # Set to wireframe if human is in wireframe
        # TODO perhaps other properties should be copied from human to object, such as subdivision state. For other hints, and duplicate code, see guicommon Object.setProxy()

        # TODO why return both obj and mesh if you can access the mesh easily through obj.mesh?
        return mesh,obj
示例#2
0
    def _createMeasureMesh(self):
        self.measureMesh = module3d.Object3D('measure', 2)
        self.measureMesh.createFaceGroup('measure')

        count = max([len(vertIdx) for vertIdx in self.ruler.Measures.values()])

        self.measureMesh.setCoords(np.zeros((count, 3), dtype=np.float32))
        self.measureMesh.setUVs(np.zeros((1, 2), dtype=np.float32))
        self.measureMesh.setFaces(np.arange(count).reshape((-1,2)))

        self.measureMesh.setColor([255, 255, 255, 255])
        self.measureMesh.setPickable(0)
        self.measureMesh.updateIndexBuffer()
        self.measureMesh.priority = 50

        self.measureObject = self.addObject(guicommon.Object(self.measureMesh))
        self.measureObject.setShadeless(True)
        self.measureObject.setDepthless(True)
示例#3
0
    def loadMeshAndObject(self, human):
        import files3d
        import guicommon

        mesh = files3d.loadMesh(self.obj_file, maxFaces = self.max_pole)
        if not mesh:
            log.error("Failed to load %s", self.obj_file)

        mesh.priority = self.z_depth           # Set render order
        mesh.setCameraProjection(0)             # Set to model camera

        obj = self.object = guicommon.Object(mesh, human.getPosition())
        obj.proxy = self
        obj.material = self.material
        obj.setRotation(human.getRotation())
        obj.setSolid(human.solid)    # Set to wireframe if human is in wireframe
        # TODO perhaps other properties should be copied from human to object, such as subdivision state. For other hints, and duplicate code, see guicommon Object.setProxy()

        # TODO why return both obj and mesh if you can access the mesh easily through obj.mesh?
        return mesh,obj