Changeset View
Changeset View
Standalone View
Standalone View
doc/guides/interface_API.txt
| Show All 29 Lines | 4.1 UiDefBut | ||||
| 9. MENU | 9. MENU | ||||
| 10. COL | 10. COL | ||||
| 4.2 Icon buttons | 4.2 Icon buttons | ||||
| 4.3 pulldown menus / block buttons | 4.3 pulldown menus / block buttons | ||||
| 14. BLOCK | 14. BLOCK | ||||
| 4.4 specials | 4.4 specials | ||||
| 15. KEYEVT | 15. KEYEVT | ||||
| 16. LINK and INLINK | 16. LINK and INLINK | ||||
| 4.5 uiButton control fuctions | 4.5 uiButton control functions | ||||
| ----------------1. General notes | ----------------1. General notes | ||||
| - The API is built with Blender in mind, with some buttons acting on lists of Blender data. | - The API is built with Blender in mind, with some buttons acting on lists of Blender data. | ||||
| It was not meant to be available as a separate SDK, nor to be used for other applications. | It was not meant to be available as a separate SDK, nor to be used for other applications. | ||||
| - It works with only OpenGL calls, for the full 100%. This means that it has some quirks | - It works with only OpenGL calls, for the full 100%. This means that it has some quirks | ||||
| ▲ Show 20 Lines • Show All 78 Lines • ▼ Show 20 Lines | - while(looping) | ||||
| - for each block | - for each block | ||||
| - call uiDoBlock (handles buttons for single block) | - call uiDoBlock (handles buttons for single block) | ||||
| - (end for) | - (end for) | ||||
| /* at this moment, a new block can be created, for a menu */ | /* at this moment, a new block can be created, for a menu */ | ||||
| /* so we create a 2nd loop for it */ | /* so we create a 2nd loop for it */ | ||||
| - while first block is a menu | - while first block is a menu | ||||
| - if block is a menu and not initialized: | - if block is a menu and not initialized: | ||||
| - initalize 'saveunder' | - initialize 'saveunder' | ||||
| - draw it | - draw it | ||||
| - get event from queue | - get event from queue | ||||
| - call uiDoBlock (handles buttons for single block) | - call uiDoBlock (handles buttons for single block) | ||||
| /* here, a new block again can be created, for a sub menu */ | /* here, a new block again can be created, for a sub menu */ | ||||
| - if return "end" from uiDoBlock | - if return "end" from uiDoBlock | ||||
| restore 'saveunder's | restore 'saveunder's | ||||
| free all menu blocks | free all menu blocks | ||||
| exit from loop | exit from loop | ||||
| Show All 30 Lines | drawtype: | ||||
| UI_EMBOSSP 5 /* Simple borderless colored button (like blender sensors) */ | UI_EMBOSSP 5 /* Simple borderless colored button (like blender sensors) */ | ||||
| font: | font: | ||||
| UI_HELV 0 /* normal font */ | UI_HELV 0 /* normal font */ | ||||
| UI_HELVB 1 /* bold font */ | UI_HELVB 1 /* bold font */ | ||||
| With the new truetype option in Blender, this is used for all font families | With the new truetype option in Blender, this is used for all font families | ||||
| When a uiBlock is created, each uiButton that is defined gets the uiBlock properties. | When a uiBlock is created, each uiButton that is defined gets the uiBlock properties. | ||||
| Changing Block properties inbetween will affact uiButtons defined thereafter. | Changing Block properties in between will affact uiButtons defined thereafter. | ||||
| ----------3.1 uiBlock Controlling functions: | ----------3.1 uiBlock Controlling functions: | ||||
| void uiDrawBlock(block) | void uiDrawBlock(block) | ||||
| draws the block | draws the block | ||||
| Show All 23 Lines | void uiBlockSetXOfs(uiBlock *block, int xofs) | ||||
| for menus, offset from parent | for menus, offset from parent | ||||
| void uiBlockSetButmFunc(uiBlock *block, void (*menufunc)(void *arg, int event), void *arg) | void uiBlockSetButmFunc(uiBlock *block, void (*menufunc)(void *arg, int event), void *arg) | ||||
| sets function to be handled when a menu-block is marked "OK" | sets function to be handled when a menu-block is marked "OK" | ||||
| void uiAutoBlock(uiBlock *block, float minx, float miny, float sizex, float sizey, UI_BLOCK_ROWS) | void uiAutoBlock(uiBlock *block, float minx, float miny, float sizex, float sizey, UI_BLOCK_ROWS) | ||||
| Sets the buttons in this block to automatically align, and fit within boundaries. | Sets the buttons in this block to automatically align, and fit within boundaries. | ||||
| Internally it allows multiple colums or rows as well. Only 'row order' has been implemented. | Internally it allows multiple columns or rows as well. Only 'row order' has been implemented. | ||||
| The uiDefBut definitions don't need coordinates as input here, but instead: | The uiDefBut definitions don't need coordinates as input here, but instead: | ||||
| - first value (x1) to indicate row number | - first value (x1) to indicate row number | ||||
| - width and height values (if filled in) will be used to define a relative width/height. | - width and height values (if filled in) will be used to define a relative width/height. | ||||
| A call to uiDrawBlock will invoke the calculus to fit in all buttons. | A call to uiDrawBlock will invoke the calculus to fit in all buttons. | ||||
| ---------- 3.2 Internal function to know: | ---------- 3.2 Internal function to know: | ||||
| Show All 19 Lines | |||||
| - directly visualize data, and write to it. | - directly visualize data, and write to it. | ||||
| - put event codes (shorts) back in the queue, to be handled | - put event codes (shorts) back in the queue, to be handled | ||||
| - call a user-defined function pointer (while being pressed, etc) | - call a user-defined function pointer (while being pressed, etc) | ||||
| - create and call another block (i.e. menu) | - create and call another block (i.e. menu) | ||||
| Internally, each button or menu item is a 'uiButton', with a generic API and handling: | Internally, each button or menu item is a 'uiButton', with a generic API and handling: | ||||
| ui_def_but(block, type, retval, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip); | ui_def_but(block, type, retval, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip); | ||||
| Beacause a lot of obscure generic (re-use) happens here, translation calls have been made | Because a lot of obscure generic (re-use) happens here, translation calls have been made | ||||
| for each most button types individually. | for each most button types individually. | ||||
| -----------4.1 UiDefBut | -----------4.1 UiDefBut | ||||
| uiBut *UiDefBut[CSIF]( uiBlock *block, int type, int retval, char *str, | uiBut *UiDefBut[CSIF]( uiBlock *block, int type, int retval, char *str, | ||||
| short x1, short y1, short x2, short y2, xxxx *poin, | short x1, short y1, short x2, short y2, xxxx *poin, | ||||
| float min, float max, float a1, float a2, char *tip) | float min, float max, float a1, float a2, char *tip) | ||||
| ▲ Show 20 Lines • Show All 172 Lines • ▼ Show 20 Lines | |||||
| uiDefIconBut(block, INLINK, 0, ICON_INLINK, x1, y1, w, h, void *poin, short fromcode, 0, 0, 0, ""); | uiDefIconBut(block, INLINK, 0, ICON_INLINK, x1, y1, w, h, void *poin, short fromcode, 0, 0, 0, ""); | ||||
| poin: the pointer of the datablock you want to create links to | poin: the pointer of the datablock you want to create links to | ||||
| fromcode: a short identifying which LINK buttons can connect to it | fromcode: a short identifying which LINK buttons can connect to it | ||||
| ------------- 4.5 uiButton control fuctions | ------------- 4.5 uiButton control functions | ||||
| void uiButSetFunc(uiBut *but, void (*func)(void *arg1, void *arg2), void *arg1, void *arg2) | void uiButSetFunc(uiBut *but, void (*func)(void *arg1, void *arg2), void *arg1, void *arg2) | ||||
| When the button is pressed and released, it calls this function, with the 2 arguments. | When the button is pressed and released, it calls this function, with the 2 arguments. | ||||
| void uiButSetFlag(uiBut *but, int flag) | void uiButSetFlag(uiBut *but, int flag) | ||||
| set a flag for further control of button behaviour: | set a flag for further control of button behaviour: | ||||
| flag: | flag: | ||||
| UI_TEXT_LEFT | UI_TEXT_LEFT | ||||
| int uiButGetRetVal(uiBut *but) | int uiButGetRetVal(uiBut *but) | ||||
| gives return value | gives return value | ||||
| </body> | </body> | ||||
| <br><br><br> | <br><br><br> | ||||