Skip to content

Commit

Permalink
Preferences: show pyluxcore version
Browse files Browse the repository at this point in the history
  • Loading branch information
howetuft committed Jan 7, 2025
1 parent 2d0f1a9 commit 3d526bf
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions ui/addon_preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from ..ui import icons
from .. import utils
from ..utils.lol import utils as lol_utils
from importlib.metadata import version


film_device_items = []
Expand Down Expand Up @@ -64,30 +65,40 @@ def film_device_items_callback(self, context):
thumb_size: IntProperty(name="Assetbar Thumbnail Size", default=96, min=-1, max=256)
use_library: BoolProperty(name="Use LuxCore Online Library", default=True)

# Read-only string property, returns the current date
def get_pyluxcore_version(self):
try:
pyluxcore_version = version("pyluxcore")
except ModuleNotFoundError:
pyluxcore_version = "ERROR: could not find pyluxcore"
return pyluxcore_version

pyluxcore_version: StringProperty(name="", get=get_pyluxcore_version)

def draw(self, context):
layout = self.layout
SPLIT_FACTOR = 1/3

row = layout.row()
row.label(text="GPU API:")

if utils.is_cuda_build():
row.prop(self, "gpu_backend", expand=True)

row = layout.row()
split = row.split(factor=SPLIT_FACTOR)
split.label(text="Film Device:")
split.prop(self, "film_device", text="")
elif utils.is_opencl_build():
row.label(text="OpenCL")

row = layout.row()
split = row.split(factor=SPLIT_FACTOR)
split.label(text="Film Device:")
split.prop(self, "film_device", text="")
else:
row.label(text="Not available in this build")

row = layout.row()
split = row.split(factor=SPLIT_FACTOR)
split.label(text="Image Nodes:")
Expand Down Expand Up @@ -115,3 +126,10 @@ def draw(self, context):
if self.use_library:
col.prop(self, "global_dir")
col.prop(self, "thumb_size")

# pyluxcore version
layout.separator()
row = layout.row()
split = row.split(factor=SPLIT_FACTOR)
split.label(text="Pyluxcore version:")
split.prop(self, "pyluxcore_version")

0 comments on commit 3d526bf

Please sign in to comment.