Example #1
0
    def __init__(self):
        QtWidgets.QDockWidget.__init__(self)
        DocObject.__init__(self, None)
        self.mgr = None
        self.setWindowTitle("Object Properties")
        w = QtWidgets.QWidget(self)
        self.ui = Ui_ObjectProperties()
        self.ui.setupUi(w)
        self.ui.comboClass.setEditable(True)
        self.setWidget(w)

        self.entity = None

        self.valueItemByPropName = {}

        self.propertiesDelegate = ObjectPropertiesDelegate(self)
        self.propertiesModel = ObjectPropertiesModel(self)
        self.ui.propertiesView.setMouseTracking(True)
        self.ui.propertiesView.setModel(self.propertiesModel)
        self.ui.propertiesView.setItemDelegate(self.propertiesDelegate)
        self.ui.propertiesView.header().setDefaultAlignment(
            QtCore.Qt.AlignCenter)
        self.ui.propertiesView.clicked.connect(self.__propertyClicked)
        self.ui.lePropertyFilter.textChanged.connect(self.__filterProperties)
        self.ui.comboClass.currentIndexChanged.connect(
            self.__changeEntityClass)

        self.updateAvailableClasses()

        base.qtWindow.addDockWindow(self, "right")
        self.clearAll()
        self.setEnabled(False)
Example #2
0
 def __init__(self, mgr):
     DocObject.__init__(self, mgr.doc)
     self.mgr = mgr
     self.enabled = False
     self.activated = False
     self.properties = None
     self.entryIdx = 0
     self.lastEntries = None
Example #3
0
 def cleanup(self):
     self.mgr = None
     self.enabled = None
     self.activatated = None
     self.properties = None
     self.lastEntries = None
     self.entryIdx = None
     DocObject.cleanup(self)
Example #4
0
 def cleanup(self):
     self.ignoreAll()
     self.ignoreAllGlobal()
     for vp in self.viewports:
         vp.cleanup()
     self.viewports = None
     self.activeViewport = None
     self.lastMouse = None
     self.tickTask.remove()
     self.tickTask = None
     DocObject.cleanup(self)
Example #5
0
    def __init__(self, viewport):
        DocObject.__init__(self, viewport.doc)

        self.viewport = viewport

        self.enabled = False
        self.mouseSensitivity = 0.3
        self.cameraSpeed = 500 / 16.0
        self.timeToSpeed = 0.5  # seconds
        self.moveStart = 0.0
        self.cameraRotateSpeed = 75.0
        self.cameraSmooth = 0.7
        self.slideFactor = 0.75
        self.maxPitch = 90
        self.minPitch = -90
        self.diagonalFactor = math.sqrt(2.0) / 2.0
        self.lastSpeeds = Vec3(0)
        self.moving = False

        self.cursor = QtGui.QCursor()
        self.cursor.setShape(QtCore.Qt.BlankCursor)

        tex = base.loader.loadTexture('icons/editor-crosshair.png')
        tex.setMinfilter(SamplerState.FTLinear)
        tex.setMagfilter(SamplerState.FTLinear)
        crosshair = OnscreenImage(tex)
        crosshair.setTransparency(True)
        crosshair.setScale(0.04)
        crosshair.reparentTo(NodePath())
        self.crosshair = crosshair

        self.inputState = {}

        self.addInput("forward", KeyBind.Forward3DView)
        self.addInput("reverse", KeyBind.Back3DView)
        self.addInput("slideLeft", KeyBind.Left3DView)
        self.addInput("slideRight", KeyBind.Right3DView)
        self.addInput("floatDown", KeyBind.Down3DView)
        self.addInput("floatUp", KeyBind.Up3DView)
        self.addInput("lookUp", KeyBind.LookUp3DView)
        self.addInput("lookDown", KeyBind.LookDown3DView)
        self.addInput("lookRight", KeyBind.LookRight3DView)
        self.addInput("lookLeft", KeyBind.LookLeft3DView)

        self.accept(KeyBinds.getPandaShortcut(KeyBind.FlyCam), self.handleZ)

        self.doc.taskMgr.add(self.__flyCamTask, 'flyCam')
Example #6
0
 def cleanup(self):
     self.selectedObjects = None
     self.selectionMins = None
     self.selectionMaxs = None
     self.selectionCenter = None
     self.disconnectModes()
     self.connected = None
     self.funcs = None
     if self.selectionMode:
         self.selectionMode.disable()
     self.selectionMode = None
     for mode in self.selectionModes.values():
         mode.cleanup()
     self.selectionModes = None
     self.selectionMode = None
     self.connected = None
     DocObject.cleanup(self)
Example #7
0
 def cleanup(self):
     self.viewport = None
     self.doc.taskMgr.remove('flyCam')
     self.inputState = None
     self.crosshair.destroy()
     self.crosshair = None
     self.cursor = None
     self.moving = None
     self.lastSpeeds = None
     self.diagonalFactor = None
     self.maxPitch = None
     self.minPitch = None
     self.slideFactor = None
     self.cameraSmooth = None
     self.cameraRotateSpeed = None
     self.cameraSpeed = None
     self.moveStart = None
     self.enabled = None
     self.mouseSensitivity = None
     DocObject.cleanup(self)
Example #8
0
    def __init__(self, doc):
        DocObject.__init__(self, doc)
        self.viewports = []
        self.activeViewport = None
        self.lastMouse = None

        self.acceptGlobal('documentActivated', self.__onDocActivated)
        self.acceptGlobal('documentDeactivated', self.__onDocDeactivated)

        self.tickTask = self.doc.taskMgr.add(self.__update,
                                             'updateViewports',
                                             sort=-100)
        self.accept('mouse1', self.m1Down)
        self.accept('mouse1-up', self.m1Up)
        self.accept('mouse2', self.m2Down)
        self.accept('mouse2-up', self.m2Up)
        self.accept('mouse3', self.m3Down)
        self.accept('mouse3-up', self.m3Up)
        self.accept('wheel_down', self.wheelDown)
        self.accept('wheel_up', self.wheelUp)
        self.accept('f9', self.screenshot)
Example #9
0
    def __init__(self, doc):
        DocObject.__init__(self, doc)
        self.selectedObjects = []
        self.selectionMins = Point3()
        self.selectionMaxs = Point3()
        self.selectionCenter = Point3()

        # We'll select groups by default
        self.selectionModes = {}
        self.funcs = {}
        self.selectionMode = None
        self.connected = False

        self.acceptGlobal('documentActivated', self.__onDocActivated)
        self.acceptGlobal('documentDeactivated', self.__onDocDeactivated)
        self.accept('objectTransformChanged', self.handleObjectTransformChange)
        self.accept('mapObjectBoundsChanged',
                    self.handleMapObjectBoundsChanged)

        self.addSelectionModes()

        self.setSelectionMode(SelectionType.Groups)
Example #10
0
 def __init__(self, doc):
     DocObject.__init__(self, doc)
Example #11
0
 def setDoc(self, doc):
     DocObject.setDoc(self, doc)
     self.updateList()
Example #12
0
 def cleanup(self):
     self.enabled = None
     self.activated = None
     self.mgr = None
     DocObject.cleanup(self)
Example #13
0
 def __init__(self, mgr):
     DocObject.__init__(self, mgr.doc)
     self.enabled = False
     self.activated = False
     self.mgr = mgr
     self.options = None