NP Station

add-ons
architecture

(Hickz) #81

Hello there, people.

I’d like to ask if there’s a possibility of implementing mirroring by 2 points (CAD - like feature) so that instead of this result :



i would get this one:


I understand that mirroring in object mode through ctrl+m only modifies object’s scale on a given axis, but is there a way to get it to manipulate geometry (or rotation, since that’s what i did on the second image) aswell?


(nBurn) #82

I’m not quite sure what you mean by “mirroring by 2 points”, but I think the mirror transform in your example is already possible with Blender’s Mirror Modifier using the “Mirror Object” option:



(Okavango) #83

He is referring to a standard CAD mirror operation, with two clicks for defining the mirror line. It is possible in 2D space or ortho view in 3D space. Usually there is a third click for delete confirmation of the source object.

Yes, the mirror operation would be a standard part of a full featured CAD setup, as i already mentioned here. It was planned for future versions of NP station, but that could be a long wait…

For the operation to be successful as per your second image, the script would probably have to manipulate object’s world matrix, i think it is possible.


(Hickz) #84

what you’re doing there is in edit mode with the help of a modifier, while i have my needs to do this in object mode with mesh data-linked objects (so that when you edit the original object, the linked mirror object changes too)


(nBurn) #85

The mirror modifier in the screenshot was added in object mode.

The mirror modifier already does this. As long as the added mirror modifier isn’t applied / finalized, the duplicate object will receive any changes made to the original. If the original object is scaled down 50 percent, the duplicate will be scaled down 50 percent.


(Hickz) #86

the geometry added by this modifier stays in that object. Say i want to mirror 50 objects without destructing their modifiers (i mean you can’t join these 50 objects into 1 object and add a mirror modifier to them). Or, for example, i want to mirror an array of duplifaces with curve modifier on them and so on. It isn’t convenient that way when you can simply ALT+D the objects you need and ctrl+m them (i wish it would work the way mirror modifier works, but it only changes the scale on XYZ object’s coordinates and not the geometry)


(nBurn) #87

Is this what you meant?

you can’t join 50 objects into 1 object and add a mirror modifier to them without first applying or removing any modifiers attached to those objects


(Hickz) #88

Yeah, that’s another way of putting it. I don’t know what else to add to elaborate other than in my workflow it is handy to have all those separate objects (snapping gemstones onto a surface, as another example. You don’t have local coordinate system for each body in edit mode)


(OLST) #89

AWESOME!!! I have no words, just very very big thank you!! Perfect CAD tools!!
Hope to see new features in future!!
Best wishes!


(nBurn) #90

Hmm… thinking this over I’m not sure how practical an example workflow like that would be for our hypothetical mirror add-on. To maintain the existing modifiers and have the mesh data of the duplicates and originals stay linked, the mirror operation would have to add 50 separate modifiers, one for each of the 50 objects’ modifier stacks. That could cause performance and stability issues depending on how complex the mesh data was. I’m not sure how undo/redo operations would work in this case either: would adding a modifier to each of those objects be considered 1 operation or 50 separate operations? If it was the latter your undo history would be trashed.

There might be a cleaner way of doing this, but I can’t think of one at the moment.


(Hickz) #91

i personally do it this way in case i have alot of objects: i simply make a dupligroup, which is an instance.

I simply need for ctrl+m to change the object’s (that’s being mirrored) to change it’s rotation and not just the scale on xyz axis (i’m not sure it’s possible, that’s why i’m asking :p)


(Okavango) #92

@nBurn & Hickz

A nice object mode tool - select objects, snap first / second / third (optional for 3D) points of mirror divider - produce duplicated / linked objects / instances if selected are groups?

@Legofon

Thanks, glad you find it useful. If you are into CAD topics, don’t hesitate to be more vocal and give support in other CAD threads, we are in a defensive position around these woods.


(Hickz) #93

that would have been very helpful, and not only for us CAD scrubs, i’m sure it can also be used in any type of modeling (character, environment, prop etc)


(Lsscpp) #94

Press A to “add targets” while snapping


(nBurn) #95

:open_mouth: TIL

Instance mirroring could work, but I’m not familiar with how Blender handles instancing under the hood. My guess is Blender is just adding a second “position” (world matrix) to an object and using that to draw the object’s geometry at two different places. If that’s the case it should be possible to change the rotation.

To clarify, this would be 2 points to create a mirror line, with an option to create a 3rd point if you’re working in perspective mode (or if you need to fine tune the mirror plane’s rotation angle)? If so, I think I might already have code that can do this (the line \ rotation plane making part) in one of the tools I’ve been experimenting with.

Loosely related, but when I was looking at np_point_distance.py and saw it was creating two separate “start” and “end” objects in NP020PDRunTranslate, but I couldn’t figure out why. What was your reasoning for creating two objects instead of having one object for snapping that you place and grab over and over until you have all the points you need?


(Okavango) #96

It’s a matter of evolution. It is one of the first operators i made, i think most of the newer ones use only one object that they move around, and your remark is totally valid.


(theApe) #97

Does this addon have a github page, to follow development?


(nBurn) #98

No github page, although creating one could be useful. Most, if not all, updates are already posted in this thread, but if you’re interested in seeing exactly what code was changed in the last update you can check the NP Station status page in Blender dev’s “User Contrib” section.


(Okavango) #99

Sorry guys, i’m just too tied up with my daily tasks… As much as this is possible and clear-envisioned in my mind, i just don’t have the resources right now.

nBurn, thanks for stepping in :slight_smile:


(nBurn) #100

No problem Okavango. :smiley:

By the way, if you have time, I have some minor code changes for NP Station I would like your input on before committing. No new features, but the changes should make the code a little easier follow and may also improve stability and performance by a tiny amount. I can link the changes here if you want or send you an email / PM, whichever you prefer.