Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'panda3d.core.GraphicsBuffer' object has no attribute 'getPointer' #9

Open
WhatWheatleySaid opened this issue Jun 29, 2020 · 1 comment

Comments

@WhatWheatleySaid
Copy link

I understand that your README is stating, that mouse stuff isn't supported right now, but i tried it anyway. I'm a bit confused about the error though, because my application (without qt) was inherited by the ShowBase class like your QPanda3DWorld class. I try to access the currents mouse position via the self.win attribute of the ShowBase class, shouldn't that work anyways?

Traceback (most recent call last): ^ File "C:\Users\****\earth_plotting\venv\lib\site-packages\QPanda3D\QPanda3DWidget.py", line 35, in tick taskMgr.step() File "C:\Users\****\earth_plotting\venv\lib\site-packages\direct\task\Task.py", line 495, in step self.mgr.poll() File "EarthPlot.py", line 313, in OrbitCameraTask md = self.win.getPointer(0) AttributeError: 'panda3d.core.GraphicsBuffer' object has no attribute 'getPointer'

The code of the task producing the problem is:

def OrbitCameraTask(self,task):
        delta_factor = .01 * self.camLens.getFov()[1]
        md = self.win.getPointer(0)
        if base.mouseWatcherNode.isButtonDown(MouseButton.one()):
            self.props.setCursorHidden(True)
            self.win.requestProperties(self.props)
            x = md.getX()
            y = md.getY()
            if self.win.movePointer(0, int(self.x_mouse_position), int(self.y_mouse_position)):
                self.heading = self.heading - (x - self.x_mouse_position) * delta_factor
                self.pitch = self.pitch - (y - self.y_mouse_position) * delta_factor
            if self.pitch > 90:
                self.pitch = 90
            elif self.pitch <-90:
                self.pitch = -90
            self.parentnode.setHpr(self.heading, self.pitch,0)
        else:
            self.props.setCursorHidden(False)
            self.win.requestProperties(self.props)
            self.x_mouse_position = md.getX()
            self.y_mouse_position = md.getY()
        return task.cont

Everything else seems to work fine, sadly the orbit camera is an important part of my application

@majabojarska
Copy link
Contributor

majabojarska commented Feb 27, 2021

It's hard do diagnose the issue with the given information. Could you please provide a minimal working example (script) that exhibits this behavior? This would allow me (or someone else) to debug and potentially solve this issue.

You could also attempt to use the OrbitCameraController implementation from the LayerView application: camera.py. It rotates the camera around a specified point, based on mouse movement. It could be however adapted to orbit automatically, e.g. based on a time interval.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants