2009-11-01 15:21:20 +00:00
|
|
|
# ##### BEGIN GPL LICENSE BLOCK #####
|
|
|
|
#
|
|
|
|
# This program 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 2
|
|
|
|
# of the License, or (at your option) any later version.
|
2009-11-03 07:23:02 +00:00
|
|
|
#
|
2009-11-01 15:21:20 +00:00
|
|
|
# This program 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.
|
2009-11-03 07:23:02 +00:00
|
|
|
#
|
2009-11-01 15:21:20 +00:00
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2009-11-01 15:21:20 +00:00
|
|
|
#
|
|
|
|
# ##### END GPL LICENSE BLOCK #####
|
2009-10-31 20:16:59 +00:00
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
# <pep8 compliant>
|
2011-08-12 06:57:00 +00:00
|
|
|
from bpy.types import Panel
|
2009-11-14 13:35:44 +00:00
|
|
|
|
2011-09-20 18:29:19 +00:00
|
|
|
|
2015-01-29 15:35:06 +11:00
|
|
|
class DataButtonsPanel:
|
2009-10-31 19:31:45 +00:00
|
|
|
bl_space_type = 'PROPERTIES'
|
|
|
|
bl_region_type = 'WINDOW'
|
|
|
|
bl_context = "data"
|
|
|
|
|
2010-08-09 01:37:09 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2019-05-19 14:51:21 +02:00
|
|
|
ob = context.object
|
|
|
|
return (ob and ob.type == 'EMPTY')
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class DATA_PT_empty(DataButtonsPanel, Panel):
|
2011-09-15 13:20:18 +00:00
|
|
|
bl_label = "Empty"
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2018-06-01 18:44:06 +02:00
|
|
|
layout.use_property_split = True
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
ob = context.object
|
2009-05-11 17:34:31 +00:00
|
|
|
|
2018-09-03 18:58:41 +02:00
|
|
|
layout.prop(ob, "empty_display_type", text="Display As")
|
2018-11-08 14:30:27 +01:00
|
|
|
layout.prop(ob, "empty_display_size", text="Size")
|
2011-05-09 16:31:54 +00:00
|
|
|
|
2018-09-03 18:58:41 +02:00
|
|
|
if ob.empty_display_type == 'IMAGE':
|
2018-07-06 10:01:05 +02:00
|
|
|
col = layout.column(align=True)
|
2018-06-01 18:44:06 +02:00
|
|
|
col.prop(ob, "empty_image_offset", text="Offset X", index=0)
|
|
|
|
col.prop(ob, "empty_image_offset", text="Y", index=1)
|
|
|
|
|
2018-11-19 19:33:09 +01:00
|
|
|
col = layout.column()
|
2020-04-15 18:49:32 +02:00
|
|
|
depth_row = col.row()
|
|
|
|
depth_row.enabled = not ob.show_in_front
|
|
|
|
depth_row.prop(ob, "empty_image_depth", text="Depth", expand=True)
|
2018-12-17 14:49:16 +11:00
|
|
|
col.row().prop(ob, "empty_image_side", text="Side", expand=True)
|
2020-01-29 11:11:09 +11:00
|
|
|
col.prop(ob, "show_empty_image_orthographic", text="Display Orthographic")
|
|
|
|
col.prop(ob, "show_empty_image_perspective", text="Display Perspective")
|
2019-09-03 18:55:26 +10:00
|
|
|
col.prop(ob, "show_empty_image_only_axis_aligned")
|
2011-04-04 10:13:04 +00:00
|
|
|
|
2017-03-18 20:03:24 +11:00
|
|
|
|
2020-01-28 10:25:46 +01:00
|
|
|
class DATA_PT_empty_alpha(DataButtonsPanel, Panel):
|
|
|
|
bl_label = "Transparency"
|
|
|
|
bl_parent_id = "DATA_PT_empty"
|
|
|
|
|
2020-01-30 17:18:07 +01:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
|
|
|
ob = context.object
|
|
|
|
return (ob and ob.type == 'EMPTY' and ob.empty_display_type == 'IMAGE')
|
|
|
|
|
2020-01-28 10:25:46 +01:00
|
|
|
def draw_header(self, context):
|
|
|
|
ob = context.object
|
|
|
|
|
|
|
|
self.layout.prop(ob, "use_empty_image_alpha", text="")
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
layout.use_property_split = True
|
|
|
|
|
|
|
|
ob = context.object
|
|
|
|
|
|
|
|
layout.active = ob.use_empty_image_alpha
|
|
|
|
layout.prop(ob, "color", text="Opacity", index=3, slider=True)
|
|
|
|
|
|
|
|
|
2019-05-19 14:51:21 +02:00
|
|
|
class DATA_PT_empty_image(DataButtonsPanel, Panel):
|
|
|
|
bl_label = "Image"
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
|
|
|
ob = context.object
|
|
|
|
return (ob and ob.type == 'EMPTY' and ob.empty_display_type == 'IMAGE')
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
ob = context.object
|
2020-01-29 11:11:09 +11:00
|
|
|
layout.template_ID(ob, "data", open="image.open", unlink="object.unlink_data")
|
2019-05-22 00:27:01 +10:00
|
|
|
layout.separator()
|
2019-05-19 14:51:21 +02:00
|
|
|
layout.template_image(ob, "data", ob.image_user, compact=True)
|
|
|
|
|
|
|
|
|
2017-03-18 20:03:24 +11:00
|
|
|
classes = (
|
|
|
|
DATA_PT_empty,
|
2020-01-28 10:25:46 +01:00
|
|
|
DATA_PT_empty_alpha,
|
2019-05-19 14:51:21 +02:00
|
|
|
DATA_PT_empty_image,
|
2017-03-18 20:03:24 +11:00
|
|
|
)
|
|
|
|
|
2011-04-04 10:13:04 +00:00
|
|
|
if __name__ == "__main__": # only for live edit.
|
2017-03-18 20:03:24 +11:00
|
|
|
from bpy.utils import register_class
|
|
|
|
for cls in classes:
|
|
|
|
register_class(cls)
|