Remove index from grid panel

Is there a node that removes indexes from a grid panel without using “Remove child at” which doesn’t work, it just breaks my grid panel. I want something that removes and the slots fit next to each other once this child comes out.
Problem
Problem

I’m just removing it visually to filter and show certain items. I don’t want to touch my array, but just the Grid panel, which is extremely more optimized and wouldn’t run the risk of breaking the inventory items.

does setting visibility to collapsed not work? otherwise may have to regenerate the grid

Hello! It doesn’t work either :confused: . I mean… yes but not how I need it to work. I noticed that it has Column and Row filling. Could you tell me if there is any way to let the grid panel calculate this automatically depending on the number of items within the grid? Or a light on the way to guide me on how to use Collumn and Row? :slight_smile: Any help is a HUGE help, friend. Thank you very much in advance.

going from memory

column is x%max
row is x/max

but that should put you in the right path

1 Like

Do you know if there is a node that fills the column and row automatically? or one where I can change the index of items within the grid. A swap, something like that…

dont think there is one built in but i gave you the function above, to be more clear its

index % maxcolumn = column
index / maxcolumn = row

% is modulo if you’ve not seen it before, its built in

1 Like

Thank you. Have a good one. :slight_smile:

That’s what a Wrap Box is for. It does the above automagically. Remove a child and other pieces fall in place.

1 Like

Hello, thanks for your response.
My system does not support using wrap box, it is using a grid panel and if I use wrap box an infinite food glitch happens. :rofl: :rofl: :rofl:

That sounds more like a developer issue, rather than a Wrap Box issue, heh! :innocent: Under the hood it’s pretty much identical - you add user widgets to a panel, but no longer need to worry about columns / rows at all. Grid / Wrap Box both have their advantages, ofc. Use what you need. Merely suggesting an immediate solution to the issue in the topic.

As in, no script is needed for the above behaviour. Adding / removing children would automatically handle the placement.


Anyway, for any kind of moderately advanced inventory management, one would create collapsible slots first, surely. So the infinite glitch should never be happening in the first place.

Also, consider a Tile View if you need something a tad more nuanced. Especially if you’re planning on have a lot of widgets.

Good luck!

2 Likes

Thank you so much again. And actually, in my case wrap box is a little better to use. I just discovered why an infinite food glitch was occurring and yes, it was because of the conflicting wrap box. Fixed and now the inventory item filter works. Thanks a lot for the help. It’s much better to be a visual-only filter and not touch the array. But I noticed that if I want to add “Dummy slots” to just show them empty, another bug occurs with the wrap box. :thinking: :rofl:

Thank you! Have a good one.

1 Like

That sounds about right, there’s always another :beetle: to fix. You’re heading in the right direction.

1 Like

For sure!

“Everything you change on one side, spoils on the other.”

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.