Hello, I'm trying to increase the amount of bookmarks in my project, taking the example of the Timeline BookmarksBR UDF menu, I set it to 9 bookmark, the configuration is correct, it saves correctly, but the green mark icon does not appear, it only appears up to bookmark 4 ,from 5 onwards no, how to fix?
Config
public void UDF_UpdateTimeline() {
// On open = identical to ActionEverySecond
// THE FOLLOWING SECTION SHOULD BE MODIFIED WHEN THE TIMELINE POPUP MENU CHANGES IN LAYOUT
// In addition the if then else section must be modified if the UDV variables change their names.
// ++++ START USER MODIFIABLE SECTION ++++
// specify start of Timeline progress bar BarX and its length BarLength in pixels from left margin
int BarX = 335;
int BarLength = 1244;
// position settings vertically from top of screen for bookmark indicators and marker
int MarkerY = 889;
int IndicatorY = 908;
int MarkerWidth = 12; // point inverted triangle is in the middle
// +++ END USER MODIFIABLE SECTION ++++
int playlistID;
int nrBookmarks=0;
long RunningTime =0;
long time;
boolean OK;
// determine running time of current movie
OK = true;
playlistID = getPlaylistID();
// determine total running time of the movie - these are given values as User Defined Variables
// you cannot use the Java switch statement because that expects constants and UDV_xx are variables
// The playlistIDs are also UDV_yy variables, values are assigned in the First Play multiaction.
if (playlistID == UDV_playIDFILME)
{ RunningTime = UDV_timeFILME;}
// perform the rest only if movie is recognized
if (OK) {
// get current playing time movie in nano-seconds and display that time as hh:mm:ss
time = getMediaTime();
setText("F:PM_Timeline_popup.Timer", time2str(time));
// Set time progress bar through clipping area. Bar starts at BarX and has width BarLength pixels
time = getMediaTimeInSeconds();
time = time * BarLength / RunningTime + BarX;
setClipping("F:PM_Timeline_popup.Timeline", 0, 0, (int)time, 1079);
// Determine number of bookmarks present for that movie
nrBookmarks = getBookmarksCount(playlistID);
// Initially set all indicators off the timeline as if there are no bookmarks
// Note that this only works if the (dropdown menu)> Change Effects for the marker and bookmarks have
// "Move container" checked!
moveToXY("F:PM_Timeline_popup.Bookmark_1", 332, IndicatorY);
moveToXY("F:PM_Timeline_popup.Bookmark_2", 332, IndicatorY);
moveToXY("F:PM_Timeline_popup.Bookmark_3", 332, IndicatorY);
moveToXY("F:PM_Timeline_popup.Bookmark_4", 332, IndicatorY);
moveToXY("F:PM_Timeline_popup.Bookmark_5", 332, IndicatorY);
moveToXY("F:PM_Timeline_popup.Bookmark_6", 332, IndicatorY);
moveToXY("F:PM_Timeline_popup.Bookmark_7", 332, IndicatorY);
moveToXY("F:PM_Timeline_popup.Bookmark_8", 332, IndicatorY);
moveToXY("F:PM_Timeline_popup.Bookmark_9", 332, IndicatorY);
// no bookmarks - marker is at height MarkerY the bookmark indicators at IndicatorY
if (nrBookmarks < 1) {
setText("F:PM_Timeline_popup.Bookmark_Time", "VAZIO");
moveToXY("F:PM_Timeline_popup.Marker", 332, MarkerY);
}
// set the marker to the current bookmark
if (nrBookmarks > 0) {
setText("F:PM_Timeline_popup.Bookmark_Time", currentBookmarkText(playlistID));
time = currentBookmarkTime(playlistID);
time = time / 1000000000L * BarLength / RunningTime + BarX;
moveToXY("F:PM_Timeline_popup.Marker", (int)(time - MarkerWidth/2), MarkerY);
}
// position first bookmark
if (nrBookmarks >= 1) {
time = getBookmarkTime(playlistID, 1);
time = time / 1000000000L * BarLength / RunningTime + BarX;
moveToXY("F:PM_Timeline_popup.Bookmark_1", (int)time, IndicatorY);
}
// position 2nd bookmark
if (nrBookmarks >= 2) {
time = getBookmarkTime(playlistID, 2);
time = time / 1000000000L * BarLength / RunningTime + BarX;
moveToXY("F:PM_Timeline_popup.Bookmark_2", (int)time, IndicatorY);
}
// position 3rd bookmark
if (nrBookmarks >= 3) {
time = getBookmarkTime(playlistID, 3);
time = time / 1000000000L * BarLength / RunningTime + BarX;
moveToXY("F:PM_Timeline_popup.Bookmark_3", (int)time, IndicatorY);
}
// position 4th bookmark
if (nrBookmarks == 4) {
time = getBookmarkTime(playlistID, 4);
time = time / 1000000000L * BarLength / RunningTime + BarX;
moveToXY("F:PM_Timeline_popup.Bookmark_4", (int)time, IndicatorY);
}
// position 5th bookmark
if (nrBookmarks == 5) {
time = getBookmarkTime(playlistID, 5);
time = time / 1000000000L * BarLength / RunningTime + BarX;
moveToXY("F:PM_Timeline_popup.Bookmark_5", (int)time, IndicatorY);
}
// position 6th bookmark
if (nrBookmarks == 6) {
time = getBookmarkTime(playlistID, 6);
time = time / 1000000000L * BarLength / RunningTime + BarX;
moveToXY("F:PM_Timeline_popup.Bookmark_6", (int)time, IndicatorY);
}
// position 7th bookmark
if (nrBookmarks == 7) {
time = getBookmarkTime(playlistID, 7);
time = time / 1000000000L * BarLength / RunningTime + BarX;
moveToXY("F:PM_Timeline_popup.Bookmark_7", (int)time, IndicatorY);
}
// position 8th bookmark
if (nrBookmarks == 8) {
time = getBookmarkTime(playlistID, 8);
time = time / 1000000000L * BarLength / RunningTime + BarX;
moveToXY("F:PM_Timeline_popup.Bookmark_8", (int)time, IndicatorY);
}
// position 9th bookmark
if (nrBookmarks == 9) {
time = getBookmarkTime(playlistID, 9);
time = time / 1000000000L * BarLength / RunningTime + BarX;
moveToXY("F:PM_Timeline_popup.Bookmark_9", (int)time, IndicatorY);
}
activateButtonEx("H:PM_Timeline_popup.Handler", "TimelineButton", false);
}
}
Bookmark indicator does not appear
Bookmark indicator does not appear
- Attachments
-
- 001.jpg (193.1 KiB) Viewed 14021 times
-
- Posts: 472
- Joined: Fri Mar 01, 2013 1:03 pm
- Contact:
Re: Bookmark indicator does not appear
Hello,
As far as I can see you should use >= instead of == in all "if (nrBookmarks ...)" conditions except the latest one. I will ask Theo to take a look.
Theoretically this code can be simplified
As far as I can see you should use >= instead of == in all "if (nrBookmarks ...)" conditions except the latest one. I will ask Theo to take a look.
Theoretically this code can be simplified
Code: Select all
public void UDF_UpdateTimeline() {
// On open = identical to ActionEverySecond
// THE FOLLOWING SECTION SHOULD BE MODIFIED WHEN THE TIMELINE POPUP MENU CHANGES IN LAYOUT
// In addition the if then else section must be modified if the UDV variables change their names.
// ++++ START USER MODIFIABLE SECTION ++++
// specify start of Timeline progress bar BarX and its length BarLength in pixels from left margin
int BarX = 335;
int BarLength = 1244;
// position settings vertically from top of screen for bookmark indicators and marker
int MarkerY = 889;
int IndicatorY = 908;
int MarkerWidth = 12; // point inverted triangle is in the middle
// +++ END USER MODIFIABLE SECTION ++++
int playlistID;
int nrBookmarks = 0;
long RunningTime = 0;
long time;
boolean OK;
// determine running time of current movie
OK = true;
playlistID = getPlaylistID();
// determine total running time of the movie - these are given values as User Defined Variables
// you cannot use the Java switch statement because that expects constants and UDV_xx are variables
// The playlistIDs are also UDV_yy variables, values are assigned in the First Play multiaction.
if (playlistID == UDV_playIDFILME) {
RunningTime = UDV_timeFILME;
}
// perform the rest only if movie is recognized
if (OK) {
// get current playing time movie in nano-seconds and display that time as hh:mm:ss
time = getMediaTime();
setText("F:PM_Timeline_popup.Timer", time2str(time));
// Set time progress bar through clipping area. Bar starts at BarX and has width BarLength
// pixels
time = getMediaTimeInSeconds();
time = time * BarLength / RunningTime + BarX;
setClipping("F:PM_Timeline_popup.Timeline", 0, 0, (int) time, 1079);
// Determine number of bookmarks present for that movie
nrBookmarks = getBookmarksCount(playlistID);
// Initially set all indicators off the timeline as if there are no bookmarks
// Note that this only works if the (dropdown menu)> Change Effects for the marker and bookmarks have
// "Move container" checked!
moveToXY("F:PM_Timeline_popup.Bookmark_1", 332, IndicatorY);
moveToXY("F:PM_Timeline_popup.Bookmark_2", 332, IndicatorY);
moveToXY("F:PM_Timeline_popup.Bookmark_3", 332, IndicatorY);
moveToXY("F:PM_Timeline_popup.Bookmark_4", 332, IndicatorY);
moveToXY("F:PM_Timeline_popup.Bookmark_5", 332, IndicatorY);
moveToXY("F:PM_Timeline_popup.Bookmark_6", 332, IndicatorY);
moveToXY("F:PM_Timeline_popup.Bookmark_7", 332, IndicatorY);
moveToXY("F:PM_Timeline_popup.Bookmark_8", 332, IndicatorY);
moveToXY("F:PM_Timeline_popup.Bookmark_9", 332, IndicatorY);
// no bookmarks - marker is at height MarkerY the bookmark indicators at IndicatorY
if (nrBookmarks < 1) {
setText("F:PM_Timeline_popup.Bookmark_Time", "VAZIO");
moveToXY("F:PM_Timeline_popup.Marker", 332, MarkerY);
}
// set the marker to the current bookmark
if (nrBookmarks > 0) {
setText("F:PM_Timeline_popup.Bookmark_Time", currentBookmarkText(playlistID));
time = currentBookmarkTime(playlistID);
time = time / 1000000000L * BarLength / RunningTime + BarX;
moveToXY("F:PM_Timeline_popup.Marker", (int) (time - MarkerWidth / 2), MarkerY);
}
for (int iBM = 1; iBM <= nrBookmarks; iBM++) {
time = getBookmarkTime(playlistID, iBM);
time = time / 1000000000L * BarLength / RunningTime + BarX;
moveToXY("F:PM_Timeline_popup.Bookmark_" + iBM, (int) time, IndicatorY);
}
activateButtonEx("H:PM_Timeline_popup.Handler", "TimelineButton", false);
}
}
Best regards,
Alexey Kolesnikov
Alexey Kolesnikov
Re: Bookmark indicator does not appear
There is apparently a new variable UDV_timeFILME that is not part of my original code and must be set somewhere... (I replace it by my own RunningTime = manager.getDurationInSeconds(); in the original code as I'm also running this project with the original menu, Australia and Coasts files - that should work with 4 or 9 bookmarks in the end).
Each marker is specified as a Bookmark N object in the Timeline Popup. These need to exist clearly, as otherwise they cannot be shown.
I'll try to figure out where it goes wrong in only showing four bookmarks
Each marker is specified as a Bookmark N object in the Timeline Popup. These need to exist clearly, as otherwise they cannot be shown.
I'll try to figure out where it goes wrong in only showing four bookmarks
Re: Bookmark indicator does not appear
Also (reading my own text - haven't touched or used this code for years) the movies (Australia/Coasts) have a green button SWITCH statement explicitly checking for the number of bookmarks. The example sets it to 4, in your case it needs to be set to 9. I cannot see from the info you've given whether this is the case (the project file would tell so but you only included a modified UDF function and a screenshot)
In addition the AddBookmark function also has a check on more than 4. This needs to be increased to 9.
After I made these changes, I can add upto 9 bookmarks... something similar should work in your case too (unless other changes you made on the code prevent it)
The check in AddBookmark is not strictly needed, as the check is made in the "green button" SWITCH action before AddBoomark is called. That fooled me too initially.
In addition the AddBookmark function also has a check on more than 4. This needs to be increased to 9.
After I made these changes, I can add upto 9 bookmarks... something similar should work in your case too (unless other changes you made on the code prevent it)
The check in AddBookmark is not strictly needed, as the check is made in the "green button" SWITCH action before AddBoomark is called. That fooled me too initially.
Re: Bookmark indicator does not appear
I made the changes but still not successful, could you check the code for me?
tks
https://drive.google.com/file/d/1WDwELR ... sp=sharing
tks
https://drive.google.com/file/d/1WDwELR ... sp=sharing
Re: Bookmark indicator does not appear
I copied it down but there are no video files for menus or movies so I need to improvise there.
But... a main mistake also pointed out by Alexey, is that UpdateTimeline needs to have
if (nrBookmarks >= 5){... etc using >= rather than == except for the last one. If you don't do that the code responds differently.
Imagine you got 7 bookmarks. That means nrBookmarks == 5 is false and code is not executed. ==6 ditto ==7 should work.
But you want all to be set upto 7, so anything below the maximum must use >= rather than ==.
Try that.
It seems to work for me (replacing all movies with Australia / Menu): I get 9 bookmarks and can select all.
Did not check anything else. Looks like a nice bluray project!
But... a main mistake also pointed out by Alexey, is that UpdateTimeline needs to have
if (nrBookmarks >= 5){... etc using >= rather than == except for the last one. If you don't do that the code responds differently.
Imagine you got 7 bookmarks. That means nrBookmarks == 5 is false and code is not executed. ==6 ditto ==7 should work.
But you want all to be set upto 7, so anything below the maximum must use >= rather than ==.
Try that.
It seems to work for me (replacing all movies with Australia / Menu): I get 9 bookmarks and can select all.
Did not check anything else. Looks like a nice bluray project!
Re: Bookmark indicator does not appear
It worked, Thanks deklerkt and Alexey you are the best
Just one last question, in "update_timeline" is there any java code to indicate the current audio and subtitles in the popup? Is it easy to enter this?
Just one last question, in "update_timeline" is there any java code to indicate the current audio and subtitles in the popup? Is it easy to enter this?
Re: Bookmark indicator does not appear
No there is not. But in the same way there are two text fields to show the timing of the movie and the bookmarks, you can add similar code to a new textfield and fill it with other info.
The information on audio and subtitle can be retrieved using the functions getAudioID and getSubID. However these functions return the index of the track (1,2,3...) not the name like audio "Espagnol", "English" or subtitles "ES", "EN" .
You would have to program that yourself in a type of Java Switch statement (Case 1: {strLang="Espagnol";break; } case 2:{strLang ="English";break;}
etc. and then assign strLang to the textfield.
A bit of Java knowledge helps here.
The information on audio and subtitle can be retrieved using the functions getAudioID and getSubID. However these functions return the index of the track (1,2,3...) not the name like audio "Espagnol", "English" or subtitles "ES", "EN" .
You would have to program that yourself in a type of Java Switch statement (Case 1: {strLang="Espagnol";break; } case 2:{strLang ="English";break;}
etc. and then assign strLang to the textfield.
A bit of Java knowledge helps here.