Page MenuHome

Add Instance Offset operators to Collections property panel
ClosedPublic

Authored by Sybren A. Stüvel (sybren) on May 17 2022, 11:21 AM.

Details

Summary

Add three operators to the Collections properties panel:

  • object.instance_offset_to_cursor, which is already available from the Object properties panel. The operator works on the active collection, though, so it's weird to not have it in the Collections panel.
  • object.instance_offset_from_object is a new operator, which performs the same operation as above, but then based on the active object's evaluated world position.
  • object.instance_offset_to_cursor is also new, and performs the opposite of the first operator: it moves the 3D cursor to the collection's instance offset.

The first two operators make it easier to set the instance offset. The last operator makes it possible to actually see the offset in the 3D viewport. Drawing it using some overlay could also work, but that would be more effort to get right, and then snapping the 3D cursor would still be useful.


Offered for review for the UI layout/code/wording.

Once this is accepted, we can adjust the Object properties panel, remove the collection instance offset, and replace the set-to-cursor operator with the set-to-object operator. That's for another patch, though.

The functionality of this patch was actually requested by @Julien Kaspar (JulienKaspar)


For history sake, the initial GUI:

Diff Detail

Repository
rB Blender
Branch
temp-collections-set-instance-offset (branched from master)
Build Status
Buildable 22131
Build 22131: arc lint + arc unit

Event Timeline

Sybren A. Stüvel (sybren) requested review of this revision.May 17 2022, 11:21 AM
Sybren A. Stüvel (sybren) created this revision.
Dalai Felinto (dfelinto) requested changes to this revision.May 17 2022, 2:40 PM

We should avoid as much as possible to have operators in the Properties Editor. I see no problems with the functionality but they belong in a menu imho.

This revision now requires changes to proceed.May 17 2022, 2:40 PM

Have you considered to add them to a pop-up menu like we do in object?

Since this is not animatable I think this could even be on the right of the topmost of those values.

The other question I have is whether we need the "From Object". How often do users set the original of a collection that they can't use the 3D cursor for that?

@Dalai Felinto (dfelinto) I'd be fine with them being in a menu next to the values if necessary. Although it adds another click each time ...

The option to set the offset from the active object essentially saves some clicks.
Because the typical workflow is to have a parent object (like an empty) that represents the offset of the collection:

  • Select the the object inside of the collection
  • Set cursor to selected
  • Set collection offset from 3d cursor

That option Sybren added will remove one of those steps.
My original request was to add an option to assign an object as the offset directly. This would've removed all of the above steps but would apparently cause depsgraph issues.

Although it adds another click each time ...

If you do this that often, you can set a shortcut for this. We can't have everything outside of menus. Was this a single new operator I think it could be reasonable. But three options for the same functionality would be too much for taking over the properties editor.

My original request was to add an option to assign an object as the offset directly. This would've removed all of the above steps but would apparently cause depsgraph issues.

I'm aware of this problem, Andy wanted something similar in the past (i.e., better tools to handle collection offsets - ideally being able to transform them in the viewport directly).

I would still encourage this to be thought out a bit deeper (together with Andy even) to map out of a more permanent solution. In the meantime I think is acceptable to have those operators if they are not cluttering the properties editor ;)

The other question I have is whether we need the "From Object". How often do users set the original of a collection that they can't use the 3D cursor for that?

Very often. The cursor is rarely at the correct position on its own, the most frequent action is indeed to snap it prior to setting collection offset.
So much so that I'd even say the option set offset from object would be more desirable than from cursor.

Have you considered to add them to a pop-up menu like we do in object?

I've proposed a patch for this before D7101 in the meantime I've been using it locally as an addon myself.

Setting collection offsets from objects en mass is also a desirable feature for which I have written a small addon Collection Utilities

The other question I have is whether we need the "From Object". How often do users set the original of a collection that they can't use the 3D cursor for that?

Very often. The cursor is rarely at the correct position on its own, the most frequent action is indeed to snap it prior to setting collection offset.
So much so that I'd even say the option set offset from object would be more desirable than from cursor.

👍

I've proposed a patch for this before https://developer.blender.org/D7101 in the meantime I've been using it locally as an addon myself.

A meta-comment: if you just type the D-number (or T-number for tasks) Phabricator will recognise it and link the two together. It'll also allow people to hover over the number and see the title of the task: D7101. You can even put curly braces around it, and it'll expand it with the title, like this: D7101: New Operator Set Collection Instance Offset from Object :)

Have you considered to add them to a pop-up menu like we do in object?

Well, I feel that that popup is completely in the wrong place. It's managing the Collection, but is located in the Objects properties panel. And then there are the instancing coordinates there, without label, which again is managing a property of the Collection inside the Object property panel. So in that sense, I don't want to have them in a pop-up menu like that ;-)

But sure, a little popup menu next to those values, instead of buttons below them, is fine by me.

How's this?

  • Move operator buttons into popup menu

I think it is much better. Have you talked to Andy by the way about that?

We should avoid as much as possible to have operators in the Properties Editor.

About this -- where is this documented/communicated? Since when is this a thing?

Sybren A. Stüvel (sybren) edited the summary of this revision. (Show Details)

I think it is much better. Have you talked to Andy by the way about that?

I like it!
But like mentioned (and we talked about it in the past). The more intuitive way to deal with this is to shot collection origins as overlays (like object centers) in 3D view. And then allow transform operations on them.

I agree with Andy. Using a transformable collection origin is the better long term goal. But for now I think this patch makes a lot of sense.

We should avoid as much as possible to have operators in the Properties Editor.

About this -- where is this documented/communicated? Since when is this a thing?

Since 2.8. This was the reason for removing the "Render" buttons for example from the Properties Editor I believe. It is part of the single-column properties editor design.

I'm not sure where this is documented though, I would need to look. But maybe @Julian Eisel (Severin) knows.

We should avoid as much as possible to have operators in the Properties Editor.
[ ... ] Since 2.8. [...] I'm not sure where this is documented though

I guess the best communication about this would be to stop calling it the "button space" in the source code ;-)

In any case, is the patch in an acceptable state to you now?

This revision is now accepted and ready to land.Jun 3 2022, 3:55 PM

Looks much better!

One small detail, there should be a separator between Set Offset from Object and Set Cursor to Offset as they are pretty different operations.

Other than that, +1!