-
Notifications
You must be signed in to change notification settings - Fork 2
/
create_hdri_environment.py
45 lines (41 loc) · 1.52 KB
/
create_hdri_environment.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# DO NOT EDIT THIS FILE DIRECTLY. This is generated from a literate program
# with the VSCode extension Literate Programming (jesterking.literate).
#
# These literate programs are Rhino 3D scripts explaining how scripting works
# in Rhino 3D with Python.
#
# Read the literate programs at:
# https://jesterking.github.io/literate
#
# This code is part of the repository:
# https://github.com/jesterKing/rhipy
#
# The Literate Programming extension repository is at:
# https://github.com/jesterKing/literate
#
# Licensed under Apache 2.0
# See https://github.com/jesterKing/rhipy/blob/master/LICENSE
#
# Copyright (C) Nathan 'jesterKing' Letwory
#
import scriptcontext as sc
import Rhino
import System
file_dialog = Rhino.UI.OpenFileDialog()
file_dialog.Filter = "EXR (*.exr)|*.exr"
if file_dialog.ShowDialog():
render_texture = Rhino.Render.RenderContentType.NewContentFromTypeId(
Rhino.Render.ContentUuids.HDRTextureType
)
render_texture.BeginChange(Rhino.Render.RenderContent.ChangeContexts.Program)
render_texture.SetParameter("filename", file_dialog.FileName)
render_texture.SetParameter("rdk-texture-adjust-saturation", 0.0)
render_texture.EndChange()
render_environment = Rhino.Render.RenderContent.Create(
System.Guid('ba51ce00-ba51-ce00-ba51-ceba51ce0000'),
Rhino.Render.RenderContent.ShowContentChooserFlags.NONE,
sc.doc
)
render_environment.BeginChange(Rhino.Render.RenderContent.ChangeContexts.Program)
render_environment.SetChild(render_texture, "texture")
render_environment.EndChange()