You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In some cases, it is useful to be able to access the total frame count of a texture sequence at runtime in Bonsai. For example, when scrubbing through a texture sequence one may want to 'wrap' back around after the maximum or minimum index of the sequence has been reached. To do this, the limits of the texture sequence indices must be available.
As far as I can tell it's very tricky to access these values either through current Bonsai operators or extensions. ImageSequence can access this internally via GetFrames but the public property FrameCount is not updated if there is no user provided value (though the internal frame count can be overwritten if there is user-provided value for FrameCount). A simple solution might be to update the FrameCount property during the GetFrames method.
The text was updated successfully, but these errors were encountered:
RoboDoig
changed the title
Expose the internal frame count in ImageSequence
Consider exposing the internal frame count in ImageSequence
Aug 13, 2024
Suggestion is rather to make TextureSequence a public class (like TextureArray), then the frame count can be accessed from the ResourceManager for the window (see BindTexture).
Tested the PR for this with the following extension which allows me to access the texture sequence data needed for e.g.wrapping functionality:
using Bonsai;
using System;
using System.ComponentModel;
using System.Linq;
using System.Reactive.Linq;
using Bonsai.Shaders;
public class GetTextureData : Source<TextureSequence>
{
[TypeConverter(typeof(TextureNameConverter))]
public string TextureName {get; set;}
public override IObservable<TextureSequence> Generate()
{
return ShaderManager.WindowSource.Select(window =>
{
var textureSequence = window.ResourceManager.Load<Texture>(TextureName) as TextureSequence;
Console.WriteLine(textureSequence.Textures.Length);
return textureSequence;
});
}
}
Relates to the Bonsai.Shaders package.
In some cases, it is useful to be able to access the total frame count of a texture sequence at runtime in Bonsai. For example, when scrubbing through a texture sequence one may want to 'wrap' back around after the maximum or minimum index of the sequence has been reached. To do this, the limits of the texture sequence indices must be available.
As far as I can tell it's very tricky to access these values either through current Bonsai operators or extensions. ImageSequence can access this internally via
GetFrames
but the public propertyFrameCount
is not updated if there is no user provided value (though the internal frame count can be overwritten if there is user-provided value forFrameCount
). A simple solution might be to update theFrameCount
property during theGetFrames
method.The text was updated successfully, but these errors were encountered: