[Bf-blender-cvs] [8f46ae5ec91] hair_guides: New object pointer in groom ID to use as a "scalp" object for attaching hair.

Lukas Tönne noreply at git.blender.org
Tue Jan 2 14:37:26 CET 2018


Commit: 8f46ae5ec916b819c0d3dd72bd7dfa6122dfb9e9
Author: Lukas Tönne
Date:   Tue Jan 2 13:36:57 2018 +0000
Branches: hair_guides
https://developer.blender.org/rB8f46ae5ec916b819c0d3dd72bd7dfa6122dfb9e9

New object pointer in groom ID to use as a "scalp" object for attaching hair.

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

M	release/scripts/startup/bl_ui/properties_data_groom.py
M	source/blender/blenkernel/intern/library_query.c
M	source/blender/blenloader/intern/readfile.c
M	source/blender/makesdna/DNA_groom_types.h
M	source/blender/makesrna/intern/rna_groom.c

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

diff --git a/release/scripts/startup/bl_ui/properties_data_groom.py b/release/scripts/startup/bl_ui/properties_data_groom.py
index 41b0b8673f6..75b3540a96c 100644
--- a/release/scripts/startup/bl_ui/properties_data_groom.py
+++ b/release/scripts/startup/bl_ui/properties_data_groom.py
@@ -62,7 +62,12 @@ class DATA_PT_groom(DataButtonsPanel, Panel):
         split = layout.split()
 
         col = split.column()
-        col.prop(groom, "curve_resolution")
+        col.label("Scalp Object:")
+        col.prop(groom, "scalp_object", "")
+
+        col = split.column()
+        col.label("Curves:")
+        col.prop(groom, "curve_resolution", "Resolution")
 
 
 class DATA_PT_groom_draw_settings(DataButtonsPanel, Panel):
diff --git a/source/blender/blenkernel/intern/library_query.c b/source/blender/blenkernel/intern/library_query.c
index faee2eb0395..c900c994f08 100644
--- a/source/blender/blenkernel/intern/library_query.c
+++ b/source/blender/blenkernel/intern/library_query.c
@@ -671,7 +671,7 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call
 			case ID_GM:
 			{
 				Groom *groom = (Groom *) id;
-				UNUSED_VARS(groom);
+				CALLBACK_INVOKE(groom->scalp_object, IDWALK_CB_NOP);
 				break;
 			}
 
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index a93d17ffada..66a3a98ad18 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -8373,7 +8373,7 @@ static void direct_link_linestyle(FileData *fd, FreestyleLineStyle *linestyle)
 
 /* ************ READ GROOM *************** */
 
-static void lib_link_grooms(FileData *fd, Main *bmain)
+static void lib_link_groom(FileData *fd, Main *bmain)
 {
 	for (Groom *groom = bmain->grooms.first; groom; groom = groom->id.next) {
 		ID *id = (ID *)groom;
@@ -8384,7 +8384,7 @@ static void lib_link_grooms(FileData *fd, Main *bmain)
 		IDP_LibLinkProperty(id->properties, fd);
 		id_us_ensure_real(id);
 
-		// LIBLINK STUFF HERE
+		groom->scalp_object = newlibadr(fd, id->lib, groom->scalp_object);
 
 		id->tag &= ~LIB_TAG_NEED_LINK;
 	}
@@ -8906,7 +8906,7 @@ static void lib_link_all(FileData *fd, Main *main)
 	lib_link_gpencil(fd, main);
 	lib_link_cachefiles(fd, main);
 	lib_link_workspaces(fd, main);
-	lib_link_grooms(fd, main);
+	lib_link_groom(fd, main);
 
 	lib_link_library(fd, main);    /* only init users */
 }
@@ -9530,6 +9530,11 @@ static void expand_particlesettings(FileData *fd, Main *mainvar, ParticleSetting
 	}
 }
 
+static void expand_groom(FileData *fd, Main *mainvar, Groom *groom)
+{
+	expand_doit(fd, mainvar, groom->scalp_object);
+}
+
 static void expand_group(FileData *fd, Main *mainvar, Group *group)
 {
 	GroupObject *go;
@@ -10275,6 +10280,9 @@ void BLO_expand_main(void *fdhandle, Main *mainvar)
 					case ID_AC:
 						expand_action(fd, mainvar, (bAction *)id); // XXX deprecated - old animation system
 						break;
+					case ID_GM:
+						expand_groom(fd, mainvar, (Groom *)id);
+						break;
 					case ID_GR:
 						expand_group(fd, mainvar, (Group *)id);
 						break;
diff --git a/source/blender/makesdna/DNA_groom_types.h b/source/blender/makesdna/DNA_groom_types.h
index 2989a25ead0..91e9b86a426 100644
--- a/source/blender/makesdna/DNA_groom_types.h
+++ b/source/blender/makesdna/DNA_groom_types.h
@@ -120,8 +120,10 @@ typedef struct Groom {
 	
 	ListBase bundles;           /* List of GroomBundle */
 	
-	struct HairSystem *hair_system;         /* Renderable hair geometry */
-	struct HairDrawSettings *hair_draw_settings; /* Draw settings for hair geometry */
+	struct HairSystem *hair_system;                 /* Renderable hair geometry */
+	struct HairDrawSettings *hair_draw_settings;    /* Draw settings for hair geometry */
+	
+	struct Object *scalp_object;                    /* Surface for attaching hairs */
 	
 	EditGroom *editgroom;
 	void *batch_cache;
diff --git a/source/blender/makesrna/intern/rna_groom.c b/source/blender/makesrna/intern/rna_groom.c
index 034509e1603..b8966cf27a6 100644
--- a/source/blender/makesrna/intern/rna_groom.c
+++ b/source/blender/makesrna/intern/rna_groom.c
@@ -99,6 +99,12 @@ static void rna_def_groom(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Hair Draw Settings", "Hair draw settings");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	
+	prop = RNA_def_property(srna, "scalp_object", PROP_POINTER, PROP_NONE);
+	RNA_def_property_pointer_sdna(prop, NULL, "scalp_object");
+	RNA_def_property_ui_text(prop, "Scalp Object", "Surface for attaching hairs");
+	RNA_def_property_flag(prop, PROP_EDITABLE);
+	RNA_def_property_update(prop, 0, "rna_Groom_update_data");
+	
 	UNUSED_VARS(prop);
 }



More information about the Bf-blender-cvs mailing list