Page MenuHome

Update Crackit addon for Blender 2.8
Open, NormalPublic

Description

Cell fracture has been updated.


hi this task is for the updating of the Cell Fracture Object and Cell Fracture addons from 2.79 to 2.8 series.
After discussion with @Nobuyuki Hirakata (Gappy1) in irc he said he was available in March to update both addons.
One consideration we talked about was to add both scripts into one folder and have both available in the UI.
This is not decided yet and will depend on development schedule and usability.
@Campbell Barton (campbellbarton) I'm adding you as a subscriber so you can follow.
Thanks.

Details

Type
Patch

Event Timeline

Brendon Murphy (meta-androcto) triaged this task as Needs Information from User priority.
Bastien Montagne (mont29) lowered the priority of this task from Needs Information from User to Confirmed, Low.Apr 11 2019, 11:50 AM

Sorry late to complete the task.
I am trying to complete the task hastily.

I updated 2.7 functionalities to 2.8 of cell fracture addon.
Now adding new features for cell fracture, then I will integrate cell fracture addon with crack it addon.
I think it can be achieved in a week, if it goes without unexpected bugs.

Brendon Murphy (meta-androcto) raised the priority of this task from Confirmed, Low to Normal.Jun 10 2019, 1:36 PM

thanks for touching base in irc. I'm looking forward to the update.

Brendon Murphy (meta-androcto) raised the priority of this task from Normal to Confirmed, Medium.Jun 17 2019, 2:17 AM

I uploaded the independent Fracture cell addon on https://github.com/squarednob/fracture_cell

Although It is temporary update, it has full features of fracture cell, and works fine in my testing.

Updated features :
New feature:
You can choose multiple fracture source,s like own verts and annotation.
Added random for fracture source.

Changing in 2.8:
Using annotation pencil , instead of grease pencil.
Mass value for BGE changed into custom property.
Adding fractures in collection, instead of layer.


Now I'm merging some "fracture crackit" functions in the process of "fracture cell".
And integrating UI of "fracture crackit" and "fracture cell".
So I mean, I think crackit's functions can be merge into fracture cell. As a additional operator. And put the execute button below cell fracture button.

If you have time to wait for 4-5 days, I think I can..
Is That OK?

@Nobuyuki Hirakata (Gappy1) thanks, it sounds like your doing a wonderful job, of course some more time to finalize will be fine. :)

https://github.com/squarednob/fracture_cell

Now, Updating fracture cell and integrating crackit is almost finished.

Only one big issue is inconsistency of result, when cell operator or crack operator is used several time.
Reverting also changes mesh from first mesh, even if setting is the same.
I can't understand why, perhaps it happens based on depsgraph?

Anyway, besides the problem, I think this version can be released for 2.8.

I put the latest code in the github link.
Please review and tell me what to do.
I can paste .diff on the page if you need.

New features:
I added crack operator and material operator.
Crack operator should be used after fracture cell.

Also I added "hide original", "move beside original object", and "simplify base mesh" in Cell fracture panel.
"Apply edge split" was changed into "edge split modifier", because it caused bug a lot. And it is hide in default, until "mark sharp edges" is turned on.

hi, @Nobuyuki Hirakata (Gappy1)
Thanks very much for the update.
From here I'll do the initial commits. Currently both addons are in contrib and I'll clean up there adding your version in. We will get a good diff from the commit.
After which, I'll add to release. I need to add tags so we have a traceable history.
Once it's back in release, it's all yours again. I've put the instructions for you to gain access to the Blender addons repo below.
It will be important to check regularly leading up to 2.8 release. RC1 would be a good aim for stable. After there will be feedback and bug reports where you can fix and prepare for release.

The following is a template for new devs
hi, if you can join this mailing list: bf-committers@blender.org and mail:
Subject:

Re: Commit Access to Addons Repository: ATT: @ideasman42

Content:

Hi my name is: "your name"
My user name on developer.blender.org is: "your user name here"
I would like commit access to the addons repository.
I am the maintainer of/my addon is:
New to Blender and it's task is here: "inset addon name and task name".
or I'm the Author of an addon in Blender and I wish to update the addon: "inset addon name and task name if applicable".
or I'm a new maintainer of an addon in Blender and I wish to update the addon/s "inset addon/s name/s and task name/s if applicable".

I'm familiar with git usage and my repo is here: "your git hub" *not needed but why not if you have one. It's important to know git usage before committing to the Blender addons repo.

It's also useful to join this mailing list: bf-extensions-cvs@blender.org as this list mails out the commits.
https://wiki.blender.org/wiki/Developer_Intro/Overview is a good read.
https://blender.chat/channel/python and https://blender.chat/channel/blender-coders provide a good place to discuss your addon or issues if needed. It's good also to drop in and say hi and meet other developers and provides a good communication platform.
Final note: Addons in the Blender repository are updated by addons devs and Blender core devs help with api updates/fixes. As there's multiple people committing it's important to make sure your local folders are updated to current before committing your self.

Any issues please let us know.
Thanks for your support.

Meta-androcto, Thanks for nice instruction.
I'll be keep watching and trying to fix issues.

Brendon Murphy (meta-androcto) lowered the priority of this task from Confirmed, Medium to Normal.Jul 1 2019, 12:19 PM

hi @Nobuyuki Hirakata (Gappy1), I'm lowering the priority to normal, I've committed to release and added a warning.
There's some bugs and issues to iron out.

Traceback (most recent call last):
  File "C:\Users\Dell\Downloads\blender-2.80-29_06_19-win64\2.80\scripts\addons_contrib\object_fracture_cell\operator.py", line 35, in execute
    cell_main.main(context, original, **cell_keywords)
  File "C:\Users\Dell\Downloads\blender-2.80-29_06_19-win64\2.80\scripts\addons_contrib\object_fracture_cell\process\cell_main.py", line 173, in main
    cells += main_object(context, original, 0, **kw_copy)
  File "C:\Users\Dell\Downloads\blender-2.80-29_06_19-win64\2.80\scripts\addons_contrib\object_fracture_cell\process\cell_main.py", line 72, in main_object
    level=level,
  File "C:\Users\Dell\Downloads\blender-2.80-29_06_19-win64\2.80\scripts\addons_contrib\object_fracture_cell\process\cell_functions.py", line 378, in cell_boolean
    bpy.ops.btool.boolean_inters()
  File "C:\Users\Dell\Downloads\blender-2.80-29_06_19-win64\2.80\scripts\modules\bpy\ops.py", line 201, in __call__
    ret = op_call(self.idname_py(), None, kw)
AttributeError: Calling operator "bpy.ops.btool.boolean_inters" error, could not be found

location: <unknown location>:-1

This would be the first to address I think.

Then, append material does not append to all the created fractures but does to the crackit fractures.
I'm not sure if it's possible to make the materials menu show up only if the object is crackit?
Maybe pressing the fracture button could bring up the crackit and the materials ui?
The way it looks now it's like 1, 2, 3, obvious order but easy to fail materials if it's 1, 3 and not using 2.
Speed seems to be an issue also. we can look at that after usability errors are solved.
Thanks again.

That bug issue about "bpy.ops.btool.boolean_inters" was occurred because the code in this part uses btool addon's modifier. I forgot that I activated the addon, and that the btool modifier is based on an addon, not a default functionality of Blender.

I fix it by using boolean modifier instead.
4 lines were changed to fix it.
So it should work with no other dependency of other addon activated.

I don't have commit access yet.
So if the fix must be hurried, please commit the fixed code.

Link:
Diff: https://developer.blender.org/differential/diff/16148/
Uploaded github page: https://github.com/squarednob/fracture_cell/tree/master/object_fracture_cell/process

I mailed to bf-committers@blender.org with "Re: Commit Access to Addons Repository: ATT: @ideasman42" template.
After I have commit access, I will commit the code by myself.

Hi, I've been looking over the commits to: https://github.com/squarednob/fracture_cell

I find it hard to follow whats going on:

  • Commit messages don't explain why changes are made.
  • Comments that aren't in English.
  • It's not clear which commits are resolving 2.8x compatibility, changing existing features or adding new features.

For example:

Could you make a small patch that makes this add-on work with 2.8?

New features and large changes aren't the purpose of updating the add-on.

@Campbell Barton (campbellbarton)

minimum change version:
First, I have minimum change version for 2.8. I uploaded it on Github to show you.
https://github.com/squarednob/fracture_cell_minimum

And if I make a branch in main repository (https://github.com/squarednob/fracture_cell), I think I can restart develop with minimum changing code.

I talked to meta-androcto on IRC chat, and whether merge or separation of cell and crack addon seems to be still pending.
I'm willing to comply your team's decision (remain minimum version, or adding new feature, merging two addon, etc)

Unclearness of commit message:
Firstly I intended to use the github page for underdevelopment process, not so official. At that time I didn't have commit access, and I didn't know commit process of Blender's internal addon.
So some commit has big change without purpose-explanation, and some comments in the code were used for remainder, and not in English.

Still, you pointed out flaw of the commits that I didn't care so much.
I should make more small changes and explain reasons in commit massage.

Why it has big code change:
After making minimum version, I took on integration task of cell and crack, and I was allowed to add new features (with testing purpose, not all needed to be adapted). So I started developing with comment at Mon, Jun 10, 6:50 PM in this task.
I should have provide diff of the minimum version to someone and request to commit for the starting point, before adding features, though....

The main big changes:

  1. Some features like relocation or hide object was added to avoid overlapping position and visibility using collection to organize objects, instead of deprecated layer.
  2. In the for loop, first 1 or 2 object somehow can't be properly dealt, So make a "bait" box object inserted list, and in the loop, deleted this quickly.
  3. extension of functionality, such as multiple point source method, and random point source.
  4. To integrate with crack addon, some processes are changed or relocated.
  5. UI menu was changed to categorize features well.
  6. To organize and for consistency of crack feature, I change file structure, and names of function and variables.

Checked the minimum version but it still change more things than necessary (reference to crack it, removed group/collection feature, remove asserts).

I've committed minimal changes to this add-on to make it work, based on rBA07ec645862275ffe2d60e2d6481080aa0ae8b1f0 (2.7x with minor API updates).

Applied a change from your patch:


@Nobuyuki Hirakata (Gappy1), are there any changes I've missed that fix issues in 2.8x?

Your patch includes grease pencil changes but a quick test for annotations seems to be working properly.

Other improvements could be made later but aren't priority for 2.8 release.

@Campbell Barton (campbellbarton) hi, I think we could have handled this better. I had been discussing with @Nobuyuki Hirakata (Gappy1) some ui fixes, and various needed changes the night before your reversions were made. we were looking to resolve any issues and present a superior tool for 2.8.
Update to 2.8 was maybe the wrong term here? I've found that during the update process, often things can change and updates become upgrades, features get added, usability get's improved, it provides a time to update to the new api and take a look at an addon in general. 2.8 is a new Blender series and huge changes have been made across all areas. All I was doing here was to try to provide the best functionality for the end user.
I only had the best intentions here. To provide Blender users with a working valid addon with improved usability and functionality.
Thanks. Sorry for the noise.

@Nobuyuki Hirakata (Gappy1) We still should update your Crackit addon, it really is a great accompaniment to the cell fracture addon.
Your welcome to update when your ready. I would still include this in 2.8. If your still having trouble with git, let me know and I'll try to help you through it.


Uploaded working alternate stand alone. This addon is the version reverted from release and based on work from @Nobuyuki Hirakata (Gappy1) .
It no longer needs to use the Fracture addon as it includes the old code. As it stands this addon serves as an update to the "Crackit".
Given the work involved in this design, I beleive we should make an exception here and add back to release.

@Nobuyuki Hirakata (Gappy1), are there any changes I've missed that fix issues in 2.8x?
Your patch includes grease pencil changes but a quick test for annotations seems to be working properly.
Other improvements could be made later but aren't priority for 2.8 release.

@Campbell Barton (campbellbarton), I found the bugs in fracture cell addon in RC1.
I also fixed the bugs. The bugs are fixed from fracture cell in RC1.
Strict minimum branch : https://github.com/squarednob/fracture_cell_minimum/tree/strict_minimum
diff: https://developer.blender.org/differential/diff/16374/

The way to fix the bugs directly came from in my first minimum version.
So, if there are alternative good solutions, please ignore my way of fixing.

I listed bugs below.

Boolean modifier is not applied:
The resulted cells still remain fractures of bounding box.
The bug seems come from bpy.data.meshes.new_from_object(). They don't apply modifier in 2.8, at least the same way in 2.7.
If bpy.data.meshes.new_from_object() can apply modifier somehow, or if there is an alternative function, it should be used.
But the simplest solution here is to add a process of applying boolean modifier:

bpy.context.view_layer.objects.active = obj_cell
bpy.ops.object.modifier_apply(apply_as='DATA', modifier="Boolean")                       
#obj_cell.modifiers.remove(mod)

Interior VGroup and Sharp Edges are not applied:
The bug is related with applying modifier problem above.
As you know, to distinguish interior meshes from exterior meshes, this addon uses "hide" or not "hide" of meshes. To do that, all of meshes are hidden before boolean modifier is applied. And after the modifier is applied, new meshes made by boolean modifier are not hidden.

To do this in 2.8, I applied Boolean modifier before bpy.data.meshes.new_from_object(), to preserve data for "hide" or not "hide".
If the order is reversed, all of the meshes are not hidden. So interior meshes are not distinguished.
fracture_cell_setup.py 337-349 are changed to this:

if use_interior_hide:
    obj_cell.data.polygons.foreach_set("hide", [True] * len(obj_cell.data.polygons))
        
mesh_old = obj_cell.data

# New meshes by boolean modifier are not hidden.
bpy.context.view_layer.objects.active = obj_cell
bpy.ops.object.modifier_apply(apply_as='DATA', modifier="Boolean")                       

obj_cell_eval = obj_cell.evaluated_get(depsgraph)
mesh_new = bpy.data.meshes.new_from_object(obj_cell_eval)

obj_cell.data = mesh_new

Collection doesn't appear in outliner:
Collection don't appear in outliner tree, because the collection is not linked to master collection.
After a new collection is linked on master collection, the new collection appears.
Also, I unlinked cells from other collection to prevent duplication in outliner.

Recursion with cursor error:
It's simple reference error. I added "context".

c = scene.cursor.location.copy()

to

c = context.scene.cursor.location.copy()

@Brendon Murphy (meta-androcto)
I'm updating crack it addon from RC1 version, using the fracture cell that I uploaded above.
I try to update it with minimum changes, although many things can be more useful.

@Brendon Murphy (meta-androcto)
I updated crackit addon with minimum changes for Blender2.8.
Although I should commit and push to blender repository by myself, I have trouble with SSH key things. It seams to take a little more time to solve this.
So if the updating is needed in a hurry, please use the github or diff below.
Sorry for bothering you.

Github official_2.8 branch: https://github.com/squarednob/crack_it/tree/official_2.8
diff with binary (for materials in .blend file): https://developer.blender.org/differential/diff/16386/

hi @Nobuyuki Hirakata (Gappy1) I seem to be having trouble here. could you test with a nightly build from here please.
https://builder.blender.org/download/

@Brendon Murphy (meta-androcto)
I downloaded the "blender-2.80rc1-windows64" from the link.
Crack it addon seems not to be updated yet here.
And after I changed the files in "object_fracture_crack" to the updated files from https://github.com/squarednob/crack_it/tree/official_2.8, it worked.

I could test more specific, if I know what kind of trouble there.

hi, it's only working on 1 selected object here, not the whole fractured object. There were recent updates to cell fracture, maybe they are the cause.

@Brendon Murphy (meta-androcto)
Is it a confusion of execution process of crackit of the minimum change version? It is not the same as integrated version.
This crackit (https://github.com/squarednob/crack_it/tree/official_2.8) doesn't need execution of cell fracture as the first one step, not like integrated version of crack it.

Users only need to select an object (not fractured) and click "crack it" button. The crackit addon executes cell fracture and crack functions together automatically.
That's why the crackit addon can only select one object. The selected object should be a "raw" object which is not fractured yet.

If this interpretation is wrong, please let me know.

hi, I'll check again. I was using your minimum version of crackit with the version of cell fracture provided with Blender . Also using a nightly build not rc release. I see now where my confusion arises. I was looking for the behavior you added in the full new version which is much more desired. A fix if there is one would be to have the minimum version of crackit for 2.8 work on all selected objects?

note, I've put up the full version you made with all my ui fixes here: https://github.com/meta-androcto/blenderpython

@Brendon Murphy (meta-androcto)
Thank you for the full version link.
I will try to implement multiple selection and try to added useful function and UI, also try to update it by myself.

hi @Nobuyuki Hirakata (Gappy1) I think we need to hold off now until 2.81, I'm going to move the non working version into contrib and you may update there for the moment. I also think to close this task soon and create a new task. If we create a new task we can offer the full version that you wrote as a new standalone addon.. It will give us more flexibility. I hope you understand that I had thought things would have gone much smoother and I will work towards a smooth transition into 2.81. Thanks for your patience here.

Campbell Barton (campbellbarton) renamed this task from Update Cell Fracture and cell fracture crackit addons Blender 2.8 to Update Crackit addons Blender 2.8.
Campbell Barton (campbellbarton) renamed this task from Update Crackit addons Blender 2.8 to Update Crackit addon for Blender 2.8.