Skip to content
This repository has been archived by the owner on Feb 11, 2024. It is now read-only.

[Request] Group Brushes Using Shortcut + Selection Behavior #58

Closed
gildedhipbone opened this issue Mar 14, 2018 · 17 comments
Closed

[Request] Group Brushes Using Shortcut + Selection Behavior #58

gildedhipbone opened this issue Mar 14, 2018 · 17 comments
Labels
status: pull-request A pull request for the issue awaits approval. type: improvement The issue is an improvement suggestion.

Comments

@gildedhipbone
Copy link

It's possible to group brushes by creating an empty GameObject and inserting the brushes as children. Could this be handled automatically? E.g. select the brushes you wish to group, press Ctrl+G and a parent GameObject is created.

Also, it would be convenient if selecting a parent GameOject selected all the children. And/or, if there was a option to select the entire group when clicking a child. Is this feasible? Perhaps it would make more sense to group brushes using some specific Sabre CSG object instead.

@Henry00IS
Copy link
Collaborator

As for your first question, it already exists, instead of CTRL+G just press the G key. To ungroup, press SHIFT+G. You can see this in the preferences window under key mappings or in the wiki.

@gildedhipbone
Copy link
Author

Well, that's embarrassing. Thank you.

@Henry00IS
Copy link
Collaborator

I made a blunder just like it very recently here haha. But I like your selection idea, makes a lot of sense. Will see how well it works. 😄

@Henry00IS
Copy link
Collaborator

I implemented most of your wishes. You can now create a group, remove a group, select all brushes in a group and select the group in the inspector. Sadly selecting the group and moving all brushes at once with the resize tool isn't an option, but you can quickly select every brush in the group now with a single button press and then move them.
We'll have to wait and see what the @sabresaurus thinks.

@Henry00IS Henry00IS added type: improvement The issue is an improvement suggestion. status: pull-request A pull request for the issue awaits approval. labels Mar 14, 2018
@gildedhipbone
Copy link
Author

Wow! Nice work, man. Been trying out the new features for a while and they work great!

I want to preface this by making clear that I'm not a programmer - I just copied and pasted some existing code. I've added a toggle to the group inspector that if checked will select all children of a group if you click on one of them. It's not particularly elegant, but allows one to select and move around groups without leaving the scene view.
image
BrushGroup.cs

public class BrushGroup : MonoBehaviour
{
    public bool selectByChild;
}

BrushGroupInspector.cs

if (GUILayout.Toggle(group.selectByChild, "Select By Child") != group.selectByChild)
{
    group.selectByChild = !group.selectByChild;
}

BrushBaseInspector.cs

if (BrushTarget.GetComponentInParent<BrushGroup>().selectByChild)
{
    List<Object> objects = Selection.objects.ToList();
    // select all of the child brush objects.
    objects.Remove(BrushTarget.transform.parent.gameObject);
    foreach (Transform child in BrushTarget.transform.parent.transform)
        if (child.GetComponent<BrushBase>())
            objects.Add(child.gameObject);
    Selection.objects = objects.ToArray();
}

@Henry00IS Henry00IS added status: in-progress A contributor is actively working on the issue. and removed status: pull-request A pull request for the issue awaits approval. labels Mar 16, 2018
@Henry00IS
Copy link
Collaborator

Sorry about the delay, your idea isn't bad and it works quite well but I found another solution that's even better. Now by default the group will be selected (similarly to a compound brush) and you get the common bounds tools. It's even more user friendly and makes the hierarchy selection less awkward.

@Henry00IS Henry00IS added status: pull-request A pull request for the issue awaits approval. and removed status: in-progress A contributor is actively working on the issue. labels Mar 16, 2018
@gildedhipbone
Copy link
Author

Awesome! Can't wait to check it out.

@gildedhipbone
Copy link
Author

Maybe it's a problem on my end, but creating a group will turn subtract brushes into add brushes. This also happens if I attempt to move the group.

@Henry00IS
Copy link
Collaborator

I can confirm this behavior, nice find. I will have a look and see why this is happening.

@Henry00IS
Copy link
Collaborator

The issue has been fixed, please try it out. :)

@Henry00IS
Copy link
Collaborator

Please have another look at the latest pull request update. I removed the 'Always Select Group' flag and it now behaves absolutely amazing just like compound brushes. No more flickering in the hierarchy. You can manually select a child brush in the hierarchy to edit it and if you click in the scene view it will select the whole group. Complete with new inspector icon.

This is the type of behavior that would make @sabresaurus proud. 😁

@gildedhipbone
Copy link
Author

Wow, that's great work! However, if you move or resize a child, it seems that the group bounds aren't updated automatically.

It's great being able to select a child in the hierarchy without activating the whole group. On that note, I think that it'd be intuitive if this behavior was also reflected in the scene view. Perhaps the user could select a child in the scene view by double-clicking it?

I'm curious - is this way of grouping brushes paving the way to being able to perform CSG operations on groups?

@Henry00IS
Copy link
Collaborator

Yeah I got stuck with the bounding box size earlier today and I couldn't find a good way to update it but all of the sudden I realized there was an obvious solution all along so it's solved now. Thanks for the reminder.

Double click has been implemented as suggested, feel free to give it a try.

Also not sure what you mean with CSG operations on groups?

@gildedhipbone
Copy link
Author

gildedhipbone commented Mar 17, 2018

You've done it! 👍 The bounding box updates without issue and the double-click selection works perfect.

By CSG operations on groups I mean setting a group to add/subtract (and intersect down the line, perhaps?) like you would an individual brush. Say you have a group consisting of two boxes, one smaller subtracting the other, creating a frame. Settings the group to subtract would essentially give the user a subtracting frame.

EDIT: I feel like I need to say it again, awesome work on the group management. Works great, feels great.

@Henry00IS
Copy link
Collaborator

Henry00IS commented Mar 17, 2018

Ah right! It's literally Unreal Editor's Intersect feature:

intersect

Unless @sabresaurus knows a trick this may not be possible because the new shape is no longer convex (SabreCSG does not support concave shapes, yet).

Edit: And thank you too! Thanks to your report we now have amazing group management! :)

@gildedhipbone
Copy link
Author

I've never used EU, but that may well be the kind of feature I had in mind. But I figured I might as well give another example, just for clarity's sake.

image
I have this L-shaped brush. As you can see, I created it by subtracting one brush with another. I've grouped the two brushes and I'd like to be able to treat them as a single brush.

In this case I'd like to use this particular group to subtract L-shaped holes in a wall - in other words, I'd like to be able to set the group to subtract, I guess essentially "inverting" the childrens' current mode (while hiding this from the user!).
image

image

@Henry00IS
Copy link
Collaborator

Your request should probably be copy & pasted into a new issue.

Henry00IS added a commit that referenced this issue Mar 27, 2018
Added visual group management. Fixes #58.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: pull-request A pull request for the issue awaits approval. type: improvement The issue is an improvement suggestion.
Projects
None yet
Development

No branches or pull requests

2 participants