svn merge ^/trunk/blender -r41230:41266

This commit is contained in:
Campbell Barton
2011-10-24 23:06:27 +00:00
73 changed files with 768 additions and 330 deletions

View File

@@ -1685,6 +1685,10 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr)
}
}
/* arrow keys should not have utf8 */
if ((keyCode > 266) && (keyCode < 271))
utf8_buf[0] = '\0';
if ((keyCode == GHOST_kKeyQ) && (m_modifierMask & NSCommandKeyMask))
break; //Cmd-Q is directly handled by Cocoa

View File

@@ -1,6 +1,7 @@
/** \file itasc/Armature.cpp
* \ingroup itasc
*/
/*
* Armature.cpp
*
* Created on: Feb 3, 2009

View File

@@ -1,3 +1,4 @@
/*
* Armature.hpp
*
* Created on: Feb 3, 2009

View File

@@ -1,6 +1,7 @@
/** \file itasc/Cache.cpp
* \ingroup itasc
*/
/*
* Cache.cpp
*
* Created on: Feb 24, 2009

View File

@@ -1,3 +1,4 @@
/*
* Cache.hpp
*
* Created on: Feb 24, 2009

View File

@@ -1,6 +1,7 @@
/** \file itasc/ConstraintSet.cpp
* \ingroup itasc
*/
/*
* ConstraintSet.cpp
*
* Created on: Jan 5, 2009

View File

@@ -1,3 +1,4 @@
/*
* ConstraintSet.hpp
*
* Created on: Jan 5, 2009

View File

@@ -1,6 +1,7 @@
/** \file itasc/ControlledObject.cpp
* \ingroup itasc
*/
/*
* ControlledObject.cpp
*
* Created on: Jan 5, 2009

View File

@@ -1,3 +1,4 @@
/*
* ControlledObject.hpp
*
* Created on: Jan 5, 2009

View File

@@ -1,6 +1,7 @@
/** \file itasc/CopyPose.cpp
* \ingroup itasc
*/
/*
* CopyPose.cpp
*
* Created on: Mar 17, 2009

View File

@@ -1,3 +1,4 @@
/*
* CopyPose.h
*
* Created on: Mar 17, 2009

View File

@@ -1,6 +1,7 @@
/** \file itasc/Distance.cpp
* \ingroup itasc
*/
/*
* Distance.cpp
*
* Created on: Jan 30, 2009

View File

@@ -1,3 +1,4 @@
/*
* Distance.hpp
*
* Created on: Jan 30, 2009

View File

@@ -1,6 +1,7 @@
/** \file itasc/FixedObject.cpp
* \ingroup itasc
*/
/*
* FixedObject.cpp
*
* Created on: Feb 10, 2009

View File

@@ -1,3 +1,4 @@
/*
* FixedObject.h
*
* Created on: Feb 10, 2009

View File

@@ -1,6 +1,7 @@
/** \file itasc/MovingFrame.cpp
* \ingroup itasc
*/
/*
* MovingFrame.cpp
*
* Created on: Feb 10, 2009

View File

@@ -1,3 +1,4 @@
/*
* MovingFrame.h
*
* Created on: Feb 10, 2009

View File

@@ -1,3 +1,4 @@
/*
* Object.hpp
*
* Created on: Jan 5, 2009

View File

@@ -1,6 +1,7 @@
/** \file itasc/Scene.cpp
* \ingroup itasc
*/
/*
* Scene.cpp
*
* Created on: Jan 5, 2009

View File

@@ -1,3 +1,4 @@
/*
* Scene.hpp
*
* Created on: Jan 5, 2009

View File

@@ -1,3 +1,4 @@
/*
* Solver.hpp
*
* Created on: Jan 8, 2009

View File

@@ -1,6 +1,7 @@
/** \file itasc/UncontrolledObject.cpp
* \ingroup itasc
*/
/*
* UncontrolledObject.cpp
*
* Created on: Jan 5, 2009

View File

@@ -1,3 +1,4 @@
/*
* UncontrolledObject.h
*
* Created on: Jan 5, 2009

View File

@@ -1,6 +1,7 @@
/** \file itasc/WDLSSolver.cpp
* \ingroup itasc
*/
/*
* WDLSSolver.hpp.cpp
*
* Created on: Jan 8, 2009

View File

@@ -1,3 +1,4 @@
/*
* WDLSSolver.hpp
*
* Created on: Jan 8, 2009

View File

@@ -1,6 +1,7 @@
/** \file itasc/WSDLSSolver.cpp
* \ingroup itasc
*/
/*
* WDLSSolver.hpp.cpp
*
* Created on: Jan 8, 2009

View File

@@ -1,3 +1,4 @@
/*
* WSDLSSolver.hpp
*
* Created on: Mar 26, 2009

View File

@@ -1,6 +1,7 @@
/** \file itasc/WorldObject.cpp
* \ingroup itasc
*/
/*
* WorldObject.cpp
*
* Created on: Feb 10, 2009

View File

@@ -1,3 +1,4 @@
/*
* WorldObject.h
*
* Created on: Feb 10, 2009

View File

@@ -1,6 +1,7 @@
/** \file itasc/eigen_types.cpp
* \ingroup itasc
*/
/*
* eigen_types.cpp
*
* Created on: March 19, 2009

View File

@@ -1,3 +1,4 @@
/*
* eigen_types.hpp
*
* Created on: March 6, 2009

View File

@@ -125,6 +125,10 @@ class MEM_CacheLimiter {
public:
typedef typename std::list<MEM_CacheLimiterHandle<T> *,
MEM_Allocator<MEM_CacheLimiterHandle<T> *> >::iterator iterator;
typedef intptr_t (*MEM_CacheLimiter_DataSize_Func) (void *data);
MEM_CacheLimiter(MEM_CacheLimiter_DataSize_Func getDataSize_)
: getDataSize(getDataSize_) {
}
~MEM_CacheLimiter() {
for (iterator it = queue.begin(); it != queue.end(); it++) {
delete *it;
@@ -143,17 +147,36 @@ public:
}
void enforce_limits() {
intptr_t max = MEM_CacheLimiter_get_maximum();
intptr_t mem_in_use= MEM_get_memory_in_use();
intptr_t mmap_in_use= MEM_get_mapped_memory_in_use();
intptr_t mem_in_use, cur_size;
if (max == 0) {
return;
}
if(getDataSize) {
mem_in_use = total_size();
} else {
mem_in_use = MEM_get_memory_in_use();
}
for (iterator it = queue.begin();
it != queue.end() && mem_in_use + mmap_in_use > max;) {
it != queue.end() && mem_in_use > max;) {
iterator jt = it;
++it;
if(getDataSize) {
cur_size= getDataSize((*jt)->get()->get_data());
} else {
cur_size= mem_in_use;
}
(*jt)->destroy_if_possible();
if(getDataSize) {
mem_in_use-= cur_size;
} else {
mem_in_use-= cur_size - MEM_get_memory_in_use();
}
}
}
void touch(MEM_CacheLimiterHandle<T> * handle) {
@@ -164,8 +187,17 @@ public:
handle->me = it;
}
private:
intptr_t total_size() {
intptr_t size = 0;
for (iterator it = queue.begin(); it != queue.end(); it++) {
size+= getDataSize((*it)->get()->get_data());
}
return size;
}
std::list<MEM_CacheLimiterHandle<T>*,
MEM_Allocator<MEM_CacheLimiterHandle<T> *> > queue;
MEM_CacheLimiter_DataSize_Func getDataSize;
};
#endif // MEM_CACHELIMITER_H

View File

@@ -41,6 +41,9 @@ typedef struct MEM_CacheLimiterHandle_s MEM_CacheLimiterHandleC;
/* function used to remove data from memory */
typedef void(*MEM_CacheLimiter_Destruct_Func)(void*);
/* function used to measure stored data element size */
typedef intptr_t(*MEM_CacheLimiter_DataSize_Func) (void*);
#ifndef MEM_CACHELIMITER_H
extern void MEM_CacheLimiter_set_maximum(int m);
extern int MEM_CacheLimiter_get_maximum(void);
@@ -54,7 +57,8 @@ extern int MEM_CacheLimiter_get_maximum(void);
*/
extern MEM_CacheLimiterC * new_MEM_CacheLimiter(
MEM_CacheLimiter_Destruct_Func data_destructor);
MEM_CacheLimiter_Destruct_Func data_destructor,
MEM_CacheLimiter_DataSize_Func data_size);
/**
* Delete MEM_CacheLimiter

View File

@@ -54,8 +54,8 @@ typedef std::list<MEM_CacheLimiterHandleCClass*,
class MEM_CacheLimiterCClass {
public:
MEM_CacheLimiterCClass(MEM_CacheLimiter_Destruct_Func data_destructor_)
: data_destructor(data_destructor_) {
MEM_CacheLimiterCClass(MEM_CacheLimiter_Destruct_Func data_destructor_, MEM_CacheLimiter_DataSize_Func data_size)
: data_destructor(data_destructor_), cache(data_size) {
}
~MEM_CacheLimiterCClass();
@@ -142,10 +142,12 @@ static inline handle_t* cast(MEM_CacheLimiterHandleC * l)
}
MEM_CacheLimiterC * new_MEM_CacheLimiter(
MEM_CacheLimiter_Destruct_Func data_destructor)
MEM_CacheLimiter_Destruct_Func data_destructor,
MEM_CacheLimiter_DataSize_Func data_size)
{
return (MEM_CacheLimiterC*) new MEM_CacheLimiterCClass(
data_destructor);
data_destructor,
data_size);
}
void delete_MEM_CacheLimiter(MEM_CacheLimiterC * This)