Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoerg Mueller <nexyon@gmail.com>2009-08-05 13:45:52 +0400
committerJoerg Mueller <nexyon@gmail.com>2009-08-05 13:45:52 +0400
commit3389f04bc1beafc5d0f879eedb4e1b8fa6d78380 (patch)
tree7fa7b2b4b28909cef80902a8f91ce7b9e5759fe7
parent20ea6bac2d01c74ecb0a2412cf06bd77daf94be3 (diff)
parent8aa33834087bf5e717c0b671254d528d93cf6001 (diff)
Merge to revision 22221 of 2.5 branch.
-rw-r--r--intern/ghost/intern/GHOST_EventManager.cpp9
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.cpp7
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.h6
-rw-r--r--intern/ghost/intern/GHOST_WindowManager.cpp1
-rw-r--r--intern/ghost/intern/GHOST_WindowX11.cpp10
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c51
-rw-r--r--source/blender/blenloader/intern/readfile.c5
-rw-r--r--source/blender/makesrna/intern/rna_object.c95
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c2
-rw-r--r--source/blender/windowmanager/intern/wm_window.c8
-rw-r--r--source/blender/windowmanager/wm_window.h1
11 files changed, 166 insertions, 29 deletions
diff --git a/intern/ghost/intern/GHOST_EventManager.cpp b/intern/ghost/intern/GHOST_EventManager.cpp
index f9b13115f32..92cea8d8ff7 100644
--- a/intern/ghost/intern/GHOST_EventManager.cpp
+++ b/intern/ghost/intern/GHOST_EventManager.cpp
@@ -51,6 +51,15 @@ GHOST_EventManager::GHOST_EventManager()
GHOST_EventManager::~GHOST_EventManager()
{
disposeEvents();
+
+ TConsumerVector::iterator iter= m_consumers.begin();
+ while (iter != m_consumers.end())
+ {
+ GHOST_IEventConsumer* consumer = *iter;
+ delete consumer;
+ m_consumers.erase(iter);
+ iter = m_consumers.begin();
+ }
}
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index dbdb65a14f4..5dba76adb02 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -148,6 +148,13 @@ GHOST_SystemX11(
}
+GHOST_SystemX11::
+~GHOST_SystemX11()
+{
+ XCloseDisplay(m_display);
+}
+
+
GHOST_TSuccess
GHOST_SystemX11::
init(
diff --git a/intern/ghost/intern/GHOST_SystemX11.h b/intern/ghost/intern/GHOST_SystemX11.h
index afd960d1ec3..782f08f6737 100644
--- a/intern/ghost/intern/GHOST_SystemX11.h
+++ b/intern/ghost/intern/GHOST_SystemX11.h
@@ -59,6 +59,12 @@ public:
GHOST_SystemX11(
);
+ /**
+ * Destructor.
+ */
+ virtual ~GHOST_SystemX11();
+
+
GHOST_TSuccess
init(
);
diff --git a/intern/ghost/intern/GHOST_WindowManager.cpp b/intern/ghost/intern/GHOST_WindowManager.cpp
index 2b0809929c5..af96653db13 100644
--- a/intern/ghost/intern/GHOST_WindowManager.cpp
+++ b/intern/ghost/intern/GHOST_WindowManager.cpp
@@ -54,6 +54,7 @@ GHOST_WindowManager::GHOST_WindowManager() :
GHOST_WindowManager::~GHOST_WindowManager()
{
+ /* m_windows is freed by GHOST_System::disposeWindow */
}
diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp
index 41c62be0966..f9774b6df70 100644
--- a/intern/ghost/intern/GHOST_WindowX11.cpp
+++ b/intern/ghost/intern/GHOST_WindowX11.cpp
@@ -1325,13 +1325,12 @@ setWindowCustomCursorShape(
int fg_color,
int bg_color
){
+ Colormap colormap= DefaultColormap(m_display, DefaultScreen(m_display));
Pixmap bitmap_pix, mask_pix;
XColor fg, bg;
- if(XAllocNamedColor(m_display, DefaultColormap(m_display, DefaultScreen(m_display)),
- "White", &fg, &fg) == 0) return GHOST_kFailure;
- if(XAllocNamedColor(m_display, DefaultColormap(m_display, DefaultScreen(m_display)),
- "Black", &bg, &bg) == 0) return GHOST_kFailure;
+ if(XAllocNamedColor(m_display, colormap, "White", &fg, &fg) == 0) return GHOST_kFailure;
+ if(XAllocNamedColor(m_display, colormap, "Black", &bg, &bg) == 0) return GHOST_kFailure;
if (m_custom_cursor) {
XFreeCursor(m_display, m_custom_cursor);
@@ -1347,6 +1346,9 @@ setWindowCustomCursorShape(
XFreePixmap(m_display, bitmap_pix);
XFreePixmap(m_display, mask_pix);
+ XFreeColors(m_display, colormap, &fg.pixel, 1, 0L);
+ XFreeColors(m_display, colormap, &bg.pixel, 1, 0L);
+
return GHOST_kSuccess;
}
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index 560ae76e4d1..983f1ecc31c 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -1202,6 +1202,7 @@ static void animsys_evaluate_nla (PointerRNA *ptr, AnimData *adt, float ctime)
NlaTrack *nlt;
short track_index=0;
+ short has_strips = 0;
ListBase estrips= {NULL, NULL};
ListBase echannels= {NULL, NULL};
@@ -1223,6 +1224,12 @@ static void animsys_evaluate_nla (PointerRNA *ptr, AnimData *adt, float ctime)
if (nlt->flag & NLATRACK_MUTED)
continue;
+ /* if this track has strips (but maybe they won't be suitable), set has_strips
+ * - used for mainly for still allowing normal action evaluation...
+ */
+ if (nlt->strips.first)
+ has_strips= 1;
+
/* otherwise, get strip to evaluate for this channel */
nes= nlastrips_ctime_get_strip(&estrips, &nlt->strips, track_index, ctime);
if (nes) nes->track= nlt;
@@ -1232,23 +1239,33 @@ static void animsys_evaluate_nla (PointerRNA *ptr, AnimData *adt, float ctime)
* - only do this if we're not exclusively evaluating the 'solo' NLA-track
*/
if ((adt->action) && !(adt->flag & ADT_NLA_SOLO_TRACK)) {
- /* make dummy NLA strip, and add that to the stack */
- memset(&dummy_strip, 0, sizeof(NlaStrip));
- dummy_trackslist.first= dummy_trackslist.last= &dummy_strip;
-
- dummy_strip.act= adt->action;
- dummy_strip.remap= adt->remap;
-
- calc_action_range(dummy_strip.act, &dummy_strip.actstart, &dummy_strip.actend, 1);
- dummy_strip.start = dummy_strip.actstart;
- dummy_strip.end = (IS_EQ(dummy_strip.actstart, dummy_strip.actend)) ? (dummy_strip.actstart + 1.0f): (dummy_strip.actend);
-
- dummy_strip.blendmode= adt->act_blendmode;
- dummy_strip.extendmode= adt->act_extendmode;
- dummy_strip.influence= adt->act_influence;
-
- /* add this to our list of evaluation strips */
- nlastrips_ctime_get_strip(&estrips, &dummy_trackslist, -1, ctime);
+ /* if there are strips, evaluate action as per NLA rules */
+ if (has_strips) {
+ /* make dummy NLA strip, and add that to the stack */
+ memset(&dummy_strip, 0, sizeof(NlaStrip));
+ dummy_trackslist.first= dummy_trackslist.last= &dummy_strip;
+
+ dummy_strip.act= adt->action;
+ dummy_strip.remap= adt->remap;
+
+ // FIXME: what happens when we want to included F-Modifier access?
+ calc_action_range(dummy_strip.act, &dummy_strip.actstart, &dummy_strip.actend, 1);
+ dummy_strip.start = dummy_strip.actstart;
+ dummy_strip.end = (IS_EQ(dummy_strip.actstart, dummy_strip.actend)) ? (dummy_strip.actstart + 1.0f): (dummy_strip.actend);
+
+ dummy_strip.blendmode= adt->act_blendmode;
+ dummy_strip.extendmode= adt->act_extendmode;
+ dummy_strip.influence= adt->act_influence;
+
+ /* add this to our list of evaluation strips */
+ nlastrips_ctime_get_strip(&estrips, &dummy_trackslist, -1, ctime);
+ }
+ else {
+ /* special case - evaluate as if there isn't any NLA data */
+ // TODO: this is really just a stop-gap measure...
+ animsys_evaluate_action(ptr, adt->action, adt->remap, ctime);
+ return;
+ }
}
/* only continue if there are strips to evaluate */
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 873aa039294..14f7a665bc3 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -10626,7 +10626,7 @@ static void append_named_part(FileData *fd, Main *mainvar, Scene *scene, char *n
}
}
- if(idcode==ID_OB) { /* loose object: give a base */
+ if(idcode==ID_OB && scene) { /* loose object: give a base */
base= MEM_callocN( sizeof(Base), "app_nam_part");
BLI_addtail(&scene->base, base);
@@ -10766,7 +10766,8 @@ void BLO_script_library_append(BlendHandle **bh, char *dir, char *name,
if(fd) fd->reports= NULL;
/* do we need to do this? */
- DAG_scene_sort(scene);
+ if(scene)
+ DAG_scene_sort(scene);
*bh= (BlendHandle*)fd;
}
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 53a73e0b03e..7e26cb00394 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -57,6 +57,7 @@ static EnumPropertyItem parent_type_items[] = {
#include "DNA_key_types.h"
#include "BKE_armature.h"
+#include "BKE_bullet.h"
#include "BKE_context.h"
#include "BKE_curve.h"
#include "BKE_depsgraph.h"
@@ -479,6 +480,86 @@ static void rna_MaterialSlot_name_get(PointerRNA *ptr, char *str)
strcpy(str, "");
}
+/* why does this have to be so complicated?, can't all this crap be
+ * moved to in BGE conversion function? - Campbell *
+ *
+ * logic from check_body_type()
+ * */
+static int rna_GameObjectSettings_physics_type_get(PointerRNA *ptr)
+{
+ Object *ob= (Object*)ptr->id.data;
+
+ /* determine the body_type setting based on flags */
+ if (!(ob->gameflag & OB_COLLISION)) {
+ if (ob->gameflag & OB_OCCLUDER) {
+ ob->body_type = OB_BODY_TYPE_OCCLUDER;
+ } else {
+ ob->body_type = OB_BODY_TYPE_NO_COLLISION;
+ }
+ } else if (ob->gameflag & OB_SENSOR) {
+ ob->body_type = OB_BODY_TYPE_SENSOR;
+ } else if (!(ob->gameflag & OB_DYNAMIC)) {
+ ob->body_type = OB_BODY_TYPE_STATIC;
+ } else if (!(ob->gameflag & (OB_RIGID_BODY|OB_SOFT_BODY))) {
+ ob->body_type = OB_BODY_TYPE_DYNAMIC;
+ } else if (ob->gameflag & OB_RIGID_BODY) {
+ ob->body_type = OB_BODY_TYPE_RIGID;
+ } else {
+ ob->body_type = OB_BODY_TYPE_SOFT;
+ /* create the structure here because we display soft body buttons in the main panel */
+ if (!ob->bsoft)
+ ob->bsoft = bsbNew();
+ }
+
+ return ob->body_type;
+}
+
+static void rna_GameObjectSettings_physics_type_set(PointerRNA *ptr, int value)
+{
+ Object *ob= (Object*)ptr->id.data;
+ ob->body_type= value;
+
+ switch (ob->body_type) {
+ case OB_BODY_TYPE_SENSOR:
+ ob->gameflag |= OB_SENSOR|OB_COLLISION|OB_GHOST;
+ ob->gameflag &= ~(OB_OCCLUDER|OB_DYNAMIC|OB_RIGID_BODY|OB_SOFT_BODY|OB_ACTOR|OB_ANISOTROPIC_FRICTION|OB_DO_FH|OB_ROT_FH|OB_COLLISION_RESPONSE);
+ break;
+ case OB_BODY_TYPE_OCCLUDER:
+ ob->gameflag |= OB_OCCLUDER;
+ ob->gameflag &= ~(OB_SENSOR|OB_COLLISION|OB_DYNAMIC);
+ break;
+ case OB_BODY_TYPE_NO_COLLISION:
+ ob->gameflag &= ~(OB_SENSOR|OB_COLLISION|OB_OCCLUDER|OB_DYNAMIC);
+ break;
+ case OB_BODY_TYPE_STATIC:
+ ob->gameflag |= OB_COLLISION;
+ ob->gameflag &= ~(OB_DYNAMIC|OB_RIGID_BODY|OB_SOFT_BODY|OB_OCCLUDER|OB_SENSOR);
+ break;
+ case OB_BODY_TYPE_DYNAMIC:
+ ob->gameflag |= OB_COLLISION|OB_DYNAMIC|OB_ACTOR;
+ ob->gameflag &= ~(OB_RIGID_BODY|OB_SOFT_BODY|OB_OCCLUDER|OB_SENSOR);
+ break;
+ case OB_BODY_TYPE_RIGID:
+ ob->gameflag |= OB_COLLISION|OB_DYNAMIC|OB_RIGID_BODY|OB_ACTOR;
+ ob->gameflag &= ~(OB_SOFT_BODY|OB_OCCLUDER|OB_SENSOR);
+ break;
+ default:
+ case OB_BODY_TYPE_SOFT:
+ ob->gameflag |= OB_COLLISION|OB_DYNAMIC|OB_SOFT_BODY|OB_ACTOR;
+ ob->gameflag &= ~(OB_RIGID_BODY|OB_OCCLUDER|OB_SENSOR);
+
+ /* assume triangle mesh, if no bounds chosen for soft body */
+ if ((ob->gameflag & OB_BOUNDS) && (ob->boundtype<OB_BOUND_POLYH))
+ {
+ ob->boundtype=OB_BOUND_POLYH;
+ }
+ /* create a BulletSoftBody structure if not already existing */
+ if (!ob->bsoft)
+ ob->bsoft = bsbNew();
+ break;
+ }
+}
+
static PointerRNA rna_Object_active_particle_system_get(PointerRNA *ptr)
{
Object *ob= (Object*)ptr->id.data;
@@ -667,11 +748,13 @@ static void rna_def_object_game_settings(BlenderRNA *brna)
PropertyRNA *prop;
static EnumPropertyItem body_type_items[] = {
- {OB_BODY_TYPE_NO_COLLISION, "NO_COLLISION", 0, "No Collision", ""},
- {OB_BODY_TYPE_STATIC, "STATIC", 0, "Static", ""},
- {OB_BODY_TYPE_DYNAMIC, "DYNAMIC", 0, "Dynamic", ""},
- {OB_BODY_TYPE_RIGID, "RIGID_BODY", 0, "Rigid Body", ""},
- {OB_BODY_TYPE_SOFT, "SOFT_BODY", 0, "Soft Body", ""},
+ {OB_BODY_TYPE_NO_COLLISION, "NO_COLLISION", 0, "No Collision", "Disable colision for this object"},
+ {OB_BODY_TYPE_STATIC, "STATIC", 0, "Static", "Stationary object"},
+ {OB_BODY_TYPE_DYNAMIC, "DYNAMIC", 0, "Dynamic", "Linear physics"},
+ {OB_BODY_TYPE_RIGID, "RIGID_BODY", 0, "Rigid Body", "Linear and angular physics"},
+ {OB_BODY_TYPE_SOFT, "SOFT_BODY", 0, "Soft Body", "Soft body"},
+ {OB_BODY_TYPE_OCCLUDER, "OCCLUDE", 0, "Occlude", "Occluder for optimizing scene rendering"},
+ {OB_BODY_TYPE_SENSOR, "SENSOR", 0, "Sensor", "Collision Sensor, detects static and dynamic objects but not the other collision sensor objects"},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem collision_bounds_items[] = {
@@ -726,7 +809,7 @@ static void rna_def_object_game_settings(BlenderRNA *brna)
prop= RNA_def_property(srna, "physics_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "body_type");
RNA_def_property_enum_items(prop, body_type_items);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE); // this controls various gameflags
+ RNA_def_property_enum_funcs(prop, "rna_GameObjectSettings_physics_type_get", "rna_GameObjectSettings_physics_type_set", NULL);
RNA_def_property_ui_text(prop, "Physics Type", "Selects the type of physical representation.");
prop= RNA_def_property(srna, "actor", PROP_BOOLEAN, PROP_NONE);
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index f0a73eb88ef..151b85bad9e 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -280,6 +280,8 @@ void WM_exit(bContext *C)
RNA_exit();
+ wm_ghost_exit();
+
CTX_free(C);
if(MEM_get_memory_blocks_in_use()!=0) {
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index 31e6de2527b..4d80836dd05 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -756,6 +756,14 @@ void wm_ghost_init(bContext *C)
}
}
+void wm_ghost_exit(void)
+{
+ if(g_system)
+ GHOST_DisposeSystem(g_system);
+
+ g_system= NULL;
+}
+
/* **************** timer ********************** */
/* to (de)activate running timers temporary */
diff --git a/source/blender/windowmanager/wm_window.h b/source/blender/windowmanager/wm_window.h
index c2a2b00b796..f159f7f098d 100644
--- a/source/blender/windowmanager/wm_window.h
+++ b/source/blender/windowmanager/wm_window.h
@@ -33,6 +33,7 @@ struct bScreen;
/* *************** internal api ************** */
void wm_ghost_init (bContext *C);
+void wm_ghost_exit(void);
wmWindow *wm_window_new (bContext *C);
void wm_window_free (bContext *C, wmWindow *win);