[Bf-blender-cvs] [efdde88dfc9] master: Particle: Remove Billboard Particle code

Clément Foucault noreply at git.blender.org
Fri Mar 15 22:33:09 CET 2019


Commit: efdde88dfc9501764d96cf5b33e2141a86ba44c9
Author: Clément Foucault
Date:   Fri Mar 15 20:56:29 2019 +0100
Branches: master
https://developer.blender.org/rBefdde88dfc9501764d96cf5b33e2141a86ba44c9

Particle: Remove Billboard Particle code

The billboard particles were only used by Blender Internal. So until it is
supported by Cycles of Eevee there is no reason to keep it in the code and
UI.

Fix T61695 Billboard particles not displaying in Eevee viewport, render

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

M	release/scripts/startup/bl_ui/properties_particle.py
M	source/blender/blenkernel/BKE_particle.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/makesrna/intern/rna_particle.c

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

diff --git a/release/scripts/startup/bl_ui/properties_particle.py b/release/scripts/startup/bl_ui/properties_particle.py
index c85b8004808..3d25829c3d2 100644
--- a/release/scripts/startup/bl_ui/properties_particle.py
+++ b/release/scripts/startup/bl_ui/properties_particle.py
@@ -1480,98 +1480,6 @@ class PARTICLE_PT_render_collection_use_count(ParticleButtonsPanel, Panel):
             row.prop(weight, "count")
 
 
-class PARTICLE_PT_render_billboards_alignment(ParticleButtonsPanel, Panel):
-    bl_label = "Billboard Alignment"
-    bl_parent_id = "PARTICLE_PT_render"
-    bl_options = {'DEFAULT_CLOSED'}
-    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
-
-    @classmethod
-    def poll(cls, context):
-        part = particle_get_settings(context)
-        return part.render_type == 'BILLBOARD'
-
-    def draw(self, context):
-        layout = self.layout
-        layout.use_property_split = True
-
-        part = particle_get_settings(context)
-
-        col = layout.column()
-
-        col.prop(part, "billboard_align", text="Align To")
-        col.prop(part, "lock_billboard", text="Lock Axis")
-        col.prop(part, "billboard_object")
-
-
-class PARTICLE_PT_render_billboards_tilt(ParticleButtonsPanel, Panel):
-    bl_label = "Billboard Tilt"
-    bl_parent_id = "PARTICLE_PT_render"
-    bl_options = {'DEFAULT_CLOSED'}
-    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
-
-    @classmethod
-    def poll(cls, context):
-        part = particle_get_settings(context)
-        return part.render_type == 'BILLBOARD'
-
-    def draw(self, context):
-        layout = self.layout
-        layout.use_property_split = True
-
-        part = particle_get_settings(context)
-
-        col = layout.column()
-
-        sub = col.column(align=True)
-        sub.prop(part, "billboard_tilt", text="Angle", slider=True)
-        sub.prop(part, "billboard_tilt_random", text="Random", slider=True)
-
-        sub = col.column(align=True)
-        sub.prop(part, "billboard_offset")
-        col.prop(part, "billboard_size", text="Scale")
-        if part.billboard_align == 'VEL':
-            col = col.column(align=True)
-            col.prop(part, "billboard_velocity_head", text="Velocity ScaleHead")
-            col.prop(part, "billboard_velocity_tail", text="Tail")
-
-
-class PARTICLE_PT_render_billboards_uv(ParticleButtonsPanel, Panel):
-    bl_label = "Billboard UVs"
-    bl_parent_id = "PARTICLE_PT_render"
-    bl_options = {'DEFAULT_CLOSED'}
-    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
-
-    @classmethod
-    def poll(cls, context):
-        part = particle_get_settings(context)
-        return part.render_type == 'BILLBOARD'
-
-    def draw(self, context):
-        layout = self.layout
-        layout.use_property_split = True
-
-        psys = context.particle_system
-        ob = context.object
-        part = particle_get_settings(context)
-
-        col = layout.column()
-
-        if psys:
-            col.prop_search(psys, "billboard_normal_uv", ob.data, "uv_layers")
-            col.prop_search(psys, "billboard_time_index_uv", ob.data, "uv_layers")
-
-        col.prop(part, "billboard_uv_split", text="Split UVs")
-
-        if psys:
-            sub = col.column()
-            sub.active = part.billboard_uv_split > 1
-            sub.prop_search(psys, "billboard_split_uv", ob.data, "uv_layers")
-
-        sub.prop(part, "billboard_animation")
-        sub.prop(part, "billboard_offset_split")
-
-
 class PARTICLE_PT_render_trails(ParticleButtonsPanel, Panel):
     bl_label = "Trails"
     bl_parent_id = "PARTICLE_PT_render"
@@ -2186,8 +2094,6 @@ classes = (
     PARTICLE_PT_render_object,
     PARTICLE_PT_render_collection,
     PARTICLE_PT_render_collection_use_count,
-    PARTICLE_PT_render_billboards_tilt,
-    PARTICLE_PT_render_billboards_uv,
     PARTICLE_PT_render_trails,
     PARTICLE_PT_render_extra,
     PARTICLE_PT_draw,
diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h
index 19036e63a8c..56f64829eb1 100644
--- a/source/blender/blenkernel/BKE_particle.h
+++ b/source/blender/blenkernel/BKE_particle.h
@@ -172,19 +172,6 @@ typedef struct ParticleTask {
 	int begin, end;
 } ParticleTask;
 
-typedef struct ParticleBillboardData {
-	struct Object *ob;
-	float vec[3], vel[3];
-	float offset[2];
-	float size[2];
-	float tilt, random, time;
-	int uv[3];
-	int lock, num;
-	int totnum;
-	int lifetime;
-	short align, uv_split, anim, split_offset;
-} ParticleBillboardData;
-
 typedef struct ParticleCollisionElement {
 	/* pointers to original data */
 	float *x[3], *v[3];
@@ -391,7 +378,6 @@ void psys_thread_context_free(struct ParticleThreadContext *ctx);
 void psys_tasks_create(struct ParticleThreadContext *ctx, int startpart, int endpart, struct ParticleTask **r_tasks, int *r_numtasks);
 void psys_tasks_free(struct ParticleTask *tasks, int numtasks);
 
-void psys_make_billboard(ParticleBillboardData *bb, float xvec[3], float yvec[3], float zvec[3], float center[3]);
 void psys_apply_hair_lattice(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct ParticleSystem *psys);
 
 /* particle_system.c */
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index da2975d8efc..bdf0b239917 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -3150,8 +3150,6 @@ static void default_particle_settings(ParticleSettings *part)
 	part->draw_as = PART_DRAW_REND;
 	part->ren_as = PART_DRAW_HALO;
 	part->bb_uv_split = 1;
-	part->bb_align = PART_BB_VIEW;
-	part->bb_split_offset = PART_BB_OFF_LINEAR;
 	part->flag = PART_EDISTR | PART_TRAND | PART_HIDE_ADVANCED_HAIR;
 
 	part->sta = 1.0;
@@ -4207,88 +4205,6 @@ void psys_get_dupli_path_transform(ParticleSimulationData *sim, ParticleData *pa
 	*scale = len;
 }
 
-void psys_make_billboard(ParticleBillboardData *bb, float xvec[3], float yvec[3], float zvec[3], float center[3])
-{
-	float onevec[3] = {0.0f, 0.0f, 0.0f}, tvec[3], tvec2[3];
-
-	xvec[0] = 1.0f; xvec[1] = 0.0f; xvec[2] = 0.0f;
-	yvec[0] = 0.0f; yvec[1] = 1.0f; yvec[2] = 0.0f;
-
-	/* can happen with bad pointcache or physics calculation
-	 * since this becomes geometry, nan's and inf's crash raytrace code.
-	 * better not allow this. */
-	if (!is_finite_v3(bb->vec) || !is_finite_v3(bb->vec)) {
-		zero_v3(bb->vec);
-		zero_v3(bb->vel);
-
-		zero_v3(xvec);
-		zero_v3(yvec);
-		zero_v3(zvec);
-		zero_v3(center);
-
-		return;
-	}
-
-	if (bb->align < PART_BB_VIEW)
-		onevec[bb->align] = 1.0f;
-
-	if (bb->lock && (bb->align == PART_BB_VIEW)) {
-		normalize_v3_v3(xvec, bb->ob->obmat[0]);
-		normalize_v3_v3(yvec, bb->ob->obmat[1]);
-		normalize_v3_v3(zvec, bb->ob->obmat[2]);
-	}
-	else if (bb->align == PART_BB_VEL) {
-		float temp[3];
-
-		normalize_v3_v3(temp, bb->vel);
-
-		sub_v3_v3v3(zvec, bb->ob->obmat[3], bb->vec);
-
-		if (bb->lock) {
-			float fac = -dot_v3v3(zvec, temp);
-
-			madd_v3_v3fl(zvec, temp, fac);
-		}
-		normalize_v3(zvec);
-
-		cross_v3_v3v3(xvec, temp, zvec);
-		normalize_v3(xvec);
-
-		cross_v3_v3v3(yvec, zvec, xvec);
-	}
-	else {
-		sub_v3_v3v3(zvec, bb->ob->obmat[3], bb->vec);
-		if (bb->lock)
-			zvec[bb->align] = 0.0f;
-		normalize_v3(zvec);
-
-		if (bb->align < PART_BB_VIEW)
-			cross_v3_v3v3(xvec, onevec, zvec);
-		else
-			cross_v3_v3v3(xvec, bb->ob->obmat[1], zvec);
-		normalize_v3(xvec);
-
-		cross_v3_v3v3(yvec, zvec, xvec);
-	}
-
-	copy_v3_v3(tvec, xvec);
-	copy_v3_v3(tvec2, yvec);
-
-	mul_v3_fl(xvec, cosf(bb->tilt * (float)M_PI));
-	mul_v3_fl(tvec2, sinf(bb->tilt * (float)M_PI));
-	add_v3_v3(xvec, tvec2);
-
-	mul_v3_fl(yvec, cosf(bb->tilt * (float)M_PI));
-	mul_v3_fl(tvec, -sinf(bb->tilt * (float)M_PI));
-	add_v3_v3(yvec, tvec);
-
-	mul_v3_fl(xvec, bb->size[0]);
-	mul_v3_fl(yvec, bb->size[1]);
-
-	madd_v3_v3v3fl(center, bb->vec, xvec, bb->offset[0]);
-	madd_v3_v3fl(center, yvec, bb->offset[1]);
-}
-
 void psys_apply_hair_lattice(Depsgraph *depsgraph, Scene *scene, Object *ob, ParticleSystem *psys)
 {
 	ParticleSimulationData sim = {0};
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index b0b389c6c2d..71341b47c6e 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -2910,5 +2910,15 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
 
 	{
 		/* Versioning code until next subversion bump goes here. */
+
+		LISTBASE_FOREACH (ParticleSettings *, part, &bmain->particles) {
+			/* Replace deprecated PART_DRAW_BB by PART_DRAW_NOT */
+			if (part->ren_as == PART_DRAW_BB) {
+				part->ren_as = PART_DRAW_NOT;
+			}
+			if (part->draw_as == PART_DRAW_BB) {
+				part->draw_as = PART_DRAW_NOT;
+			}
+		}
 	}
 }
diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h
index dc6e9dd05a1..68bc79d4543 100644
--- a/source/blender/makesdna/DNA_particle_types.h
+++ b/source/blender/makesdna/DNA_particle_types.h
@@ -206,8 +206,8 @@ typedef struct ParticleSettings {
 	short kink, kink_axis;
 
 	/* billboards */
-	short bb_align, bb_uv_split, bb_anim, bb_split_offset;
-	float bb_tilt, bb_rand_tilt, bb_offset[2], bb_size[2], bb_vel_head, bb_vel_tail;
+	short bb_align, bb_uv_split, bb_anim, bb_split_offset DNA_DEPRECATED;
+	float bb_tilt, bb_rand_tilt, bb_offset[2], bb_size[2], bb_vel_head, bb_vel_tail DNA_DEPRECATED;
 
 	/* draw color */
 	float color_vec_max;
@@ -362,7 +362,7 @@ typedef struct ParticleSystem {
 	char _pad1[6];
 
 	/** Billboard uv name, MAX_CUSTOMDATA_LAYER_NAME. */
-	char bb_uvname[3][64];
+	char bb_uvname[3][64] DNA_DEPRECATED;
 
 	/* if you change these remember to update array lengths to PSYS_TOT_VG! */
 	/** Vertex groups, 0==disable, 1==starting index. */
@@ -412,7 +412,7 @@ typedef enum eParticleDrawFlag {
 	PART_DRAW_HEALTH        = (1 << 4),
 	PART_ABS_PATH_TIME      = (1 << 5),
 	PART_DRAW_COUNT_GR      = (1 << 6),
-	PART_DRAW_BB_LOCK       = (1 << 7), /* used with billboards */
+	PART_DRAW_BB_LOCK       = (1 << 7), /* used with billboards */ /* DEPRECATED */
 	PART_DRA

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list