Manual Identificator (ID) for scene

Please add a field with setting of ID of scene. Because now I need to use index of scenes for it.

var sceneObj = document.querySelectorAll('.HYPE_scene')[2];

And it isn’t comfortable because order of scenes can be changed

PS Maybe is there a way to get id, which hype automatically generate for scenes?

1 Like

manipulating the sceneelement is always kind of a hack. so it’s not supported within the UI. within @MaxZieb’s extensionproject he’s offered a bunch of nice methods to extend hypes API. this includes a save method to get the current sceneelement. you may have a closer look :slight_smile:

btw onsceneload the element-argument is always the sceneelement …

1 Like

Thanks for the request!

Ideally we would be able to give a scene a fixed id the same way we can with elements

Or we already have

hypeDocument.showSceneNamed

So
Would it be a stretch to have

hypeDocument.iDOfsceneNamed

Although a fixed id would help with external scripts

1 Like

Ooooh, that's interesting. It's kinda silly that scenes can have the same name. Naming of scenes would probably be more effective if the name of the scene was the ID. (That would make scene naming more restrictive though.)

1 Like

The main problem with using a name as apposed to an id is scene names can be duplicated. So there is a risk you will get unexpected results. This is true of showSceneNamed. So a fixed id would in most cases be preferable

1 Like

It is exactly this - we didn't want to make the UI restrictive or throw up warnings, but this kinda is at odds with an API that also seeks to be perhaps slightly too friendly as well.

If it is your own document, you can of course ensure uniqueness by just making sure you scenes all differently :slight_smile:. (You'd need to do just this if you wanted to do manual IDs as well!)

However I imagine @MarkHunte the use case for this request is for something programmatic where you want to make a script that could be used with other people's documents?

I forgot to mention we already have hypeDocument.currentSceneId

Which means you have to be on that scene already to manipulate it and use the hype scope

For me it would just open up the ability to targeting a scene programmatically if needed regardless of it being current or not. Normally you are trying to something with ids outside of the hype scope , would be handy for the use case of trying to do this from a document scope rather than a hypeDocument scope.
And it would bring scenes inline with other elements where we can do this.

1 Like

I encountered this issue while looping programmatically over scenes, managing transitions to look ahead (like interstitials in a setup using Hype scenes as a slides manager). Another instance is in my Transition efforts in the extensions (Custom Transitions and Hype Scene Magic). The problem arises when the interface only interacts with scene names, causing navigation limitations if there are identical names. This issue also applies to fetching functions with hypeDocument.functions(). Ideally, names should be unique, but Hype allows multiple functions with the same name, as with scenes. Despite this, you can still access the scene with the next scene. I believe the runtime has a function to navigate to a scene by index, although it is not exposed in the API.

2 Likes