Commit f8b0948f authored by Julien Finet's avatar Julien Finet Committed by Sebastien Jourdain

Fix typos in web protocols

parent c353ed5c
...@@ -178,7 +178,6 @@ vtkUnsignedCharArray* vtkWebApplication::StillRender(vtkRenderWindow* view, int ...@@ -178,7 +178,6 @@ vtkUnsignedCharArray* vtkWebApplication::StillRender(vtkRenderWindow* view, int
value.Data != nullptr /* FIXME SEB && value.Data != nullptr /* FIXME SEB &&
view->HasDirtyRepresentation() == false */) view->HasDirtyRepresentation() == false */)
{ {
//cout << "Reusing cache" << endl;
bool latest = this->Internals->Encoder->GetLatestOutput(this->Internals->ObjectIdMap->GetGlobalId(view), value.Data); bool latest = this->Internals->Encoder->GetLatestOutput(this->Internals->ObjectIdMap->GetGlobalId(view), value.Data);
value.HasImagesBeingProcessed = !latest; value.HasImagesBeingProcessed = !latest;
return value.Data; return value.Data;
...@@ -210,7 +209,9 @@ vtkUnsignedCharArray* vtkWebApplication::StillRender(vtkRenderWindow* view, int ...@@ -210,7 +209,9 @@ vtkUnsignedCharArray* vtkWebApplication::StillRender(vtkRenderWindow* view, int
//vtkTimerLog::MarkEndEvent("StillRenderToString"); //vtkTimerLog::MarkEndEvent("StillRenderToString");
//vtkTimerLog::DumpLogWithIndents(&cout, 0.0); //vtkTimerLog::DumpLogWithIndents(&cout, 0.0);
this->Internals->Encoder->PushAndTakeReference(this->Internals->ObjectIdMap->GetGlobalId(view), image, quality); this->Internals->Encoder->PushAndTakeReference(
this->Internals->ObjectIdMap->GetGlobalId(view), image, quality,
this->ImageEncoding);
assert(image == nullptr); assert(image == nullptr);
if (value.Data == nullptr) if (value.Data == nullptr)
......
...@@ -143,7 +143,7 @@ class vtkWebViewPort(vtkWebProtocol): ...@@ -143,7 +143,7 @@ class vtkWebViewPort(vtkWebProtocol):
RPC callback to reset camera. RPC callback to reset camera.
""" """
view = self.getView(viewId) view = self.getView(viewId)
camera = view.GetRenderer().GetActiveCamera() camera = view.GetRenderers().GetFirstRenderer().GetActiveCamera()
camera.ResetCamera() camera.ResetCamera()
try: try:
# FIXME seb: view.CenterOfRotation = camera.GetFocalPoint() # FIXME seb: view.CenterOfRotation = camera.GetFocalPoint()
...@@ -186,10 +186,10 @@ class vtkWebViewPort(vtkWebProtocol): ...@@ -186,10 +186,10 @@ class vtkWebViewPort(vtkWebProtocol):
def updateCamera(self, view_id, focal_point, view_up, position): def updateCamera(self, view_id, focal_point, view_up, position):
view = self.getView(view_id) view = self.getView(view_id)
camera = view.GetRenderer().GetActiveCamera() camera = view.GetRenderers().GetFirstRenderer().GetActiveCamera()
camera.SetFocalPoint(focal_point) camera.SetFocalPoint(focal_point)
camera.SetCameraViewUp(view_up) camera.SetViewUp(view_up)
camera.SetCameraPosition(position) camera.SetPosition(position)
self.getApplication().InvalidateCache(view) self.getApplication().InvalidateCache(view)
self.getApplication().InvokeEvent('UpdateEvent') self.getApplication().InvokeEvent('UpdateEvent')
...@@ -342,6 +342,8 @@ class vtkWebPublishImageDelivery(vtkWebProtocol): ...@@ -342,6 +342,8 @@ class vtkWebPublishImageDelivery(vtkWebProtocol):
self.targetFrameRate = self.maxFrameRate self.targetFrameRate = self.maxFrameRate
if nextAnimateTime < 0: if nextAnimateTime < 0:
if nextAnimateTime < -1.0:
self.targetFrameRate = 1
if self.targetFrameRate > self.minFrameRate: if self.targetFrameRate > self.minFrameRate:
self.targetFrameRate -= 1.0 self.targetFrameRate -= 1.0
reactor.callLater(0.001, lambda: self.animate()) reactor.callLater(0.001, lambda: self.animate())
...@@ -366,10 +368,9 @@ class vtkWebPublishImageDelivery(vtkWebProtocol): ...@@ -366,10 +368,9 @@ class vtkWebPublishImageDelivery(vtkWebProtocol):
sView = self.getView(viewId) sView = self.getView(viewId)
realViewId = str(self.getGlobalId(sView)) realViewId = str(self.getGlobalId(sView))
if realViewId not in self.viewsInAnimations: self.viewsInAnimations.append(realViewId)
self.viewsInAnimations.append(realViewId) if len(self.viewsInAnimations) == 1:
if len(self.viewsInAnimations) == 1: self.animate()
self.animate()
@exportRpc("viewport.image.animation.stop") @exportRpc("viewport.image.animation.stop")
...@@ -475,7 +476,7 @@ class vtkWebPublishImageDelivery(vtkWebProtocol): ...@@ -475,7 +476,7 @@ class vtkWebPublishImageDelivery(vtkWebProtocol):
# There is an observer on this view already # There is an observer on this view already
self.trackingViews[realViewId]['observerCount'] += 1 self.trackingViews[realViewId]['observerCount'] += 1
self.publish('viewport.image.push.subscription', self.pushRender(realViewId)) self.pushRender(realViewId)
return { 'success': True, 'viewId': realViewId } return { 'success': True, 'viewId': realViewId }
...@@ -524,7 +525,7 @@ class vtkWebPublishImageDelivery(vtkWebProtocol): ...@@ -524,7 +525,7 @@ class vtkWebPublishImageDelivery(vtkWebProtocol):
# Update image size right now! # Update image size right now!
if "originalSize" in self.trackingViews[realViewId]: if "originalSize" in self.trackingViews[realViewId]:
size = [int(s * ratio) for s in self.trackingViews[realViewId]["originalSize"]] size = [int(s * ratio) for s in self.trackingViews[realViewId]["originalSize"]]
if 'SetSize' in sView: if hasattr(sView, 'SetSize'):
sView.SetSize(size) sView.SetSize(size)
else: else:
sView.ViewSize = size sView.ViewSize = size
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment