mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-16 13:46:54 +00:00
Created a UI for Radiance Rendering in the Services and System Panel
This commit is contained in:
@@ -85,6 +85,7 @@ modules = {
|
|||||||
"ifcgit": None,
|
"ifcgit": None,
|
||||||
"covering": None,
|
"covering": None,
|
||||||
"web": None,
|
"web": None,
|
||||||
|
"light": None,
|
||||||
# Uncomment this line to enable loading of the demo module. Happy hacking!
|
# Uncomment this line to enable loading of the demo module. Happy hacking!
|
||||||
# The name "demo" must correlate to a folder name in `bim/module/`.
|
# The name "demo" must correlate to a folder name in `bim/module/`.
|
||||||
# "demo": None,
|
# "demo": None,
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
# BlenderBIM Add-on - OpenBIM Blender Add-on
|
||||||
|
# Copyright (C) 2020, 2021 Dion Moult <dion@thinkmoult.com>
|
||||||
|
#
|
||||||
|
# This file is part of BlenderBIM Add-on.
|
||||||
|
#
|
||||||
|
# BlenderBIM Add-on is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# BlenderBIM Add-on is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import bpy
|
||||||
|
from . import ui, prop, operator
|
||||||
|
|
||||||
|
|
||||||
|
classes = (
|
||||||
|
operator.ExportRadiance,
|
||||||
|
prop.RadianceExporterProperties,
|
||||||
|
ui.BIM_PT_radiance_exporter,
|
||||||
|
)
|
||||||
|
|
||||||
|
def register():
|
||||||
|
# for cls in classes:
|
||||||
|
# bpy.utils.register_class(cls)
|
||||||
|
bpy.types.Scene.radiance_exporter_properties = bpy.props.PointerProperty(type=prop.RadianceExporterProperties)
|
||||||
|
|
||||||
|
def unregister():
|
||||||
|
# for cls in reversed(classes):
|
||||||
|
# bpy.utils.unregister_class(cls)
|
||||||
|
del bpy.types.Scene.radiance_exporter_properties
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
# BlenderBIM Add-on - OpenBIM Blender Add-on
|
||||||
|
# Copyright (C) 2020, 2021 Dion Moult <dion@thinkmoult.com>
|
||||||
|
#
|
||||||
|
# This file is part of BlenderBIM Add-on.
|
||||||
|
#
|
||||||
|
# BlenderBIM Add-on is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# BlenderBIM Add-on is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import os
|
||||||
|
import pyradiance as pr
|
||||||
|
import bpy
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
from typing import Union, Optional, Sequence
|
||||||
|
import json
|
||||||
|
import ifcopenshell
|
||||||
|
import ifcopenshell.geom
|
||||||
|
import multiprocessing
|
||||||
|
|
||||||
|
class ExportRadiance(bpy.types.Operator):
|
||||||
|
"""Exports and renders the scene with Radiance using rad"""
|
||||||
|
bl_idname = "export_scene.radiance"
|
||||||
|
bl_label = "Export and Render"
|
||||||
|
bl_description = "Export the scene to Radiance and render it"
|
||||||
|
|
||||||
|
def execute(self, context):
|
||||||
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
|
def getResolution(self, context):
|
||||||
|
scene = context.scene
|
||||||
|
props = scene.radiance_exporter_properties
|
||||||
|
resolution_x = props.radiance_resolution_x
|
||||||
|
resolution_y = props.radiance_resolution_y
|
||||||
|
return resolution_x, resolution_y
|
||||||
|
|
||||||
|
def save_obj2mesh_output(inp: Union[bytes, str, Path], output_file: str, **kwargs):
|
||||||
|
output_bytes = pr.obj2mesh(inp, **kwargs)
|
||||||
|
with open(output_file, 'wb') as f:
|
||||||
|
f.write(output_bytes)
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
# BlenderBIM Add-on - OpenBIM Blender Add-on
|
||||||
|
# Copyright (C) 2020, 2021 Dion Moult <dion@thinkmoult.com>
|
||||||
|
#
|
||||||
|
# This file is part of BlenderBIM Add-on.
|
||||||
|
#
|
||||||
|
# BlenderBIM Add-on is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# BlenderBIM Add-on is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import bpy
|
||||||
|
from bpy.props import IntProperty, StringProperty, EnumProperty
|
||||||
|
from bpy.types import PropertyGroup
|
||||||
|
|
||||||
|
class RadianceExporterProperties(PropertyGroup):
|
||||||
|
radiance_resolution_x: IntProperty(
|
||||||
|
name="X",
|
||||||
|
description="Horizontal resolution of the output image",
|
||||||
|
default=1920,
|
||||||
|
min=1
|
||||||
|
)
|
||||||
|
radiance_resolution_y: IntProperty(
|
||||||
|
name="Y",
|
||||||
|
description="Vertical resolution of the output image",
|
||||||
|
default=1080,
|
||||||
|
min=1
|
||||||
|
)
|
||||||
|
ifc_file_name: StringProperty(
|
||||||
|
name="IFC File Name",
|
||||||
|
description="Name of the IFC file to use (without .ifc extension)",
|
||||||
|
default="AC20-FZK-Haus"
|
||||||
|
)
|
||||||
|
radiance_quality: EnumProperty(
|
||||||
|
name="Quality",
|
||||||
|
description="Radiance rendering quality",
|
||||||
|
items=[
|
||||||
|
('LOW', "Low", "Low quality"),
|
||||||
|
('MEDIUM', "Medium", "Medium quality"),
|
||||||
|
('HIGH', "High", "High quality")
|
||||||
|
],
|
||||||
|
default='MEDIUM'
|
||||||
|
)
|
||||||
|
radiance_detail: EnumProperty(
|
||||||
|
name="Detail",
|
||||||
|
description="Radiance rendering detail",
|
||||||
|
items=[
|
||||||
|
('LOW', "Low", "Low detail"),
|
||||||
|
('MEDIUM', "Medium", "Medium detail"),
|
||||||
|
('HIGH', "High", "High detail")
|
||||||
|
],
|
||||||
|
default='MEDIUM'
|
||||||
|
)
|
||||||
|
radiance_variability: EnumProperty(
|
||||||
|
name="Variability",
|
||||||
|
description="Radiance rendering variability",
|
||||||
|
items=[
|
||||||
|
('LOW', "Low", "Low variability"),
|
||||||
|
('MEDIUM', "Medium", "Medium variability"),
|
||||||
|
('HIGH', "High", "High variability")
|
||||||
|
],
|
||||||
|
default='MEDIUM'
|
||||||
|
)
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
# BlenderBIM Add-on - OpenBIM Blender Add-on
|
||||||
|
# Copyright (C) 2020, 2021 Dion Moult <dion@thinkmoult.com>
|
||||||
|
#
|
||||||
|
# This file is part of BlenderBIM Add-on.
|
||||||
|
#
|
||||||
|
# BlenderBIM Add-on is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# BlenderBIM Add-on is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import bpy
|
||||||
|
|
||||||
|
class BIM_PT_radiance_exporter(bpy.types.Panel):
|
||||||
|
"""Creates a Panel in the render properties window"""
|
||||||
|
bl_label = "Radiance Exporter"
|
||||||
|
bl_idname = "BIM_PT_radiance_exporter"
|
||||||
|
bl_options = {'DEFAULT_CLOSED'}
|
||||||
|
bl_space_type = 'PROPERTIES'
|
||||||
|
bl_region_type = 'WINDOW'
|
||||||
|
bl_context = "scene"
|
||||||
|
bl_parent_id = "BIM_PT_tab_services"
|
||||||
|
|
||||||
|
def draw(self, context):
|
||||||
|
layout = self.layout
|
||||||
|
scene = context.scene
|
||||||
|
|
||||||
|
props = scene.radiance_exporter_properties
|
||||||
|
|
||||||
|
row = layout.row()
|
||||||
|
row.prop(props, "ifc_file_name")
|
||||||
|
|
||||||
|
row = layout.row()
|
||||||
|
row.label(text="Resolution")
|
||||||
|
row.prop(props, "radiance_resolution_x", text="X")
|
||||||
|
|
||||||
|
row = layout.row()
|
||||||
|
row.label(text="")
|
||||||
|
row.prop(props, "radiance_resolution_y", text="Y")
|
||||||
|
|
||||||
|
row = layout.row()
|
||||||
|
row.prop(props, "radiance_quality")
|
||||||
|
|
||||||
|
row = layout.row()
|
||||||
|
row.prop(props, "radiance_detail")
|
||||||
|
|
||||||
|
row = layout.row()
|
||||||
|
row.prop(props, "radiance_variability")
|
||||||
|
|
||||||
|
row = layout.row()
|
||||||
|
row.operator("export_scene.radiance", text="Export and Render")
|
||||||
Reference in New Issue
Block a user