[Bf-blender-cvs] [e0e3038b1e7] blender2.8: Hair Particles: DNA: Add properties for new GPU hairs.

Clément Foucault noreply at git.blender.org
Wed May 30 12:25:29 CEST 2018


Commit: e0e3038b1e7aec26da7161defa5a34b5d9373b5c
Author: Clément Foucault
Date:   Tue May 29 11:20:37 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBe0e3038b1e7aec26da7161defa5a34b5d9373b5c

Hair Particles: DNA: Add properties for new GPU hairs.

Hair Particles shape properties are ported from cycles. Thoses properties
have the same defaults and have a do_version of their own. Cycles will use
theses properties instead of its custom ones.

Some realtime engine specific settings are also added to scene->r because
it's much easier to control as global values.

Bumping Version number so cycles can do its own do_version on top of the
default settings.

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

M	release/scripts/startup/bl_ui/properties_particle.py
M	release/scripts/startup/bl_ui/properties_render.py
M	source/blender/blenkernel/BKE_blender_version.h
M	source/blender/blenkernel/intern/particle.c
M	source/blender/blenloader/intern/versioning_280.c
M	source/blender/makesdna/DNA_particle_types.h
M	source/blender/makesdna/DNA_scene_types.h
M	source/blender/makesrna/intern/rna_particle.c
M	source/blender/makesrna/intern/rna_scene.c

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

diff --git a/release/scripts/startup/bl_ui/properties_particle.py b/release/scripts/startup/bl_ui/properties_particle.py
index b6f7cfe3e84..f470a81dca1 100644
--- a/release/scripts/startup/bl_ui/properties_particle.py
+++ b/release/scripts/startup/bl_ui/properties_particle.py
@@ -1428,6 +1428,36 @@ class PARTICLE_PT_textures(ParticleButtonsPanel, Panel):
             layout.template_ID(slot, "texture", new="texture.new")
 
 
+class PARTICLE_PT_hair_shape(ParticleButtonsPanel, Panel):
+    bl_label = "Hair Shape"
+    bl_options = {'DEFAULT_CLOSED'}
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_CLAY', 'BLENDER_EEVEE'}
+
+    @classmethod
+    def poll(cls, context):
+        if context.particle_system is None:
+            return False
+        return particle_panel_poll(cls, context)
+
+    def draw(self, context):
+        layout = self.layout
+
+        psys = context.particle_system
+        part = psys.settings
+
+        row = layout.row()
+        row.prop(part, "shape", text="Shape")
+
+        layout.label(text="Thickness:")
+        row = layout.row()
+        row.prop(part, "root_radius", text="Root")
+        row.prop(part, "tip_radius", text="Tip")
+
+        row = layout.row()
+        row.prop(part, "radius_scale", text="Scaling")
+        row.prop(part, "use_close_tip")
+
+
 class PARTICLE_PT_custom_props(ParticleButtonsPanel, PropertyPanel, Panel):
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_CLAY', 'BLENDER_EEVEE'}
     _context_path = "particle_system.settings"
@@ -1449,6 +1479,7 @@ classes = (
     PARTICLE_PT_render,
     PARTICLE_PT_draw,
     PARTICLE_PT_children,
+    PARTICLE_PT_hair_shape,
     PARTICLE_PT_field_weights,
     PARTICLE_PT_force_fields,
     PARTICLE_PT_vertexgroups,
diff --git a/release/scripts/startup/bl_ui/properties_render.py b/release/scripts/startup/bl_ui/properties_render.py
index bccde2da2f4..404e4c4500b 100644
--- a/release/scripts/startup/bl_ui/properties_render.py
+++ b/release/scripts/startup/bl_ui/properties_render.py
@@ -710,6 +710,26 @@ class RENDER_PT_eevee_film(RenderButtonsPanel, Panel):
         col.prop(rd, "alpha_mode", text="Alpha")
 
 
+class RENDER_PT_hair(RenderButtonsPanel, Panel):
+    bl_label = "Hair"
+    bl_options = {'DEFAULT_CLOSED'}
+    COMPAT_ENGINES = {'BLENDER_EEVEE'}
+
+    @classmethod
+    def poll(cls, context):
+        return (context.engine in cls.COMPAT_ENGINES)
+
+    def draw(self, context):
+        layout = self.layout
+        scene = context.scene
+        rd = scene.render
+
+        row = layout.row()
+        row.prop(rd, "hair_type", expand=True)
+
+        layout.prop(rd, "hair_subdiv")
+
+
 classes = (
     RENDER_MT_presets,
     RENDER_MT_ffmpeg_presets,
@@ -722,6 +742,7 @@ classes = (
     RENDER_PT_encoding,
     RENDER_UL_renderviews,
     RENDER_PT_stereoscopy,
+    RENDER_PT_hair,
     RENDER_PT_clay_settings,
     RENDER_PT_eevee_sampling,
     RENDER_PT_eevee_film,
diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h
index 3712e556b63..8befeff498e 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -28,7 +28,7 @@
  * and keep comment above the defines.
  * Use STRINGIFY() rather than defining with quotes */
 #define BLENDER_VERSION         280
-#define BLENDER_SUBVERSION      15
+#define BLENDER_SUBVERSION      16
 /* Several breakages with 270, e.g. constraint deg vs rad */
 #define BLENDER_MINVERSION      270
 #define BLENDER_MINSUBVERSION   6
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index a42826a1f89..9550cbc6b50 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -3169,6 +3169,12 @@ static void default_particle_settings(ParticleSettings *part)
 	part->omat = 1;
 	part->use_modifier_stack = false;
 	part->draw_size = 0.1f;
+
+	part->shape_flag = PART_SHAPE_CLOSE_TIP;
+	part->shape = 0.0f;
+	part->rad_root = 1.0f;
+	part->rad_tip = 0.0f;
+	part->rad_scale = 0.01f;
 }
 
 
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 2331bc07f0f..bdac8067bb5 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -1437,7 +1437,8 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
 			}
 		}
 
-		if (!DNA_struct_elem_find(fd->filesdna, "SceneDisplay", "int", "matcap_icon")) {
+
+		if (!MAIN_VERSION_ATLEAST(main, 280, 15)) {
 			for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
 				scene->display.matcap_icon = 1;
 				scene->display.matcap_type = CLAY_MATCAP_NONE;
@@ -1450,9 +1451,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
 				scene->display.matcap_ssao_factor_edge = 1.0f;
 				scene->display.matcap_ssao_samples = 16;
 			}
-		}
 
-		if (!DNA_struct_elem_find(fd->filesdna, "SpaceOops", "short", "filter_id_type")) {
 			for (bScreen *screen = main->screen.first; screen; screen = screen->id.next) {
 				for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
 					for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
@@ -1464,25 +1463,34 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
 					}
 				}
 			}
-		}
 
-		for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
-			switch (scene->toolsettings->snap_mode) {
-				case 0: scene->toolsettings->snap_mode = SCE_SNAP_MODE_INCREMENT; break;
-				case 1: scene->toolsettings->snap_mode = SCE_SNAP_MODE_VERTEX   ; break;
-				case 2: scene->toolsettings->snap_mode = SCE_SNAP_MODE_EDGE     ; break;
-				case 3: scene->toolsettings->snap_mode = SCE_SNAP_MODE_FACE     ; break;
-				case 4: scene->toolsettings->snap_mode = SCE_SNAP_MODE_VOLUME   ; break;
-			}
-			switch (scene->toolsettings->snap_node_mode) {
-				case 5: scene->toolsettings->snap_node_mode = SCE_SNAP_MODE_NODE_X; break;
-				case 6: scene->toolsettings->snap_node_mode = SCE_SNAP_MODE_NODE_Y; break;
-				case 7: scene->toolsettings->snap_node_mode = SCE_SNAP_MODE_NODE_X | SCE_SNAP_MODE_NODE_Y; break;
-				case 8: scene->toolsettings->snap_node_mode = SCE_SNAP_MODE_GRID  ; break;
+			for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
+				switch (scene->toolsettings->snap_mode) {
+					case 0: scene->toolsettings->snap_mode = SCE_SNAP_MODE_INCREMENT; break;
+					case 1: scene->toolsettings->snap_mode = SCE_SNAP_MODE_VERTEX   ; break;
+					case 2: scene->toolsettings->snap_mode = SCE_SNAP_MODE_EDGE     ; break;
+					case 3: scene->toolsettings->snap_mode = SCE_SNAP_MODE_FACE     ; break;
+					case 4: scene->toolsettings->snap_mode = SCE_SNAP_MODE_VOLUME   ; break;
+				}
+				switch (scene->toolsettings->snap_node_mode) {
+					case 5: scene->toolsettings->snap_node_mode = SCE_SNAP_MODE_NODE_X; break;
+					case 6: scene->toolsettings->snap_node_mode = SCE_SNAP_MODE_NODE_Y; break;
+					case 7: scene->toolsettings->snap_node_mode = SCE_SNAP_MODE_NODE_X | SCE_SNAP_MODE_NODE_Y; break;
+					case 8: scene->toolsettings->snap_node_mode = SCE_SNAP_MODE_GRID  ; break;
+				}
+				switch (scene->toolsettings->snap_uv_mode) {
+					case 0: scene->toolsettings->snap_uv_mode = SCE_SNAP_MODE_INCREMENT; break;
+					case 1: scene->toolsettings->snap_uv_mode = SCE_SNAP_MODE_VERTEX   ; break;
+				}
 			}
-			switch (scene->toolsettings->snap_uv_mode) {
-				case 0: scene->toolsettings->snap_uv_mode = SCE_SNAP_MODE_INCREMENT; break;
-				case 1: scene->toolsettings->snap_uv_mode = SCE_SNAP_MODE_VERTEX   ; break;
+
+			ParticleSettings *part;
+			for (part = main->particle.first; part; part = part->id.next) {
+				part->shape_flag = PART_SHAPE_CLOSE_TIP;
+				part->shape = 0.0f;
+				part->rad_root = 1.0f;
+				part->rad_tip = 0.0f;
+				part->rad_scale = 0.01f;
 			}
 		}
 	}
diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h
index 583b8504524..8437c93a722 100644
--- a/source/blender/makesdna/DNA_particle_types.h
+++ b/source/blender/makesdna/DNA_particle_types.h
@@ -255,12 +255,18 @@ typedef struct ParticleSettings {
 
 	/* modified dm support */
 	short use_modifier_stack;
-
 	short pad5;
-	int pad8;
 
-	float twist;
-	float pad6;
+	/* hair shape */
+	short shape_flag;
+	short pad6;
+
+	float twist, pad8;
+
+	/* hair thickness shape */
+	float shape;
+	float rad_root, rad_tip, rad_scale;
+
 	struct CurveMapping *twistcurve;
 	void *pad7;
 } ParticleSettings;
@@ -449,6 +455,11 @@ typedef enum eParticleChildFlag {
 	PART_CHILD_USE_TWIST_CURVE  = (1<<3),
 } eParticleChildFlag;
 
+/* part->shape_flag */
+typedef enum eParticleShapeFlag {
+	PART_SHAPE_CLOSE_TIP     = (1<<0),
+} eParticleShapeFlag;
+
 /* part->draw_col */
 #define PART_DRAW_COL_NONE		0
 #define PART_DRAW_COL_MAT		1
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index cbd863f706f..d51c4912c5c 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -713,12 +713,21 @@ typedef struct RenderData {
 	ListBase views;  /* SceneRenderView */
 	short actview;
 	short views_format;
-	short pad8[2];
+
+	/* Hair Display */
+	short hair_type, hair_subdiv;
 
 	/* Motion blur shutter */
 	struct CurveMapping mblur_shutter_curve;
 } RenderData;
 
+/* RenderData.hair_type */
+typedef enum eHairType {
+	SCE_HAIR_SHAPE_STRAND      = 0,
+	SCE_HAIR_SHAPE_STRIP       = 1,
+} eHairType;
+
+
 /* *************************************************************** */
 /* Render Conversion/Simplfication Settings */
 
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
index 17e9a6604fd..52c97130ada 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -3147,6 +3147,38 @@ static void rna_def_particle_settings(BlenderRNA *brna)
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Twist Curve", "Curve defining twist");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+	

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list