Maybe not so simple :) GUI question

i Know some python but i dont know any Related to making a GUI.
I was wondering how to make a GUI that had a list of push on push off buttons it would be
5 X a lot. this would be for mapping notes for me shadow and lilgrugeboy’s Rock of Ages game so there would be a number by each row that would be in tenths of a second so .1 .2 .3… when you push on a button i want it to append the time on the side to the list and when you click it off it should remove it. if you sellect .1 for green the glist should append .1
thanks in advance

btw If you help you will get your name in the credits

does anyone know how to do this???

Could you post your question again, but this time with dots and comma’s? I will then try to give you some help. Mind you, I mean just giving some hints, not coding the GUI for you.

Well i wanted to know how to make a simple GUI for the Rock of ages game I’m working on, but I need a way to map out the notes. So I wanted to have a GUI with 5 by lots of buttons each symbolizing a note and time. All I need is an example on how you would add a push on / off button that appends the time that is to the left of the row to a list if pushed down, but if you unclick it, it would remove the time from the list.

  1. Please use dots and comma’s to separate your text, that’s what they are for.
  2. Are you talking about Game Engine GUI or Blender GUI? If it’s GE, it does not exist as far as I know: you can only fake it with planes and such. To be sure, you should post this problem on the GE forum.
  3. What does “mapping the notes” mean?
  4. This is by no means simple, it would take at least an hour to code it properly.

oooo im dumb i was reading it fast and i thought you put without dots or commas. (i’ll correct it)

  1. I am talking about Blender GUI.

  2. well in the game I’m working on is like guitar hero. The notes are added with empties so I made a script that adds the notes at the right time with a list of notes. This means you have to get the times to add the notes somehow and I wanted to make it so you play the song and add markers at the time there are notes then push in the buttons for the right note and time and when you are done it makes a list that you just copy and paste into the note adding script.

  3. Do you mean the GUI wouldn’t be simple or would it just be easy but take a long time to add all the buttons

So you want an out-of-game note editor so that you can edit the music that the in-game guitar hero has to hear and play?
My advice: save yourself some trouble. Get yourself a free MIDI composer and use the Blender MIDI plugin that someone is working on to import it. If the plugin doesn’t work for you, Google yourself another script that does the job. If there are none and all you can find is a C library, post again, I will show you how to call a C library from Python.

Thanks, but I cant find a MIDI plugin that works

None of them worked that I tried :(. Is there any way To get animation marker times or something.

So is this for editing the song (as in the actual midi notes) or do you just want something where you can lay out what buttons on the ‘guitar’ should be pushed like:

(obviously just a quick mock-up, without text, but there could/would be markers indicating time, etc. quite easily).

Its for Making a list of the notes so you can put them into the song
Edit: We wont use midi because you cant get the midi files for the songs were using. (there open source)

could you please tell me the script.:smiley: Right now this is the Best option I have.:yes:

the script will have to be more complex than just that i’d think.

you need a way to put in varying song tempos, and i’m assuming a way to make longer notes.

how fast will the notes ever be? because with just buttons i imagine you’d need to plan for 16th notes at least, if not 32nd notes for some parts. and even if you make 16th notes your fastest note, that means there will be 4 buttons a beat.

an average song, 120 bmp, thats 3 minutes long works out to 1440 buttons. and if you’d need 32nd notes, thats 2880 buttons on an average song. yikes!

not that most of them would ever need to be pressed, but you’d need to set it up like that to have the functionality there.

i would think using a system that reads midi notes would be far easier, though very strange to set up. (in midi program, only use 1 midi note for each button, so you’re plotting out 5 midi notes in total, only listen to the timing don’t listen to how they sound) because using midi you can have differing note values, without a disgusting amount of unnecessary buttons. and a midi-note to your games song chart would likely be pretty easy to set up.

Hey, its still a little buggy, but you should be able to squash a couple, and add the necessary functions for saving out the list, alter it to your needs and what not (its still a ‘debug’ version so to speak):

Truthfully, like adimperium said, you’d be better of using a midi editor and assigning certain notes to be what you need. From there you can probably use some of the midi modules for python to generate whatever list you need in whatever format so you can use it for your game. It’d be a whole lot easier than trying to recode everything for Blender.

I tried the midi modules but they didn’t work. So how would you get the column and row of a button? and how would you get the start time of the currently showing numbers.
how would you detect if a button is pushed down?
i’ll put you in the credits :slight_smile:
btw how does the save/load work

To load/save see: (New Version)

You need to set your load/save paths manually in the script, though you could do it with a file selector from the API too.

Start time of the currently showing numbers is stored in the variable MIN_TIME.

thanks, but… do the buttons pressed append to a list or how does the save/load work because if it doesn’t have different lists and just has the points of the notes I could probably make my other script work with that if I know how that works.

When you press a button, it gets added to the ‘timeMat’ variable, which is GridMatrix object. Right now, when you press a button, it updates the internal information for all buttons being displayed as they are in GridMatrix (which stores a series of 1’s and 0’s where each first level accessor is a column and each access within that is a row -> timeMat.__list[n] gives you the n’th column, timeMat.__list[n][m] gives you the n’th column m’th row, which is the same as it is for the GridToggle object as well).

Basically, the GridToggle object functions as a kind of sliding window. It only displays a portion of the entire ‘model’ that is the GridMatrix instance timeMat. When you press the left or right time buttons, it slides this window left or right, and the appropriate data from the model (GridMatrix object, or ‘timeMat’ variable) is updated and then is loaded into the new bounds of the “sliding window.”

Save, just saves the internal GridMatrix.__list out as a python list, and then load, reloads this, and with an exec command, assigns it back into the __list member.

In the GridMatrix list there is no sense of time. The index of the column multiplied by the time step is what time that’s occurring at. If you’d like to add a sense of time you could use a dictionary where key’s are time values and then you put the “notes” as the values.

so the grid matrix would be like:


but longer…

x = 0
if it is couldn’t I just get matrix[0][x] and if that equals zero then get matrix[0][x] and if
that == one then
addtime = x + 1
if time == addtime:
gl.addActiveActuator(add, 1)
x = x + 1

idk I think I can get it to work so what exactly does it save? is it just the matrix?