diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2017-06-07 19:32:27 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2017-06-09 02:15:17 +0300 |
commit | c1009af596a17e6be37d5c64746ae3b2c6b6dc7d (patch) | |
tree | a0a08e3a5f985c975c0c3a2cd1525ad23233f093 /release/scripts/startup/bl_ui | |
parent | 4df449edd51bd5602c0c7763ac4984b6de81e285 (diff) |
Probe: Add panel and "Add-menu" items.
Also revisits defaults.
Diffstat (limited to 'release/scripts/startup/bl_ui')
-rw-r--r-- | release/scripts/startup/bl_ui/__init__.py | 1 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/properties_data_probe.py | 77 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_view3d.py | 13 |
3 files changed, 91 insertions, 0 deletions
diff --git a/release/scripts/startup/bl_ui/__init__.py b/release/scripts/startup/bl_ui/__init__.py index c5772101df8..d1984649624 100644 --- a/release/scripts/startup/bl_ui/__init__.py +++ b/release/scripts/startup/bl_ui/__init__.py @@ -40,6 +40,7 @@ _modules = [ "properties_data_mesh", "properties_data_metaball", "properties_data_modifier", + "properties_data_probe", "properties_data_speaker", "properties_game", "properties_mask_common", diff --git a/release/scripts/startup/bl_ui/properties_data_probe.py b/release/scripts/startup/bl_ui/properties_data_probe.py new file mode 100644 index 00000000000..e800c1ab9fa --- /dev/null +++ b/release/scripts/startup/bl_ui/properties_data_probe.py @@ -0,0 +1,77 @@ +# ##### 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. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# ##### END GPL LICENSE BLOCK ##### + +# <pep8 compliant> +import bpy +from bpy.types import Panel + + +class DataButtonsPanel: + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_context = "data" + + @classmethod + def poll(cls, context): + engine = context.scene.render.engine + return context.probe and (engine in cls.COMPAT_ENGINES) + + +class DATA_PT_context_probe(DataButtonsPanel, Panel): + bl_label = "" + bl_options = {'HIDE_HEADER'} + COMPAT_ENGINES = {'BLENDER_CLAY', 'BLENDER_EEVEE'} + + def draw(self, context): + layout = self.layout + + ob = context.object + probe = context.probe + space = context.space_data + + if ob: + layout.template_ID(ob, "data") + elif probe: + layout.template_ID(space, "pin_id") + + +class DATA_PT_probe(DataButtonsPanel, Panel): + bl_label = "Probe" + COMPAT_ENGINES = {'BLENDER_CLAY', 'BLENDER_EEVEE'} + + def draw(self, context): + layout = self.layout + + ob = context.object + probe = context.probe + + layout.prop(probe, "type", expand=True) + + layout.prop(probe, "distance") + layout.prop(probe, "falloff") + + +classes = ( + DATA_PT_context_probe, + DATA_PT_probe, +) + +if __name__ == "__main__": # only for live edit. + from bpy.utils import register_class + for cls in classes: + register_class(cls) diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 317d621778a..080b92bdccc 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -1205,6 +1205,17 @@ class INFO_MT_lamp_add(Menu): layout.operator_enum("object.lamp_add", "type") +class INFO_MT_probe_add(Menu): + bl_idname = "INFO_MT_probe_add" + bl_label = "Probe" + + def draw(self, context): + layout = self.layout + + layout.operator_context = 'INVOKE_REGION_WIN' + layout.operator_enum("object.probe_add", "type") + + class INFO_MT_camera_add(Menu): bl_idname = "INFO_MT_camera_add" bl_label = "Camera" @@ -1252,6 +1263,7 @@ class INFO_MT_add(Menu): INFO_MT_camera_add.draw(self, context) layout.menu("INFO_MT_lamp_add", icon='OUTLINER_OB_LAMP') + layout.menu("INFO_MT_probe_add") layout.separator() layout.operator_menu_enum("object.effector_add", "type", text="Force Field", icon='OUTLINER_OB_EMPTY') @@ -3775,6 +3787,7 @@ classes = ( INFO_MT_edit_armature_add, INFO_MT_armature_add, INFO_MT_lamp_add, + INFO_MT_probe_add, INFO_MT_camera_add, INFO_MT_add, VIEW3D_MT_object, |