mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 18:21:59 +00:00
Run black on light
This commit is contained in:
@@ -25,8 +25,9 @@ from pathlib import Path
|
|||||||
import importlib
|
import importlib
|
||||||
import pyradiance
|
import pyradiance
|
||||||
|
|
||||||
|
|
||||||
def get_pyradiance_path():
|
def get_pyradiance_path():
|
||||||
return importlib.util.find_spec('pyradiance').submodule_search_locations[0]
|
return importlib.util.find_spec("pyradiance").submodule_search_locations[0]
|
||||||
|
|
||||||
|
|
||||||
classes = (
|
classes = (
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ class RadianceRender(bpy.types.Operator):
|
|||||||
output_file_format = props.output_file_format
|
output_file_format = props.output_file_format
|
||||||
use_hdr = props.use_hdr
|
use_hdr = props.use_hdr
|
||||||
choose_hdr_image = props.choose_hdr_image
|
choose_hdr_image = props.choose_hdr_image
|
||||||
if(use_hdr):
|
if use_hdr:
|
||||||
hdr_image = "noon_grass_2k.hdr"
|
hdr_image = "noon_grass_2k.hdr"
|
||||||
hdr_mask = "noon_grass_2k_mask.hdr"
|
hdr_mask = "noon_grass_2k_mask.hdr"
|
||||||
sky_map_cal = "skymap.cal"
|
sky_map_cal = "skymap.cal"
|
||||||
@@ -159,7 +159,6 @@ class RadianceRender(bpy.types.Operator):
|
|||||||
hour = sun_props.hour
|
hour = sun_props.hour
|
||||||
minute = sun_props.minute
|
minute = sun_props.minute
|
||||||
|
|
||||||
|
|
||||||
camera = self.get_active_camera(context)
|
camera = self.get_active_camera(context)
|
||||||
if camera is None:
|
if camera is None:
|
||||||
self.report({"ERROR"}, "No active camera found in the scene. Please add a camera and set it as active.")
|
self.report({"ERROR"}, "No active camera found in the scene. Please add a camera and set it as active.")
|
||||||
@@ -168,7 +167,6 @@ class RadianceRender(bpy.types.Operator):
|
|||||||
# Get camera position and direction
|
# Get camera position and direction
|
||||||
camera_position, camera_direction = self.get_camera_data(camera)
|
camera_position, camera_direction = self.get_camera_data(camera)
|
||||||
|
|
||||||
|
|
||||||
dt = datetime(2024, month, day, hour, minute)
|
dt = datetime(2024, month, day, hour, minute)
|
||||||
|
|
||||||
sky_description = pr.gensky(
|
sky_description = pr.gensky(
|
||||||
@@ -180,10 +178,10 @@ class RadianceRender(bpy.types.Operator):
|
|||||||
sunny_without_sun=False,
|
sunny_without_sun=False,
|
||||||
cloudy=True,
|
cloudy=True,
|
||||||
ground_reflectance=0.2,
|
ground_reflectance=0.2,
|
||||||
turbidity=3.0
|
turbidity=3.0,
|
||||||
)
|
)
|
||||||
|
|
||||||
sky_description_str = sky_description.decode('utf-8')
|
sky_description_str = sky_description.decode("utf-8")
|
||||||
|
|
||||||
# Write all this to file
|
# Write all this to file
|
||||||
# skyfunc glow sky_glow
|
# skyfunc glow sky_glow
|
||||||
@@ -206,9 +204,9 @@ class RadianceRender(bpy.types.Operator):
|
|||||||
# 0
|
# 0
|
||||||
# 4 0 0 -1 180
|
# 4 0 0 -1 180
|
||||||
|
|
||||||
if(choose_hdr_image == "Noon"):
|
if choose_hdr_image == "Noon":
|
||||||
|
|
||||||
with open(sky_file_path, 'w') as f:
|
with open(sky_file_path, "w") as f:
|
||||||
f.write(sky_description_str)
|
f.write(sky_description_str)
|
||||||
f.write("\n")
|
f.write("\n")
|
||||||
# f.write("skyfunc glow sky_glow\n0\n0\n4 .9 .9 1.15 0\n")
|
# f.write("skyfunc glow sky_glow\n0\n0\n4 .9 .9 1.15 0\n")
|
||||||
@@ -216,8 +214,13 @@ class RadianceRender(bpy.types.Operator):
|
|||||||
# f.write("skyfunc glow ground_glow\n0\n0\n4 1.4 .9 .6 0\n")
|
# f.write("skyfunc glow ground_glow\n0\n0\n4 1.4 .9 .6 0\n")
|
||||||
# f.write("ground_glow source ground\n0\n0\n4 0 0 -1 180\n")
|
# f.write("ground_glow source ground\n0\n0\n4 0 0 -1 180\n")
|
||||||
|
|
||||||
f.write('''void colorpict env_map
|
f.write(
|
||||||
7 red green blue "'''+hdr_image_path+'''" "'''+ sky_map_cal_path +'''" map_u map_v
|
'''void colorpict env_map
|
||||||
|
7 red green blue "'''
|
||||||
|
+ hdr_image_path
|
||||||
|
+ '''" "'''
|
||||||
|
+ sky_map_cal_path
|
||||||
|
+ '''" map_u map_v
|
||||||
0
|
0
|
||||||
1 0.5
|
1 0.5
|
||||||
|
|
||||||
@@ -236,7 +239,11 @@ skyfunc colorfunc sky_colour
|
|||||||
0
|
0
|
||||||
|
|
||||||
void mixpict composite
|
void mixpict composite
|
||||||
7 env_colour sky_colour grey "'''+ hdr_mask_path +'''" "'''+ sky_map_cal_path +'''" map_u map_v
|
7 env_colour sky_colour grey "'''
|
||||||
|
+ hdr_mask_path
|
||||||
|
+ '''" "'''
|
||||||
|
+ sky_map_cal_path
|
||||||
|
+ """" map_u map_v
|
||||||
0
|
0
|
||||||
2 0.5 1
|
2 0.5 1
|
||||||
|
|
||||||
@@ -258,10 +265,11 @@ env_colour glow ground_glow
|
|||||||
ground_glow source ground
|
ground_glow source ground
|
||||||
0
|
0
|
||||||
0
|
0
|
||||||
4 0 0 -1 180''')
|
4 0 0 -1 180"""
|
||||||
|
)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
with open(sky_file_path, 'w') as f:
|
with open(sky_file_path, "w") as f:
|
||||||
f.write(sky_description_str)
|
f.write(sky_description_str)
|
||||||
f.write("\n")
|
f.write("\n")
|
||||||
f.write("skyfunc glow sky_glow\n0\n0\n4 .9 .9 1.15 0\n")
|
f.write("skyfunc glow sky_glow\n0\n0\n4 .9 .9 1.15 0\n")
|
||||||
@@ -338,8 +346,7 @@ ground_glow source ground
|
|||||||
|
|
||||||
tiff_path = os.path.join(output_dir, f"{output_file_name}.tiff")
|
tiff_path = os.path.join(output_dir, f"{output_file_name}.tiff")
|
||||||
|
|
||||||
pr.ra_tiff(inp = pcond_image, out = tiff_path, lzw=True)
|
pr.ra_tiff(inp=pcond_image, out=tiff_path, lzw=True)
|
||||||
|
|
||||||
|
|
||||||
self.report({"INFO"}, "Radiance rendering completed. Output: {}".format(tiff_path))
|
self.report({"INFO"}, "Radiance rendering completed. Output: {}".format(tiff_path))
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|||||||
@@ -23,7 +23,15 @@ import datetime
|
|||||||
import blenderbim.tool as tool
|
import blenderbim.tool as tool
|
||||||
from math import radians, pi
|
from math import radians, pi
|
||||||
from mathutils import Euler, Vector, Matrix, Quaternion
|
from mathutils import Euler, Vector, Matrix, Quaternion
|
||||||
from bpy.props import IntProperty, StringProperty, EnumProperty, FloatProperty, FloatVectorProperty, BoolProperty, CollectionProperty
|
from bpy.props import (
|
||||||
|
IntProperty,
|
||||||
|
StringProperty,
|
||||||
|
EnumProperty,
|
||||||
|
FloatProperty,
|
||||||
|
FloatVectorProperty,
|
||||||
|
BoolProperty,
|
||||||
|
CollectionProperty,
|
||||||
|
)
|
||||||
from bpy.types import PropertyGroup
|
from bpy.types import PropertyGroup
|
||||||
from blenderbim.bim.module.light.data import SolarData
|
from blenderbim.bim.module.light.data import SolarData
|
||||||
from blenderbim.bim.module.light.decorator import SolarDecorator
|
from blenderbim.bim.module.light.decorator import SolarDecorator
|
||||||
@@ -261,7 +269,7 @@ class RadianceExporterProperties(PropertyGroup):
|
|||||||
choose_hdr_image: EnumProperty(
|
choose_hdr_image: EnumProperty(
|
||||||
name="HDR Image",
|
name="HDR Image",
|
||||||
description="Choose an HDR image to use",
|
description="Choose an HDR image to use",
|
||||||
items = [
|
items=[
|
||||||
("Noon", "Noon", "Noon"),
|
("Noon", "Noon", "Noon"),
|
||||||
],
|
],
|
||||||
default="Noon",
|
default="Noon",
|
||||||
|
|||||||
Reference in New Issue
Block a user