EDIT Making a dedicated thread for this.
Hi, here’s a function to use if you want to un-alias the first block.
Click to view contents
SEE BELOW FOR AN EXAMPLE OF SLOPPY CODING BY KMaki. I can’t believe this thing worked. I actually messed up the for loops with pairs iterating so bad - switched key and value variables with each other. So don’t use this.
function unalias_better()
local pattern = renoise.song().selected_pattern
local track_index = renoise.song().selected_track_index
local pattern_track = pattern:track(track_index)
local was_alias_to_index = pattern_track.alias_pattern_index
if was_alias_to_index == 0 then
--It's not aliased
--[[
Extra behavior: Check if there are aliases for this pattern track in song
if aliases are found, remap them to the first aliased pattern track in song,
"unhook" this one
--]]
local found_aliases = table.create()
local sequenced_patterns = table.create()
local this_pattern_index = renoise.song().selected_pattern_index
--Check sequenced patterns
for pattern_index, sequence_index in pairs (renoise.song().sequencer.pattern_sequence) do
local pattern = renoise.song():pattern(pattern_index)
--don't remap track_index when iterating
local pattern_track = pattern:track(track_index)
--check if listed in sequenced_patterns
local is_in_sequenced_list = false
for p_i, index in pairs(sequenced_patterns) do
if p_i == pattern_index then
is_in_sequenced_list = true
break
end
end
if not is_in_sequenced_list then
--not listed yet, add there
table.insert(sequenced_patterns, pattern_index)
end
--check if aliased
if pattern_track.alias_pattern_index == this_pattern_index then
--an alias to current pattern track found
--check if it's already in found_aliases table
local is_added = false
for p_i, index in pairs (found_aliases) do
if p_i == pattern_index then
--already added
is_added = true
break
end
end
if not is_added then
table.insert(found_aliases, pattern_index)
end
end
end
--Check UNSEQUENCED patterns (go to the end of "found aliases" list)
for index = 1, #renoise.song().patterns do
--check if this is seq:d
local is_sequenced = false
for seq_i, dummy in pairs(sequenced_patterns) do
if index == seq_i then
is_sequenced = true
break
end
end
if is_sequenced == false then
local pattern = renoise.song():pattern(index)
local pattern_track = pattern_:track(track_index)
if pattern_track.alias_pattern_index == this_pattern_index then
--an alias to current pattern track found
--check if it's already in found_aliases table
local is_added = false
for p_i, index in pairs (found_aliases) do
if p_i == pattern_index then
--already added
is_added = true
break
end
end
if not is_added then
table.insert(found_aliases, pattern_index)
end
end
end
end
if #found_aliases > 0 then
--Aliases for this mother found in song - Time to magic
local first_alias = renoise.song():pattern(found_aliases[1]):track(track_index)
--unalias the first alias
first_alias.alias_pattern_index = 0
--copy from this (the mother)
local mother_pattern = pattern
local mother_pattern_track = mother_pattern:track(track_index)
first_alias:copy_from(mother_pattern_track)
--If there was only 1 alias, the job is done
if #found_aliases > 1 then
--map rest of the aliases to the first alias (now mother)
for i = 2, #found_aliases do
renoise.song():pattern(found_aliases[i]):track(track_index).alias_pattern_index = found_aliases[1]
end
end
else
--No aliases for this mother found in song
end
else
--It is aliased
--un-alias
pattern_track.alias_pattern_index = 0
--copy from original
local mother_pattern = renoise.song():pattern(was_alias_to_index)
local mother_pattern_track = mother_pattern:track(track_index)
pattern_track:copy_from(mother_pattern_track)
end
end[/s]
Tried this just now with my shortcut wizard tool, but this should work as a generic function too. In short, this is a replacement for the vanilla un-alias shortcut. It just checks also if this patterntrack is a “mother” patterntrack for aliases. If it is, it remaps the first (in sequence) found “child” alias to be the mother for every other “child” alias. (Obviously the numbers change too…)
Oh what the hex. Heres an xrns. This will create a context menu entry for the pattern matrix, and a keyboard shortcut under “Pattern Matrix:Edit”. Hope this solves at least one problem for you, XG2003.
com.kmaki.BetterUnalias_V1.1.xrnx
(DISCLAIMER: NOT EXTENSIVELY TESTED. FIXED A PROBLEM JUST NOW, THOUGH.)
Sorry about the mess - made a dedicated thread for the FIXED tool. it was more broken than Hindenburg.