forked from bartvdbraak/blender
2.5
Logic editing back! Test screenie: http://download.blender.org/institute/rt9.jpg I gave the buttons a bit more width, added nicer linkline draw. Not working yet: - theme colors for sensor/actuator types (was old button colors) - moving sensors up/down (used bad pupmenu... better is icons like used for modifiers) - Linkline mouse-over select. Currently deleting a link goes by drawing the same line again. Needs to be fully tested for functionality too, leave that to the GE department. :) I noted there's bad button hacking with reading button values, like check_state_mask(). uiBut structure was not meant to be exported outside of interface module.
This commit is contained in:
parent
54ed699743
commit
0b0b02caf8
@ -398,18 +398,21 @@ void uiMenuPopupBoundsBlock(uiBlock *block, int addval, int mx, int my)
|
||||
|
||||
static void ui_draw_linkline(uiBut *but, uiLinkLine *line)
|
||||
{
|
||||
float vec1[2], vec2[2];
|
||||
rcti rect;
|
||||
|
||||
if(line->from==NULL || line->to==NULL) return;
|
||||
|
||||
vec1[0]= (line->from->x1+line->from->x2)/2.0;
|
||||
vec1[1]= (line->from->y1+line->from->y2)/2.0;
|
||||
vec2[0]= (line->to->x1+line->to->x2)/2.0;
|
||||
vec2[1]= (line->to->y1+line->to->y2)/2.0;
|
||||
rect.xmin= (line->from->x1+line->from->x2)/2.0;
|
||||
rect.ymin= (line->from->y1+line->from->y2)/2.0;
|
||||
rect.xmax= (line->to->x1+line->to->x2)/2.0;
|
||||
rect.ymax= (line->to->y1+line->to->y2)/2.0;
|
||||
|
||||
if(line->flag & UI_SELECT) glColor3ub(100,100,100);
|
||||
else glColor3ub(0,0,0);
|
||||
fdrawline(vec1[0], vec1[1], vec2[0], vec2[1]);
|
||||
if(line->flag & UI_SELECT)
|
||||
glColor3ub(100,100,100);
|
||||
else
|
||||
glColor3ub(0,0,0);
|
||||
|
||||
ui_draw_link_bezier(&rect);
|
||||
}
|
||||
|
||||
static void ui_draw_links(uiBlock *block)
|
||||
@ -475,6 +478,8 @@ static int ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBut
|
||||
but->selend= oldbut->selend;
|
||||
but->softmin= oldbut->softmin;
|
||||
but->softmax= oldbut->softmax;
|
||||
but->linkto[0]= oldbut->linkto[0];
|
||||
but->linkto[1]= oldbut->linkto[1];
|
||||
found= 1;
|
||||
|
||||
oldbut->active= NULL;
|
||||
@ -733,8 +738,13 @@ static void ui_is_but_sel(uiBut *but)
|
||||
|
||||
/* XXX 2.50 no links supported yet */
|
||||
|
||||
#if 0
|
||||
static uiBut *ui_get_valid_link_button(uiBlock *block, uiBut *but, short *mval)
|
||||
static int uibut_contains_pt(uiBut *but, short *mval)
|
||||
{
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
uiBut *ui_get_valid_link_button(uiBlock *block, uiBut *but, short *mval)
|
||||
{
|
||||
uiBut *bt;
|
||||
|
||||
@ -745,7 +755,7 @@ static uiBut *ui_get_valid_link_button(uiBlock *block, uiBut *but, short *mval)
|
||||
|
||||
if (bt) {
|
||||
if (but->type==LINK && bt->type==INLINK) {
|
||||
if( but->link->tocode == (int)bt->min ) {
|
||||
if( but->link->tocode == (int)bt->hardmin ) {
|
||||
return bt;
|
||||
}
|
||||
}
|
||||
@ -759,21 +769,6 @@ static uiBut *ui_get_valid_link_button(uiBlock *block, uiBut *but, short *mval)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int ui_is_a_link(uiBut *from, uiBut *to)
|
||||
{
|
||||
uiLinkLine *line;
|
||||
uiLink *link;
|
||||
|
||||
link= from->link;
|
||||
if(link) {
|
||||
line= link->lines.first;
|
||||
while(line) {
|
||||
if(line->from==from && line->to==to) return 1;
|
||||
line= line->next;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static uiBut *ui_find_inlink(uiBlock *block, void *poin)
|
||||
{
|
||||
@ -839,98 +834,6 @@ void uiComposeLinks(uiBlock *block)
|
||||
}
|
||||
}
|
||||
|
||||
static void ui_add_link(uiBut *from, uiBut *to)
|
||||
{
|
||||
/* in 'from' we have to add a link to 'to' */
|
||||
uiLink *link;
|
||||
void **oldppoin;
|
||||
int a;
|
||||
|
||||
if(ui_is_a_link(from, to)) {
|
||||
printf("already exists\n");
|
||||
return;
|
||||
}
|
||||
|
||||
link= from->link;
|
||||
|
||||
/* are there more pointers allowed? */
|
||||
if(link->ppoin) {
|
||||
oldppoin= *(link->ppoin);
|
||||
|
||||
(*(link->totlink))++;
|
||||
*(link->ppoin)= MEM_callocN( *(link->totlink)*sizeof(void *), "new link");
|
||||
|
||||
for(a=0; a< (*(link->totlink))-1; a++) {
|
||||
(*(link->ppoin))[a]= oldppoin[a];
|
||||
}
|
||||
(*(link->ppoin))[a]= to->poin;
|
||||
|
||||
if(oldppoin) MEM_freeN(oldppoin);
|
||||
}
|
||||
else {
|
||||
*(link->poin)= to->poin;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static int ui_do_but_LINK(uiBlock *block, uiBut *but)
|
||||
{
|
||||
/*
|
||||
* This button only visualizes, the dobutton mode
|
||||
* can add a new link, but then the whole system
|
||||
* should be redrawn/initialized.
|
||||
*
|
||||
*/
|
||||
uiBut *bt=0, *bto=NULL;
|
||||
short sval[2], mval[2], mvalo[2], first= 1;
|
||||
|
||||
uiGetMouse(curarea->win, sval);
|
||||
mvalo[0]= sval[0];
|
||||
mvalo[1]= sval[1];
|
||||
|
||||
while (get_mbut() & L_MOUSE) {
|
||||
uiGetMouse(curarea->win, mval);
|
||||
|
||||
if(mval[0]!=mvalo[0] || mval[1]!=mvalo[1] || first) {
|
||||
/* clear completely, because of drawbuttons */
|
||||
bt= ui_get_valid_link_button(block, but, mval);
|
||||
if(bt) {
|
||||
bt->flag |= UI_ACTIVE;
|
||||
ui_draw_but(ar, bt);
|
||||
}
|
||||
if(bto && bto!=bt) {
|
||||
bto->flag &= ~UI_ACTIVE;
|
||||
ui_draw_but(ar, bto);
|
||||
}
|
||||
bto= bt;
|
||||
|
||||
if (!first) {
|
||||
glutil_draw_front_xor_line(sval[0], sval[1], mvalo[0], mvalo[1]);
|
||||
}
|
||||
glutil_draw_front_xor_line(sval[0], sval[1], mval[0], mval[1]);
|
||||
|
||||
mvalo[0]= mval[0];
|
||||
mvalo[1]= mval[1];
|
||||
|
||||
first= 0;
|
||||
}
|
||||
else UI_wait_for_statechange();
|
||||
}
|
||||
|
||||
if (!first) {
|
||||
glutil_draw_front_xor_line(sval[0], sval[1], mvalo[0], mvalo[1]);
|
||||
}
|
||||
|
||||
if(bt) {
|
||||
if(but->type==LINK) ui_add_link(but, bt);
|
||||
else ui_add_link(bt, but);
|
||||
|
||||
scrarea_queue_winredraw(curarea);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* ************************************************ */
|
||||
|
||||
|
@ -165,6 +165,7 @@ typedef struct uiAfterFunc {
|
||||
bContextStore *context;
|
||||
} uiAfterFunc;
|
||||
|
||||
static int ui_mouse_inside_button(ARegion *ar, uiBut *but, int x, int y);
|
||||
static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState state);
|
||||
static int ui_handler_region_menu(bContext *C, wmEvent *event, void *userdata);
|
||||
static int ui_handler_popup(bContext *C, wmEvent *event, void *userdata);
|
||||
@ -525,6 +526,149 @@ static void ui_apply_but_CHARTAB(bContext *C, uiBut *but, uiHandleButtonData *da
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static void ui_delete_active_linkline(uiBlock *block)
|
||||
{
|
||||
uiBut *but;
|
||||
uiLink *link;
|
||||
uiLinkLine *line, *nline;
|
||||
int a, b;
|
||||
|
||||
but= block->buttons.first;
|
||||
while(but) {
|
||||
if(but->type==LINK && but->link) {
|
||||
line= but->link->lines.first;
|
||||
while(line) {
|
||||
|
||||
nline= line->next;
|
||||
|
||||
if(line->flag & UI_SELECT) {
|
||||
BLI_remlink(&but->link->lines, line);
|
||||
|
||||
link= line->from->link;
|
||||
|
||||
/* are there more pointers allowed? */
|
||||
if(link->ppoin) {
|
||||
|
||||
if(*(link->totlink)==1) {
|
||||
*(link->totlink)= 0;
|
||||
MEM_freeN(*(link->ppoin));
|
||||
*(link->ppoin)= NULL;
|
||||
}
|
||||
else {
|
||||
b= 0;
|
||||
for(a=0; a< (*(link->totlink)); a++) {
|
||||
|
||||
if( (*(link->ppoin))[a] != line->to->poin ) {
|
||||
(*(link->ppoin))[b]= (*(link->ppoin))[a];
|
||||
b++;
|
||||
}
|
||||
}
|
||||
(*(link->totlink))--;
|
||||
}
|
||||
}
|
||||
else {
|
||||
*(link->poin)= NULL;
|
||||
}
|
||||
|
||||
MEM_freeN(line);
|
||||
}
|
||||
line= nline;
|
||||
}
|
||||
}
|
||||
but= but->next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static uiLinkLine *ui_is_a_link(uiBut *from, uiBut *to)
|
||||
{
|
||||
uiLinkLine *line;
|
||||
uiLink *link;
|
||||
|
||||
link= from->link;
|
||||
if(link) {
|
||||
line= link->lines.first;
|
||||
while(line) {
|
||||
if(line->from==from && line->to==to) return line;
|
||||
line= line->next;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void ui_add_link(uiBut *from, uiBut *to)
|
||||
{
|
||||
/* in 'from' we have to add a link to 'to' */
|
||||
uiLink *link;
|
||||
uiLinkLine *line;
|
||||
void **oldppoin;
|
||||
int a;
|
||||
|
||||
if( (line= ui_is_a_link(from, to)) ) {
|
||||
line->flag |= UI_SELECT;
|
||||
ui_delete_active_linkline(from->block);
|
||||
printf("already exists, means deletion now\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (from->type==LINK && to->type==INLINK) {
|
||||
if( from->link->tocode != (int)to->hardmin ) {
|
||||
printf("cannot link\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if(from->type==INLINK && to->type==LINK) {
|
||||
if( to->link->tocode == (int)from->hardmin ) {
|
||||
printf("cannot link\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
link= from->link;
|
||||
|
||||
/* are there more pointers allowed? */
|
||||
if(link->ppoin) {
|
||||
oldppoin= *(link->ppoin);
|
||||
|
||||
(*(link->totlink))++;
|
||||
*(link->ppoin)= MEM_callocN( *(link->totlink)*sizeof(void *), "new link");
|
||||
|
||||
for(a=0; a< (*(link->totlink))-1; a++) {
|
||||
(*(link->ppoin))[a]= oldppoin[a];
|
||||
}
|
||||
(*(link->ppoin))[a]= to->poin;
|
||||
|
||||
if(oldppoin) MEM_freeN(oldppoin);
|
||||
}
|
||||
else {
|
||||
*(link->poin)= to->poin;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void ui_apply_but_LINK(bContext *C, uiBut *but, uiHandleButtonData *data)
|
||||
{
|
||||
ARegion *ar= CTX_wm_region(C);
|
||||
uiBut *bt;
|
||||
|
||||
for(bt= but->block->buttons.first; bt; bt= bt->next) {
|
||||
if( ui_mouse_inside_button(ar, bt, but->linkto[0]+ar->winrct.xmin, but->linkto[1]+ar->winrct.ymin) )
|
||||
break;
|
||||
}
|
||||
if(bt && bt!=but) {
|
||||
|
||||
if(but->type==LINK) ui_add_link(but, bt);
|
||||
else ui_add_link(bt, but);
|
||||
|
||||
ui_apply_but_func(C, but);
|
||||
data->retval= but->retval;
|
||||
}
|
||||
data->applied= 1;
|
||||
}
|
||||
|
||||
|
||||
static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, int interactive)
|
||||
{
|
||||
char *editstr;
|
||||
@ -640,6 +784,7 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
|
||||
#endif
|
||||
case LINK:
|
||||
case INLINK:
|
||||
ui_apply_but_LINK(C, but, data);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -2806,6 +2951,38 @@ static int ui_do_but_CHARTAB(bContext *C, uiBlock *block, uiBut *but, uiHandleBu
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static int ui_do_but_LINK(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
|
||||
{
|
||||
ARegion *ar= CTX_wm_region(C);
|
||||
|
||||
but->linkto[0]= event->x-ar->winrct.xmin;
|
||||
but->linkto[1]= event->y-ar->winrct.ymin;
|
||||
|
||||
if(data->state == BUTTON_STATE_HIGHLIGHT) {
|
||||
if(event->type == LEFTMOUSE && event->val==KM_PRESS) {
|
||||
button_activate_state(C, but, BUTTON_STATE_WAIT_RELEASE);
|
||||
return WM_UI_HANDLER_BREAK;
|
||||
}
|
||||
else if(event->type == LEFTMOUSE && but->block->handle) {
|
||||
button_activate_state(C, but, BUTTON_STATE_EXIT);
|
||||
return WM_UI_HANDLER_BREAK;
|
||||
}
|
||||
}
|
||||
else if(data->state == BUTTON_STATE_WAIT_RELEASE) {
|
||||
|
||||
if(event->type == LEFTMOUSE && event->val!=KM_PRESS) {
|
||||
if(!(but->flag & UI_SELECT))
|
||||
data->cancel= 1;
|
||||
button_activate_state(C, but, BUTTON_STATE_EXIT);
|
||||
return WM_UI_HANDLER_BREAK;
|
||||
}
|
||||
}
|
||||
|
||||
return WM_UI_HANDLER_CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
|
||||
{
|
||||
uiHandleButtonData *data;
|
||||
@ -2951,13 +3128,11 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
|
||||
retval= ui_do_but_CHARTAB(C, block, but, data, event);
|
||||
break;
|
||||
#endif
|
||||
/* XXX 2.50 links not implemented yet */
|
||||
#if 0
|
||||
|
||||
case LINK:
|
||||
case INLINK:
|
||||
retval= retval= ui_do_but_LINK(block, but);
|
||||
retval= ui_do_but_LINK(C, but, data, event);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
return retval;
|
||||
@ -3421,6 +3596,13 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
|
||||
else if(data->state == BUTTON_STATE_WAIT_RELEASE) {
|
||||
switch(event->type) {
|
||||
case MOUSEMOVE:
|
||||
|
||||
if(ELEM(but->type,LINK, INLINK)) {
|
||||
but->flag |= UI_SELECT;
|
||||
ui_do_button(C, block, but, event);
|
||||
ED_region_tag_redraw(data->region);
|
||||
}
|
||||
else {
|
||||
/* deselect the button when moving the mouse away */
|
||||
if(ui_mouse_inside_button(ar, but, event->x, event->y)) {
|
||||
if(!(but->flag & UI_SELECT)) {
|
||||
@ -3436,6 +3618,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
|
||||
ED_region_tag_redraw(data->region);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
/* otherwise catch mouse release event */
|
||||
|
@ -181,6 +181,7 @@ struct uiBut {
|
||||
void *search_arg;
|
||||
|
||||
uiLink *link;
|
||||
short linkto[2];
|
||||
|
||||
char *tip, *lockstr;
|
||||
|
||||
@ -408,6 +409,7 @@ extern int ui_button_is_active(struct ARegion *ar);
|
||||
void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y3);
|
||||
void ui_draw_menu_back(struct uiStyle *style, uiBlock *block, rcti *rect);
|
||||
void ui_draw_search_back(struct uiStyle *style, uiBlock *block, rcti *rect);
|
||||
void ui_draw_link_bezier(rcti *rect);
|
||||
|
||||
extern void ui_draw_but(const struct bContext *C, ARegion *ar, struct uiStyle *style, uiBut *but, rcti *rect);
|
||||
/* theme color init */
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "BLI_rect.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_curve.h"
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_utildefines.h"
|
||||
|
||||
@ -1550,6 +1551,76 @@ static void widget_numbut(uiWidgetColors *wcol, rcti *rect, int state, int round
|
||||
|
||||
}
|
||||
|
||||
|
||||
static int ui_link_bezier_points(rcti *rect, float coord_array[][2], int resol)
|
||||
{
|
||||
float dist, vec[4][2];
|
||||
|
||||
vec[0][0]= rect->xmin;
|
||||
vec[0][1]= rect->ymin;
|
||||
vec[3][0]= rect->xmax;
|
||||
vec[3][1]= rect->ymax;
|
||||
|
||||
dist= 0.5f*ABS(vec[0][0] - vec[3][0]);
|
||||
|
||||
vec[1][0]= vec[0][0]+dist;
|
||||
vec[1][1]= vec[0][1];
|
||||
|
||||
vec[2][0]= vec[3][0]-dist;
|
||||
vec[2][1]= vec[3][1];
|
||||
|
||||
forward_diff_bezier(vec[0][0], vec[1][0], vec[2][0], vec[3][0], coord_array[0], resol, 2);
|
||||
forward_diff_bezier(vec[0][1], vec[1][1], vec[2][1], vec[3][1], coord_array[0]+1, resol, 2);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
#define LINK_RESOL 24
|
||||
void ui_draw_link_bezier(rcti *rect)
|
||||
{
|
||||
float coord_array[LINK_RESOL+1][2];
|
||||
|
||||
if(ui_link_bezier_points(rect, coord_array, LINK_RESOL)) {
|
||||
float dist;
|
||||
int i;
|
||||
|
||||
/* we can reuse the dist variable here to increment the GL curve eval amount*/
|
||||
dist = 1.0f/(float)LINK_RESOL;
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glEnable(GL_LINE_SMOOTH);
|
||||
|
||||
glBegin(GL_LINE_STRIP);
|
||||
for(i=0; i<=LINK_RESOL; i++) {
|
||||
glVertex2fv(coord_array[i]);
|
||||
}
|
||||
glEnd();
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
glDisable(GL_LINE_SMOOTH);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void widget_link(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
|
||||
{
|
||||
|
||||
if(but->flag & UI_SELECT) {
|
||||
rcti rectlink;
|
||||
|
||||
UI_ThemeColor(TH_TEXT_HI);
|
||||
|
||||
rectlink.xmin= (rect->xmin+rect->xmax)/2;
|
||||
rectlink.ymin= (rect->ymin+rect->ymax)/2;
|
||||
rectlink.xmax= but->linkto[0];
|
||||
rectlink.ymax= but->linkto[1];
|
||||
|
||||
ui_draw_link_bezier(&rectlink);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
|
||||
{
|
||||
uiWidgetBase wtb, wtb1;
|
||||
@ -2078,6 +2149,13 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
|
||||
wt= widget_type(UI_WTYPE_BOX);
|
||||
break;
|
||||
|
||||
case LINK:
|
||||
case INLINK:
|
||||
wt= widget_type(UI_WTYPE_ICON);
|
||||
wt->custom= widget_link;
|
||||
|
||||
break;
|
||||
|
||||
case BUT_EXTRA:
|
||||
widget_draw_extra_mask(C, but, widget_type(UI_WTYPE_BOX), rect);
|
||||
break;
|
||||
|
@ -614,6 +614,7 @@ void ui_theme_init_userdef(void)
|
||||
|
||||
/* space logic */
|
||||
btheme->tlogic= btheme->tv3d;
|
||||
SETCOL(btheme->tlogic.back, 100, 100, 100, 255);
|
||||
|
||||
}
|
||||
|
||||
@ -1245,6 +1246,7 @@ void init_userdef_do_versions(void)
|
||||
if(btheme->tlogic.syntaxn[3]==0) {
|
||||
/* re-uses syntax color storage */
|
||||
btheme->tlogic= btheme->tv3d;
|
||||
SETCOL(btheme->tlogic.back, 100, 100, 100, 255);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -51,5 +51,8 @@ void logic_header_buttons(const struct bContext *C, struct ARegion *ar);
|
||||
void logic_buttons_register(struct ARegionType *art);
|
||||
void LOGIC_OT_properties(struct wmOperatorType *ot);
|
||||
|
||||
/* logic_window.c */
|
||||
void logic_buttons(struct bContext *C, struct ARegion *ar);
|
||||
|
||||
#endif /* ED_LOGIC_INTERN_H */
|
||||
|
||||
|
3351
source/blender/editors/space_logic/logic_window.c
Normal file
3351
source/blender/editors/space_logic/logic_window.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -122,6 +122,30 @@ static SpaceLink *logic_new(const bContext *C)
|
||||
BLI_addtail(&slogic->regionbase, ar);
|
||||
ar->regiontype= RGN_TYPE_WINDOW;
|
||||
|
||||
ar->v2d.tot.xmin= 0.0f;
|
||||
ar->v2d.tot.ymin= 0.0f;
|
||||
ar->v2d.tot.xmax= 1280;
|
||||
ar->v2d.tot.ymax= 240.0f;
|
||||
|
||||
ar->v2d.cur.xmin= 0.0f;
|
||||
ar->v2d.cur.ymin= 0.0f;
|
||||
ar->v2d.cur.xmax= 1280.0f;
|
||||
ar->v2d.cur.ymax= 240.0f;
|
||||
|
||||
ar->v2d.min[0]= 1.0f;
|
||||
ar->v2d.min[1]= 1.0f;
|
||||
|
||||
ar->v2d.max[0]= 32000.0f;
|
||||
ar->v2d.max[1]= 32000.0f;
|
||||
|
||||
ar->v2d.minzoom= 0.5f;
|
||||
ar->v2d.maxzoom= 1.21f;
|
||||
|
||||
ar->v2d.scroll= (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM);
|
||||
ar->v2d.keepzoom= V2D_KEEPZOOM|V2D_KEEPASPECT;
|
||||
ar->v2d.keeptot= 0;
|
||||
|
||||
|
||||
return (SpaceLink *)slogic;
|
||||
}
|
||||
|
||||
@ -205,7 +229,7 @@ static void logic_main_area_init(wmWindowManager *wm, ARegion *ar)
|
||||
{
|
||||
ListBase *keymap;
|
||||
|
||||
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy);
|
||||
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
|
||||
|
||||
/* own keymaps */
|
||||
keymap= WM_keymap_listbase(wm, "Logic Generic", SPACE_LOGIC, 0);
|
||||
@ -217,6 +241,7 @@ static void logic_main_area_draw(const bContext *C, ARegion *ar)
|
||||
/* draw entirely, view changes should be handled here */
|
||||
// SpaceLogic *slogic= (SpaceLogic*)CTX_wm_space_data(C);
|
||||
View2D *v2d= &ar->v2d;
|
||||
View2DScrollers *scrollers;
|
||||
float col[3];
|
||||
|
||||
/* clear and setup matrix */
|
||||
@ -224,15 +249,18 @@ static void logic_main_area_draw(const bContext *C, ARegion *ar)
|
||||
glClearColor(col[0], col[1], col[2], 0.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
/* we set view2d from own zoom and offset each time */
|
||||
// image_main_area_set_view2d(sima, ar, scene);
|
||||
|
||||
UI_view2d_view_ortho(C, v2d);
|
||||
|
||||
/* scrollers? */
|
||||
/*scrollers= UI_view2d_scrollers_calc(C, v2d, V2D_UNIT_VALUES, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
|
||||
logic_buttons((bContext *)C, ar);
|
||||
|
||||
/* reset view matrix */
|
||||
UI_view2d_view_restore(C);
|
||||
|
||||
/* scrollers */
|
||||
scrollers= UI_view2d_scrollers_calc(C, v2d, 10, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
|
||||
UI_view2d_scrollers_draw(C, v2d, scrollers);
|
||||
UI_view2d_scrollers_free(scrollers);*/
|
||||
UI_view2d_scrollers_free(scrollers);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -306,11 +334,10 @@ void ED_spacetype_logic(void)
|
||||
/* regions: main window */
|
||||
art= MEM_callocN(sizeof(ARegionType), "spacetype logic region");
|
||||
art->regionid = RGN_TYPE_WINDOW;
|
||||
art->keymapflag= ED_KEYMAP_FRAMES;
|
||||
art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_FRAMES|ED_KEYMAP_VIEW2D;
|
||||
art->init= logic_main_area_init;
|
||||
art->draw= logic_main_area_draw;
|
||||
art->listener= logic_listener;
|
||||
art->keymapflag= 0;
|
||||
|
||||
BLI_addhead(&st->regiontypes, art);
|
||||
|
||||
|
@ -369,8 +369,8 @@ typedef struct SpaceLogic {
|
||||
|
||||
short blockhandler[8];
|
||||
|
||||
short flag, pad;
|
||||
int pad2;
|
||||
short flag, scaflag;
|
||||
int pad;
|
||||
|
||||
struct bGPdata *gpd; /* grease-pencil data */
|
||||
} SpaceLogic;
|
||||
|
Loading…
Reference in New Issue
Block a user