Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
12 changes: 12 additions & 0 deletions common.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import mathutils
import gpu

from bpy.types import Context

from .material.parser import (
parse_f3d_rendermode_preset,
quantize_direction,
Expand Down Expand Up @@ -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"}
)
14 changes: 14 additions & 0 deletions light_prop.py
Original file line number Diff line number Diff line change
@@ -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")
9 changes: 2 additions & 7 deletions renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -424,12 +424,7 @@ 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)


Expand Down