Пример #1
0
    def enable(self):
        cameraController.enable()
        self.menuBarGui.enable()

        if DGUI_SCENEGRAPHBROWSER_ACTIVE:
            self.scenegraphBrowserWindow = DirectSidebar(
                frameSize=(1., 1.5),
                pos=Vec3(0, 0, 0.05),
                align=ALIGN_LEFT | ALIGN_BOTTOM,
                orientation=VERTICAL,
                text='scenegraph',
                frameColor=(0, 0, 0, .8),
            )
            # create SceneGraphBrowser and point it on aspect2d
            self.scenegraphBrowser = SceneGraphBrowser(
                parent=self.
                scenegraphBrowserWindow,  # where to attach SceneGraphBrowser frame
                treeWrapperRoot=self.editorInstance.
                treeParent,  # display children under this root node
                includeTag=ENABLE_SCENEGRAPHBROWSER_MODEL_TAG,
                button1func=modelController.selectObject,
                pos=(0, 0, 0),
                frameSize=(1, 1.5))
            self.scenegraphBrowser.accept(EVENT_SCENEGRAPH_REFRESH,
                                          self.scenegraphBrowser.update)
            self.accept('r', messenger.send, [EVENT_SCENEGRAPH_REFRESH])

        # some help text nodes
        self.helpText = list()
        #self.helpText.append( addTitle("Panda3D: Simple scene editor") )
        helpTexts = [
            "LeftMouse: select object to move, select again to rotate, select again to scale",
            "MittleMouse: press & drag to rotate camera, turn to zoom (or page_up/down)",
            "RightMouse: press & drag to move camera pivot",
            "%s: Toggle Editor On/off (currently buggy)" %
            EDITOR_DGUI_TOGGLE_BUTTON.upper(),
            "F5: save scene      F9: load scene"
        ]
        helpTexts = []
        for i in xrange(len(helpTexts)):
            self.helpText.append(
                addInstructions(1.0 - 0.05 * (i + 1), helpTexts[i]))
        for text in self.helpText:
            text.show()

        messenger.send(EDITOR_MODE_WORLD_EDIT)

        self.editorObjectGuiInstance = None
        self.lastSelectedObject = None

        self.accept(EVENT_MODELCONTROLLER_SELECTED_OBJECT_CHANGE,
                    self.modelSelected)

        self.editorInstance.toggleEditmode(True)