Problem delete massive tracks with collapsed groups not work

R3.1 x64, Win10 x64

I experienced it months ago, but I did not know exactly what was happening so far.I thought it must be a problem for the Lua API available to create tools, but now I think it is not.Which is something internal under the hood of Renoise, which may be directly related to this matter.

Steps:

  • Creates a basic tool to execute a function.
  • Use the following function for delete multiple tracks (or similar that does the same):
function delete_multiple_tracks( song, i, n )
  song = renoise.song()
  n = song.sequencer_track_count -- maximum number of tracks (only tracks and groups)
  print('n:', n)
  for i = 1, n, 1 do --erase 1 to "n" tracks
    --if song.selected_track.type ~= renoise.Track.TRACK_TYPE_MASTER then
      song:delete_track_at( song.selected_track_index )
    --end
  end
end
  • Your song should have several tracks, some of them with groups and subgroups.Collapse some groups.
  • Run the tool to apply the function delete_multiple_tracks()

What happens:

  • For example. Create a main group, a subgroup and a track inside the subgroup. Collapse main group (CTRL+J), the function is unable to delete the group collapsed and their members.The 3 tracks (main group, subgroup and track) are not deleted.The function should delete all tracks (all the tracks and all the groups).Include many more groups, subgroups and tracks and collapse groups. You will see that something strange happens.
  • This causes unnecessary jumps in the index even by selecting the Master Track, when should never happen.

I have not tried the reverse function ( for i = n, 1, -1 do ). But I guess the same thing will happen.I think it has to do with the problem already fixed here.

This creates problems when creating tools with functions that involve deleting multiple tracks in a single function.It may be appropriate to take a deep look, to really see what happens.

Thanks!

I just thought of a partial solution to avoid this problem: obligate to expand all tracks and groups and subgroups before removing them.But this should not be necessary.Something happens with the collapsed groups that should be solved.

EDIT : Oops!Maybe this is not possible either because of the same error.

Raul, I think this function may also come into play with what you are trying to do?:

-- Delete the group with the given index and all its member tracks.
-- Index must be that of a group or a track that is a member of a group.
renoise.song():delete_group_at(index)

What 4Tey said, and also:

I have not tried the reverse function ( for i = n, 1, -1 do )

Yes, the way you are doing things, you need to do it in reverse.

Raul, I think this function may also come into play with what you are trying to do?:

-- Delete the group with the given index and all its member tracks.
-- Index must be that of a group or a track that is a member of a group.
renoise.song():delete_group_at(index)

No, it is not necessary.When erasing, you are erasing an index, without distinguishing between track and group.I mean, it does not matter if it’s a track or a group.

What 4Tey said, and also:

Yes, the way you are doing things, you need to do it in reverse.

No, I finally tried it yesterday and it does not work. Ocurrs the same.If you have all groups expanded, works correctly.I do not think it’s from the Lua API for build tools.Something extra happens with the collapsed groups, and I think it has to do with the error fixed here.Expanded works, not expanded does not work.Has no sense.

Well then, temporarily expand it before?

I think it has to do with the error fixed here.Expanded works, not expanded does not work

Ah, OK. Yes, some quirks were discovered when duplicating groups. Maybe a similar thing happens when removing?

Will need to take a look at this as well.

But otherwise, what I said still holds true: when you’re removing items from an array that you’re also iterating through, you need to use a reverse counter or ripairs (“reverse ipairs”).

I just thought of a partial solution to avoid this problem: obligate to expand all tracks and groups and subgroups before removing them.But this should not be necessary.Something happens with the collapsed groups that should be solved.

EDIT : Oops!Maybe this is not possible either because of the same error.

Well then, temporarily expand it before?

It’s not working either.It is as if being a collapsed main group with some subgroup inside, the collapsed main group “is locked” or does not work well under the hood of Renoise.That’s why I think something is not working right.And it does not depend on the API Lua, is something internal of Renoise.I could do what it says 4Tey but that would be like a patch.

And erasing or doing anything iterating forward or backward, should work the same way both ways, because you are only playing with an index (positions).It is for all I have pointed out that it may be appropriate to revise it, because the operation is not consistent.

In other words, Renoise v3.1.0 with collapsed groups with other groups within generates problems, maybe related to this new bug fixed here recently(various bugs with cloning groups).It is possible that after this arrangement, it already works well. But perhaps it would be appropriate to review it, before launching a new version.I guess soon we will have a version 3.1.1, with bugs fixed.For being a recent case, that’s why I comment.The related bug was solved a few days ago.

Take a deep look at this, please, Danoise, Taktik, etc.

Ah, OK. Yes, some quirks were discovered when duplicating groups. Maybe a similar thing happens when removing?

Will need to take a look at this as well.

Yes, that’s it!

But otherwise, what I said still holds true: when you’re removing items from an array that you’re also iterating through, you need to use a reverse counter or ripairs (“reverse ipairs”).

Okay, I’ll keep this in mind too.

Thaaaaaanks!!! :slight_smile: