From 3e60bceb159a5bf1cc1c72c4c6060c202b7d4f83 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Sat, 2 Mar 2024 15:28:18 -0500 Subject: [PATCH] Add the ability to query DCM capability from Python. Myst V didn't have this function either. That's interesting because, in theory, we may be presented with a video card that doesn't support the Direct3D caps needed to perform the effect. At this stage in the game, everyone should support DCMs, so this is just an exercise in technical correctness. --- Scripts/Python/plasma/Plasma.py | 4 ++++ Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp | 5 +++++ Sources/Plasma/FeatureLib/pfPython/cyMisc.h | 1 + Sources/Plasma/FeatureLib/pfPython/cyMiscGlue4.cpp | 6 ++++++ 4 files changed, 16 insertions(+) diff --git a/Scripts/Python/plasma/Plasma.py b/Scripts/Python/plasma/Plasma.py index 513d9ed2af..19901433fa 100644 --- a/Scripts/Python/plasma/Plasma.py +++ b/Scripts/Python/plasma/Plasma.py @@ -827,6 +827,10 @@ def PtStartScreenCapture(selfKey,width=800,height=600): """Starts a capture of the screen""" pass +def PtSupportsPlanarReflections() -> bool: + """Returns if planar reflections are supported""" + ... + def PtToggleAvatarClickability(on): """Turns on and off our avatar's clickability""" pass diff --git a/Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp b/Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp index 86f1bde52a..960c146148 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp @@ -2541,6 +2541,11 @@ void cyMisc::EnablePlanarReflections(bool enable) plDynamicCamMap::SetEnabled(enable); } +bool cyMisc::ArePlanarReflectionsSupported() +{ + return plDynamicCamMap::GetCapable(); +} + void cyMisc::GetSupportedDisplayModes(std::vector *res) { fPipeline->GetSupportedDisplayModes(res); diff --git a/Sources/Plasma/FeatureLib/pfPython/cyMisc.h b/Sources/Plasma/FeatureLib/pfPython/cyMisc.h index 0205b10200..d4dfe6aad1 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyMisc.h +++ b/Sources/Plasma/FeatureLib/pfPython/cyMisc.h @@ -898,6 +898,7 @@ class cyMisc static ST::string GetLocalizedString(const ST::string& name, const std::vector & arguments); static void EnablePlanarReflections(bool enable = true); + static bool ArePlanarReflectionsSupported(); static void SetGraphicsOptions(int Width, int Height, int ColorDepth, bool Windowed, int NumAASamples, int MaxAnisotropicSamples, bool VSync); static void GetSupportedDisplayModes(std::vector *res); static int GetDesktopWidth(); diff --git a/Sources/Plasma/FeatureLib/pfPython/cyMiscGlue4.cpp b/Sources/Plasma/FeatureLib/pfPython/cyMiscGlue4.cpp index 070c27e69e..eca9d42ab1 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyMiscGlue4.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/cyMiscGlue4.cpp @@ -610,6 +610,11 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtEnablePlanarReflections, args, "Params: on\nEn PYTHON_RETURN_NONE; } +PYTHON_GLOBAL_METHOD_DEFINITION_NOARGS(PtSupportsPlanarReflections, "Returns if planar reflections are supported") +{ + return PyBool_FromLong(cyMisc::ArePlanarReflectionsSupported() ? 1 : 0); +} + PYTHON_GLOBAL_METHOD_DEFINITION_NOARGS(PtGetSupportedDisplayModes, "Returns a list of supported resolutions") { std::vector res; @@ -818,6 +823,7 @@ void cyMisc::AddPlasmaMethods4(PyObject* m) PYTHON_GLOBAL_METHOD_NOARGS(PtCheckVisLOSFromCursor) PYTHON_GLOBAL_METHOD(PtEnablePlanarReflections) + PYTHON_GLOBAL_METHOD_NOARGS(PtSupportsPlanarReflections) PYTHON_GLOBAL_METHOD_NOARGS(PtGetSupportedDisplayModes) PYTHON_GLOBAL_METHOD_NOARGS(PtGetDesktopWidth) PYTHON_GLOBAL_METHOD_NOARGS(PtGetDesktopHeight)