Recently I have a use case where I need users to have an interactive OpenGL pick session of the contents of an Alembic archive inside Houdini to return a path to a PyQt4 (PySide) application hosted within Houdini.
So abcview's viewer widget seems to fit the bill.
But I get terrible performance of the PySide OpenGL window hosted in Houdini.
I feel I am doing something wrong.
In pure Python I get 60fps approx, in Houdini I get lag and then 2fps.
Can someone confirm they see similar behaviour.
My only test environment is a proprietary setup at my workplace. Where the PATH , LD_LIBRARY_PATH and PYTHONPATH are a combination of PySide from SideFX, Alembic from SideFX and custom built, Qt from SideFX, and Python interpreter from SideFX.
I will post a test script if there are any Houdini Alembic users up for testing.
Thanks in advance for any help, I have contacted SESI but they haven't been able to help as they are unfamiliar with PyAlembic.
Sam
import abcview.widget.viewer_widget
from PyQt4 import QtGui
import sys
import os
import sys
import math
import traceback
from functools import wraps
from PyQt4 import QtCore
from PyQt4 import QtGui
from PyQt4 import uic
from PyQt4 import QtOpenGL
import numpy
import numpy.linalg as linalg
import OpenGL
OpenGL.ERROR_CHECKING = True
from OpenGL.GL import *
from OpenGL.GLU import *
# flag opengl errors
from OpenGL.arrays import numpymodule
numpymodule.NumpyHandler.ERROR_ON_COPY = True
import imath
import alembic
import abcview
from abcview.io import Mode
from abcview.gl import GLCamera, GLICamera, GLScene
from abcview.gl import get_final_matrix
from abcview import log, style, config
class MyGLWidget(abcview.widget.viewer_widget.GLWidget):
def __init__(self, parent=None,state=None):
abcview.widget.viewer_widget.GLWidget.__init__(self,parent=parent,state=state)
def mouseDoubleClickEvent(self, event):
"""
mouse double-click event handler
"""
if self.camera.mode == Mode.OFF:
return
# get scene selection hits
hit = None
for scene in self.state.scenes:
if scene.mode == Mode.OFF or not scene.visible:
continue
x, y = event.pos().x(), event.pos().y()
camera = self.camera.views[self]
hit = scene.selection(x, y, camera)
#HACK: need a better/faster way to find the object
if hit:
print "Shape node is called:", hit
name = hit.split("/")[-1]
self.signal_object_selected.emit(".*%s" % name)
if __name__ == "__main__" and len(sys.argv) == 2:
app = QtGui.QApplication(sys.argv)
blah = MyGLWidget()
blah.add_file(sys.argv[1])
blah.show()
sys.exit(app.exec_())
else:
print "Usage: %s filename.abc" % sys.argv[0]
--
You received this message because you are subscribed to the Google Groups "alembic-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to alembic-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
| CprData::~CprData() | |
| { | |
| if ( m_propertyHeaders ) | |
| { | |
| delete [] m_propertyHeaders; | |
| } | |
| }
|
def update_camera(func):
"""
GL camera update decorator
"""
@wraps(func)
def with_wrapped_func(*args, **kwargs):
func(*args, **kwargs)
wid = args[0]
wid.camera.apply()
wid.updateGL()
wid.signal_camera_updated.emit(wid.camera)
wid.state.signal_state_change.emit()
return with_wrapped_func
within
@update_camera
def mouseMoveEvent(self, event):
"""
mouse move event handler
"""
# alt key is required to move the camera
if not event.modifiers() & QtCore.Qt.AltModifier:
return
newPoint2D = event.pos()
if ((newPoint2D.x() < 0) or (newPoint2D.x() > self.width()) or
(newPoint2D.y() < 0) or (newPoint2D.y() > self.height())):
return
value_y = 0
newPoint_hitSphere, newPoint3D = self.map_to_sphere(newPoint2D)
dx = float(newPoint2D.x() - self.__last_p2d.x())
dy = float(newPoint2D.y() - self.__last_p2d.y())
w = float(self.width())
h = float(self.height())
self.makeCurrent()
if (((event.buttons() & QtCore.Qt.LeftButton) and (event.buttons() & QtCore.Qt.MidButton))
or (event.buttons() & QtCore.Qt.LeftButton and event.modifiers() & QtCore.Qt.ControlModifier)
or (event.buttons() & QtCore.Qt.RightButton and event.modifiers() & QtCore.Qt.AltModifier)):
self.camera.dolly(dx, dy)
elif (event.buttons() & QtCore.Qt.MidButton
or (event.buttons() & QtCore.Qt.LeftButton and event.modifiers() & QtCore.Qt.ShiftModifier)):
self.camera.track(dx, dy)
elif event.buttons() & QtCore.Qt.LeftButton:
self.__rotating = True
self.camera.rotate(dx, dy)
# TODO: replace with global state (with these as attrs)
self.__last_p2d = newPoint2D
self.__last_p3d = newPoint3D
self.__last_pok = newPoint_hitSphere
So that shouldnt be hammering through reloading the file as far as I can see.
> email to alembic-discussion+unsub...@googlegroups.com.