diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-01-23 20:46:35 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-01-23 20:46:35 +0400 |
commit | 5cc898ada2fbe11e1847c385b0c0439df3a706df (patch) | |
tree | 5b61839f273a2f4204f4cf92b291ef9e01ce7e06 /source | |
parent | 6c9438ea8a34054c66690a8c5d49162d0fd9379a (diff) | |
parent | 74b4fd26d2d1dde537a46f9237839c057cd03aaf (diff) |
svn merge ^/trunk/blender -r43616:43639
Diffstat (limited to 'source')
19 files changed, 108 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index 4e122ec0f11..44df3edb3e5 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -131,6 +131,7 @@ void cloth_init ( ClothModifierData *clmd ) clmd->sim_parms->presets = 2; /* cotton as start setting */ clmd->sim_parms->timescale = 1.0f; /* speed factor, describes how fast cloth moves */ clmd->sim_parms->reset = 0; + clmd->sim_parms->vel_damping = 1.0f; /* 1.0 = no damping, 0.0 = fully dampened */ clmd->coll_parms->self_friction = 5.0; clmd->coll_parms->friction = 5.0; diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c index 00a2de369a3..757d3ddf9ac 100644 --- a/source/blender/blenkernel/intern/implicit.c +++ b/source/blender/blenkernel/intern/implicit.c @@ -1852,6 +1852,9 @@ int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase while(step < tf) { + // damping velocity for artistic reasons + mul_lfvectorS(id->V, id->V, clmd->sim_parms->vel_damping, numverts); + // calculate forces cloth_calc_force(clmd, frame, id->F, id->X, id->V, id->dFdV, id->dFdX, effectors, step, id->M); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 91d85d4519f..c11d9411821 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -13118,6 +13118,20 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* put compatibility code here until next subversion bump */ { + { + Object *ob; + for(ob=main->object.first; ob; ob= ob->id.next) { + ModifierData *md; + + for (md=ob->modifiers.first; md; md=md->next) { + if (md->type==eModifierType_Cloth) { + ClothModifierData *clmd = (ClothModifierData*) md; + if(clmd->sim_parms) + clmd->sim_parms->vel_damping = 1.0f; + } + } + } + } } /* WATCH IT!!!: pointers from libdata have not been converted yet here! */ diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 3903271679f..9bc8937a616 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -850,7 +850,7 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, uiItemEnumO(row, "OBJECT_OT_modifier_apply", IFACE_("Apply"), 0, "apply_as", MODIFIER_APPLY_DATA); if (modifier_sameTopology(md) && !modifier_nonGeometrical(md)) - uiItemEnumO(row, "OBJECT_OT_modifier_apply", IFACE_("Apply as Shape"), 0, "apply_as", MODIFIER_APPLY_SHAPE); + uiItemEnumO(row, "OBJECT_OT_modifier_apply", IFACE_("Apply as Shape Key"), 0, "apply_as", MODIFIER_APPLY_SHAPE); } uiBlockClearButLock(block); diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 0264cf5ad05..eaa04a1e09e 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -1022,6 +1022,8 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto UI_icon_draw(x, y, ICON_MOD_VERTEX_WEIGHT); break; case eModifierType_DynamicPaint: UI_icon_draw(x, y, ICON_MOD_DYNAMICPAINT); break; + case eModifierType_Ocean: + UI_icon_draw(x, y, ICON_MOD_WAVE); break; default: UI_icon_draw(x, y, ICON_DOT); break; } diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index d4b496e45b7..5cbcca81b28 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -235,8 +235,10 @@ static void view3d_project_short_clip(ARegion *ar, const float vec[3], short adr } } +/* BMESH NOTE: this function is unused in bmesh only */ + /* only use while object drawing */ -static void view3d_project_short_noclip(ARegion *ar, const float vec[3], short adr[2]) +static void UNUSED_FUNCTION(view3d_project_short_noclip)(ARegion *ar, const float vec[3], short adr[2]) { RegionView3D *rv3d= ar->regiondata; float fx, fy, vec4[4]; diff --git a/source/blender/makesdna/DNA_cloth_types.h b/source/blender/makesdna/DNA_cloth_types.h index 5c333c3fc1f..1079f1db835 100644 --- a/source/blender/makesdna/DNA_cloth_types.h +++ b/source/blender/makesdna/DNA_cloth_types.h @@ -70,6 +70,7 @@ typedef struct ClothSimSettings float goalfrict; float velocity_smooth; /* smoothing of velocities for hair */ float collider_friction; /* friction with colliders */ + float vel_damping; /* damp the velocity to speed up getting to the resting position */ int stepsPerFrame; /* Number of time steps per frame. */ int flags; /* flags, see CSIMSETT_FLAGS enum above. */ @@ -82,7 +83,7 @@ typedef struct ClothSimSettings short shapekey_rest; /* vertex group for scaling structural stiffness */ short presets; /* used for presets on GUI */ short reset; - short pad[3]; + short pad; struct EffectorWeights *effector_weights; } ClothSimSettings; diff --git a/source/blender/makesdna/DNA_object_force.h b/source/blender/makesdna/DNA_object_force.h index 1707c0d3929..70aeaaacd44 100644 --- a/source/blender/makesdna/DNA_object_force.h +++ b/source/blender/makesdna/DNA_object_force.h @@ -186,6 +186,8 @@ typedef struct PointCache { int endframe; /* simulation end frame */ int editframe; /* frame being edited (runtime only) */ int last_exact; /* last exact frame that's cached */ + int last_valid; /* used for editing cache - what is the last baked frame */ + int pad; /* for external cache files */ int totpoint; /* number of cached points */ diff --git a/source/blender/makesrna/intern/rna_cloth.c b/source/blender/makesrna/intern/rna_cloth.c index db6cb28bd98..839c67f6297 100644 --- a/source/blender/makesrna/intern/rna_cloth.c +++ b/source/blender/makesrna/intern/rna_cloth.c @@ -289,6 +289,12 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Air Damping", "Air has normally some thickness which slows falling things down"); RNA_def_property_update(prop, 0, "rna_cloth_update"); + prop= RNA_def_property(srna, "vel_damping", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "vel_damping"); + RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_ui_text(prop, "Velocity Damping", "Damp velocity to help cloth reach the resting position faster. [1.0 = no damping, 0.0 = fully dampened]"); + RNA_def_property_update(prop, 0, "rna_cloth_update"); + prop= RNA_def_property(srna, "use_pin_cloth", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", CLOTH_SIMSETTINGS_FLAG_GOAL); RNA_def_property_ui_text(prop, "Pin Cloth", "Enable pinning of cloth vertices to other objects/positions"); diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index c75cdf525b0..976e0d79d2c 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -1969,10 +1969,11 @@ static void rna_def_mesh_vertices(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "add", "ED_mesh_vertices_add"); RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of vertices to add", 0, INT_MAX); - +#if 0 // Remove until BMesh merge func= RNA_def_function(srna, "remove", "ED_mesh_vertices_remove"); RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of vertices to remove", 0, INT_MAX); +#endif } /* mesh.edges */ @@ -1992,10 +1993,11 @@ static void rna_def_mesh_edges(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "add", "ED_mesh_edges_add"); RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of edges to add", 0, INT_MAX); - +#if 0 // Remove until BMesh merge func= RNA_def_function(srna, "remove", "ED_mesh_edges_remove"); RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of edges to remove", 0, INT_MAX); +#endif } /* mesh.faces */ @@ -2019,10 +2021,11 @@ static void rna_def_mesh_faces(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "add", "ED_mesh_faces_add"); RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of faces to add", 0, INT_MAX); - +#if 0 // Remove until BMesh merge func= RNA_def_function(srna, "remove", "ED_mesh_faces_remove"); RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of faces to remove", 0, INT_MAX); +#endif } /* mesh.loops */ diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index d38d2270fc5..0486b997915 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -2917,7 +2917,7 @@ static void rna_def_modifier_ocean(BlenderRNA *brna) srna= RNA_def_struct(brna, "OceanModifier", "Modifier"); RNA_def_struct_ui_text(srna, "Ocean Modifier", "Simulate an ocean surface"); RNA_def_struct_sdna(srna, "OceanModifierData"); - RNA_def_struct_ui_icon(srna, ICON_MOD_FLUIDSIM); + RNA_def_struct_ui_icon(srna, ICON_MOD_WAVE); /* General check if blender was built with OceanSim modifier support */ prop= RNA_def_property(srna, "is_build_enabled", PROP_BOOLEAN, PROP_NONE); diff --git a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp index 2a21b531b6b..7e7b3d2e3d4 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp +++ b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp @@ -59,6 +59,11 @@ void KX_BlenderCanvas::SwapBuffers() BL_SwapBuffers(m_win); } +void KX_BlenderCanvas::ResizeWindow(int width, int height) +{ + // Not implemented for the embedded player +} + void KX_BlenderCanvas::BeginFrame() { glEnable(GL_DEPTH_TEST); diff --git a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h index 1f38cf9766d..44dffb5bc54 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h +++ b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h @@ -78,7 +78,7 @@ public: SwapBuffers( ); void - Resize( + ResizeWindow( int width, int height ); diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp index c63b32830b0..1d4edb45242 100644 --- a/source/gameengine/Converter/BL_ActionActuator.cpp +++ b/source/gameengine/Converter/BL_ActionActuator.cpp @@ -350,6 +350,12 @@ bool BL_ActionActuator::Update(double curtime, bool frame) PyObject* BL_ActionActuator::PyGetChannel(PyObject* value) { const char *string= _PyUnicode_AsString(value); + + if (GetParent()->GetGameObjectType() != SCA_IObject::OBJ_ARMATURE) + { + PyErr_SetString(PyExc_NotImplementedError, "actuator.getChannel(): Only armatures support channels"); + return NULL; + } if (!string) { PyErr_SetString(PyExc_TypeError, "expected a single string"); @@ -414,6 +420,12 @@ KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel, PyObject *pymat= NULL; PyObject *pyloc= NULL, *pysize= NULL, *pyquat= NULL; bPoseChannel *pchan; + + if (GetParent()->GetGameObjectType() != SCA_IObject::OBJ_ARMATURE) + { + PyErr_SetString(PyExc_NotImplementedError, "actuator.setChannel(): Only armatures support channels"); + return NULL; + } if(PyTuple_Size(args)==2) { if (!PyArg_ParseTuple(args,"sO:setChannel", &string, &pymat)) // matrix @@ -574,6 +586,12 @@ PyObject* BL_ActionActuator::pyattr_get_channel_names(void *self_v, const KX_PYA PyObject *ret= PyList_New(0); PyObject *item; + if (self->GetParent()->GetGameObjectType() != SCA_IObject::OBJ_ARMATURE) + { + PyErr_SetString(PyExc_NotImplementedError, "actuator.channelNames: Only armatures support channels"); + return NULL; + } + bPose *pose= ((BL_ArmatureObject*)self->GetParent())->GetOrigPose(); if(pose) { diff --git a/source/gameengine/GamePlayer/common/GPC_Canvas.h b/source/gameengine/GamePlayer/common/GPC_Canvas.h index 6ac1323783b..a9d7ab1b93f 100644 --- a/source/gameengine/GamePlayer/common/GPC_Canvas.h +++ b/source/gameengine/GamePlayer/common/GPC_Canvas.h @@ -103,6 +103,7 @@ public: void Resize(int width, int height); + virtual void ResizeWindow(int width, int height){}; /** * @section Methods inherited from abstract base class RAS_ICanvas. diff --git a/source/gameengine/GamePlayer/ghost/GPG_Canvas.cpp b/source/gameengine/GamePlayer/ghost/GPG_Canvas.cpp index 4b5d2bbf96a..9b01cb5786f 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Canvas.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_Canvas.cpp @@ -108,6 +108,26 @@ void GPG_Canvas::SwapBuffers() } } +void GPG_Canvas::ResizeWindow(int width, int height) +{ + if (m_window->getState() == GHOST_kWindowStateFullScreen) + { + GHOST_ISystem* system = GHOST_ISystem::getSystem(); + GHOST_DisplaySetting setting; + setting.xPixels = width; + setting.yPixels = height; + //XXX allow these to be changed or kept from previous state + setting.bpp = 32; + setting.frequency = 60; + + system->updateFullScreen(setting, &m_window); + } + + m_window->setClientSize(width, height); + + Resize(width, height); +} + float GPG_Canvas::GetMouseNormalizedX(int x) { return float(x)/this->GetWidth(); diff --git a/source/gameengine/GamePlayer/ghost/GPG_Canvas.h b/source/gameengine/GamePlayer/ghost/GPG_Canvas.h index c1ebb09251c..217cfc5eb88 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Canvas.h +++ b/source/gameengine/GamePlayer/ghost/GPG_Canvas.h @@ -60,6 +60,8 @@ public: virtual float GetMouseNormalizedX(int x); virtual float GetMouseNormalizedY(int y); + virtual void ResizeWindow(int width, int height); + bool BeginDraw() { return true;}; void EndDraw() {}; }; diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index 114ca735265..32106b1fdd8 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -1288,6 +1288,16 @@ static PyObject* gPyDrawLine(PyObject*, PyObject* args) Py_RETURN_NONE; } +static PyObject* gPySetWindowSize(PyObject*, PyObject* args) +{ + int width, height; + if (!PyArg_ParseTuple(args, "ii:resize", &width, &height)) + return NULL; + + gp_Canvas->ResizeWindow(width, height); + Py_RETURN_NONE; +} + static struct PyMethodDef rasterizer_methods[] = { {"getWindowWidth",(PyCFunction) gPyGetWindowWidth, METH_VARARGS, "getWindowWidth doc"}, @@ -1329,6 +1339,7 @@ static struct PyMethodDef rasterizer_methods[] = { METH_VARARGS, "get the anisotropic filtering level"}, {"drawLine", (PyCFunction) gPyDrawLine, METH_VARARGS, "draw a line on the screen"}, + {"setWindowSize", (PyCFunction) gPySetWindowSize, METH_VARARGS, ""}, { NULL, (PyCFunction) NULL, 0, NULL } }; diff --git a/source/gameengine/Rasterizer/RAS_ICanvas.h b/source/gameengine/Rasterizer/RAS_ICanvas.h index d7e2f237bb0..2c2f62c946e 100644 --- a/source/gameengine/Rasterizer/RAS_ICanvas.h +++ b/source/gameengine/Rasterizer/RAS_ICanvas.h @@ -205,6 +205,15 @@ public: MakeScreenShot( const char* filename )=0; + + virtual + void + ResizeWindow( + int width, + int height + )=0; + + protected: RAS_MouseState m_mousestate; |