Particle system parenting
* Allows moving, rotating & scaling of particle simulations. * Setting in particle render options. * Changes viewed & rendered particles from global space to parent space. * Doesn't effect simulations at all.
This commit is contained in:
@@ -288,7 +288,9 @@ class PARTICLE_PT_render(ParticleButtonsPanel):
|
||||
psys = context.particle_system
|
||||
part = psys.settings
|
||||
|
||||
layout.itemR(part, "material")
|
||||
row = layout.row()
|
||||
row.itemR(part, "material")
|
||||
row.itemR(psys, "parent");
|
||||
|
||||
split = layout.split()
|
||||
|
||||
|
||||
@@ -3239,6 +3239,9 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
|
||||
if(draw_as!=PART_DRAW_PATH){
|
||||
state.time=cfra;
|
||||
if(psys_get_particle_state(scene,ob,psys,a,&state,0)){
|
||||
if(psys->parent)
|
||||
Mat4MulVecfl(psys->parent->obmat, state.co);
|
||||
|
||||
/* create actiual particle data */
|
||||
switch(draw_as){
|
||||
case PART_DRAW_DOT:
|
||||
|
||||
@@ -192,6 +192,7 @@ typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in
|
||||
struct Object *target_ob;
|
||||
struct Object *keyed_ob;
|
||||
struct Object *lattice;
|
||||
struct Object *parent; /* particles from global space -> parent space */
|
||||
|
||||
struct ListBase effectors, reactevents; /* runtime */
|
||||
|
||||
|
||||
@@ -1715,6 +1715,14 @@ static void rna_def_particle_system(BlenderRNA *brna)
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "pointcache");
|
||||
RNA_def_property_struct_type(prop, "PointCache");
|
||||
RNA_def_property_ui_text(prop, "Point Cache", "");
|
||||
|
||||
/* offset ob */
|
||||
prop= RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "parent");
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(prop, "Parent", "Use this object's coordinate system instead of global coordinate system.");
|
||||
RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
|
||||
|
||||
}
|
||||
|
||||
void RNA_def_particle(BlenderRNA *brna)
|
||||
|
||||
@@ -1886,6 +1886,9 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
|
||||
if(psys_get_particle_state(re->scene,ob,psys,a,&state,0)==0)
|
||||
continue;
|
||||
|
||||
if(psys->parent)
|
||||
Mat4MulVecfl(psys->parent->obmat, state.co);
|
||||
|
||||
VECCOPY(loc,state.co);
|
||||
if(part->ren_as!=PART_DRAW_BB)
|
||||
MTC_Mat4MulVecfl(re->viewmat,loc);
|
||||
|
||||
Reference in New Issue
Block a user