eXzacT / RePrimitive

Blender addon that allows you to tweak primitives whenever you want without creating them from scratch
MIT License
68 stars 4 forks source link

Blender 4.1 / BoxCutter compatibility #9

Open AVA3d opened 8 months ago

AVA3d commented 8 months ago

Hey Damjan,

Today I've finally installed the latest Blender 4.1.1. There are some compatibility issues with BoxCutter. https://github.com/eXzacT/RePrimitive/assets/84742853/7100afea-e345-4c9c-88f8-d3de24c63a9c

And also get errors sometimes (50/50) if a mesh has a loop cut: https://github.com/eXzacT/RePrimitive/assets/84742853/53a49373-4fd6-4a06-a1f6-6184d35d7d89

Take a look please

eXzacT commented 8 months ago

Yeah as I said, loop cuts are no longer supported when the addon needs to find out which shape it is, I would have to think of a different way, I don't wanna say it's impossible but it's really hard.

Can you further explain what's wrong with 4.1, it creates a new object?

eXzacT commented 8 months ago

The workaround you can use for now is directly use the reprimitive_circle/cone/cylinder etc because you bypass the find_object_type

AVA3d commented 8 months ago

Yeah, it creates a new object without modifiers. But the old one stays as well: 2024-04-01_1

eXzacT commented 8 months ago

are you sure it's connected to boxcutter or it doesn't work in general

AVA3d commented 8 months ago

The workaround you can use for now is directly use the reprimitive_circle/cone/cylinder etc because you bypass the find_object_type

The same

are you sure it's connected to boxcutter or it doesn't work in general

It looks like there are no problems if I add the same modifiers manually. Only if I add them via BC Can this be the reason? 2024-04-01_2

Attaching a blend. file. You can check yourself:

BC-4.1bug.zip

eXzacT commented 8 months ago

Okay I'll check why it doesn't work for loop cuts then, As for the other issue it seems to just be a collection problem again, it's not about boxcutter, if you make any collection and put the object in and run reprimitive it will also be linked in the main collection, they must have changed some code related to collections, I have to check it out

eXzacT commented 8 months ago

Actually I'm on 4.0 and it happens to me too, so it's not because of the version

AVA3d commented 8 months ago

a collection problem again

It also happens with one collection only

eXzacT commented 8 months ago

Should be fine now, can you send me the blend where you had the issue with loop cuts?

AVA3d commented 8 months ago

I haven't saved it unfortunately, and can't reproduce it now...

AVA3d commented 8 months ago

Ok, I could reproduce it: loop_bug.zip

It also happens in B4.0. So it isn't 4.1 related

eXzacT commented 8 months ago

I could save myself a huge headache if instead of using reprimitive on blender default objects I made it so people have to add primitive shapes through the addon, and those objects would have all the data saved as custom properties, there would be no need for any calculations anywhere, loop cuts would work out of the box and performance would be better but I think people wouldn't like having to use those custom primitives

The other way to do it would be run the calculations only the first time you run them on a primitive, store all the results as custom properties, then if you added loop cuts those properties wouldn't change and I could reapply the loop cuts after changing the object

The last way is find a better way to calculate which object type something is which I don't think I'm smart enough for

image What I'm doing right now is so ugly but it works if there's no loop cuts

AVA3d commented 8 months ago

As I said in another topic - you might delegate to a user to choose which object type to modify. This might be a huge time/headache saver for you in terms of coding I guess :)

eXzacT commented 8 months ago

If it was like that from the beginning people would accept it but right now it's a downgrade if they have to say which object it is

eXzacT commented 8 months ago

I could just ignore loop cuts because after all it is destructive workflow core.zip You can just replace the core.py with this it should fix the collections and loop cut for now, it won't work if you applied the rotation though and it won't reapply the loop cut I have to do big refactors again so next version will probably come out at the end of the week

AVA3d commented 8 months ago

core.zip

Replaced, but it isn't working 2024-04-01_3

eXzacT commented 8 months ago

Oh I'm sorry, I need to send you the other one too operators.zip

AVA3d commented 8 months ago

The same unfortunately:

https://github.com/eXzacT/RePrimitive/assets/84742853/03ce8e00-ff8c-4413-8c8d-f8c7925ae388

eXzacT commented 8 months ago

It's not a collection issue then, that was a separate thing, could you send me that blend file too? Perhaps I need to have boxcutter in order to test it

AVA3d commented 8 months ago

Yep, as I said :) Here it is: BC-4.1bug01.zip

eXzacT commented 8 months ago

did u copy paste the object and try on 4.0?

AVA3d commented 8 months ago

I opened the file in 4.0 - it works without any problem

eXzacT commented 8 months ago

Okay I'm downloading 4.1 to check

eXzacT commented 8 months ago

core.zip

Can you try it now please, your blend file worked fine, there's a slight bug with naming but it was there before the object will shift back and forth between some names. The problem was shading as you said they changed it in 4.1, I'm not sure if I can get a difference between shade smooth and shade smooth by angle anymore, so I just set it to be shade smooth by angle as I don't think anyone uses the previous one

AVA3d commented 8 months ago

At first glance it looks like you fixed it! 👍
But let me test it more thoroughly, including this new shading system

eXzacT commented 8 months ago

I'm cooking really big refactors, the addon should be lightning fast next release, also figured out how I'll reapply loop cuts :D

eXzacT commented 7 months ago

RePrimitive.zip

Can you give it a shot? There's a known bug with scale, if you change the scale and call the reprimitive it will calculate the location wrong but I'll fix it, other than that everything should work fine except I didn't add readding loop cuts yet Also maybe there will be some clashes with other addons but I'm not sure, everything works fine on my end

AVA3d commented 7 months ago

Sure! If you need any testings just let me know - it's the least I can do to help you with the addon :) Downloading it atm

AVA3d commented 7 months ago

It looks like something is missing - both the hotkey and my pie-menus do nothing with this version.

eXzacT commented 7 months ago

it needs to be on a newly added object, doesn't work if the primitive is already there

eXzacT commented 7 months ago

Sure! If you need any testings just let me know - it's the least I can do to help you with the addon :) Downloading it atm

I appreciate it :)

AVA3d commented 7 months ago

+: tweaking works fine with standard primitives

Issues I've found while using it with BC: ⦁ loss of an object for a boolean modifier ⦁ scale/center issue ⦁ conversion doesn't work (via my pie-menu) ⦁ presets half-broken ⦁ cone: 1. I run RePrimitive and it did nothing; 2. But then it started to tweak it as sphere ⦁ no redo menu (left-bottom corner)

https://github.com/eXzacT/RePrimitive/assets/84742853/df4daa08-1eab-4e87-b817-0e4c5750312d

eXzacT commented 7 months ago

That's odd, were all these primitives added post installing the new version?

eXzacT commented 7 months ago

The no redu menu is intentional as I am using blender default popup window, that one doesn't show up in the bottom left after you're done, what I had before was a hack to get both popup and bottom left but it's not supposed to be used in that way and it makes the code a lot more complicated So I can choose either have it in bottom left always or have it as a popup but not both

AVA3d commented 7 months ago

That's odd, were all these primitives added post installing the new version?

Yes. Hmmm.... but why should that matter? In case we opened an old file.

eXzacT commented 7 months ago

Because to get what type of an object it is I am hooking into object creation and writing data to it, so if an object was there before the new version is installed it doesn't have that data written to it

eXzacT commented 7 months ago

That's the downside of this approach but it's faster and simpler and will work for any future projects

AVA3d commented 7 months ago

The no redu menu is intentional

The previous behavior was much better - we can choose either we want to use pop-up menu under the cursor, or that in left-bottom(as standard for all the tools in Blended).

eXzacT commented 7 months ago

It's not the standard behavior, when you add a new object you only get the menu in the bottom left and not a popup

eXzacT commented 7 months ago

If there's some other operator that has the same behavior I was using before I can take a look at how they did it

eXzacT commented 7 months ago

Could you please send me the blend file you used in the video?

AVA3d commented 7 months ago

It's not the standard behaviour, when you add a new object you only get the menu in the bottom left and not a popup

Yep, you're right. I'm not insist. This isn't top priority thing.

eXzacT commented 7 months ago

Trust me if I could have both with code being nice and clean I would but what I was doing was so weird and shouldn't be done, I wish it was like that by default in blender

AVA3d commented 7 months ago

Sure: RePrimTest_02.zip

eXzacT commented 7 months ago

Oh I think I know why it says it's a sphere, did you spawn it as a sphere and then changed it to a cone by calling the operator manually?

AVA3d commented 7 months ago

Not sure, manually or not. What I did:

  1. Created BC "rig". Tweaking the cone doesn't work
  2. Then I added a couple standard primitives and it started recognize it as sphere.
eXzacT commented 7 months ago

I'm not sure what a BC rig is but I'm guessing it's their custom objects and they don't use the usual blender bpy.ops.mesh.primitive_*_add

AVA3d commented 7 months ago

"BC rig" - no, nothing fancy, it's just standard cylinder + a couple of cuts.

eXzacT commented 7 months ago

could you please add the bc rig, open the scripting tab and then check bottom left or idk how you set it up image I need to know what operator they use for that

AVA3d commented 7 months ago

Because to get what type of an object it is I am hooking into object creation and writing data to it, so if an object was there before the new version is installed it doesn't have that data written to it

That's the downside of this approach but it's faster and simpler and will work for any future projects

Damjan, I'm sorry if it could sound like critique, but this approach is problematic. It's a common thing opening an old file/preset/kitbash or other user asset. And in this case we get a broken addon. And in general, this isn't a good thing to add unnecessary data into a file. This can cause crashes because of conflicts with other addon.