2.5
Smaller jobs, all in one commit! - Moved object_do_update out of view3d drawing, into the event system (currently after notifiers). Depsgraph calls for setting update flags will have to keep track of each Screen's needs, so a UI showing only a Sequencer doesn't do objects. - Added button in "Properties region" in 3D window to set or disable 4-split, including the 3 options it has. (lock, box, clip) - Restored legacy code for UI, to make things work like bone rename, autocomplete. - Node editor now shows Curves widgets again - Bugfix: composite job increased Viewer user id count - Bugfix: Node editor, not "Enable nodes" still called a Job, which didn't do anything - Various code cleaning, unused vars and prototypes.
This commit is contained in:
@@ -1012,8 +1012,7 @@ bNode *nodeCopyNode(struct bNodeTree *ntree, struct bNode *node, int internal)
|
||||
oldsock->new_sock= sock;
|
||||
}
|
||||
|
||||
if(nnode->id)
|
||||
nnode->id->us++;
|
||||
/* don't increase node->id users, freenode doesn't decrement either */
|
||||
|
||||
if(node->typeinfo->copystoragefunc)
|
||||
node->typeinfo->copystoragefunc(node, nnode);
|
||||
|
||||
@@ -4386,7 +4386,6 @@ static int pose_de_select_all_exec(bContext *C, wmOperator *op)
|
||||
Object *ob= CTX_data_active_object(C);
|
||||
bArmature *arm= ob->data;
|
||||
bPoseChannel *pchan;
|
||||
EditBone *ebone;
|
||||
int sel=1;
|
||||
|
||||
/* Determine if there are any selected bones
|
||||
@@ -4425,7 +4424,6 @@ void POSE_OT_de_select_all(wmOperatorType *ot)
|
||||
static int pose_select_parent_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob= CTX_data_active_object(C);
|
||||
bArmature *arm= ob->data;
|
||||
bPoseChannel *pchan,*parent;
|
||||
|
||||
/* Determine if there is an active bone */
|
||||
@@ -4439,7 +4437,7 @@ static int pose_select_parent_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_BONE_SELECT, NULL);
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_BONE_SELECT, ob);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
@@ -513,6 +513,28 @@ void UI_add_region_handlers(struct ListBase *handlers);
|
||||
void UI_add_area_handlers(struct ListBase *handlers);
|
||||
void UI_add_popup_handlers(struct ListBase *handlers, uiPopupBlockHandle *menu);
|
||||
|
||||
/* Legacy code
|
||||
* Callbacks and utils to get 2.48 work */
|
||||
|
||||
void test_idbutton_cb(struct bContext *C, void *namev, void *arg2);
|
||||
void test_scriptpoin_but(struct bContext *C, char *name, ID **idpp);
|
||||
void test_actionpoin_but(struct bContext *C, char *name, ID **idpp);
|
||||
void test_obpoin_but(struct bContext *C, char *name, ID **idpp);
|
||||
void test_meshobpoin_but(struct bContext *C, char *name, ID **idpp);
|
||||
void test_meshpoin_but(struct bContext *C, char *name, ID **idpp);
|
||||
void test_matpoin_but(struct bContext *C, char *name, ID **idpp);
|
||||
void test_scenepoin_but(struct bContext *C, char *name, ID **idpp);
|
||||
void test_grouppoin_but(struct bContext *C, char *name, ID **idpp);
|
||||
void test_texpoin_but(struct bContext *C, char *name, ID **idpp);
|
||||
void test_imapoin_but(struct bContext *C, char *name, ID **idpp);
|
||||
void autocomplete_bone(struct bContext *C, char *str, void *arg_v);
|
||||
void autocomplete_vgroup(struct bContext *C, char *str, void *arg_v);
|
||||
|
||||
struct CurveMapping;
|
||||
struct rctf;
|
||||
void curvemap_buttons(uiBlock *block, struct CurveMapping *cumap, char labeltype, short event, short redraw, struct rctf *rect);
|
||||
|
||||
|
||||
/* Module
|
||||
*
|
||||
* init and exit should be called before using this module. init_userdef must
|
||||
|
||||
@@ -624,6 +624,7 @@ void uiEndBlock(const bContext *C, uiBlock *block)
|
||||
|
||||
void uiDrawBlock(const bContext *C, uiBlock *block)
|
||||
{
|
||||
ARegion *ar= CTX_wm_region(C);
|
||||
uiBut *but;
|
||||
|
||||
if(!block->endblock)
|
||||
@@ -640,7 +641,7 @@ void uiDrawBlock(const bContext *C, uiBlock *block)
|
||||
if(block->drawextra) block->drawextra(C, block);
|
||||
|
||||
for (but= block->buttons.first; but; but= but->next)
|
||||
ui_draw_but(but);
|
||||
ui_draw_but(ar, but);
|
||||
|
||||
ui_draw_links(block);
|
||||
}
|
||||
@@ -863,11 +864,11 @@ static int ui_do_but_LINK(uiBlock *block, uiBut *but)
|
||||
bt= ui_get_valid_link_button(block, but, mval);
|
||||
if(bt) {
|
||||
bt->flag |= UI_ACTIVE;
|
||||
ui_draw_but(bt);
|
||||
ui_draw_but(ar, bt);
|
||||
}
|
||||
if(bto && bto!=bt) {
|
||||
bto->flag &= ~UI_ACTIVE;
|
||||
ui_draw_but(bto);
|
||||
ui_draw_but(ar, bto);
|
||||
}
|
||||
bto= bt;
|
||||
|
||||
@@ -965,7 +966,7 @@ static void edit_but(uiBlock *block, uiBut *but, uiEvent *uevent)
|
||||
but->x2 += dx;
|
||||
but->y2 += dy;
|
||||
|
||||
ui_draw_but(but);
|
||||
ui_draw_but(ar, but);
|
||||
ui_block_flush_back(but->block);
|
||||
didit= 1;
|
||||
|
||||
|
||||
@@ -2975,7 +2975,7 @@ static void ui_draw_but_curve_grid(uiBut *but, float zoomx, float zoomy, float o
|
||||
|
||||
}
|
||||
|
||||
static void ui_draw_but_CURVE(uiBut *but)
|
||||
static void ui_draw_but_CURVE(ARegion *ar, uiBut *but)
|
||||
{
|
||||
CurveMapping *cumap;
|
||||
CurveMap *cuma;
|
||||
@@ -2990,10 +2990,10 @@ static void ui_draw_but_CURVE(uiBut *but)
|
||||
/* need scissor test, curve can draw outside of boundary */
|
||||
glGetIntegerv(GL_VIEWPORT, scissor);
|
||||
fx= but->x1; fy= but->y1;
|
||||
/* XXX 2.50 need context: ui_graphics_to_window(but->win, &fx, &fy); */
|
||||
ui_block_to_window_fl(ar, but->block, &fx, &fy);
|
||||
dx= but->x2; dy= but->y2;
|
||||
/* XXX 2.50 need context: ui_graphics_to_window(but->win, &dx, &dy); */
|
||||
//glScissor((int)floor(fx), (int)floor(fy), (int)ceil(dx-fx), (int)ceil(dy-fy));
|
||||
ui_block_to_window_fl(ar, but->block, &dx, &dy);
|
||||
glScissor((int)floor(fx), (int)floor(fy), (int)ceil(dx-fx), (int)ceil(dy-fy));
|
||||
|
||||
/* calculate offset and zoom */
|
||||
zoomx= (but->x2-but->x1-2.0*but->aspect)/(cumap->curr.xmax - cumap->curr.xmin);
|
||||
@@ -3254,7 +3254,7 @@ void ui_set_embossfunc(uiBut *but, int drawtype)
|
||||
// note: if you want aligning, adapt the call uiBlockEndAlign in interface.c
|
||||
}
|
||||
|
||||
void ui_draw_but(uiBut *but)
|
||||
void ui_draw_but(ARegion *ar, uiBut *but)
|
||||
{
|
||||
double value;
|
||||
float x1, x2, y1, y2, fac;
|
||||
@@ -3322,7 +3322,7 @@ void ui_draw_but(uiBut *but)
|
||||
ui_draw_but_NORMAL(but);
|
||||
break;
|
||||
case BUT_CURVE:
|
||||
ui_draw_but_CURVE(but);
|
||||
ui_draw_but_CURVE(ar, but);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -313,13 +313,18 @@ void ui_popup_block_free(struct bContext *C, uiPopupBlockHandle *handle);
|
||||
|
||||
void ui_set_name_menu(uiBut *but, int value);
|
||||
|
||||
struct AutoComplete;
|
||||
struct AutoComplete *autocomplete_begin(char *startname, int maxlen);
|
||||
void autocomplete_do_name(struct AutoComplete *autocpl, const char *name);
|
||||
void autocomplete_end(struct AutoComplete *autocpl, char *autoname);
|
||||
|
||||
/* interface_panel.c */
|
||||
extern int ui_handler_panel_region(struct bContext *C, struct wmEvent *event);
|
||||
extern void ui_draw_panel(struct ARegion *ar, uiBlock *block);
|
||||
|
||||
/* interface_draw.c */
|
||||
extern void ui_set_embossfunc(uiBut *but, int drawtype);
|
||||
extern void ui_draw_but(uiBut *but);
|
||||
extern void ui_draw_but(ARegion *ar, uiBut *but);
|
||||
extern void ui_rasterpos_safe(float x, float y, float aspect);
|
||||
extern void ui_draw_tria_icon(float x, float y, float aspect, char dir);
|
||||
extern void ui_draw_anti_x(float x1, float y1, float x2, float y2);
|
||||
|
||||
@@ -29,11 +29,15 @@
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "DNA_action_types.h"
|
||||
#include "DNA_color_types.h"
|
||||
#include "DNA_listBase.h"
|
||||
#include "DNA_material_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
#include "DNA_windowmanager_types.h"
|
||||
|
||||
#include "BKE_colortools.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_idprop.h"
|
||||
#include "BKE_library.h"
|
||||
@@ -45,6 +49,7 @@
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "ED_screen.h"
|
||||
#include "ED_util.h"
|
||||
|
||||
#include "WM_api.h"
|
||||
@@ -672,3 +677,458 @@ int uiDefIDPoinButs(uiBlock *block, Main *bmain, ID *parid, ID **id_p, int id_co
|
||||
return x;
|
||||
}
|
||||
|
||||
/* ****************************** default button callbacks ******************* */
|
||||
/* ************ LEGACY WARNING, only to get things work with 2.48 code! ****** */
|
||||
|
||||
void test_idbutton_cb(struct bContext *C, void *namev, void *arg2)
|
||||
{
|
||||
char *name= namev;
|
||||
|
||||
test_idbutton(name+2);
|
||||
}
|
||||
|
||||
|
||||
void test_scriptpoin_but(struct bContext *C, char *name, ID **idpp)
|
||||
{
|
||||
ID *id;
|
||||
|
||||
id= CTX_data_main(C)->text.first;
|
||||
while(id) {
|
||||
if( strcmp(name, id->name+2)==0 ) {
|
||||
*idpp= id;
|
||||
return;
|
||||
}
|
||||
id= id->next;
|
||||
}
|
||||
*idpp= NULL;
|
||||
}
|
||||
|
||||
void test_actionpoin_but(struct bContext *C, char *name, ID **idpp)
|
||||
{
|
||||
ID *id;
|
||||
|
||||
id= CTX_data_main(C)->action.first;
|
||||
while(id) {
|
||||
if( strcmp(name, id->name+2)==0 ) {
|
||||
id_us_plus(id);
|
||||
*idpp= id;
|
||||
return;
|
||||
}
|
||||
id= id->next;
|
||||
}
|
||||
*idpp= NULL;
|
||||
}
|
||||
|
||||
|
||||
void test_obpoin_but(struct bContext *C, char *name, ID **idpp)
|
||||
{
|
||||
ID *id;
|
||||
|
||||
// XXX if(idpp == (ID **)&(emptytex.object)) {
|
||||
// error("You must add a texture first");
|
||||
// *idpp= 0;
|
||||
// return;
|
||||
// }
|
||||
|
||||
id= CTX_data_main(C)->object.first;
|
||||
while(id) {
|
||||
if( strcmp(name, id->name+2)==0 ) {
|
||||
*idpp= id;
|
||||
id_lib_extern(id); /* checks lib data, sets correct flag for saving then */
|
||||
return;
|
||||
}
|
||||
id= id->next;
|
||||
}
|
||||
*idpp= NULL;
|
||||
}
|
||||
|
||||
/* tests for an object of type OB_MESH */
|
||||
void test_meshobpoin_but(struct bContext *C, char *name, ID **idpp)
|
||||
{
|
||||
ID *id;
|
||||
|
||||
id = CTX_data_main(C)->object.first;
|
||||
while(id) {
|
||||
Object *ob = (Object *)id;
|
||||
if(ob->type == OB_MESH && strcmp(name, id->name + 2) == 0) {
|
||||
*idpp = id;
|
||||
/* checks lib data, sets correct flag for saving then */
|
||||
id_lib_extern(id);
|
||||
return;
|
||||
}
|
||||
id = id->next;
|
||||
}
|
||||
*idpp = NULL;
|
||||
}
|
||||
|
||||
void test_meshpoin_but(struct bContext *C, char *name, ID **idpp)
|
||||
{
|
||||
ID *id;
|
||||
|
||||
if( *idpp ) (*idpp)->us--;
|
||||
|
||||
id= CTX_data_main(C)->mesh.first;
|
||||
while(id) {
|
||||
if( strcmp(name, id->name+2)==0 ) {
|
||||
*idpp= id;
|
||||
id_us_plus(id);
|
||||
return;
|
||||
}
|
||||
id= id->next;
|
||||
}
|
||||
*idpp= NULL;
|
||||
}
|
||||
|
||||
void test_matpoin_but(struct bContext *C, char *name, ID **idpp)
|
||||
{
|
||||
ID *id;
|
||||
|
||||
if( *idpp ) (*idpp)->us--;
|
||||
|
||||
id= CTX_data_main(C)->mat.first;
|
||||
while(id) {
|
||||
if( strcmp(name, id->name+2)==0 ) {
|
||||
*idpp= id;
|
||||
id_us_plus(id);
|
||||
return;
|
||||
}
|
||||
id= id->next;
|
||||
}
|
||||
*idpp= NULL;
|
||||
}
|
||||
|
||||
void test_scenepoin_but(struct bContext *C, char *name, ID **idpp)
|
||||
{
|
||||
ID *id;
|
||||
|
||||
if( *idpp ) (*idpp)->us--;
|
||||
|
||||
id= CTX_data_main(C)->scene.first;
|
||||
while(id) {
|
||||
if( strcmp(name, id->name+2)==0 ) {
|
||||
*idpp= id;
|
||||
id_us_plus(id);
|
||||
return;
|
||||
}
|
||||
id= id->next;
|
||||
}
|
||||
*idpp= NULL;
|
||||
}
|
||||
|
||||
void test_grouppoin_but(struct bContext *C, char *name, ID **idpp)
|
||||
{
|
||||
ID *id;
|
||||
|
||||
if( *idpp ) (*idpp)->us--;
|
||||
|
||||
id= CTX_data_main(C)->group.first;
|
||||
while(id) {
|
||||
if( strcmp(name, id->name+2)==0 ) {
|
||||
*idpp= id;
|
||||
id_us_plus(id);
|
||||
return;
|
||||
}
|
||||
id= id->next;
|
||||
}
|
||||
*idpp= NULL;
|
||||
}
|
||||
|
||||
void test_texpoin_but(struct bContext *C, char *name, ID **idpp)
|
||||
{
|
||||
ID *id;
|
||||
|
||||
if( *idpp ) (*idpp)->us--;
|
||||
|
||||
id= CTX_data_main(C)->tex.first;
|
||||
while(id) {
|
||||
if( strcmp(name, id->name+2)==0 ) {
|
||||
*idpp= id;
|
||||
id_us_plus(id);
|
||||
return;
|
||||
}
|
||||
id= id->next;
|
||||
}
|
||||
*idpp= NULL;
|
||||
}
|
||||
|
||||
void test_imapoin_but(struct bContext *C, char *name, ID **idpp)
|
||||
{
|
||||
ID *id;
|
||||
|
||||
if( *idpp ) (*idpp)->us--;
|
||||
|
||||
id= CTX_data_main(C)->image.first;
|
||||
while(id) {
|
||||
if( strcmp(name, id->name+2)==0 ) {
|
||||
*idpp= id;
|
||||
id_us_plus(id);
|
||||
return;
|
||||
}
|
||||
id= id->next;
|
||||
}
|
||||
*idpp= NULL;
|
||||
}
|
||||
|
||||
/* autocomplete callback for buttons */
|
||||
void autocomplete_bone(struct bContext *C, char *str, void *arg_v)
|
||||
{
|
||||
Object *ob= (Object *)arg_v;
|
||||
|
||||
if(ob==NULL || ob->pose==NULL) return;
|
||||
|
||||
/* search if str matches the beginning of name */
|
||||
if(str[0]) {
|
||||
AutoComplete *autocpl= autocomplete_begin(str, 32);
|
||||
bPoseChannel *pchan;
|
||||
|
||||
for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next)
|
||||
autocomplete_do_name(autocpl, pchan->name);
|
||||
|
||||
autocomplete_end(autocpl, str);
|
||||
}
|
||||
}
|
||||
|
||||
/* autocomplete callback for buttons */
|
||||
void autocomplete_vgroup(struct bContext *C, char *str, void *arg_v)
|
||||
{
|
||||
Object *ob= (Object *)arg_v;
|
||||
|
||||
if(ob==NULL) return;
|
||||
|
||||
/* search if str matches the beginning of a name */
|
||||
if(str[0]) {
|
||||
AutoComplete *autocpl= autocomplete_begin(str, 32);
|
||||
bDeformGroup *dg;
|
||||
|
||||
for(dg= ob->defbase.first; dg; dg= dg->next)
|
||||
if(dg->name!=str)
|
||||
autocomplete_do_name(autocpl, dg->name);
|
||||
|
||||
autocomplete_end(autocpl, str);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* ----------- custom button group ---------------------- */
|
||||
|
||||
static void curvemap_buttons_zoom_in(bContext *C, void *cumap_v, void *unused)
|
||||
{
|
||||
CurveMapping *cumap = cumap_v;
|
||||
float d;
|
||||
|
||||
/* we allow 20 times zoom */
|
||||
if( (cumap->curr.xmax - cumap->curr.xmin) > 0.04f*(cumap->clipr.xmax - cumap->clipr.xmin) ) {
|
||||
d= 0.1154f*(cumap->curr.xmax - cumap->curr.xmin);
|
||||
cumap->curr.xmin+= d;
|
||||
cumap->curr.xmax-= d;
|
||||
d= 0.1154f*(cumap->curr.ymax - cumap->curr.ymin);
|
||||
cumap->curr.ymin+= d;
|
||||
cumap->curr.ymax-= d;
|
||||
}
|
||||
}
|
||||
|
||||
static void curvemap_buttons_zoom_out(bContext *C, void *cumap_v, void *unused)
|
||||
{
|
||||
CurveMapping *cumap = cumap_v;
|
||||
float d, d1;
|
||||
|
||||
/* we allow 20 times zoom, but dont view outside clip */
|
||||
if( (cumap->curr.xmax - cumap->curr.xmin) < 20.0f*(cumap->clipr.xmax - cumap->clipr.xmin) ) {
|
||||
d= d1= 0.15f*(cumap->curr.xmax - cumap->curr.xmin);
|
||||
|
||||
if(cumap->flag & CUMA_DO_CLIP)
|
||||
if(cumap->curr.xmin-d < cumap->clipr.xmin)
|
||||
d1= cumap->curr.xmin - cumap->clipr.xmin;
|
||||
cumap->curr.xmin-= d1;
|
||||
|
||||
d1= d;
|
||||
if(cumap->flag & CUMA_DO_CLIP)
|
||||
if(cumap->curr.xmax+d > cumap->clipr.xmax)
|
||||
d1= -cumap->curr.xmax + cumap->clipr.xmax;
|
||||
cumap->curr.xmax+= d1;
|
||||
|
||||
d= d1= 0.15f*(cumap->curr.ymax - cumap->curr.ymin);
|
||||
|
||||
if(cumap->flag & CUMA_DO_CLIP)
|
||||
if(cumap->curr.ymin-d < cumap->clipr.ymin)
|
||||
d1= cumap->curr.ymin - cumap->clipr.ymin;
|
||||
cumap->curr.ymin-= d1;
|
||||
|
||||
d1= d;
|
||||
if(cumap->flag & CUMA_DO_CLIP)
|
||||
if(cumap->curr.ymax+d > cumap->clipr.ymax)
|
||||
d1= -cumap->curr.ymax + cumap->clipr.ymax;
|
||||
cumap->curr.ymax+= d1;
|
||||
}
|
||||
}
|
||||
|
||||
static void curvemap_buttons_setclip(bContext *C, void *cumap_v, void *unused)
|
||||
{
|
||||
CurveMapping *cumap = cumap_v;
|
||||
|
||||
curvemapping_changed(cumap, 0);
|
||||
}
|
||||
|
||||
static void curvemap_buttons_delete(bContext *C, void *cumap_v, void *unused)
|
||||
{
|
||||
CurveMapping *cumap = cumap_v;
|
||||
|
||||
curvemap_remove(cumap->cm+cumap->cur, SELECT);
|
||||
curvemapping_changed(cumap, 0);
|
||||
}
|
||||
|
||||
/* NOTE: this is a block-menu, needs 0 events, otherwise the menu closes */
|
||||
static uiBlock *curvemap_clipping_func(struct bContext *C, struct ARegion *ar, void *cumap_v)
|
||||
{
|
||||
CurveMapping *cumap = cumap_v;
|
||||
uiBlock *block;
|
||||
uiBut *bt;
|
||||
|
||||
block= uiBeginBlock(C, ar, "curvemap_clipping_func", UI_EMBOSS, UI_HELV);
|
||||
|
||||
/* use this for a fake extra empy space around the buttons */
|
||||
uiDefBut(block, LABEL, 0, "", -4, 16, 128, 106, NULL, 0, 0, 0, 0, "");
|
||||
|
||||
bt= uiDefButBitI(block, TOG, CUMA_DO_CLIP, 1, "Use Clipping",
|
||||
0,100,120,18, &cumap->flag, 0.0, 0.0, 10, 0, "");
|
||||
uiButSetFunc(bt, curvemap_buttons_setclip, cumap, NULL);
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefButF(block, NUM, 0, "Min X ", 0,74,120,18, &cumap->clipr.xmin, -100.0, cumap->clipr.xmax, 10, 0, "");
|
||||
uiDefButF(block, NUM, 0, "Min Y ", 0,56,120,18, &cumap->clipr.ymin, -100.0, cumap->clipr.ymax, 10, 0, "");
|
||||
uiDefButF(block, NUM, 0, "Max X ", 0,38,120,18, &cumap->clipr.xmax, cumap->clipr.xmin, 100.0, 10, 0, "");
|
||||
uiDefButF(block, NUM, 0, "Max Y ", 0,20,120,18, &cumap->clipr.ymax, cumap->clipr.ymin, 100.0, 10, 0, "");
|
||||
|
||||
uiBlockSetDirection(block, UI_RIGHT);
|
||||
|
||||
uiEndBlock(C, block);
|
||||
return block;
|
||||
}
|
||||
|
||||
|
||||
static void curvemap_tools_dofunc(bContext *C, void *cumap_v, int event)
|
||||
{
|
||||
CurveMapping *cumap = cumap_v;
|
||||
CurveMap *cuma= cumap->cm+cumap->cur;
|
||||
|
||||
switch(event) {
|
||||
case 0:
|
||||
curvemap_reset(cuma, &cumap->clipr);
|
||||
curvemapping_changed(cumap, 0);
|
||||
break;
|
||||
case 1:
|
||||
cumap->curr= cumap->clipr;
|
||||
break;
|
||||
case 2: /* set vector */
|
||||
curvemap_sethandle(cuma, 1);
|
||||
curvemapping_changed(cumap, 0);
|
||||
break;
|
||||
case 3: /* set auto */
|
||||
curvemap_sethandle(cuma, 0);
|
||||
curvemapping_changed(cumap, 0);
|
||||
break;
|
||||
case 4: /* extend horiz */
|
||||
cuma->flag &= ~CUMA_EXTEND_EXTRAPOLATE;
|
||||
curvemapping_changed(cumap, 0);
|
||||
break;
|
||||
case 5: /* extend extrapolate */
|
||||
cuma->flag |= CUMA_EXTEND_EXTRAPOLATE;
|
||||
curvemapping_changed(cumap, 0);
|
||||
break;
|
||||
}
|
||||
ED_region_tag_redraw(CTX_wm_region(C));
|
||||
}
|
||||
|
||||
static uiBlock *curvemap_tools_func(struct bContext *C, struct ARegion *ar, void *cumap_v)
|
||||
{
|
||||
uiBlock *block;
|
||||
short yco= 0, menuwidth=120;
|
||||
|
||||
block= uiBeginBlock(C, ar, "curvemap_tools_func", UI_EMBOSSP, UI_HELV);
|
||||
uiBlockSetButmFunc(block, curvemap_tools_dofunc, cumap_v);
|
||||
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Reset View", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Vector Handle", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Auto Handle", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, "");
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Extend Horizontal", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Extend Extrapolated", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, "");
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Reset Curve", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
|
||||
|
||||
uiBlockSetDirection(block, UI_RIGHT);
|
||||
uiTextBoundsBlock(block, 50);
|
||||
|
||||
uiEndBlock(C, block);
|
||||
return block;
|
||||
}
|
||||
|
||||
/* still unsure how this call evolves... we use labeltype for defining what curve-channels to show */
|
||||
void curvemap_buttons(uiBlock *block, CurveMapping *cumap, char labeltype, short event, short redraw, rctf *rect)
|
||||
{
|
||||
uiBut *bt;
|
||||
float dx, fy= rect->ymax-18.0f;
|
||||
int icon;
|
||||
short xco, yco;
|
||||
|
||||
yco= (short)(rect->ymax-18.0f);
|
||||
|
||||
/* curve choice options + tools/settings, 8 icons + spacer */
|
||||
dx= (rect->xmax-rect->xmin)/(9.0f);
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
if(labeltype=='v') { /* vector */
|
||||
xco= (short)rect->xmin;
|
||||
if(cumap->cm[0].curve)
|
||||
uiDefButI(block, ROW, redraw, "X", xco, yco+2, dx, 16, &cumap->cur, 0.0, 0.0, 0.0, 0.0, "");
|
||||
xco= (short)(rect->xmin+1.0f*dx);
|
||||
if(cumap->cm[1].curve)
|
||||
uiDefButI(block, ROW, redraw, "Y", xco, yco+2, dx, 16, &cumap->cur, 0.0, 1.0, 0.0, 0.0, "");
|
||||
xco= (short)(rect->xmin+2.0f*dx);
|
||||
if(cumap->cm[2].curve)
|
||||
uiDefButI(block, ROW, redraw, "Z", xco, yco+2, dx, 16, &cumap->cur, 0.0, 2.0, 0.0, 0.0, "");
|
||||
}
|
||||
else if(labeltype=='c') { /* color */
|
||||
xco= (short)rect->xmin;
|
||||
if(cumap->cm[3].curve)
|
||||
uiDefButI(block, ROW, redraw, "C", xco, yco+2, dx, 16, &cumap->cur, 0.0, 3.0, 0.0, 0.0, "");
|
||||
xco= (short)(rect->xmin+1.0f*dx);
|
||||
if(cumap->cm[0].curve)
|
||||
uiDefButI(block, ROW, redraw, "R", xco, yco+2, dx, 16, &cumap->cur, 0.0, 0.0, 0.0, 0.0, "");
|
||||
xco= (short)(rect->xmin+2.0f*dx);
|
||||
if(cumap->cm[1].curve)
|
||||
uiDefButI(block, ROW, redraw, "G", xco, yco+2, dx, 16, &cumap->cur, 0.0, 1.0, 0.0, 0.0, "");
|
||||
xco= (short)(rect->xmin+3.0f*dx);
|
||||
if(cumap->cm[2].curve)
|
||||
uiDefButI(block, ROW, redraw, "B", xco, yco+2, dx, 16, &cumap->cur, 0.0, 2.0, 0.0, 0.0, "");
|
||||
}
|
||||
/* else no channels ! */
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
xco= (short)(rect->xmin+4.5f*dx);
|
||||
uiBlockSetEmboss(block, UI_EMBOSSN);
|
||||
bt= uiDefIconBut(block, BUT, redraw, ICON_ZOOMIN, xco, yco, dx, 14, NULL, 0.0, 0.0, 0.0, 0.0, "Zoom in");
|
||||
uiButSetFunc(bt, curvemap_buttons_zoom_in, cumap, NULL);
|
||||
|
||||
xco= (short)(rect->xmin+5.25f*dx);
|
||||
bt= uiDefIconBut(block, BUT, redraw, ICON_ZOOMOUT, xco, yco, dx, 14, NULL, 0.0, 0.0, 0.0, 0.0, "Zoom out");
|
||||
uiButSetFunc(bt, curvemap_buttons_zoom_out, cumap, NULL);
|
||||
|
||||
xco= (short)(rect->xmin+6.0f*dx);
|
||||
bt= uiDefIconBlockBut(block, curvemap_tools_func, cumap, event, ICON_MODIFIER, xco, yco, dx, 18, "Tools");
|
||||
|
||||
xco= (short)(rect->xmin+7.0f*dx);
|
||||
if(cumap->flag & CUMA_DO_CLIP) icon= ICON_CLIPUV_HLT; else icon= ICON_CLIPUV_DEHLT;
|
||||
bt= uiDefIconBlockBut(block, curvemap_clipping_func, cumap, event, icon, xco, yco, dx, 18, "Clipping Options");
|
||||
|
||||
xco= (short)(rect->xmin+8.0f*dx);
|
||||
bt= uiDefIconBut(block, BUT, event, ICON_X, xco, yco, dx, 18, NULL, 0.0, 0.0, 0.0, 0.0, "Delete points");
|
||||
uiButSetFunc(bt, curvemap_buttons_delete, cumap, NULL);
|
||||
|
||||
uiBlockSetEmboss(block, UI_EMBOSS);
|
||||
|
||||
uiDefBut(block, BUT_CURVE, event, "",
|
||||
rect->xmin, rect->ymin, rect->xmax-rect->xmin, fy-rect->ymin,
|
||||
cumap, 0.0f, 1.0f, 0, 0, "");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -480,8 +480,6 @@ void OBJECT_OT_curve_add(wmOperatorType *ot)
|
||||
static int object_add_armature_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
bArmature *arm;
|
||||
EditBone *ebone;
|
||||
int newob= 0;
|
||||
|
||||
if ((obedit==NULL) || (obedit->type != OB_ARMATURE)) {
|
||||
|
||||
@@ -86,8 +86,8 @@
|
||||
|
||||
#include "BIF_gl.h"
|
||||
|
||||
#include "ED_anim_api.h"
|
||||
#include "ED_fluidsim.h"
|
||||
#include "ED_screen.h"
|
||||
|
||||
/* XXX */
|
||||
/* from header info.c */
|
||||
|
||||
@@ -1558,7 +1558,7 @@ static void saction_idpoin_handle(bContext *C, ID *id, int event)
|
||||
{
|
||||
SpaceAction *saction= (SpaceAction*)CTX_wm_space_data(C);
|
||||
Object *obact= CTX_data_active_object(C);
|
||||
AnimData *adt= BKE_id_add_animdata((ID *)obact);
|
||||
// AnimData *adt= BKE_id_add_animdata((ID *)obact);
|
||||
|
||||
switch (event) {
|
||||
case UI_ID_BROWSE:
|
||||
|
||||
@@ -272,12 +272,12 @@ static int node_buts_time(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *b
|
||||
short dx= (short)((butr->xmax-butr->xmin)/2);
|
||||
butr->ymin += 26;
|
||||
|
||||
// XXX curvemap_buttons(block, node->storage, 's', B_NODE_EXEC, B_REDR, butr);
|
||||
curvemap_buttons(block, node->storage, 's', B_NODE_EXEC, B_REDR, butr);
|
||||
|
||||
if(cumap) {
|
||||
cumap->flag |= CUMA_DRAW_CFRA;
|
||||
if(node->custom1<node->custom2)
|
||||
;// XXX cumap->sample[0]= (float)(CFRA - node->custom1)/(float)(node->custom2-node->custom1);
|
||||
//cumap->flag |= CUMA_DRAW_CFRA;
|
||||
//if(node->custom1<node->custom2)
|
||||
// cumap->sample[0]= (float)(CFRA - node->custom1)/(float)(node->custom2-node->custom1);
|
||||
}
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
@@ -305,7 +305,7 @@ static int node_buts_valtorgb(uiBlock *block, bNodeTree *ntree, bNode *node, rct
|
||||
static int node_buts_curvevec(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
|
||||
{
|
||||
if(block) {
|
||||
; // XXX curvemap_buttons(block, node->storage, 'v', B_NODE_EXEC, B_REDR, butr);
|
||||
curvemap_buttons(block, node->storage, 'v', B_NODE_EXEC, B_REDR, butr);
|
||||
}
|
||||
return (int)(node->width-NODE_DY);
|
||||
}
|
||||
@@ -327,7 +327,7 @@ static int node_buts_curvecol(uiBlock *block, bNodeTree *ntree, bNode *node, rct
|
||||
else
|
||||
cumap->flag &= ~CUMA_DRAW_SAMPLE;
|
||||
|
||||
// XXX curvemap_buttons(block, node->storage, 'c', B_NODE_EXEC, B_REDR, butr);
|
||||
curvemap_buttons(block, node->storage, 'c', B_NODE_EXEC, B_REDR, butr);
|
||||
}
|
||||
return (int)(node->width-NODE_DY);
|
||||
}
|
||||
|
||||
@@ -164,9 +164,13 @@ static void node_area_refresh(const struct bContext *C, struct ScrArea *sa)
|
||||
|
||||
if(snode->nodetree) {
|
||||
if(snode->treetype==NTREE_SHADER) {
|
||||
Material *ma= (Material *)snode->id;
|
||||
if(ma->use_nodes)
|
||||
ED_preview_shader_job(C, sa, snode->id, 100, 100);
|
||||
}
|
||||
else if(snode->treetype==NTREE_COMPOSIT) {
|
||||
Scene *scene= (Scene *)snode->id;
|
||||
if(scene->use_nodes)
|
||||
snode_composite_job(C, sa);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,6 +126,10 @@
|
||||
|
||||
#define B_CLR_WPAINT 2850
|
||||
|
||||
#define B_RV3D_LOCKED 2900
|
||||
#define B_RV3D_BOXVIEW 2901
|
||||
#define B_RV3D_BOXCLIP 2902
|
||||
|
||||
#define B_IDNAME 3000
|
||||
|
||||
/* temporary struct for storing transform properties */
|
||||
@@ -466,7 +470,7 @@ static void validate_bonebutton_cb(bContext *C, void *bonev, void *namev)
|
||||
/* restore */
|
||||
BLI_strncpy(bone->name, oldname, 32);
|
||||
|
||||
armature_bone_rename(ob->data, oldname, newname); // editarmature.c
|
||||
armature_bone_rename(ob, oldname, newname); // editarmature.c
|
||||
}
|
||||
}
|
||||
|
||||
@@ -493,6 +497,7 @@ static void v3d_posearmature_buts(uiBlock *block, View3D *v3d, Object *ob, float
|
||||
else
|
||||
but= uiDefBut(block, TEX, B_NOP, "Bone:", 160, 140, 140, 19, bone->name, 1, 31, 0, 0, "");
|
||||
uiButSetFunc(but, validate_bonebutton_cb, bone, NULL);
|
||||
uiButSetCompleteFunc(but, autocomplete_bone, (void *)ob);
|
||||
|
||||
QuatToEul(pchan->quat, tfp->ob_eul);
|
||||
tfp->ob_eul[0]*= 180.0/M_PI;
|
||||
@@ -525,6 +530,22 @@ static void v3d_posearmature_buts(uiBlock *block, View3D *v3d, Object *ob, float
|
||||
uiBlockEndAlign(block);
|
||||
}
|
||||
|
||||
/* assumes armature editmode */
|
||||
void validate_editbonebutton_cb(bContext *C, void *bonev, void *namev)
|
||||
{
|
||||
EditBone *eBone= bonev;
|
||||
char oldname[32], newname[32];
|
||||
|
||||
/* need to be on the stack */
|
||||
BLI_strncpy(newname, eBone->name, 32);
|
||||
BLI_strncpy(oldname, (char *)namev, 32);
|
||||
/* restore */
|
||||
BLI_strncpy(eBone->name, oldname, 32);
|
||||
|
||||
armature_bone_rename(CTX_data_edit_object(C), oldname, newname); // editarmature.c
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_BONE_SELECT, CTX_data_edit_object(C)); // XXX fix
|
||||
}
|
||||
|
||||
static void v3d_editarmature_buts(uiBlock *block, View3D *v3d, Object *ob, float lim)
|
||||
{
|
||||
bArmature *arm= ob->data;
|
||||
@@ -546,7 +567,7 @@ static void v3d_editarmature_buts(uiBlock *block, View3D *v3d, Object *ob, float
|
||||
but= uiDefBut(block, TEX, B_NOP, "Bone:", 160, 130, 140, 19, ebone->name, 1, 31, 0, 0, "");
|
||||
else
|
||||
but= uiDefBut(block, TEX, B_NOP, "Bone:", 160, 150, 140, 19, ebone->name, 1, 31, 0, 0, "");
|
||||
// XXX uiButSetFunc(but, validate_editbonebutton_cb, ebone, NULL);
|
||||
uiButSetFunc(but, validate_editbonebutton_cb, ebone, NULL);
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefButF(block, NUM, B_ARMATUREPANEL1, "HeadX:", 10, 70, 140, 19, ebone->head, -lim, lim, 10, 3, "");
|
||||
@@ -869,7 +890,37 @@ static void do_view3d_region_buttons(bContext *C, void *arg, int event)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case B_RV3D_LOCKED:
|
||||
case B_RV3D_BOXVIEW:
|
||||
case B_RV3D_BOXCLIP:
|
||||
{
|
||||
ScrArea *sa= CTX_wm_area(C);
|
||||
ARegion *ar= sa->regionbase.last;
|
||||
RegionView3D *rv3d;
|
||||
short viewlock;
|
||||
|
||||
ar= ar->prev;
|
||||
rv3d= ar->regiondata;
|
||||
viewlock= rv3d->viewlock;
|
||||
|
||||
if((viewlock & RV3D_LOCKED)==0)
|
||||
viewlock= 0;
|
||||
else if((viewlock & RV3D_BOXVIEW)==0)
|
||||
viewlock &= ~RV3D_BOXCLIP;
|
||||
|
||||
for(; ar; ar= ar->prev) {
|
||||
if(ar->alignment==RGN_ALIGN_QSPLIT) {
|
||||
rv3d= ar->regiondata;
|
||||
rv3d->viewlock= viewlock;
|
||||
}
|
||||
}
|
||||
|
||||
if(rv3d->viewlock & RV3D_BOXVIEW)
|
||||
view3d_boxview_copy(sa, sa->regionbase.last);
|
||||
|
||||
ED_area_tag_redraw(sa);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* default for now */
|
||||
@@ -1115,14 +1166,14 @@ static void view3d_panel_object(const bContext *C, ARegion *ar, short cntrl) //
|
||||
}
|
||||
else {
|
||||
bt= uiDefBut(block, TEX, B_IDNAME, "OB: ", 10,180,140,20, ob->id.name+2, 0.0, 21.0, 0, 0, "");
|
||||
// XXX uiButSetFunc(bt, test_idbutton_cb, ob->id.name, NULL);
|
||||
uiButSetFunc(bt, test_idbutton_cb, ob->id.name, NULL);
|
||||
|
||||
if((G.f & G_PARTICLEEDIT)==0) {
|
||||
uiBlockBeginAlign(block);
|
||||
// XXX uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_OBJECTPANELPARENT, "Par:", 160, 180, 140, 20, &ob->parent, "Parent Object");
|
||||
uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_OBJECTPANELPARENT, "Par:", 160, 180, 140, 20, &ob->parent, "Parent Object");
|
||||
if((ob->parent) && (ob->partype == PARBONE)) {
|
||||
bt= uiDefBut(block, TEX, B_OBJECTPANELPARENT, "ParBone:", 160, 160, 140, 20, ob->parsubstr, 0, 30, 0, 0, "");
|
||||
// XXX uiButSetCompleteFunc(bt, autocomplete_bone, (void *)ob->parent);
|
||||
uiButSetCompleteFunc(bt, autocomplete_bone, (void *)ob->parent);
|
||||
}
|
||||
else {
|
||||
strcpy(ob->parsubstr, "");
|
||||
@@ -1285,8 +1336,11 @@ static void view3d_panel_background(const bContext *C, ARegion *ar, short cntrl)
|
||||
|
||||
static void view3d_panel_properties(const bContext *C, ARegion *ar, short cntrl) // VIEW3D_HANDLER_SETTINGS
|
||||
{
|
||||
ScrArea *sa= CTX_wm_area(C);
|
||||
ARegion *arlast;
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
View3D *v3d= CTX_wm_view3d(C);
|
||||
RegionView3D *rv3d;
|
||||
uiBlock *block;
|
||||
float *curs;
|
||||
|
||||
@@ -1337,8 +1391,27 @@ static void view3d_panel_properties(const bContext *C, ARegion *ar, short cntrl)
|
||||
|
||||
uiDefBut(block, LABEL, 1, "View Locking:", 160, 60, 150, 19, NULL, 0.0, 0.0, 0, 0, "");
|
||||
uiBlockBeginAlign(block);
|
||||
// XXX uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_REDR, "Object:", 160, 40, 140, 19, &v3d->ob_centre, "Lock view to center to this Object");
|
||||
uiDefBut(block, TEX, B_REDR, "Bone:", 160, 20, 140, 19, v3d->ob_centre_bone, 1, 31, 0, 0, "If view locked to Object, use this Bone to lock to view to");
|
||||
uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_REDR, "Object:", 160, 40, 150, 19, &v3d->ob_centre, "Lock view to center to this Object");
|
||||
uiDefBut(block, TEX, B_REDR, "Bone:", 160, 20, 150, 19, v3d->ob_centre_bone, 1, 31, 0, 0, "If view locked to Object, use this Bone to lock to view to");
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
/* last region is always 3d... a bit weak */
|
||||
arlast= sa->regionbase.last;
|
||||
uiBlockBeginAlign(block);
|
||||
if(arlast->alignment==RGN_ALIGN_QSPLIT) {
|
||||
arlast= arlast->prev;
|
||||
rv3d= arlast->regiondata;
|
||||
|
||||
uiDefButO(block, BUT, "SCREEN_OT_region_foursplit", WM_OP_EXEC_REGION_WIN, "End 4-Split View", 160, -10, 150, 19, "Join the 3D View");
|
||||
uiDefButBitS(block, TOG, RV3D_LOCKED, B_RV3D_LOCKED, "Lock", 160, -30, 50, 19, &rv3d->viewlock, 0, 0, 0, 0, "");
|
||||
uiDefButBitS(block, TOG, RV3D_BOXVIEW, B_RV3D_BOXVIEW, "Box", 210, -30, 50, 19, &rv3d->viewlock, 0, 0, 0, 0, "");
|
||||
uiDefButBitS(block, TOG, RV3D_BOXCLIP, B_RV3D_BOXCLIP, "Clip", 260, -30, 50, 19, &rv3d->viewlock, 0, 0, 0, 0, "");
|
||||
}
|
||||
else
|
||||
uiDefButO(block, BUT, "SCREEN_OT_region_foursplit", WM_OP_EXEC_REGION_WIN, "4-Split View", 160, -10, 150, 19, "Split 3D View in 4 parts");
|
||||
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
|
||||
// XXX
|
||||
// uiDefBut(block, LABEL, 1, "Keyframe Display:", 160, -2, 150, 19, NULL, 0.0, 0.0, 0, 0, "");
|
||||
|
||||
@@ -1880,20 +1880,6 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
|
||||
/* from now on all object derived meshes check this */
|
||||
v3d->customdata_mask= get_viewedit_datamask(CTX_wm_screen(C));
|
||||
|
||||
/* update all objects, ipos, matrices, displists, etc. Flags set by depgraph or manual,
|
||||
no layer check here, gets correct flushed */
|
||||
/* sets first, we allow per definition current scene to have dependencies on sets */
|
||||
if(scene->set) {
|
||||
for(SETLOOPER(scene->set, base))
|
||||
object_handle_update(scene, base->object); // bke_object.h
|
||||
}
|
||||
|
||||
v3d->lay_used = 0;
|
||||
for(base= scene->base.first; base; base= base->next) {
|
||||
object_handle_update(scene, base->object); // bke_object.h
|
||||
v3d->lay_used |= base->lay;
|
||||
}
|
||||
|
||||
/* shadow buffers, before we setup matrices */
|
||||
if(draw_glsl_material(scene, NULL, v3d, v3d->drawtype))
|
||||
gpu_update_lamps_shadows(scene, v3d);
|
||||
@@ -1997,8 +1983,13 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
|
||||
/* Transp and X-ray afterdraw stuff for sets is done later */
|
||||
}
|
||||
|
||||
/* extra service in layerbuttons, showing used layers */
|
||||
v3d->lay_used = 0;
|
||||
|
||||
/* then draw not selected and the duplis, but skip editmode object */
|
||||
for(base= scene->base.first; base; base= base->next) {
|
||||
v3d->lay_used |= base->lay;
|
||||
|
||||
if(v3d->lay & base->lay) {
|
||||
|
||||
/* dupli drawing */
|
||||
|
||||
@@ -100,7 +100,7 @@ static void view3d_boxview_clip(ScrArea *sa)
|
||||
if(ar->regiontype==RGN_TYPE_WINDOW) {
|
||||
RegionView3D *rv3d= ar->regiondata;
|
||||
|
||||
if(rv3d->viewlock) {
|
||||
if(rv3d->viewlock & RV3D_BOXCLIP) {
|
||||
if(ELEM(rv3d->view, V3D_VIEW_TOP, V3D_VIEW_BOTTOM)) {
|
||||
if(ar->winx>ar->winy) x1= rv3d->dist;
|
||||
else x1= ar->winx*rv3d->dist/ar->winy;
|
||||
@@ -157,7 +157,7 @@ static void view3d_boxview_clip(ScrArea *sa)
|
||||
if(ar->regiontype==RGN_TYPE_WINDOW) {
|
||||
RegionView3D *rv3d= ar->regiondata;
|
||||
|
||||
if(rv3d->viewlock) {
|
||||
if(rv3d->viewlock & RV3D_BOXCLIP) {
|
||||
rv3d->rflag |= RV3D_CLIPPING;
|
||||
memcpy(rv3d->clip, clip, sizeof(clip));
|
||||
}
|
||||
@@ -166,7 +166,7 @@ static void view3d_boxview_clip(ScrArea *sa)
|
||||
MEM_freeN(bb);
|
||||
}
|
||||
|
||||
/* sync ortho view of region to others, for view transforms */
|
||||
/* sync center/zoom view of region to others, for view transforms */
|
||||
static void view3d_boxview_sync(ScrArea *sa, ARegion *ar)
|
||||
{
|
||||
ARegion *artest;
|
||||
@@ -206,7 +206,7 @@ static void view3d_boxview_sync(ScrArea *sa, ARegion *ar)
|
||||
}
|
||||
|
||||
/* for home, center etc */
|
||||
static void view3d_boxview_copy(ScrArea *sa, ARegion *ar)
|
||||
void view3d_boxview_copy(ScrArea *sa, ARegion *ar)
|
||||
{
|
||||
ARegion *artest;
|
||||
RegionView3D *rv3d= ar->regiondata;
|
||||
@@ -579,7 +579,7 @@ static void viewmove_apply(ViewOpsData *vod, int x, int y)
|
||||
window_to_3d_delta(vod->ar, dvec, x-vod->oldx, y-vod->oldy);
|
||||
VecAddf(vod->rv3d->ofs, vod->rv3d->ofs, dvec);
|
||||
|
||||
if(vod->rv3d->viewlock)
|
||||
if(vod->rv3d->viewlock & RV3D_BOXVIEW)
|
||||
view3d_boxview_sync(vod->sa, vod->ar);
|
||||
}
|
||||
|
||||
@@ -742,7 +742,7 @@ static void viewzoom_apply(ViewOpsData *vod, int x, int y)
|
||||
|
||||
// XXX if(vod->rv3d->persp==V3D_ORTHO || vod->rv3d->persp==V3D_CAMOB) preview3d_event= 0;
|
||||
|
||||
if(vod->rv3d->viewlock)
|
||||
if(vod->rv3d->viewlock & RV3D_BOXVIEW)
|
||||
view3d_boxview_sync(vod->sa, vod->ar);
|
||||
|
||||
ED_region_tag_redraw(vod->ar);
|
||||
@@ -795,7 +795,7 @@ static int viewzoom_exec(bContext *C, wmOperator *op)
|
||||
else if(rv3d->dist> 0.001*v3d->grid) rv3d->dist*=.83333f;
|
||||
}
|
||||
|
||||
if(rv3d->viewlock)
|
||||
if(rv3d->viewlock & RV3D_BOXVIEW)
|
||||
view3d_boxview_sync(CTX_wm_area(C), CTX_wm_region(C));
|
||||
|
||||
request_depth_update(CTX_wm_region_view3d(C));
|
||||
@@ -900,7 +900,7 @@ static int viewhome_exec(bContext *C, wmOperator *op) /* was view3d_home() in 2.
|
||||
}
|
||||
// XXX BIF_view3d_previewrender_signal(curarea, PR_DBASE|PR_DISPRECT);
|
||||
|
||||
if(rv3d->viewlock)
|
||||
if(rv3d->viewlock & RV3D_BOXVIEW)
|
||||
view3d_boxview_copy(CTX_wm_area(C), ar);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
@@ -1034,7 +1034,7 @@ static int viewcenter_exec(bContext *C, wmOperator *op) /* like a localview with
|
||||
}
|
||||
|
||||
// XXX BIF_view3d_previewrender_signal(curarea, PR_DBASE|PR_DISPRECT);
|
||||
if(rv3d->viewlock)
|
||||
if(rv3d->viewlock & RV3D_BOXVIEW)
|
||||
view3d_boxview_copy(CTX_wm_area(C), ar);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
@@ -1265,7 +1265,7 @@ static int view3d_border_zoom_exec(bContext *C, wmOperator *op)
|
||||
|
||||
smooth_view(C, NULL, NULL, new_ofs, NULL, &new_dist, NULL);
|
||||
|
||||
if(rv3d->viewlock)
|
||||
if(rv3d->viewlock & RV3D_BOXVIEW)
|
||||
view3d_boxview_sync(CTX_wm_area(C), ar);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
@@ -1559,7 +1559,7 @@ static int viewpan_exec(bContext *C, wmOperator *op)
|
||||
rv3d->ofs[1]+= vec[1];
|
||||
rv3d->ofs[2]+= vec[2];
|
||||
|
||||
if(rv3d->viewlock)
|
||||
if(rv3d->viewlock & RV3D_BOXVIEW)
|
||||
view3d_boxview_sync(CTX_wm_area(C), ar);
|
||||
|
||||
ED_region_tag_redraw(ar);
|
||||
|
||||
@@ -77,6 +77,8 @@ void VIEW3D_OT_border_zoom(struct wmOperatorType *ot);
|
||||
void VIEW3D_OT_drawtype(struct wmOperatorType *ot);
|
||||
void VIEW3D_OT_editmesh_face_toolbox(struct wmOperatorType *ot);
|
||||
|
||||
void view3d_boxview_copy(ScrArea *sa, ARegion *ar);
|
||||
|
||||
/* drawobject.c */
|
||||
void draw_object(Scene *scene, struct ARegion *ar, View3D *v3d, Base *base, int flag);
|
||||
int draw_glsl_material(Scene *scene, Object *ob, View3D *v3d, int dt);
|
||||
|
||||
@@ -205,6 +205,7 @@ typedef struct View3D {
|
||||
/* RegionView3d->viewlock */
|
||||
#define RV3D_LOCKED 1
|
||||
#define RV3D_BOXVIEW 2
|
||||
#define RV3D_BOXCLIP 4
|
||||
|
||||
/* View3d->flag2 (short) */
|
||||
#define V3D_SOLID_TEX 8
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
|
||||
#include "DNA_listBase.h"
|
||||
#include "DNA_screen_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_windowmanager_types.h"
|
||||
#include "DNA_userdef_types.h"
|
||||
|
||||
@@ -44,7 +45,9 @@
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_idprop.h"
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_report.h"
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_utildefines.h"
|
||||
|
||||
#include "ED_screen.h"
|
||||
@@ -194,7 +197,10 @@ void wm_event_do_notifiers(bContext *C)
|
||||
|
||||
/* cached: editor refresh callbacks now, they get context */
|
||||
for(win= wm->windows.first; win; win= win->next) {
|
||||
Scene *sce, *scene= win->screen->scene;
|
||||
ScrArea *sa;
|
||||
Base *base;
|
||||
|
||||
CTX_wm_window_set(C, win);
|
||||
for(sa= win->screen->areabase.first; sa; sa= sa->next) {
|
||||
if(sa->do_refresh) {
|
||||
@@ -202,6 +208,19 @@ void wm_event_do_notifiers(bContext *C)
|
||||
ED_area_do_refresh(C, sa);
|
||||
}
|
||||
}
|
||||
|
||||
/* update all objects, ipos, matrices, displists, etc. Flags set by depgraph or manual,
|
||||
no layer check here, gets correct flushed */
|
||||
/* sets first, we allow per definition current scene to have dependencies on sets */
|
||||
if(scene->set) {
|
||||
for(SETLOOPER(scene->set, base))
|
||||
object_handle_update(scene, base->object);
|
||||
}
|
||||
|
||||
for(base= scene->base.first; base; base= base->next) {
|
||||
object_handle_update(scene, base->object);
|
||||
}
|
||||
|
||||
}
|
||||
CTX_wm_window_set(C, NULL);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user