Skip to content

Commit

Permalink
#5629: Extend CameraInterface for scripts to request a redraw of the …
Browse files Browse the repository at this point in the history
…view
  • Loading branch information
codereader committed Jun 9, 2021
1 parent 2dc9f1f commit a3ac032
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion plugins/script/interfaces/CameraInterface.cpp
Expand Up @@ -60,6 +60,11 @@ void ScriptCameraView::setFarClipPlaneDistance(float distance)
_cameraView.setFarClipPlaneDistance(distance);
}

void ScriptCameraView::refresh()
{
_cameraView.queueDraw();
}

ScriptCameraView CameraInterface::getActiveView()
{
return ScriptCameraView(GlobalCameraManager().getActiveView());
Expand All @@ -80,12 +85,13 @@ void CameraInterface::registerInterface(py::module& scope, py::dict& globals)
camera.def("getForwardVector", &ScriptCameraView::getForwardVector, py::return_value_policy::reference);
camera.def("getFarClipPlaneDistance", &ScriptCameraView::getFarClipPlaneDistance);
camera.def("setFarClipPlaneDistance", &ScriptCameraView::setFarClipPlaneDistance);
camera.def("refresh", &ScriptCameraView::refresh);

// Define the BrushCreator interface
py::class_<CameraInterface> cameraManager(scope, "Camera");
cameraManager.def("getActiveView", &CameraInterface::getActiveView);

// Now point the Python variable "CameraInterface" to this instance
// Now point the Python variable "GlobalCameraManager" to this instance
globals["GlobalCameraManager"] = this;
}

Expand Down
2 changes: 2 additions & 0 deletions plugins/script/interfaces/CameraInterface.h
Expand Up @@ -31,6 +31,8 @@ class ScriptCameraView

float getFarClipPlaneDistance() const;
void setFarClipPlaneDistance(float distance);

void refresh();
};

class CameraInterface :
Expand Down

0 comments on commit a3ac032

Please sign in to comment.