Exemplo n.º 1
0
    def onHide(self, event):
        # Restore selected scene
        sceneTask = gui3d.app.getTask('Rendering', 'Scene')
        scene = sceneTask.scene
        glmodule.setSceneLighting(scene)

        guirender.RenderTaskView.onHide(self, event)
Exemplo n.º 2
0
    def __init__(self, category):
        guirender.RenderTaskView.__init__(self, category, 'Scene')
        self.scene = scene.Scene()

        sceneDir = mh.getPath('scenes')
        if not os.path.exists(sceneDir):
            os.makedirs(sceneDir)
        self.currentScene = os.path.join(sceneDir, "Default.mhscene")
        if os.path.exists(self.currentScene):
            loaded = self.scene.load(self.currentScene)
            if loaded is False:
                self.scene.save(self.currentScene)
        else:
            self.scene.save(self.currentScene)
        if not os.path.exists(os.path.join(sceneDir, "notfound.thumb")):
            shutil.copy(
                os.path.normpath(mh.getSysDataPath("uvs/notfound.thumb")),
                sceneDir)
        self.filechooser = self.addRightWidget( \
        fc.IconListFileChooser(sceneDir , 'mhscene', ['thumb', 'png'], 'notfound.thumb', 'Scene'))
        #self.addLeftWidget(self.filechooser.createSortBox())
        self.filechooser.enableAutoRefresh(False)

        glmodule.setSceneLighting(self.scene)

        @self.filechooser.mhEvent
        def onFileSelected(filename):
            self.loadScene(filename)
Exemplo n.º 3
0
    def _sceneChanged(self, event):
        """
        Method to be called internally when the scene is modified,
        that updates the view according to the modified scene,
        and emits the onSceneChanged event application - wide.
        """
        if event.file != self.scene.file:
            return

        if event.objectWasChanged:
            from glmodule import setSceneLighting
            setSceneLighting(self.scene)

        for category in self.categories.itervalues():
            for task in category.tasks:
                task.callEvent('onSceneChanged', event)
Exemplo n.º 4
0
 def loadScene(self, filename):
     self.currentScene = filename
     self.scene.load(filename)
     glmodule.setSceneLighting(self.scene)
Exemplo n.º 5
0
 def updateScene(self):
     glmodule.setSceneLighting(self.scene)