I noticed when I was using the ParticleInstance modifier that the geometry it was generating did not give the user the ability to control the starting rotations every particle (this is a problem when you’re trying to use flat planes with textures on them to simulate things like fur or grass). After messing with the code I was able to come up with a solution by using the mesh’s UV cooridinates to generate the matrix for the hair particle.
I’d like to work this into a more finished solution that I could submit as a patch. To do that, I’d need to extend the modifier’s UI to include a field that lets the user pick a UV set that belongs to the same object as appears in the Object field.
How would I go about adding this field? The RNA/DNA system is a little confusing and some of the files seem like they might be auto generated.
There are at least three files you’d have to change for this. One is DNA_modifier_types.h. You can think of the DNA files as the actual storage of the data, they control what actually gets written to files. If you add a new variable to a modifier struct you should also add it to DNA_modifier_defaults.h.
Next is rna_modifier.c, which is where the stored variables from DNA are actually made useful in a more “public” way. There are plenty of examples in that file, I would suggest just looking at them and trying things out. Indeed, the rna_*_gen.c files are autogenerated, from these rna* files.
Finally, the MOD_particleinstance.c file is where the actual logic for the modifier lives, as well as its flag. The UI also lives here, in the “panel_draw” functions. If you look in more of the modifier files the odds are quite high that you’ll find an existing example of the sort of UI you’re imagining.
This is a great patch! I was also upset about the lack of such an important function and used addons (in fact, with this patch we are getting closer to creating fast game ready hair in Blender).
I know that the Ornatrix plugin for Maya has a function both to rotate all hairs outward from the emmiter geometry of the mesh used (I suspect that this is tied to the emmiter normals), and to rotate all the dies towards the camera or other object. Whichever implementation you do it is very cool that there is a development of the hair system!
Well, this patch is more to let you set a UV map that will provide a starting rotation for the hair so that you can have them all point in the same direction (or whatever direction you want). What you’re describing sounds more like billboarding the hair particles. That could be done too, but is different from what I’m trying to do in this patch.