Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with scons, make, but not cmake, that seems to have an issue not related to these changes. The changes include: * GLSL support in the viewport and game engine, enable in the game menu in textured draw mode. * Synced and merged part of the duplicated blender and gameengine/ gameplayer drawing code. * Further refactoring of game engine drawing code, especially mesh storage changed a lot. * Optimizations in game engine armatures to avoid recomputations. * A python function to get the framerate estimate in game. * An option take object color into account in materials. * An option to restrict shadow casters to a lamp's layers. * Increase from 10 to 18 texture slots for materials, lamps, word. An extra texture slot shows up once the last slot is used. * Memory limit for undo, not enabled by default yet because it needs the .B.blend to be changed. * Multiple undo for image painting. * An offset for dupligroups, so not all objects in a group have to be at the origin.
This commit is contained in:
@@ -107,6 +107,7 @@ typedef struct UndoElem {
|
||||
Object *ob; // pointer to edited object
|
||||
int type; // type of edited object
|
||||
void *undodata;
|
||||
uintptr_t undosize;
|
||||
char name[MAXUNDONAME];
|
||||
void (*freedata)(void *);
|
||||
void (*to_editmode)(void *);
|
||||
@@ -138,6 +139,7 @@ void undo_editmode_push(char *name, void (*freedata)(void *),
|
||||
{
|
||||
UndoElem *uel;
|
||||
int nr;
|
||||
uintptr_t memused, totmem, maxmem;
|
||||
|
||||
/* at first here was code to prevent an "original" key to be insterted twice
|
||||
this was giving conflicts for example when mesh changed due to keys or apply */
|
||||
@@ -145,9 +147,8 @@ void undo_editmode_push(char *name, void (*freedata)(void *),
|
||||
/* remove all undos after (also when curundo==NULL) */
|
||||
while(undobase.last != curundo) {
|
||||
uel= undobase.last;
|
||||
BLI_remlink(&undobase, uel);
|
||||
uel->freedata(uel->undodata);
|
||||
MEM_freeN(uel);
|
||||
BLI_freelinkN(&undobase, uel);
|
||||
}
|
||||
|
||||
/* make new */
|
||||
@@ -160,7 +161,7 @@ void undo_editmode_push(char *name, void (*freedata)(void *),
|
||||
uel->from_editmode= from_editmode;
|
||||
uel->validate_undo= validate_undo;
|
||||
|
||||
/* and limit amount to the maximum */
|
||||
/* limit amount to the maximum amount*/
|
||||
nr= 0;
|
||||
uel= undobase.last;
|
||||
while(uel) {
|
||||
@@ -171,19 +172,43 @@ void undo_editmode_push(char *name, void (*freedata)(void *),
|
||||
if(uel) {
|
||||
while(undobase.first!=uel) {
|
||||
UndoElem *first= undobase.first;
|
||||
BLI_remlink(&undobase, first);
|
||||
first->freedata(first->undodata);
|
||||
MEM_freeN(first);
|
||||
BLI_freelinkN(&undobase, first);
|
||||
}
|
||||
}
|
||||
|
||||
/* copy */
|
||||
memused= MEM_get_memory_in_use();
|
||||
curundo->undodata= curundo->from_editmode();
|
||||
curundo->undosize= MEM_get_memory_in_use() - memused;
|
||||
curundo->ob= G.obedit;
|
||||
curundo->id= G.obedit->id;
|
||||
curundo->type= G.obedit->type;
|
||||
}
|
||||
|
||||
if(U.undomemory != 0) {
|
||||
/* limit to maximum memory (afterwards, we can't know in advance) */
|
||||
totmem= 0;
|
||||
maxmem= ((uintptr_t)U.undomemory)*1024*1024;
|
||||
|
||||
uel= undobase.last;
|
||||
while(uel && uel->prev) {
|
||||
totmem+= uel->undosize;
|
||||
if(totmem>maxmem) break;
|
||||
uel= uel->prev;
|
||||
}
|
||||
|
||||
if(uel) {
|
||||
if(uel->prev && uel->prev->prev)
|
||||
uel= uel->prev;
|
||||
|
||||
while(undobase.first!=uel) {
|
||||
UndoElem *first= undobase.first;
|
||||
first->freedata(first->undodata);
|
||||
BLI_freelinkN(&undobase, first);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* helper to remove clean other objects from undo stack */
|
||||
static void undo_clean_stack(void)
|
||||
@@ -205,9 +230,8 @@ static void undo_clean_stack(void)
|
||||
}
|
||||
else {
|
||||
mixed= 1;
|
||||
BLI_remlink(&undobase, uel);
|
||||
uel->freedata(uel->undodata);
|
||||
MEM_freeN(uel);
|
||||
BLI_freelinkN(&undobase, uel);
|
||||
}
|
||||
|
||||
uel= next;
|
||||
|
||||
Reference in New Issue
Block a user