Re: [Bf-committers] Collada exporter
Am 20.11.2012 00:43, schrieb Gaia: Sure. Any improvement of the Collada module is welcome and appreciated :) Please can you add the patch to the patch tracker at http://projects.blender.org/ ? Then i will take a look on it. thanks! Gaia On 20.11.2012 00:37, Daniel Jungmann wrote: Hi everyone! As I use multiple vertex colors in blender and found out that the collada exporter can't export them all, I wrote a patch so blender exports all vertex colors. Is there any interest here for the patch? ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers Ok, done, ID is 33255 Daniel ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers
[Bf-committers] numpy integration followup
Several months ago, there was a discussion on this list, where integrating numpy was agreed with. However, it obviously didn't happen, probably due to lack of time on the side of platform maintainers. I am now developing a CAM addon for blender, and numpy would really speed up a lot of computations and make life easy for many other interesting addons. I do not want to make an addon which would depend on many external libraries, for obvious reasons. I use myself several platforms on different computers and building same python library can be an uneasy task, especially without an internet connection in my studio(it's hard to believe, but yes, there are still computers/houses without internet out there...) That's why I wanted to ask if there's somebody who would be willing to proceed with the plan of numpy integration ...?please :) Thanks Vilem ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers
Re: [Bf-committers] AAC and ACC3 support
David, I've commited your patch. At least it can not make AAC/AC3 worse :) Also seems the same change was needed for Vorbis with FFmpeg-1.0. On Tue, Nov 20, 2012 at 9:23 PM, Sergey Sharybin sergey@gmail.comwrote: Hi David, Thanks for the patch. From quick glance seems ok. Will do some more tests later tonight. On Tue, Nov 20, 2012 at 7:10 PM, David erwi...@gmx.net wrote: On Nov 19, 2012, at 6:38 PM, Sergey Sharybin wrote: Hi, Well, issue is simple -- in FFmpeg this codecs are marked as experimental and unless you're configuring export context in a proper way (enable experimental codecs) you can not use this codecs. It seems that if FFmpeg is compiled with libfaac this codecs could be used. Bad thing that it makes FFmpeg unable to be redistributed via blender.org. I've made quick tests trying to make AAC/AC3 working without libfaac (seems FFmpeg does have own implementation for this codecs) but it ended up in only noise in output. The question is: is there somebody who're familiar with this stuff and could make it work or we're simply disable this codecs? I just submitted a patch, from the tracker: this patch enables the use of the AAC and AC3 encoders in ffmpeg. These are marked as experimental, yet they seem to be in widespread use and all the information I could find on what makes them experimental is that they create files with suboptimal quality per bitrate, i.e. for a given bitrate the quality achieved could be better. This seems to be an issue only for lower bitrates, any rates 160kbps seem to be transparent anyways. Note: I have not tested the patch more than just quickly encoding one test file, I don't have time to look at this longer unfortunately at the moment. http://projects.blender.org/tracker/index.php?func=detailaid=33242group_id=9atid=127 till then, David. -- With best regards, Sergey Sharybin ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers -- With best regards, Sergey Sharybin -- With best regards, Sergey Sharybin ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers
Re: [Bf-committers] Cursor to center of mass
It's pretty easy to handle: http://www.pasteall.org/37405/python Am 21.11.2012 04:55, schrieb Brecht Van Lommel: Tessfaces includes both triangles and quads, it doesn't triangulate entirely, so you'd need to handle the quads still. Brecht. On Wed, Nov 21, 2012 at 4:30 AM, Ummi Nom ummi...@gmail.com wrote: Hi! I've written some center of mass calculations in python for closed meshes, but there is an issue with using tessfaces in my code; I run mesh.update with tessfaces=True but when I loop over mesh.tessfaces there are only 6 faces in default scene cube so the center of mass is offset. It seems to work when the mesh is triangulated http://www.pasteall.org/37396/python # Code import mathutils from mathutils import * import bpy tess_count = 0 # Handle tri as a tetrahedron with fourth point at origo def handleTri(v1, v2, v3): global tess_count tess_count = tess_count + 1 temp = (v3-v1).cross(v2-v1) nor = temp.normalized() area = 0.5*temp.dot(nor) vol = area*nor.dot(v1)/3.0 centroid = (v1+v2+v3)/4.0 return (centroid, vol) for me in bpy.data.meshes: me.update(calc_tessface=True) sumc= Vector() summ = 0 for f in me.tessfaces: v1 = Vector(me.vertices[f.vertices[0]].co) v2 = Vector(me.vertices[f.vertices[1]].co) v3 = Vector(me.vertices[f.vertices[2]].co) centroid, mass = handleTri(v1, v2, v3) sumc += centroid * mass summ += mass print(tess_count) print(sumc/summ) ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers
Re: [Bf-committers] numpy integration followup
Hi Vilem, Are you sure it didn't happen? I never build with numpy because I don't have it installed, but I always get a warning from CMake saying that NumPy will not be installed due to my system. Which makes me assume Blender itself incorporated numpy. Have you tried one of the official test builds in builder.blender.org? -- Dalai ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers
Re: [Bf-committers] numpy integration followup
On Wed, Nov 21, 2012 at 12:01:49PM +0100, Vilem Novak wrote: Several months ago, there was a discussion on this list, where integrating numpy was agreed with. Not sure what the state of numpy integration with blender is, but if you have numpy installed (for the correct version of blender's python), you can use it simply by adding the path to your local numpy installation. example: import sys sys.append('/usr/local/python3.3/site-packages') import numpy # note: a smarter script would go an look for numpy in the # usual places The appeal of only installing blender is understandable, but the Numpy people already package up their software for various platforms. I'm not sure it is worth our effort to duplicate that work. Stephen -- Stephen Swaney sswa...@centurytel.net ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers
Re: [Bf-committers] Cursor to center of mass
Hey Jason, currently there is a problem with n-gons when chalculating the center of mass. The issue is that we don't have a good way of calculating centroids for n-gons and just use the vertex average, so the calculated origin will drift a little when your polygons have many vertices. I'd prefer to just tirangulate the model and use the triangle centroids but after a discussion with Campbell we decided it's not worth allocating a bunch of faces just to get a litte more accuracy. Regards, Sergej. Am Di, 20. Nov, 2012 um 12:12 ,Jason Wilkins jason.a.wilk...@gmail.com schrieb: Brecht, I figured that was what it did after testing it some, but since subdividing a face caused the center to move slightly I had my doubts. If it was vertexes I expected a really large move (since there were 100 times as many vertexes in my subdivided face than the rest of the model), but using faces or tets it should not move at all. Did I find a bug? On Mon, Nov 19, 2012 at 5:05 PM, Martin Bürbaum wrote: Just FYI - I did something similar (Snap Cursor to Centroid) as a script a while back. http://projects.blender.org/tracker/index.php?func=detailaid=30299group_id=153atid=467 Cheers, Martin Original-Nachricht Datum: Mon, 19 Nov 2012 19:00:23 -0300 Von: Juan Pablo Bouza An: bf-committers@blender.org Betreff: [Bf-committers] Cursor to center of mass Hi! The addition of the center of mass option for object origins is really cool! Now, there are many times in rigging when you need the center of the object to be at 0 0 0, specially for exporting meshes. So, in these cases, the origin to center of mass option would not be used. Nevertheless, the center of mass options would be really usefull for placing objects such as bones... So, I propose to add the center of mass option also in the Cursor snapping menu (shif+S). That would be cursor to center of mass. Cheers! ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers
[Bf-committers] numpy integration followup
Well today I tested various builds on mac including official release build and buildbot build, where none had numpy in it. On windows I tested the same. I also tried to build numpy for mac with python 3.3 and 3.2, and both were unsuccessfull.(so on mac i didn't get it running at all...) On windows, installing numpy is a simple task, since it is really bundled quite comfortably. On ubuntu, its super-simple, as long as you have your machine connected to internet. If not, I cannot imagine how to do that - because you also cannot check if you have all the dependencies. The idea is not only that I as addon developer have to go through some trouble to get things running, also possible users of the addons using the lib have to do the same, where I can see this as a very discouraging moment for possible users. Blender has a full python in it, but to build numpy(on mac), you have to download install python, download numpy and try to build it. then you have to copy it and then you can uninstall python again, in the case you use it only in blender. - which probably most artists do. Cheers Vilem ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers
Re: [Bf-committers] Cursor to center of mass
I can sort of see the reasoning behind that, but I would also argue accuracy can be very important. Maybe it'd be worth it to make a high quality operator bool in the same vein as the high quality normals in the Solidify modifier? -Patrick Date: Wed, 21 Nov 2012 17:36:19 +0001 From: sergej.re...@googlemail.com To: bf-committers@blender.org CC: bf-committers@blender.org Subject: Re: [Bf-committers] Cursor to center of mass Hey Jason, currently there is a problem with n-gons when chalculating the center of mass. The issue is that we don't have a good way of calculating centroids for n-gons and just use the vertex average, so the calculated origin will drift a little when your polygons have many vertices. I'd prefer to just tirangulate the model and use the triangle centroids but after a discussion with Campbell we decided it's not worth allocating a bunch of faces just to get a litte more accuracy. Regards, Sergej. Am Di, 20. Nov, 2012 um 12:12 ,Jason Wilkins jason.a.wilk...@gmail.com schrieb: Brecht, I figured that was what it did after testing it some, but since subdividing a face caused the center to move slightly I had my doubts. If it was vertexes I expected a really large move (since there were 100 times as many vertexes in my subdivided face than the rest of the model), but using faces or tets it should not move at all. Did I find a bug? On Mon, Nov 19, 2012 at 5:05 PM, Martin Bürbaum wrote: Just FYI - I did something similar (Snap Cursor to Centroid) as a script a while back. http://projects.blender.org/tracker/index.php?func=detailaid=30299group_id=153atid=467 Cheers, Martin Original-Nachricht Datum: Mon, 19 Nov 2012 19:00:23 -0300 Von: Juan Pablo Bouza An: bf-committers@blender.org Betreff: [Bf-committers] Cursor to center of mass Hi! The addition of the center of mass option for object origins is really cool! Now, there are many times in rigging when you need the center of the object to be at 0 0 0, specially for exporting meshes. So, in these cases, the origin to center of mass option would not be used. Nevertheless, the center of mass options would be really usefull for placing objects such as bones... So, I propose to add the center of mass option also in the Cursor snapping menu (shif+S). That would be cursor to center of mass. Cheers! ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers
Re: [Bf-committers] Cursor to center of mass
Oops, I forgot this was about the cursor snapping and had something else in mind... My apologies. =) From: p_boel...@msn.com To: bf-committers@blender.org Date: Wed, 21 Nov 2012 20:07:04 +0100 Subject: Re: [Bf-committers] Cursor to center of mass I can sort of see the reasoning behind that, but I would also argue accuracy can be very important. Maybe it'd be worth it to make a high quality operator bool in the same vein as the high quality normals in the Solidify modifier? -Patrick Date: Wed, 21 Nov 2012 17:36:19 +0001 From: sergej.re...@googlemail.com To: bf-committers@blender.org CC: bf-committers@blender.org Subject: Re: [Bf-committers] Cursor to center of mass Hey Jason, currently there is a problem with n-gons when chalculating the center of mass. The issue is that we don't have a good way of calculating centroids for n-gons and just use the vertex average, so the calculated origin will drift a little when your polygons have many vertices. I'd prefer to just tirangulate the model and use the triangle centroids but after a discussion with Campbell we decided it's not worth allocating a bunch of faces just to get a litte more accuracy. Regards, Sergej. Am Di, 20. Nov, 2012 um 12:12 ,Jason Wilkins jason.a.wilk...@gmail.com schrieb: Brecht, I figured that was what it did after testing it some, but since subdividing a face caused the center to move slightly I had my doubts. If it was vertexes I expected a really large move (since there were 100 times as many vertexes in my subdivided face than the rest of the model), but using faces or tets it should not move at all. Did I find a bug? On Mon, Nov 19, 2012 at 5:05 PM, Martin Bürbaum wrote: Just FYI - I did something similar (Snap Cursor to Centroid) as a script a while back. http://projects.blender.org/tracker/index.php?func=detailaid=30299group_id=153atid=467 Cheers, Martin Original-Nachricht Datum: Mon, 19 Nov 2012 19:00:23 -0300 Von: Juan Pablo Bouza An: bf-committers@blender.org Betreff: [Bf-committers] Cursor to center of mass Hi! The addition of the center of mass option for object origins is really cool! Now, there are many times in rigging when you need the center of the object to be at 0 0 0, specially for exporting meshes. So, in these cases, the origin to center of mass option would not be used. Nevertheless, the center of mass options would be really usefull for placing objects such as bones... So, I propose to add the center of mass option also in the Cursor snapping menu (shif+S). That would be cursor to center of mass. Cheers! ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers
Re: [Bf-committers] Cursor to center of mass
Well, the calculation is used first to map the origin of the object and this discussion was just how to extend that to moving the cursor. As for it being because of n-gons, I do not think my model contained n-gons. What I did was call the subdivide operator 4 times on one end of the model, which created a bunch of new quads. Do quads count as n-gons in this case? I'll see if I can duplicate it and provide a .blend that narrows this down if there is a problem. On Wed, Nov 21, 2012 at 1:08 PM, patrick boelens p_boel...@msn.com wrote: Oops, I forgot this was about the cursor snapping and had something else in mind... My apologies. =) From: p_boel...@msn.com To: bf-committers@blender.org Date: Wed, 21 Nov 2012 20:07:04 +0100 Subject: Re: [Bf-committers] Cursor to center of mass I can sort of see the reasoning behind that, but I would also argue accuracy can be very important. Maybe it'd be worth it to make a high quality operator bool in the same vein as the high quality normals in the Solidify modifier? -Patrick Date: Wed, 21 Nov 2012 17:36:19 +0001 From: sergej.re...@googlemail.com To: bf-committers@blender.org CC: bf-committers@blender.org Subject: Re: [Bf-committers] Cursor to center of mass Hey Jason, currently there is a problem with n-gons when chalculating the center of mass. The issue is that we don't have a good way of calculating centroids for n-gons and just use the vertex average, so the calculated origin will drift a little when your polygons have many vertices. I'd prefer to just tirangulate the model and use the triangle centroids but after a discussion with Campbell we decided it's not worth allocating a bunch of faces just to get a litte more accuracy. Regards, Sergej. Am Di, 20. Nov, 2012 um 12:12 ,Jason Wilkins jason.a.wilk...@gmail.com schrieb: Brecht, I figured that was what it did after testing it some, but since subdividing a face caused the center to move slightly I had my doubts. If it was vertexes I expected a really large move (since there were 100 times as many vertexes in my subdivided face than the rest of the model), but using faces or tets it should not move at all. Did I find a bug? On Mon, Nov 19, 2012 at 5:05 PM, Martin Bürbaum wrote: Just FYI - I did something similar (Snap Cursor to Centroid) as a script a while back. http://projects.blender.org/tracker/index.php?func=detailaid=30299group_id=153atid=467 Cheers, Martin Original-Nachricht Datum: Mon, 19 Nov 2012 19:00:23 -0300 Von: Juan Pablo Bouza An: bf-committers@blender.org Betreff: [Bf-committers] Cursor to center of mass Hi! The addition of the center of mass option for object origins is really cool! Now, there are many times in rigging when you need the center of the object to be at 0 0 0, specially for exporting meshes. So, in these cases, the origin to center of mass option would not be used. Nevertheless, the center of mass options would be really usefull for placing objects such as bones... So, I propose to add the center of mass option also in the Cursor snapping menu (shif+S). That would be cursor to center of mass. Cheers! ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers
Re: [Bf-committers] Cursor to center of mass
Hi! I finished writing some testing code (only prints out the cm though). Planar convex/concave n-gon centroids should be correct and for closed meshes there's the tetrahedron stuff which uses either fake tris from polys or correct tris from tessfaces. Non-planar polys won't be correct because of the quick triangulation (v[0], v[i-1], v[i]) and because a flipped tri (vs polynormal) is always considered to have negative area. http://www.pasteall.org/37425/python On Thu, Nov 22, 2012 at 12:20 AM, Jason Wilkins jason.a.wilk...@gmail.comwrote: Well, the calculation is used first to map the origin of the object and this discussion was just how to extend that to moving the cursor. As for it being because of n-gons, I do not think my model contained n-gons. What I did was call the subdivide operator 4 times on one end of the model, which created a bunch of new quads. Do quads count as n-gons in this case? I'll see if I can duplicate it and provide a .blend that narrows this down if there is a problem. On Wed, Nov 21, 2012 at 1:08 PM, patrick boelens p_boel...@msn.com wrote: Oops, I forgot this was about the cursor snapping and had something else in mind... My apologies. =) From: p_boel...@msn.com To: bf-committers@blender.org Date: Wed, 21 Nov 2012 20:07:04 +0100 Subject: Re: [Bf-committers] Cursor to center of mass I can sort of see the reasoning behind that, but I would also argue accuracy can be very important. Maybe it'd be worth it to make a high quality operator bool in the same vein as the high quality normals in the Solidify modifier? -Patrick Date: Wed, 21 Nov 2012 17:36:19 +0001 From: sergej.re...@googlemail.com To: bf-committers@blender.org CC: bf-committers@blender.org Subject: Re: [Bf-committers] Cursor to center of mass Hey Jason, currently there is a problem with n-gons when chalculating the center of mass. The issue is that we don't have a good way of calculating centroids for n-gons and just use the vertex average, so the calculated origin will drift a little when your polygons have many vertices. I'd prefer to just tirangulate the model and use the triangle centroids but after a discussion with Campbell we decided it's not worth allocating a bunch of faces just to get a litte more accuracy. Regards, Sergej. Am Di, 20. Nov, 2012 um 12:12 ,Jason Wilkins jason.a.wilk...@gmail.com schrieb: Brecht, I figured that was what it did after testing it some, but since subdividing a face caused the center to move slightly I had my doubts. If it was vertexes I expected a really large move (since there were 100 times as many vertexes in my subdivided face than the rest of the model), but using faces or tets it should not move at all. Did I find a bug? On Mon, Nov 19, 2012 at 5:05 PM, Martin Bürbaum wrote: Just FYI - I did something similar (Snap Cursor to Centroid) as a script a while back. http://projects.blender.org/tracker/index.php?func=detailaid=30299group_id=153atid=467 Cheers, Martin Original-Nachricht Datum: Mon, 19 Nov 2012 19:00:23 -0300 Von: Juan Pablo Bouza An: bf-committers@blender.org Betreff: [Bf-committers] Cursor to center of mass Hi! The addition of the center of mass option for object origins is really cool! Now, there are many times in rigging when you need the center of the object to be at 0 0 0, specially for exporting meshes. So, in these cases, the origin to center of mass option would not be used. Nevertheless, the center of mass options would be really usefull for placing objects such as bones... So, I propose to add the center of mass option also in the Cursor snapping menu (shif+S). That would be cursor to center of mass. Cheers! ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers ___ Bf-committers mailing list Bf-committers@blender.org
Re: [Bf-committers] Cursor to center of mass
Did you check against 'non orientable surfaces'? like Möbius strip Klein Bottle I doubt the algorithm stands with that... As far as I remember those objects have no defined volume? As : how would you like to make a cylinder from a Möbius strip? You can always create a bounding object .. like in triangulating the circle .. alas .. it will be getting close enough, which might be sufficient for blender, and might be nice to have.. Well if blender refuses to create such geometry .. bad enough Mathematica and friends can. Well I think you should check the definition of 'closed' and require 'orientable' and it will work out fine. so much for that BM one more .. your algorithm assumes homogeneous density .. how realistic is that ? .. for all cases ? Is a balloon filled with air the same as the balloon filled with water? As the mass is on the surface versus the mass is in the volume ? Am 21.11.2012 04:30, schrieb Ummi Nom: Hi! I've written some center of mass calculations in python for closed meshes, but there is an issue with using tessfaces in my code; I run mesh.update with tessfaces=True but when I loop over mesh.tessfaces there are only 6 faces in default scene cube so the center of mass is offset. It seems to work when the mesh is triangulated http://www.pasteall.org/37396/python # Code import mathutils from mathutils import * import bpy tess_count = 0 # Handle tri as a tetrahedron with fourth point at origo def handleTri(v1, v2, v3): global tess_count tess_count = tess_count + 1 temp = (v3-v1).cross(v2-v1) nor = temp.normalized() area = 0.5*temp.dot(nor) vol = area*nor.dot(v1)/3.0 centroid = (v1+v2+v3)/4.0 return (centroid, vol) for me in bpy.data.meshes: me.update(calc_tessface=True) sumc= Vector() summ = 0 for f in me.tessfaces: v1 = Vector(me.vertices[f.vertices[0]].co) v2 = Vector(me.vertices[f.vertices[1]].co) v3 = Vector(me.vertices[f.vertices[2]].co) centroid, mass = handleTri(v1, v2, v3) sumc += centroid * mass summ += mass print(tess_count) print(sumc/summ) ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers
Re: [Bf-committers] Cursor to center of mass
Every algorithm has it's limitations. Computing the center of mass for a body that has no volume is a quite useless task and assuming inhomogeneous density for a body that is only defined by the surface is also questionable. For the average case a closed surface and the assumption of homogeneity is already sufficient enough. For anything else you could play around with shrinkwrap or something else to create a hull that approximates the volume. Regarding the balloon. It doesn't matter in this case if the mass is centred at the surface or inside the volume. The result for the center of mass is still the same. It would only matter if you had a balloon filled half with water and half air. Am 22.11.2012 02:46, schrieb bjornm...@gmx.net: Did you check against 'non orientable surfaces'? like Möbius strip Klein Bottle I doubt the algorithm stands with that... As far as I remember those objects have no defined volume? As : how would you like to make a cylinder from a Möbius strip? You can always create a bounding object .. like in triangulating the circle .. alas .. it will be getting close enough, which might be sufficient for blender, and might be nice to have.. Well if blender refuses to create such geometry .. bad enough Mathematica and friends can. Well I think you should check the definition of 'closed' and require 'orientable' and it will work out fine. so much for that BM one more .. your algorithm assumes homogeneous density .. how realistic is that ? .. for all cases ? Is a balloon filled with air the same as the balloon filled with water? As the mass is on the surface versus the mass is in the volume ? Am 21.11.2012 04:30, schrieb Ummi Nom: Hi! I've written some center of mass calculations in python for closed meshes, but there is an issue with using tessfaces in my code; I run mesh.update with tessfaces=True but when I loop over mesh.tessfaces there are only 6 faces in default scene cube so the center of mass is offset. It seems to work when the mesh is triangulated http://www.pasteall.org/37396/python # Code import mathutils from mathutils import * import bpy tess_count = 0 # Handle tri as a tetrahedron with fourth point at origo def handleTri(v1, v2, v3): global tess_count tess_count = tess_count + 1 temp = (v3-v1).cross(v2-v1) nor = temp.normalized() area = 0.5*temp.dot(nor) vol = area*nor.dot(v1)/3.0 centroid = (v1+v2+v3)/4.0 return (centroid, vol) for me in bpy.data.meshes: me.update(calc_tessface=True) sumc= Vector() summ = 0 for f in me.tessfaces: v1 = Vector(me.vertices[f.vertices[0]].co) v2 = Vector(me.vertices[f.vertices[1]].co) v3 = Vector(me.vertices[f.vertices[2]].co) centroid, mass = handleTri(v1, v2, v3) sumc += centroid * mass summ += mass print(tess_count) print(sumc/summ) ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers
Re: [Bf-committers] Cursor to center of mass
Hi! I'm aiming a bit lower so I prefer to attack the mechanics of the problem. Limiting the calculation by actual volume to when it makes sense would be nice, but detecting overlaps etc. seems overkill. Here's later code which does it basically two ways, one is the tetrahedron and the other is polygon centroid. http://www.pasteall.org/37425/python On Thu, Nov 22, 2012 at 3:46 AM, bjornm...@gmx.net bjornm...@gmx.netwrote: Did you check against 'non orientable surfaces'? like Möbius strip Klein Bottle I doubt the algorithm stands with that... As far as I remember those objects have no defined volume? As : how would you like to make a cylinder from a Möbius strip? You can always create a bounding object .. like in triangulating the circle .. alas .. it will be getting close enough, which might be sufficient for blender, and might be nice to have.. Well if blender refuses to create such geometry .. bad enough Mathematica and friends can. Well I think you should check the definition of 'closed' and require 'orientable' and it will work out fine. so much for that BM one more .. your algorithm assumes homogeneous density .. how realistic is that ? .. for all cases ? Is a balloon filled with air the same as the balloon filled with water? As the mass is on the surface versus the mass is in the volume ? Am 21.11.2012 04:30, schrieb Ummi Nom: Hi! I've written some center of mass calculations in python for closed meshes, but there is an issue with using tessfaces in my code; I run mesh.update with tessfaces=True but when I loop over mesh.tessfaces there are only 6 faces in default scene cube so the center of mass is offset. It seems to work when the mesh is triangulated http://www.pasteall.org/37396/python # Code import mathutils from mathutils import * import bpy tess_count = 0 # Handle tri as a tetrahedron with fourth point at origo def handleTri(v1, v2, v3): global tess_count tess_count = tess_count + 1 temp = (v3-v1).cross(v2-v1) nor = temp.normalized() area = 0.5*temp.dot(nor) vol = area*nor.dot(v1)/3.0 centroid = (v1+v2+v3)/4.0 return (centroid, vol) for me in bpy.data.meshes: me.update(calc_tessface=True) sumc= Vector() summ = 0 for f in me.tessfaces: v1 = Vector(me.vertices[f.vertices[0]].co) v2 = Vector(me.vertices[f.vertices[1]].co) v3 = Vector(me.vertices[f.vertices[2]].co) centroid, mass = handleTri(v1, v2, v3) sumc += centroid * mass summ += mass print(tess_count) print(sumc/summ) ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers
Re: [Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52453] trunk/blender: Fix 33149: LLVM caused startup crash on linux systems using Mesa llvmpipe.
Thanks, Brecht! Have been trying to make this working tonight, but something didn't work.. On Thu, Nov 22, 2012 at 3:28 AM, Brecht Van Lommel brechtvanlom...@pandora.be wrote: Revision: 52453 http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=52453 Author: blendix Date: 2012-11-21 22:28:15 + (Wed, 21 Nov 2012) Log Message: --- Fix 33149: LLVM caused startup crash on linux systems using Mesa llvmpipe. Now we hide the LLVM symbols with an ld version script to avoid conflicts. Modified Paths: -- trunk/blender/CMakeLists.txt trunk/blender/build_files/buildbot/config/user-config-glibc211-i686.py trunk/blender/build_files/buildbot/config/user-config-glibc211-x86_64.py trunk/blender/build_files/buildbot/config/user-config-glibc27-i686.py trunk/blender/build_files/buildbot/config/user-config-glibc27-x86_64.py trunk/blender/build_files/scons/config/linux-config.py Added Paths: --- trunk/blender/source/creator/blender.map Modified: trunk/blender/CMakeLists.txt === --- trunk/blender/CMakeLists.txt2012-11-21 21:42:07 UTC (rev 52452) +++ trunk/blender/CMakeLists.txt2012-11-21 22:28:15 UTC (rev 52453) @@ -759,6 +759,9 @@ else() message(FATAL_ERROR LLVM not found.) endif() + + # Fix for conflict with Mesa llvmpipe + set(PLATFORM_LINKFLAGS ${PLATFORM_LINKFLAGS} -Wl,--version-script=${CMAKE_SOURCE_DIR}/source/creator/blender.map) endif() if(WITH_CYCLES_OSL) @@ -821,7 +824,7 @@ endif() endif() - set(PLATFORM_LINKFLAGS -pthread) + set(PLATFORM_LINKFLAGS ${PLATFORM_LINKFLAGS} -pthread) # lfs on glibc, all compilers should use add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE) Modified: trunk/blender/build_files/buildbot/config/user-config-glibc211-i686.py === --- trunk/blender/build_files/buildbot/config/user-config-glibc211-i686.py 2012-11-21 21:42:07 UTC (rev 52452) +++ trunk/blender/build_files/buildbot/config/user-config-glibc211-i686.py 2012-11-21 22:28:15 UTC (rev 52453) @@ -162,4 +162,4 @@ BF_DEBUG = False REL_CCFLAGS = ['-O2', '-msse', '-msse2'] # C C++ PLATFORM_LINKFLAGS = ['-lrt'] -BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive'] +BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive', '-Wl,--version-script=source/creator/blender.map'] Modified: trunk/blender/build_files/buildbot/config/user-config-glibc211-x86_64.py === --- trunk/blender/build_files/buildbot/config/user-config-glibc211-x86_64.py 2012-11-21 21:42:07 UTC (rev 52452) +++ trunk/blender/build_files/buildbot/config/user-config-glibc211-x86_64.py 2012-11-21 22:28:15 UTC (rev 52453) @@ -161,4 +161,4 @@ BF_DEBUG = False REL_CCFLAGS = ['-O2', '-msse', '-msse2'] # C C++ PLATFORM_LINKFLAGS = ['-lrt'] -BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive'] +BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive', '-Wl,--version-script=source/creator/blender.map'] Modified: trunk/blender/build_files/buildbot/config/user-config-glibc27-i686.py === --- trunk/blender/build_files/buildbot/config/user-config-glibc27-i686.py 2012-11-21 21:42:07 UTC (rev 52452) +++ trunk/blender/build_files/buildbot/config/user-config-glibc27-i686.py 2012-11-21 22:28:15 UTC (rev 52453) @@ -147,4 +147,4 @@ BF_DEBUG = False REL_CCFLAGS = ['-O2'] # C C++ PLATFORM_LINKFLAGS = ['-L/home/sources/staticlibs/lib32'] -BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive'] +BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive', '-Wl,--version-script=source/creator/blender.map'] Modified: trunk/blender/build_files/buildbot/config/user-config-glibc27-x86_64.py === --- trunk/blender/build_files/buildbot/config/user-config-glibc27-x86_64.py 2012-11-21 21:42:07 UTC (rev 52452) +++ trunk/blender/build_files/buildbot/config/user-config-glibc27-x86_64.py 2012-11-21 22:28:15 UTC (rev 52453) @@ -146,4 +146,4 @@ BF_DEBUG = False REL_CCFLAGS = ['-O2', '-msse', '-msse2'] # C C++ PLATFORM_LINKFLAGS = ['-L/home/sources/staticlibs/lib64'] -BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive'] +BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive', '-Wl,--version-script=source/creator/blender.map']
Re: [Bf-committers] Cursor to center of mass
Actually, subdivide creates n-gons in most cases (unless you use it on edge rings or the whole mesh), so it's likely to be the problem. Also here is a quick patch that adds a Cursor to Center of Mass option: http://www.pasteall.org/37435/diff Am Mi, 21. Nov, 2012 um 11:20 ,Jason Wilkins jason.a.wilk...@gmail.com schrieb: Well, the calculation is used first to map the origin of the object and this discussion was just how to extend that to moving the cursor. As for it being because of n-gons, I do not think my model contained n-gons. What I did was call the subdivide operator 4 times on one end of the model, which created a bunch of new quads. Do quads count as n-gons in this case? I'll see if I can duplicate it and provide a .blend that narrows this down if there is a problem. On Wed, Nov 21, 2012 at 1:08 PM, patrick boelens wrote: Oops, I forgot this was about the cursor snapping and had something else in mind... My apologies. =) From: p_boel...@msn.com To: bf-committers@blender.org Date: Wed, 21 Nov 2012 20:07:04 +0100 Subject: Re: [Bf-committers] Cursor to center of mass I can sort of see the reasoning behind that, but I would also argue accuracy can be very important. Maybe it'd be worth it to make a high quality operator bool in the same vein as the high quality normals in the Solidify modifier? -Patrick Date: Wed, 21 Nov 2012 17:36:19 +0001 From: sergej.re...@googlemail.com To: bf-committers@blender.org CC: bf-committers@blender.org Subject: Re: [Bf-committers] Cursor to center of mass Hey Jason, currently there is a problem with n-gons when chalculating the center of mass. The issue is that we don't have a good way of calculating centroids for n-gons and just use the vertex average, so the calculated origin will drift a little when your polygons have many vertices. I'd prefer to just tirangulate the model and use the triangle centroids but after a discussion with Campbell we decided it's not worth allocating a bunch of faces just to get a litte more accuracy. Regards, Sergej. Am Di, 20. Nov, 2012 um 12:12 ,Jason Wilkins schrieb: Brecht, I figured that was what it did after testing it some, but since subdividing a face caused the center to move slightly I had my doubts. If it was vertexes I expected a really large move (since there were 100 times as many vertexes in my subdivided face than the rest of the model), but using faces or tets it should not move at all. Did I find a bug? On Mon, Nov 19, 2012 at 5:05 PM, Martin Bürbaum wrote: Just FYI - I did something similar (Snap Cursor to Centroid) as a script a while back. http://projects.blender.org/tracker/index.php?func=detailaid=30299group_id=153atid=467 Cheers, Martin Original-Nachricht Datum: Mon, 19 Nov 2012 19:00:23 -0300 Von: Juan Pablo Bouza An: bf-committers@blender.org Betreff: [Bf-committers] Cursor to center of mass Hi! The addition of the center of mass option for object origins is really cool! Now, there are many times in rigging when you need the center of the object to be at 0 0 0, specially for exporting meshes. So, in these cases, the origin to center of mass option would not be used. Nevertheless, the center of mass options would be really usefull for placing objects such as bones... So, I propose to add the center of mass option also in the Cursor snapping menu (shif+S). That would be cursor to center of mass. Cheers! ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers
Re: [Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52453] trunk/blender: Fix 33149: LLVM caused startup crash on linux systems using Mesa llvmpipe.
Yes, can confirm my fedora vbox build is now working fine! Many thanks, Brecht! :) On 22/11/2012 07:46, Sergey Sharybin wrote: Thanks, Brecht! Have been trying to make this working tonight, but something didn't work.. On Thu, Nov 22, 2012 at 3:28 AM, Brecht Van Lommel brechtvanlom...@pandora.be wrote: Revision: 52453 http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=52453 Author: blendix Date: 2012-11-21 22:28:15 + (Wed, 21 Nov 2012) Log Message: --- Fix 33149: LLVM caused startup crash on linux systems using Mesa llvmpipe. Now we hide the LLVM symbols with an ld version script to avoid conflicts. Modified Paths: -- trunk/blender/CMakeLists.txt trunk/blender/build_files/buildbot/config/user-config-glibc211-i686.py trunk/blender/build_files/buildbot/config/user-config-glibc211-x86_64.py trunk/blender/build_files/buildbot/config/user-config-glibc27-i686.py trunk/blender/build_files/buildbot/config/user-config-glibc27-x86_64.py trunk/blender/build_files/scons/config/linux-config.py Added Paths: --- trunk/blender/source/creator/blender.map Modified: trunk/blender/CMakeLists.txt === --- trunk/blender/CMakeLists.txt2012-11-21 21:42:07 UTC (rev 52452) +++ trunk/blender/CMakeLists.txt2012-11-21 22:28:15 UTC (rev 52453) @@ -759,6 +759,9 @@ else() message(FATAL_ERROR LLVM not found.) endif() + + # Fix for conflict with Mesa llvmpipe + set(PLATFORM_LINKFLAGS ${PLATFORM_LINKFLAGS} -Wl,--version-script=${CMAKE_SOURCE_DIR}/source/creator/blender.map) endif() if(WITH_CYCLES_OSL) @@ -821,7 +824,7 @@ endif() endif() - set(PLATFORM_LINKFLAGS -pthread) + set(PLATFORM_LINKFLAGS ${PLATFORM_LINKFLAGS} -pthread) # lfs on glibc, all compilers should use add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE) Modified: trunk/blender/build_files/buildbot/config/user-config-glibc211-i686.py === --- trunk/blender/build_files/buildbot/config/user-config-glibc211-i686.py 2012-11-21 21:42:07 UTC (rev 52452) +++ trunk/blender/build_files/buildbot/config/user-config-glibc211-i686.py 2012-11-21 22:28:15 UTC (rev 52453) @@ -162,4 +162,4 @@ BF_DEBUG = False REL_CCFLAGS = ['-O2', '-msse', '-msse2'] # C C++ PLATFORM_LINKFLAGS = ['-lrt'] -BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive'] +BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive', '-Wl,--version-script=source/creator/blender.map'] Modified: trunk/blender/build_files/buildbot/config/user-config-glibc211-x86_64.py === --- trunk/blender/build_files/buildbot/config/user-config-glibc211-x86_64.py 2012-11-21 21:42:07 UTC (rev 52452) +++ trunk/blender/build_files/buildbot/config/user-config-glibc211-x86_64.py 2012-11-21 22:28:15 UTC (rev 52453) @@ -161,4 +161,4 @@ BF_DEBUG = False REL_CCFLAGS = ['-O2', '-msse', '-msse2'] # C C++ PLATFORM_LINKFLAGS = ['-lrt'] -BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive'] +BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive', '-Wl,--version-script=source/creator/blender.map'] Modified: trunk/blender/build_files/buildbot/config/user-config-glibc27-i686.py === --- trunk/blender/build_files/buildbot/config/user-config-glibc27-i686.py 2012-11-21 21:42:07 UTC (rev 52452) +++ trunk/blender/build_files/buildbot/config/user-config-glibc27-i686.py 2012-11-21 22:28:15 UTC (rev 52453) @@ -147,4 +147,4 @@ BF_DEBUG = False REL_CCFLAGS = ['-O2'] # C C++ PLATFORM_LINKFLAGS = ['-L/home/sources/staticlibs/lib32'] -BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive'] +BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive', '-Wl,--version-script=source/creator/blender.map'] Modified: trunk/blender/build_files/buildbot/config/user-config-glibc27-x86_64.py === --- trunk/blender/build_files/buildbot/config/user-config-glibc27-x86_64.py 2012-11-21 21:42:07 UTC (rev 52452) +++ trunk/blender/build_files/buildbot/config/user-config-glibc27-x86_64.py 2012-11-21 22:28:15 UTC (rev 52453) @@ -146,4 +146,4 @@ BF_DEBUG = False REL_CCFLAGS = ['-O2', '-msse', '-msse2'] # C C++ PLATFORM_LINKFLAGS = ['-L/home/sources/staticlibs/lib64'] -BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec',