eXzacT / RePrimitive

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

Expanding functionality of the addon via pie-menu #6

Closed AVA3d closed 8 months ago

AVA3d commented 8 months ago

Damjan, I'd like to share a cool idea that came to me.

What if instead of complex checks you'll add a 8-section pie-menu instead?

Advantages:

  1. no need for complex coding for you with headache regarding tricky checks, proper naming and renaming
  2. a user can choose what he would like to modify. AND! This way we also can CONVERT!!! one primitive into another! Change a cube into a cylinder, a cone into a sphere etc.!
  3. using the pie-menu is a VERY convenient way of working - in couple of days there is a muscle memory formed for frequently used menus

I've already made a semi-workable prototype as proof of the concept (no coding from my side, just using Pie Menu Editor Addon): Video1: https://github.com/eXzacT/RePrimitive/assets/84742853/2e8ea9c6-fcea-4a59-9643-4bec85e7c18e

Video2 (booleans/BoxCutter): https://github.com/eXzacT/RePrimitive/assets/84742853/7613a582-ba7a-4f83-a9a7-333a5c6a9774

This thing can expand the functionality of your addon substantially :)

eXzacT commented 8 months ago

That's a pretty good idea, however the issue here is that going from 1 object to another, I can't guarantee what would happen as the scripts are tailored to each object, it's possible that the object ends up being huge or even worse problems. I can't say for sure as I never tested the operators for a different object type than the object actually is, as there was no need to do so. It did seem to work fine with your examples though. Also I think there has to be a different math-y way to figure out which object it is without fixing their rotations, but I remember not being able to come up with one before.

eXzacT commented 8 months ago

Side note, my laptop is falling apart when I'm running a boolean with an exact solver, is that happening for you guys too? Even if I am just moving the cutter around and not using reprimitive on it. I've fixed the parenting and booleans losing track of a cutter object, there's still some bugs left when the location/rotation is applied though, probably finishing that today along with adding loop cuts.

AVA3d commented 8 months ago

I can't guarantee what would happen as the scripts are tailored to each object

You can add to the description that besides the main functionality the addon has an another conversion feature, but it's outcome can not be 100% predicted and it's up to the user experimenting with it.

Regarding huge sizes - is it possible to implement bounding-box check of the initial mesh and make the resulting mesh similar to it? Somewhere in the future, as 2nd grade task. As the main thing now, I guess, is the preserving the initial state of the object - parenting, origin, booleans and shading(wired/solid, smooth/flat)

eXzacT commented 8 months ago

The other problem with this is that I would also need to create a built in pie menu because not everyone has it and it does add some work for the user which is what I'm trying to avoid, I think most people wouldn't want to choose which operator to use and would prefer if the addon figured out

AVA3d commented 8 months ago

Side note, my laptop is falling apart when I'm running a boolean with an exact solver, is that happening for you guys too? Only on very dense meshes. On something simple like in the videos above - all works fine. Besides hardware power , you can check if some other addons (like Kit OPS) take resources of your laptop.

AVA3d commented 8 months ago

some work for the user which is what I'm trying to avoid Well, there is still no such a button "make me a prop without any efforts". Even with all the fuss around AI...

To be serious. Do you mean it can be confusing to a user to choose proper option in the menu? Well, if you want you can preserve the current one-button implementation and add the pie-menu as advanced option for another hothey.

eXzacT commented 8 months ago

Yes I know, I was thinking about that as an option, that one might take a while though because I don't know how long it would take me to add a pie menu, I'm thinking since it exists as a separate addon it's probably not easy at all

eXzacT commented 8 months ago

https://gifyu.com/image/SUFh2

eXzacT commented 8 months ago

I suppose a simpler thing would be to just add the quick rename mesh

AVA3d commented 8 months ago

https://gifyu.com/image/SUFh2 It looks like everything is fixed! I'm eager to try it :))

Reg. PME - this is really complex addon with a lot of functionality. I barely use 50% of it... I'm not a programmer, and can't give you any advice regarding it unfortunately. But I think it shouldn't be too complex to create 8-section pie menu. I believe I've seen something regarding it on youtube.

AVA3d commented 8 months ago

Here is a video on YT: https://www.youtube.com/watch?v=41fXtvzJ3Ik&t=8s I hope it might help

eXzacT commented 8 months ago

I'll see if I can do it after work, also the loop cuts. Thanks for the help :)

eXzacT commented 8 months ago

Which object do you use most for cutters, I assume cylinders? If you want I can make it work for word Cutter aswell but it will assume it's a cylinder. I'll upload the files here because it's not fully finished for a release yet

eXzacT commented 8 months ago

RePrimitive.zip

AVA3d commented 8 months ago

Well... there aren't one most shape for cutters. All variations of cubes, cylinders and n-gons are used quite often. No, thanks. I think I'll stick with the menu approach - it's more flexible for my needs.

RePrimitive.zip Answered in the "Boolean / Parenting / Vieport Display" topic

AVA3d commented 8 months ago

Oh, man! It's so cool be able to work like this thanks to your addon!

https://github.com/eXzacT/RePrimitive/assets/84742853/68d51967-8564-4bc5-b367-887ba80e3057

eXzacT commented 8 months ago

I'm glad you're having fun :)

eXzacT commented 8 months ago

is there any point adding loop cut support for toruses or is it just for cylinders/cones?

AVA3d commented 8 months ago

No, adding support for cylinders/cones is enough.

Bu the way, I'm going to try add an another item in the pie-menu - Cube (4 sided cylinder + 45 degree rotation). It could be useful for faster conversion.

eXzacT commented 8 months ago

I don't know if I want to add the pie menu, because going from 1 object to another one makes no sense, I mean calculation-wise but I do have to figure out a way for Cutters to also be accepted as a name and to pick the correct operator that gets called. I don't know if there's a nice way to do that other than going down a huge tree and deciding which path to take and once you reach the end of a path you can say with 100% certainty what kind of shape it was

AVA3d commented 8 months ago

An another use case I've found for RePrimitive :)

https://github.com/eXzacT/RePrimitive/assets/84742853/d4b9197f-24f8-49d3-8247-27af7d9e409f

eXzacT commented 8 months ago

That looks funky ahahhahaha 😄

eXzacT commented 8 months ago

I'll be working on the addon again this weekend, been busy

eXzacT commented 8 months ago

Can you tell me if a cutter is always parented to the object it's cutting? Or is that not always the case, because right now it's looking for modifiers that a parent has, I would have to change it to go through every object in the scene and check if some have modifiers that are linked to the object you're changing, which might be costly depending on the scene but probably fine, also would you like the loop cuts to get reapplied after changing the object? That might be a bit tricky since I can't really know where to put those cuts again, I guess I could get the height of a cut and what's the percentage of total height, then reapply it at that height percentage

AVA3d commented 8 months ago

"Can you tell me if a cutter is always parented to the object it's cutting?" - if we're talking about BoxCutter, than yes, it always parents a cutter as well as creates the folder Cutters, and put there the cutter as well. Hmm.. I'm not sure I understand why it's necessary to looking for modifiers, but it's technical things I'm not competent with :)

" would you like the loop cuts to get reapplied after changing the object?" - if it's possible, it could be very handy for cylinders and cones. Probably it's worth to implement it via checkmark? Good idea regarding height! I don't know if this is useful but BC orients cutters along Z axis:

https://github.com/eXzacT/RePrimitive/assets/84742853/562f482f-3fec-46a3-9c2f-3c804adaab36

eXzacT commented 8 months ago

Because the object you are changing is the target in the boolean modifier of the parent object, so when I delete the old objects I have to point the parent at the new one, I'm guessing that's one of the reasons they put it as a parent so they can easily track which objects have cutters and which cutters are cutting what.

Okay I'll see about reapplying the loopcuts at the correct heights again, I'll send the fixes I've doen so far here later today :)

eXzacT commented 8 months ago

Set it as not planned since I think I can solve it in a better way, I've done the rest you mentioned here though(I think), please let me know if you find any issues I'll get to fixing them as soon as I can, thanks :)

AVA3d commented 8 months ago

Great job Damjan! :) RePrimitive preserves origin now, the same thing with Flat/Smooth. Working with the addon is very comfortable now!

eXzacT commented 8 months ago

Thank you, glad you found it helpful :D

AVA3d commented 8 months ago

Looks like we didn't notice the elephant in the room :D There are couple of problems if we edit a source object:

  1. with parenting;
  2. loss of a boolean if we edit a cutter AFTER editing the source object

https://github.com/eXzacT/RePrimitive/assets/84742853/52b0b914-fb56-43a2-bb15-50b0aa9cc1e8

eXzacT commented 8 months ago

Oh of course, I should have thought of that 🤦, fixing it right now

eXzacT commented 8 months ago

RePrimitive.zip I think it works now, can you please check if I understood you correctly?

AVA3d commented 8 months ago

Yeah, you fixed these 2 issues! *thumbs up Though I've noticed it creates unnecessary duplicate: https://github.com/eXzacT/RePrimitive/assets/84742853/aeb9e87a-1b8c-44d1-ac53-bec6db718126

Could you also add preserving shading?

AVA3d commented 8 months ago

One more thought. Probably it would be better if scaling of an object could work from the origin. https://github.com/eXzacT/RePrimitive/assets/84742853/49dfb642-b9fe-47ad-a618-68344401791f

What do you think?

eXzacT commented 8 months ago

Yeah, you fixed these 2 issues! *thumbs up Though I've noticed it creates unnecessary duplicate: https://github.com/eXzacT/RePrimitive/assets/84742853/aeb9e87a-1b8c-44d1-ac53-bec6db718126

Could you also add preserving shading?

I'm not sure what's wrong in the video, shading should work, is that the right click -> shade smooth?

eXzacT commented 8 months ago

Oof the scaling might be really hard, I have to check it out, when you change radius/depth I think it's different from the "s" scaling one, but I could be wrong

AVA3d commented 8 months ago

2024-03-27_1 I think it's Shade Auto Smooth. Though there are some changes in Blender 4.1 regarding shading. I haven't test 4.1 yet, but I heard this option removed completely and replaced by either a modifier or geometry node modifier (not 100% sure)

eXzacT commented 8 months ago

As far as I know, there is no way for me to tell whether shade smooth OR shade smooth(auto) was used on an object, so I can't know which of those two to reapply. Right now I'm reapplying shade smooth which is why the code doesn't work for you. Maybe the best thing I can do is just always shade smooth auto it(if either was used) if that one is generally more used

eXzacT commented 8 months ago

False alarm sorry, I can find out which shading was used

AVA3d commented 8 months ago

This smoothy thing is subject to change in B4.1, so please don't invest to much time into it. I need a couple of days to figured out all the changes that B4.1 has brought, since it was released yesterday.

eXzacT commented 8 months ago

It was just couple lines of code to change it(I think it should work fine now) I'm trying to reproduce the bug where it created duplicates but it doesn't happen to me, was it in that specific scenario or is it creating duplicates constantly?

eXzacT commented 8 months ago

Oh maybe because you're on 4.1

AVA3d commented 8 months ago

No, I'm on still 4.0.3 I guess this has to do with additional collections in the project.

AVA3d commented 8 months ago

Nope, this is related with the selection state of a collection:

https://github.com/eXzacT/RePrimitive/assets/84742853/7b2b7491-71f0-40d2-8cf5-4bc9b7af6d38

AVA3d commented 8 months ago

It creates a duplicate if something other than the Cutters and initial Collection folders is selected

eXzacT commented 8 months ago

I don't think it's a duplicate, just linked to two different collections at once

eXzacT commented 8 months ago

but I still don't know how to recreate the bug, could you do it manually without boxcutter creating some collections?

eXzacT commented 8 months ago

I think I'm supposed to unlink it from the default blender collection where objects get added if it wasn't there to begin with, let me check after meeting

AVA3d commented 8 months ago

I don't think it's a duplicate, just linked to two different collections at once

Yes, you're right.

but I still don't know how to recreate the bug,

I can send you the file: RePrimitive_01_2.zip

could you do it manually without boxcutter creating some collections?

Checking it atm

AVA3d commented 8 months ago

The same thing without using BC:

https://github.com/eXzacT/RePrimitive/assets/84742853/9f9a3725-bc8e-4a32-80b2-142c6eedf3f1