[Bf-committers] Questions regarding adding new mesh primitive

Campbell Barton cbarton at metavr.com
Wed Aug 22 13:24:48 CEST 2007

Hi Rodrigo,
Is there any reason to do this in C?
a procedural python mesh example is add_mesh_torus.py

Adding static objects is a lot easier, an example.

The script to write a blender mesh to a script like the teapot is 
commented in BPyAddMesh.py, it wasn't exposed because we didnt want 
people to use the add menu as their personal model library.

Rodrigo Hernandez wrote:
> Hello,
> My name is Rodrigo Hernandez and I am writing some code to add an 
> Octahedron primitive
> (dubbed "octaspehere" following the icosphere convention).
> I have already managed to add the code, however I have a couple of 
> questions before submitting a patch:
> 1- My changes are on header_info.c and editmesh_add.c, I reckon I also 
> need to add some code to
> python\api2_2x\meshPrimitive.c in order to expose the function to Python 
> (am I right?), but I also noticed
> that the file toolbox.c in the create_mesh_sublevel function has 
> something that looks vaguely as a primitive menu,
> How should I modify it in order to add the new primitive? would just 
> adding the line for octasphere do?
> My code works without any changes to this file, so I am wondering what 
> exactly does it do.
> 2 - In order not to reinvent the wheel I just made a search for the 
> string icosphere and duplicated the code, then
> made the appropriate modifications, I noticed the static arrays icoverts 
> and icofaces.
> I noticed that icoverts are normal vectors multiplied by 200, I use the 
> length 1 normal vectors on my octaverts,
> it works fine, but I am wondering if I should be using the times 200 
> version instead, is this some sort of floating
> point safeguard? the octaverts are actually coaxial, so I doubt there 
> would be any problems,
> but I rather use the Blender standard and keep everything consistent...
> I might have just answered my own question there.
> So, thats it for now.
> Thanks.
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers

Campbell J Barton (ideasman42)

More information about the Bf-committers mailing list