From 99d306354f15033083f1e88d9c9a414fc880a91c Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Mon, 14 Jul 2025 02:00:25 +0200 Subject: [PATCH 1/2] extend DATA_PT_light w/ color --- renderer.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/renderer.py b/renderer.py index dafc71e..f67cfa5 100644 --- a/renderer.py +++ b/renderer.py @@ -433,6 +433,27 @@ def draw_render_settings(self, context: bpy.types.Context): self.layout.popover(F64RenderSettingsPanel.bl_idname) +# The light color is only shown in the UI in the DATA_PT_EEVEE_light panel, +# which is only shown with EEVEE enabled. The DATA_PT_light panel is shown otherwise, +# but only allows changing the light type. +# This panel extends the DATA_PT_light panel to allow setting the light color. +class LightDataPanel(bpy.types.Panel): + bl_label = "f64render light data" + bl_idname = "DATA_PT_f64render_light_data" + bl_space_type = "PROPERTIES" + bl_region_type = "WINDOW" + bl_context = "data" + bl_parent_id = "DATA_PT_light" + bl_options = {"HIDE_HEADER"} + + @classmethod + def poll(cls, context): + return context.scene is not None and context.scene.render.engine == Fast64RenderEngine.bl_idname + + def draw(self, context): + self.layout.prop(context.light, "color") + + # By default blender will hide quite a few panels like materials or vertex attributes # Add this method to override the check blender does by render engine def get_panels(): From 221832a4ce9e017aed7892ace3039bd0f0a37fc3 Mon Sep 17 00:00:00 2001 From: Lila Date: Sun, 4 Jan 2026 17:01:27 +0000 Subject: [PATCH 2/2] draw property correctly, create new file for this, update to main --- __init__.py | 4 ++++ common.py | 12 ++++++++++++ light_prop.py | 14 ++++++++++++++ renderer.py | 30 ++---------------------------- 4 files changed, 32 insertions(+), 28 deletions(-) create mode 100644 light_prop.py diff --git a/__init__.py b/__init__.py index c4d65b8..dcdb260 100644 --- a/__init__.py +++ b/__init__.py @@ -21,14 +21,18 @@ "category": "3D View", } +from .light_prop import draw_light_color from . import auto_load +import bpy auto_load.init() def register(): + bpy.types.DATA_PT_light.append(draw_light_color) auto_load.register() def unregister(): auto_load.unregister() + bpy.types.DATA_PT_light.remove(draw_light_color) diff --git a/common.py b/common.py index ee4c94e..6842b5e 100644 --- a/common.py +++ b/common.py @@ -7,6 +7,8 @@ import mathutils import gpu +from bpy.types import Context + from .material.parser import ( parse_f3d_rendermode_preset, quantize_direction, @@ -235,3 +237,13 @@ def collect_obj_info( info.mats.append((i, indices_count, f64mat)) return info + + +def check_if_using_renderer(context: Context): + """ONLY applies to view 3d. For ambigous cases use context.scene.render.engine == 'FAST64_RENDER_ENGINE'""" + space_data = context.space_data + return ( + context.scene.render.engine == "FAST64_RENDER_ENGINE" + and space_data.type == "VIEW_3D" + and space_data.shading.type in {"MATERIAL", "RENDERED"} + ) diff --git a/light_prop.py b/light_prop.py new file mode 100644 index 0000000..d4a59a4 --- /dev/null +++ b/light_prop.py @@ -0,0 +1,14 @@ +from bpy.types import Context, Panel + + +def draw_light_color(self: Panel, context: Context): + if context.scene.render.engine != "FAST64_RENDER_ENGINE": + return + + layout = self.layout + + layout.use_property_split = True + layout.use_property_decorate = False + + layout.separator() + layout.prop(context.light, "color") diff --git a/renderer.py b/renderer.py index f67cfa5..40a656c 100644 --- a/renderer.py +++ b/renderer.py @@ -11,7 +11,7 @@ from .utils.addon import addon_set_fast64_path from .material.parser import f64_parse_obj_light -from .common import ObjRenderInfo, draw_f64_obj, get_scene_render_state, collect_obj_info +from .common import draw_f64_obj, get_scene_render_state, collect_obj_info, check_if_using_renderer from .properties import F64RenderProperties, F64RenderSettings from .globals import F64_GLOBALS @@ -424,36 +424,10 @@ def draw(self, context): def draw_render_settings(self, context: bpy.types.Context): - space_data = context.space_data - if ( - context.scene.render.engine == Fast64RenderEngine.bl_idname - and space_data.type == "VIEW_3D" - and space_data.shading.type in {"MATERIAL", "RENDERED"} - ): + if check_if_using_renderer(context): self.layout.popover(F64RenderSettingsPanel.bl_idname) -# The light color is only shown in the UI in the DATA_PT_EEVEE_light panel, -# which is only shown with EEVEE enabled. The DATA_PT_light panel is shown otherwise, -# but only allows changing the light type. -# This panel extends the DATA_PT_light panel to allow setting the light color. -class LightDataPanel(bpy.types.Panel): - bl_label = "f64render light data" - bl_idname = "DATA_PT_f64render_light_data" - bl_space_type = "PROPERTIES" - bl_region_type = "WINDOW" - bl_context = "data" - bl_parent_id = "DATA_PT_light" - bl_options = {"HIDE_HEADER"} - - @classmethod - def poll(cls, context): - return context.scene is not None and context.scene.render.engine == Fast64RenderEngine.bl_idname - - def draw(self, context): - self.layout.prop(context.light, "color") - - # By default blender will hide quite a few panels like materials or vertex attributes # Add this method to override the check blender does by render engine def get_panels():