[Bf-blender-cvs] [ed27d3a3989] hair_guides: Add UI script for groom data.

Lukas Tönne noreply at git.blender.org
Sat Dec 30 09:09:30 CET 2017


Commit: ed27d3a398990d2fd541a4d4bc4e5715406ed12c
Author: Lukas Tönne
Date:   Thu Dec 28 14:16:44 2017 +0000
Branches: hair_guides
https://developer.blender.org/rBed27d3a398990d2fd541a4d4bc4e5715406ed12c

Add UI script for groom data.

===================================================================

M	release/scripts/startup/bl_ui/__init__.py
A	release/scripts/startup/bl_ui/properties_data_groom.py
M	source/blender/editors/space_buttons/buttons_context.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/__init__.py b/release/scripts/startup/bl_ui/__init__.py
index 967da8da74a..92c24454569 100644
--- a/release/scripts/startup/bl_ui/__init__.py
+++ b/release/scripts/startup/bl_ui/__init__.py
@@ -35,6 +35,7 @@ _modules = [
     "properties_data_camera",
     "properties_data_curve",
     "properties_data_empty",
+    "properties_data_groom",
     "properties_data_lamp",
     "properties_data_lattice",
     "properties_data_mesh",
diff --git a/release/scripts/startup/bl_ui/properties_data_groom.py b/release/scripts/startup/bl_ui/properties_data_groom.py
new file mode 100644
index 00000000000..388c034af26
--- /dev/null
+++ b/release/scripts/startup/bl_ui/properties_data_groom.py
@@ -0,0 +1,82 @@
+# ##### 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 Menu, Panel
+from rna_prop_ui import PropertyPanel
+
+
+class DataButtonsPanel:
+    bl_space_type = 'PROPERTIES'
+    bl_region_type = 'WINDOW'
+    bl_context = "data"
+
+    @classmethod
+    def poll(cls, context):
+        return context.groom
+
+
+class DATA_PT_context_groom(DataButtonsPanel, Panel):
+    bl_label = ""
+    bl_options = {'HIDE_HEADER'}
+
+    def draw(self, context):
+        layout = self.layout
+
+        ob = context.object
+        groom = context.groom
+        space = context.space_data
+
+        split = layout.split(percentage=0.65)
+
+        if ob:
+            split.template_ID(ob, "data")
+        elif groom:
+            split.template_ID(space, "pin_id")
+
+
+class DATA_PT_groom(DataButtonsPanel, Panel):
+    bl_label = "Groom"
+
+    def draw(self, context):
+        layout = self.layout
+
+        groom = context.groom
+
+        split = layout.split()
+
+        col = split.column()
+        col.prop(groom, "curve_resolution")
+
+
+class DATA_PT_custom_props_groom(DataButtonsPanel, PropertyPanel, Panel):
+    _context_path = "object.data"
+    _property_type = bpy.types.Groom
+
+
+classes = (
+    DATA_PT_context_groom,
+    DATA_PT_groom,
+    DATA_PT_custom_props_groom,
+)
+
+if __name__ == "__main__":  # only for live edit.
+    from bpy.utils import register_class
+    for cls in classes:
+        register_class(cls)
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c
index c9c62164da6..4b5f01897c1 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -810,7 +810,7 @@ const char *buttons_context_dir[] = {
 	"texture", "texture_user", "texture_user_property", "bone", "edit_bone",
 	"pose_bone", "particle_system", "particle_system_editable", "particle_settings",
 	"cloth", "soft_body", "fluid", "smoke", "collision", "brush", "dynamic_paint",
-	"line_style", "collection", "workspace", NULL
+	"line_style", "collection", "workspace", "groom", NULL
 };
 
 int buttons_context(const bContext *C, const char *member, bContextDataResult *result)
@@ -1142,6 +1142,10 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
 		set_pointer_type(path, result, &RNA_LayerCollection);
 		return 1;
 	}
+	else if (CTX_data_equals(member, "groom")) {
+		set_pointer_type(path, result, &RNA_Groom);
+		return 1;
+	}
 	else {
 		return 0; /* not found */
 	}



More information about the Bf-blender-cvs mailing list