1 # ##### BEGIN GPL LICENSE BLOCK #####
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 # ##### END GPL LICENSE BLOCK #####
21 "name": "Light Field Tools",
22 "author": "Aurel Wildfellner",
23 "description": "Tools to create a light field camera and projector",
25 "blender": (2, 64, 0),
26 "location": "View3D > Tool Shelf > Light Field Tools",
27 "url": "http://www.jku.at/cg/",
28 "wiki_url": "https://wiki.blender.org/index.php/Extensions:2.6/Py/"
29 "Scripts/Render/Light_Field_Tools",
36 importlib
.reload(light_field_tools
)
38 from . import light_field_tools
42 from bpy
.types
import (
46 from bpy
.props
import (
55 # global properties for the script, mainly for UI
56 class LightFieldPropertyGroup(PropertyGroup
):
60 default
=0.69813170079,
63 max=3.001966313430247,
66 description
="Field of view of camera and angle of beam for spotlights"
68 row_length
: IntProperty(
72 description
="The number of cameras/lights in one row"
74 create_handler
: BoolProperty(
77 description
="Creates an empty object, to which the cameras and spotlights are parented to"
79 do_camera
: BoolProperty(
82 description
="A light field camera is created"
84 animate_camera
: BoolProperty(
85 name
="Animate Camera",
87 description
="Animates a single camera, so not multiple cameras get created"
89 do_projection
: BoolProperty(
90 name
="Create Projector",
92 description
="A light field projector is created"
94 texture_path
: StringProperty(
96 description
="From this path textures for the spotlights will be loaded",
99 light_intensity
: FloatProperty(
100 name
="Light Intensity",
104 description
="Total intensity of all lamps"
106 # blending of the spotlights
107 spot_blend
: FloatProperty(
113 description
="Blending of the spotlights"
115 # spacing in pixels on the focal plane
116 spacing
: IntProperty(
120 description
="The spacing in pixels between two cameras on the focal plane"
124 # Add-ons Preferences Update Panel
126 # Define Panel classes for updating
128 light_field_tools
.VIEW3D_PT_lightfield_tools
,
132 def update_panel(self
, context
):
133 message
= "Light Field Tools: Updating Panel locations has failed"
136 if "bl_rna" in panel
.__dict
__:
137 bpy
.utils
.unregister_class(panel
)
140 panel
.bl_category
= context
.preferences
.addons
[__name__
].preferences
.category
141 bpy
.utils
.register_class(panel
)
143 except Exception as e
:
144 print("\n[{}]\n{}\n\nError:\n{}".format(__name__
, message
, e
))
148 class LFTPreferences(AddonPreferences
):
149 # this must match the addon name, use '__package__'
150 # when defining this in a submodule of a python package.
153 category
: StringProperty(
155 description
="Choose a name for the category of the panel",
160 def draw(self
, context
):
165 col
.label(text
="Tab Category:")
166 col
.prop(self
, "category", text
="")
170 # register properties
171 # bpy.utils.register_class(LightFieldPropertyGroup)
172 bpy
.utils
.register_module(__name__
)
173 bpy
.types
.Scene
.lightfield
= PointerProperty(type=LightFieldPropertyGroup
)
177 bpy
.utils
.unregister_module(__name__
)
178 del bpy
.types
.Scene
.lightfield
181 if __name__
== "__main__":