Renoise.song().patterns[].is_empty Doesn't Detect Automation


(Achenar) #1

The documentation claims that renoise.song().patterns[].is_empty will “quickly check if a pattern has some pattern lines or automation.” I’m trying it on a pattern that does have automation though nothing in the Pattern Editor, but it returns true.


(ffx) #2

I think is_empty was related to pattern commands? I use ins.parameters[].is_automated instead.


(joule) #3

Looks like a mistake in the docs.

It’s easily fixable like this

renoise.Pattern.is_really_empty = property(
  function(obj)
    for _, track in pairs(obj.tracks) do
      if #track.automation > 0 then
        return false
      end
    end
    return obj.is_empty
  end
)

print(renoise.song():pattern(1).is_really_empty)

(Achenar) #4

Thanks for the excellent example, joule. It solved the issue and there were also few useful things for me to pick up on in there.