diff options
author | YimingWu <xp8110@outlook.com> | 2020-05-16 18:08:40 +0300 |
---|---|---|
committer | YimingWu <xp8110@outlook.com> | 2020-05-16 18:08:40 +0300 |
commit | cd54abd2c1316136753f7bbe227bd762a5f9e7d9 (patch) | |
tree | 69f2a4a1a5013acc78213bb4f3fe888912380ea4 /release/scripts/startup/bl_ui/properties_data_hair.py | |
parent | f7770cb97bb9d19d0806f67da9377129fd4d09b0 (diff) | |
parent | eaf7d36d66e551c3262d69f472b4028aeccb7e97 (diff) |
Merge remote-tracking branch 'origin/master' into temp-lanpr-review
Diffstat (limited to 'release/scripts/startup/bl_ui/properties_data_hair.py')
-rw-r--r-- | release/scripts/startup/bl_ui/properties_data_hair.py | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/release/scripts/startup/bl_ui/properties_data_hair.py b/release/scripts/startup/bl_ui/properties_data_hair.py new file mode 100644 index 00000000000..6017765b83d --- /dev/null +++ b/release/scripts/startup/bl_ui/properties_data_hair.py @@ -0,0 +1,78 @@ +# ##### 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, UIList +from rna_prop_ui import PropertyPanel + + +class DataButtonsPanel: + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_context = "data" + + @classmethod + def poll(cls, context): + engine = context.scene.render.engine + return hasattr(context, 'hair') and context.hair and (engine in cls.COMPAT_ENGINES) + + +class DATA_PT_context_hair(DataButtonsPanel, Panel): + bl_label = "" + bl_options = {'HIDE_HEADER'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'} + + def draw(self, context): + layout = self.layout + + ob = context.object + hair = context.hair + space = context.space_data + + if ob: + layout.template_ID(ob, "data") + elif hair: + layout.template_ID(space, "pin_id") + + +class DATA_PT_hair(DataButtonsPanel, Panel): + bl_label = "Hair" + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'} + + def draw(self, context): + layout = self.layout + hair = context.hair + pass + +class DATA_PT_custom_props_hair(DataButtonsPanel, PropertyPanel, Panel): + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'} + _context_path = "object.data" + _property_type = bpy.types.Hair if hasattr(bpy.types, "Hair") else None + + +classes = ( + DATA_PT_context_hair, + DATA_PT_hair, + DATA_PT_custom_props_hair, +) + +if __name__ == "__main__": # only for live edit. + from bpy.utils import register_class + for cls in classes: + register_class(cls) |