Object: Fracture tools #21793

Closed
opened 2010-03-27 12:53:01 +01:00 by Brendon Murphy · 33 comments
Member

Project: Blender Extensions
Tracker: Py Scripts Release
Blender: 2.64
Python: 3.2
Script name: Object: Fracture Tools
Homepage: http://blenderartists.org/forum/showthread.php?t=181391
Wiki page: http://wiki.blender.org/index.php/Extensions:2.5/Py/Scripts/Object/Fracture
Author(s): pildanovak (vilda)
Category: Object
SVN Download: https://svn.blender.org/svnroot/bf-extensions/trunk/py/scripts/addons/object_fracture/
Status: Open

%%%Short tutorial:
1.Download and install extension. go to preferences->addons>install, find the .zip file(do not unpack it yourself, installer does). Then enable the Fracture extension.
2. create a manifold mesh(cube), space-search fracture object operator, run it.
3. Tweak the operator properties in the last operator area. then check execute. The operator tweaking isn't possible since that point. If you set up a lot of shards, you'll have to wait.
4. select all the shards you want to take part in explosion. Then search and run the Setup shards operator.
5. run these 2 operators: Add rigidbody recorder, Add bomb.
6. you can place the bomb whereever you want, and tweak it's properties in the logic window. prop names should be self explanatory.
7. Select the shards.
8. Run the game engine.
9. After leaving engine, your animation should be baked.

Notes:
there is allready game engine recording feature in 2.5, so theoretically this could be redone to not use the recorder, but now you have to use it because it also freezes objects in the beginning. I also consider the possibility to re-bake just the selected shards much better than baking all rigidbodies in the scene...
No projectile or 'active shard' feature from 2.49, not possible with 2.5 now.
Also no 2d version(no acces to images from rna yet ), no voronoi yet e.t.c. I have now very few time for this, so anybody wanting to play with the code is welcome. It's very simple, just few lines of code!%%%

**Project**: Blender Extensions **Tracker**: Py Scripts Release **Blender**: 2.64 **Python**: 3.2 **Script name**: Object: Fracture Tools **Homepage**: http://blenderartists.org/forum/showthread.php?t=181391 **Wiki page**: http://wiki.blender.org/index.php/Extensions:2.5/Py/Scripts/Object/Fracture **Author(s)**: pildanovak (vilda) **Category**: Object **SVN Download**: https://svn.blender.org/svnroot/bf-extensions/trunk/py/scripts/addons/object_fracture/ **Status**: Open %%%Short tutorial: 1.Download and install extension. go to preferences->addons>install, find the .zip file(do not unpack it yourself, installer does). Then enable the Fracture extension. 2. create a manifold mesh(cube), space-search fracture object operator, run it. 3. Tweak the operator properties in the last operator area. then check execute. The operator tweaking isn't possible since that point. If you set up a lot of shards, you'll have to wait. 4. select all the shards you want to take part in explosion. Then search and run the Setup shards operator. 5. run these 2 operators: Add rigidbody recorder, Add bomb. 6. you can place the bomb whereever you want, and tweak it's properties in the logic window. prop names should be self explanatory. 7. Select the shards. 8. Run the game engine. 9. After leaving engine, your animation should be baked. Notes: there is allready game engine recording feature in 2.5, so theoretically this could be redone to not use the recorder, but now you have to use it because it also freezes objects in the beginning. I also consider the possibility to re-bake just the selected shards much better than baking all rigidbodies in the scene... No projectile or 'active shard' feature from 2.49, not possible with 2.5 now. Also no 2d version(no acces to images from rna yet ), no voronoi yet e.t.c. I have now very few time for this, so anybody wanting to play with the code is welcome. It's very simple, just few lines of code!%%%
Author
Member

Changed status to: 'Open'

Changed status to: 'Open'

This task was automatically closed as archived as part of migration, because it was determined to be no longer active.

The authoritative list of addons is on the wiki, we no longer have a report for each addon to track bugs and updates. Bugs can be reported individually and assigned to the addon developers. See the #Addons project page for more information on the workflow.

This task was automatically closed as archived as part of migration, because it was determined to be no longer active. The authoritative list of addons is on the wiki, we no longer have a report for each addon to track bugs and updates. Bugs can be reported individually and assigned to the addon developers. See the #Addons project page for more information on the workflow.

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'

%%%Fixed archive fracture.zip

  • Converted the .rar into a .zip file
  • Removed unnecessary files inside (.blend1, .blend2 ~ backup files and .pyc)
  • Fixed for API changes (Mathutils -> mathutils)

fracture.rar is obsolete%%%

%%%Fixed archive fracture.zip * Converted the .rar into a .zip file * Removed unnecessary files inside (.blend1, .blend2 ~ backup files and .pyc) * Fixed for API changes (Mathutils -> mathutils) fracture.rar is obsolete%%%

%%%New fracture.zip

  • Fixed problem with create_mesh() (API change: needs a scene as first parameter)
  • Made the scripts PEP8 compatible and cleaned up the code a bit.%%%
%%%New fracture.zip * Fixed problem with create_mesh() (API change: needs a scene as first parameter) * Made the scripts PEP8 compatible and cleaned up the code a bit.%%%

%%%The script is available in bf-extensions trunk now (r562++).%%%

%%%The script is available in bf-extensions trunk now (r562++).%%%

%%%in version 2.0 script return errors
in ubuntu 10.04, with http://ppa.launchpad.net/cheleb/blender-svn/ubuntu for download blender and addons%%%

%%%in version 2.0 script return errors in ubuntu 10.04, with http://ppa.launchpad.net/cheleb/blender-svn/ubuntu for download blender and addons%%%
Member

%%%- marked as no wiki
wikipage is there but massively incomplete.%%%

%%%- marked as no wiki wikipage is there but massively incomplete.%%%

%%%I fixed errors in bomb and recorder script, caused by the Python API changes. It should work with Blender 2.56.6 now.%%%

%%%I fixed errors in bomb and recorder script, caused by the Python API changes. It should work with Blender 2.56.6 now.%%%
Author
Member

%%%Reported & confirmed broken in Release 2.57%%%

%%%Reported & confirmed broken in Release 2.57%%%

%%%I think I found and fixed the problem – was line 217 in fracture_ops.py
Attached the fixed (I hope) version.%%%

%%%I think I found and fixed the problem – was line 217 in fracture_ops.py Attached the fixed (I hope) version.%%%

%%%Bah, in fact, there are other problems as well – will try to check all today…%%%

%%%Bah, in fact, there are other problems as well – will try to check all today…%%%

%%%Updated data.blend for py api changes...

current_frame --> frame_current
object.selected ---> object.select

Check for default__cam name and ignore in recorder script (threw errors if nothing was selected)

Also if the user added a projectile it would never collide with teh broken objects as it was looking for game property "age" when the pieces have game property "shard"... Fixed, checked and it works.%%%

%%%Updated data.blend for py api changes... current_frame --> frame_current object.selected ---> object.select Check for __default__cam__ name and ignore in recorder script (threw errors if nothing was selected) Also if the user added a projectile it would never collide with teh broken objects as it was looking for game property "age" when the pieces have game property "shard"... Fixed, checked and it works.%%%

%%%Bug fixes:
*bpy.ops.object.duplicate(linked=False, mode=1) → bpy.ops.object.duplicate(linked=False, mode='DUMMY')
*Only 20 layers in Blender! (rem lines 72-74)

Enhancements:
*Commented out non-manifold check on returned shards (lines 234-235)
*Modified Fracture Group UI (now using custom draw func, to be able to search existing groups without having to reload the whole Python!)

Also, updated API version to 36147.%%%

%%%Bug fixes: *bpy.ops.object.duplicate(linked=False, mode=1) → bpy.ops.object.duplicate(linked=False, mode='DUMMY') *Only 20 layers in Blender! (rem lines 72-74) Enhancements: *Commented out non-manifold check on returned shards (lines 234-235) *Modified Fracture Group UI (now using custom draw func, to be able to search existing groups without having to reload the whole Python!) Also, updated API version to 36147.%%%

%%%As I was at it, I made a few enhancements (I hope!) to that nice tool… So here is a 2.1 proposition :)

Heavily reviewed fracture group behavior:

  • It now does a (very basic) optimization by roughly detecting if a cutter could affect
  a given object.
  • Now, it really fractures objects: you get “difference shards”, ie parts of object outside
  of any cutter, and “intersect shards”, ie parts of object inside cutters – taking into
  account situations where cutters intersect each others ! So this allows to create very precise and specific cuts.
  • And optionally, you can choose whether to get only diff or inter shards.

Also changed UI part:

  • Now using a single operator for both simple and group fracture.
  • Put settings properties in a collection in scene object.
  • This allows for the tool to be fired from a “tool panel”, like e.g. cloud generator, and
  to get rid of this ugly exe property!

All this in attached file!
%%%

%%%As I was at it, I made a few enhancements (I hope!) to that nice tool… So here is a 2.1 proposition :) Heavily reviewed fracture group behavior: * It now does a (very basic) optimization by roughly detecting if a cutter could affect ``` a given object. ``` * Now, it really fractures objects: you get “difference shards”, ie parts of object outside ``` of any cutter, and “intersect shards”, ie parts of object inside cutters – taking into account situations where cutters intersect each others ! So this allows to create very precise and specific cuts. ``` * And optionally, you can choose whether to get only diff or inter shards. Also changed UI part: * Now using a single operator for both simple and group fracture. * Put settings properties in a collection in scene object. * This allows for the tool to be fired from a “tool panel”, like e.g. cloud generator, and ``` to get rid of this ugly exe property! ``` All this in attached file! %%%

%%%An update (correcting a bug in bbox intersection detection, and a few UI improvements).%%%

%%%An update (correcting a bug in bbox intersection detection, and a few UI improvements).%%%

%%%Bastien, i think your last commits broke something...

[code]
Boolean code using new merge technique.
Traceback (most recent call last):

File "/home/michael/svn-blender/install/linux2/2.57/scripts/addons/object_fracture/fracture_ops.py", line 398, in execute
  self.roughness)
File "/home/michael/svn-blender/install/linux2/2.57/scripts/addons/object_fracture/fracture_ops.py", line 309, in fracture_basic
  newshards = splitobject(context, ob, crack_type, roughness)
File "/home/michael/svn-blender/install/linux2/2.57/scripts/addons/object_fracture/fracture_ops.py", line 272, in splitobject
  fault, newshards = boolop(ob, cutter, op)
File "/home/michael/svn-blender/install/linux2/2.57/scripts/addons/object_fracture/fracture_ops.py", line 217, in boolop
  bpy.ops.object.duplicate(linked=False, mode=1)
File "/home/michael/svn-blender/install/linux2/2.57/scripts/modules/bpy/ops.py", line 179, in __call__
  ret = op_call(self.idname_py(), None, kw)

TypeError: Converting py args to operator properties: OBJECT_OT_duplicate.mode expected a string enum or a set of strings in ('INIT', 'DUMMY', 'TRANSLATION', 'ROTATION', 'RESIZE', 'TOSPHERE', 'SHEAR', 'WARP', 'SHRINKFATTEN', 'TILT', 'TRACKBALL', 'PUSHPULL', 'CREASE', 'MIRROR', 'BONE_SIZE', 'BONE_ENVELOPE', 'CURVE_SHRINKFATTEN', 'BONE_ROLL', 'TIME_TRANSLATE', 'TIME_SLIDE', 'TIME_SCALE', 'TIME_EXTEND', 'BAKE_TIME', 'BEVEL', 'BWEIGHT', 'ALIGN', 'EDGESLIDE', 'SEQSLIDE'), not int

location::-1

location::-1

[/code]%%%

%%%Bastien, i think your last commits broke something... [code] Boolean code using new merge technique. Traceback (most recent call last): ``` File "/home/michael/svn-blender/install/linux2/2.57/scripts/addons/object_fracture/fracture_ops.py", line 398, in execute self.roughness) File "/home/michael/svn-blender/install/linux2/2.57/scripts/addons/object_fracture/fracture_ops.py", line 309, in fracture_basic newshards = splitobject(context, ob, crack_type, roughness) File "/home/michael/svn-blender/install/linux2/2.57/scripts/addons/object_fracture/fracture_ops.py", line 272, in splitobject fault, newshards = boolop(ob, cutter, op) File "/home/michael/svn-blender/install/linux2/2.57/scripts/addons/object_fracture/fracture_ops.py", line 217, in boolop bpy.ops.object.duplicate(linked=False, mode=1) File "/home/michael/svn-blender/install/linux2/2.57/scripts/modules/bpy/ops.py", line 179, in __call__ ret = op_call(self.idname_py(), None, kw) ``` TypeError: Converting py args to operator properties: OBJECT_OT_duplicate.mode expected a string enum or a set of strings in ('INIT', 'DUMMY', 'TRANSLATION', 'ROTATION', 'RESIZE', 'TOSPHERE', 'SHEAR', 'WARP', 'SHRINKFATTEN', 'TILT', 'TRACKBALL', 'PUSHPULL', 'CREASE', 'MIRROR', 'BONE_SIZE', 'BONE_ENVELOPE', 'CURVE_SHRINKFATTEN', 'BONE_ROLL', 'TIME_TRANSLATE', 'TIME_SLIDE', 'TIME_SCALE', 'TIME_EXTEND', 'BAKE_TIME', 'BEVEL', 'BWEIGHT', 'ALIGN', 'EDGESLIDE', 'SEQSLIDE'), not int location:<unknown location>:-1 location:<unknown location>:-1 [/code]%%%

%%%Michael, I don’t know whether you talk about my last svn commit, or my 2.1 proposition (which I didn’t commit in svn), but you are using neither of those… The line in your trace back…

File "/home/michael/svn-blender/install/linux2/2.57/scripts/addons/object_fracture/fracture_ops.py", line 217, in boolop bpy.ops.object.duplicate(linked=False, mode=1)

…was one of the fixes I have to make, as the object.duplicate() op now needs a string as mode parameter (I used the 'DUMMY' one).

So please check that you really have the latest svn version of fracture, and test again…%%%

%%%Michael, I don’t know whether you talk about my last svn commit, or my 2.1 proposition (which I didn’t commit in svn), but you are using neither of those… The line in your trace back… File "/home/michael/svn-blender/install/linux2/2.57/scripts/addons/object_fracture/fracture_ops.py", line 217, in boolop bpy.ops.object.duplicate(linked=False, mode=1) …was one of the fixes I have to make, as the object.duplicate() op now needs a string as mode parameter (I used the 'DUMMY' one). So please check that you really have the latest svn version of fracture, and test again…%%%

%%%Ah, i don't know if i'm just missing some obscure setting, but this Add-on doesn't seem to be working on 3 out of my 4 machines. On my MacPro1,1 running 10.5.6 it seems to work, but on my MacPro3,1 also running 10.5.6, HP Touchsmart running windows7 and my Asus X55 running Ubuntu 10.10 nothing seems to happen when i press the execute check box.%%%

%%%Ah, i don't know if i'm just missing some obscure setting, but this Add-on doesn't seem to be working on 3 out of my 4 machines. On my MacPro1,1 running 10.5.6 it seems to work, but on my MacPro3,1 also running 10.5.6, HP Touchsmart running windows7 and my Asus X55 running Ubuntu 10.10 nothing seems to happen when i press the execute check box.%%%

%%%That’s weird ! Could you please post logs from the console ? And are you sure you have the same svn version of the script on all your machines (it was modified recently) ?%%%

%%%That’s weird ! Could you please post logs from the console ? And are you sure you have the same svn version of the script on all your machines (it was modified recently) ?%%%

%%%As best as i can tell, they should all be running the same 2.0 version of the script that came stock with Blender2.7 on release. This is basically what all the machines are putting out except for the MacPro1,1:

bpy.ops.object.fracture_simple(exe=False, hierarchy=False, nshards=5, crack_type='FLAT', roughness=0.5)
bpy.ops.mesh.primitive_cube_add(view_align=False, enter_editmode=False, location=(0, 0, 0), rotation=(0, 0, 0), layers=(True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False))
bpy.ops.object.editmode_toggle()
bpy.ops.mesh.faces_shade_smooth()
bpy.ops.uv.reset()
bpy.ops.object.editmode_toggle()
bpy.ops.object.select_all(action='TOGGLE')
bpy.ops.object.modifier_add(type='BOOLEAN')

It doesn't actually give me any python syntax errors, however the MacPro seems to run the exact same console code, except it does it 25 times (ie that's how many shards i choose) so my thinking is that there may be some run time error in the code that causes the other machines to default to 1 shard. So as far as the python API is concerned, the code is running properly, but the because i thinks you only want 1 shard when you fracture the object it outputs the whole object as a single shard.%%%

%%%As best as i can tell, they should all be running the same 2.0 version of the script that came stock with Blender2.7 on release. This is basically what all the machines are putting out except for the MacPro1,1: bpy.ops.object.fracture_simple(exe=False, hierarchy=False, nshards=5, crack_type='FLAT', roughness=0.5) bpy.ops.mesh.primitive_cube_add(view_align=False, enter_editmode=False, location=(0, 0, 0), rotation=(0, 0, 0), layers=(True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False)) bpy.ops.object.editmode_toggle() bpy.ops.mesh.faces_shade_smooth() bpy.ops.uv.reset() bpy.ops.object.editmode_toggle() bpy.ops.object.select_all(action='TOGGLE') bpy.ops.object.modifier_add(type='BOOLEAN') It doesn't actually give me any python syntax errors, however the MacPro seems to run the exact same console code, except it does it 25 times (ie that's how many shards i choose) so my thinking is that there may be some run time error in the code that causes the other machines to default to 1 shard. So as far as the python API is concerned, the code is running properly, but the because i thinks you only want 1 shard when you fracture the object it outputs the whole object as a single shard.%%%

%%%Well, if there’s no Python error, it’s gonna be hard to trace it… I’ll see if I can do something, but I do not swear anything…%%%

%%%Well, if there’s no Python error, it’s gonna be hard to trace it… I’ll see if I can do something, but I do not swear anything…%%%
Author
Member

%%%Hi!
Since your script is now in bf-extensions' svn (contrib|trunk) we have deleted the current attachments to avoid that end-users could reach this page and get the wrong version of your script.
Note that your script may have api changes or small maintenence changes applied in SVN.
Please retrieve your script from SVN before updating SVN to avoid mis-versioned scripts.
Thanks!
%%%

%%%Hi! Since your script is now in bf-extensions\' svn (contrib|trunk) we have deleted the current attachments to avoid that end-users could reach this page and get the wrong version of your script. Note that your script may have api changes or small maintenence changes applied in SVN. Please retrieve your script from SVN before updating SVN to avoid mis-versioned scripts. Thanks! %%%

%%%Hi, thanks for this very useful script.
I tried it since several months, sometimes it worked and sometimes doesn't but I didn't understand why.
And today I find the cause of my problem. Fracture Object only works on Layer 1. If I try to use it on the other layers, I get this error in the console:

RuntimeError: Operator bpy.ops.object.editmode_toggle.poll() failed, context is incorrect

location::-1

location::-1

It's just an annoying bug, not a real trouble, though.%%%

%%%Hi, thanks for this very useful script. I tried it since several months, sometimes it worked and sometimes doesn't but I didn't understand why. And today I find the cause of my problem. Fracture Object only works on Layer 1. If I try to use it on the other layers, I get this error in the console: RuntimeError: Operator bpy.ops.object.editmode_toggle.poll() failed, context is incorrect location:<unknown location>:-1 location:<unknown location>:-1 It's just an annoying bug, not a real trouble, though.%%%
Member

%%%[canned response]

Hi, can you prepare a wiki page with a bit of a manual about how to
use this?

See
http://wiki.blender.org/index.php/Dev:2.5/Py/Scripts/Guidelines/Addons

Thanks!%%%

%%%[canned response] Hi, can you prepare a wiki page with a bit of a manual about how to use this? See http://wiki.blender.org/index.php/Dev:2.5/Py/Scripts/Guidelines/Addons Thanks!%%%
Member

%%%Please try to expand the documentation a bit, including the different options and parameters.%%%

%%%Please try to expand the documentation a bit, including the different options and parameters.%%%
Author
Member

%%%hi, script is broken in bmesh, svn 44275
fracture script, fracture object, crack type spherical rough crashes blender completely.%%%

%%%hi, script is broken in bmesh, svn 44275 fracture script, fracture object, crack type spherical rough crashes blender completely.%%%
Author
Member

%%%Hi,
Due to changes to the api including the merging of bmesh, several addons are outdated.
Please, if you are the author of an addon check your script with blender revision 44256 or newer.
That is builds made After blender 2.62 official release.
I would ask that updates be made to your addon before the Blender 2.63 release.
6-8 weeks away.
This allows time for the api to become more exposed & bmesh to stablize furthur.
If you need help, drop into irc freenode #blenderpython or #blendercoders & feel welcome to ask questions.
At the time of 2.63 release, scripts that are not repaired or in active developement will have their tracker page marked "Closed"
this will not affect your links to the tracker, similar to closing scripts in 2.49b, the page will be still availible & can be re-opened.

Thanks for your understanding & patience during these Exciting Times.
Brendon.

%%%

%%%Hi, Due to changes to the api including the merging of bmesh, several addons are outdated. Please, if you are the author of an addon check your script with blender revision 44256 or newer. That is builds made After blender 2.62 official release. I would ask that updates be made to your addon before the Blender 2.63 release. 6-8 weeks away. This allows time for the api to become more exposed & bmesh to stablize furthur. If you need help, drop into irc freenode #blenderpython or #blendercoders & feel welcome to ask questions. At the time of 2.63 release, scripts that are not repaired or in active developement will have their tracker page marked "Closed" this will not affect your links to the tracker, similar to closing scripts in 2.49b, the page will be still availible & can be re-opened. Thanks for your understanding & patience during these Exciting Times. Brendon. %%%

%%%Hi,
This addon seems to have a bug when dealing with UV coordinates on object that have been mirrored.
Step to reproduce:

  1. make a mirrored object out of the default cube (remove the face in the symmetry plan to get a nice closed object)
  2. unwrap the one real side
  3. apply a texture
  4. apply the mirror modifier
  5. use cell fracture

The originaly real side is stil well textured, the other have its UV coordinate messed up.%%%

%%%Hi, This addon seems to have a bug when dealing with UV coordinates on object that have been mirrored. Step to reproduce: 1) make a mirrored object out of the default cube (remove the face in the symmetry plan to get a nice closed object) 2) unwrap the one real side 3) apply a texture 4) apply the mirror modifier 5) use cell fracture The originaly real side is stil well textured, the other have its UV coordinate messed up.%%%
%%%Additional info: http://pasteall.org/pic/show.php?id=42529 http://www.pasteall.org/pic/show.php?id=42530 Blender 2.65%%%

%%%Bug reported about "Setup fracture shards" operator, but it's working correct as far as I can tell so closed it.
http://projects.blender.org/tracker/index.php?func=detail&aid=36071&group_id=9&atid=498

The name could perhaps be changed to indicate that this operator sets up game engine physics settings, that's not really clear.%%%

%%%Bug reported about "Setup fracture shards" operator, but it's working correct as far as I can tell so closed it. http://projects.blender.org/tracker/index.php?func=detail&aid=36071&group_id=9&atid=498 The name could perhaps be changed to indicate that this operator sets up game engine physics settings, that's not really clear.%%%

Added subscriber: @k.sravangupta

Added subscriber: @k.sravangupta

hello,

please could any one help me..

I am getting error as,
Traceback(most recent call last):

whenever I try to export my blender files in to OGRE meshes and scenes I am getting this error please any one could help me..Its very important for me

hello, please could any one help me.. I am getting error as, Traceback(most recent call last): whenever I try to export my blender files in to OGRE meshes and scenes I am getting this error please any one could help me..Its very important for me
Sign in to join this conversation.
No Milestone
No project
No Assignees
14 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#21793
No description provided.