svn merge ^/trunk/blender -r43616:43639

This commit is contained in:
Campbell Barton 2012-01-23 16:46:35 +00:00
commit 5cc898ada2
27 changed files with 163 additions and 31 deletions

@ -77,6 +77,14 @@ Functions
:rtype: integer
.. function:: setWindowSize(width, height)
Set the width and height of the window (in pixels). This also works for fullscreen applications.
:type width: integer
:type height: integer
.. function:: makeScreenshot(filename)
Writes a screenshot to the given filename.

@ -8,6 +8,7 @@ incs += ' ../../source/blender/blenlib'
defs = []
if not env['WITH_BF_CARVE']:
import os
sources = env.Glob('intern/*.cpp')
sources.remove('intern' + os.sep + 'BOP_CarveInterface.cpp')
else:

@ -337,16 +337,13 @@ class CyclesObject_PT_ray_visibility(CyclesButtonsPanel, Panel):
ob = context.object
visibility = ob.cycles_visibility
split = layout.split()
col = split.column()
col.prop(visibility, "camera")
col.prop(visibility, "diffuse")
col.prop(visibility, "glossy")
col = split.column()
col.prop(visibility, "transmission")
col.prop(visibility, "shadow")
flow = layout.column_flow()
flow.prop(visibility, "camera")
flow.prop(visibility, "diffuse")
flow.prop(visibility, "glossy")
flow.prop(visibility, "transmission")
flow.prop(visibility, "shadow")
def find_node(material, nodetype):
@ -473,17 +470,13 @@ class CyclesWorld_PT_settings(CyclesButtonsPanel, Panel):
world = context.world
cworld = world.cycles
split = layout.split()
col = split.column()
col = layout.column()
col.prop(cworld, "sample_as_light")
row = col.row()
row.active = cworld.sample_as_light
row.prop(cworld, "sample_map_resolution")
col = split.column()
col.label()
class CyclesWorld_PT_volume(CyclesButtonsPanel, Panel):
bl_label = "Volume"
@ -617,14 +610,9 @@ class CyclesTexture_PT_context(CyclesButtonsPanel, Panel):
col.template_ID(user, "texture", new="texture.new")
if tex:
row = split.row()
row.prop(tex, "use_nodes", icon="NODETREE", text="")
row.label()
if not tex.use_nodes:
split = layout.split(percentage=0.2)
split.label(text="Type:")
split.prop(tex, "type", text="")
split = layout.split(percentage=0.2)
split.label(text="Type:")
split.prop(tex, "type", text="")
class CyclesTexture_PT_nodes(CyclesButtonsPanel, Panel):

@ -271,6 +271,15 @@ public:
*/
virtual GHOST_TSuccess beginFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow** window,
const bool stereoVisual, const GHOST_TUns16 numOfAASamples=0) = 0;
/**
* Updates the resolution while in fullscreen mode.
* @param setting The new setting of the display.
* @param window Window displayed in full screen.
*
* @return Indication of success.
*/
virtual GHOST_TSuccess updateFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow** window) = 0;
/**
* Ends full screen mode.

@ -168,6 +168,19 @@ GHOST_TSuccess GHOST_System::beginFullScreen(const GHOST_DisplaySetting& setting
}
GHOST_TSuccess GHOST_System::updateFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow** window)
{
GHOST_TSuccess success = GHOST_kFailure;
GHOST_ASSERT(m_windowManager, "GHOST_System::updateFullScreen(): invalid window manager");
if(m_displayManager) {
if (m_windowManager->getFullScreen()) {
success = m_displayManager->setCurrentDisplaySetting(GHOST_DisplayManager::kMainDisplay, setting);
}
}
return success;
}
GHOST_TSuccess GHOST_System::endFullScreen(void)
{
GHOST_TSuccess success = GHOST_kFailure;

@ -145,6 +145,15 @@ public:
*/
virtual GHOST_TSuccess beginFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow** window,
const bool stereoVisual, const GHOST_TUns16 numOfAASamples=0);
/**
* Updates the resolution while in fullscreen mode.
* @param setting The new setting of the display.
* @param window Window displayed in full screen.
*
* @return Indication of success.
*/
virtual GHOST_TSuccess updateFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow** window);
/**
* Ends full screen mode.

@ -87,6 +87,7 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel, Panel):
col.label(text="Damping:")
col.prop(cloth, "spring_damping", text="Spring")
col.prop(cloth, "air_damping", text="Air")
col.prop(cloth, "vel_damping", text="Velocity")
col.prop(cloth, "use_pin_cloth", text="Pinning")
sub = col.column()

@ -58,6 +58,9 @@ class NODE_HT_header(Header):
# Don't show "Use Nodes" Button when Engine is BI for Lamps
if snode_id and not (scene.render.use_shading_nodes == 0 and ob.type == 'LAMP'):
layout.prop(snode_id, "use_nodes")
if snode.shader_type == 'WORLD':
layout.template_ID(scene, "world", new="world.new")
elif snode.tree_type == 'TEXTURE':
layout.prop(snode, "texture_type", text="", expand=True)

@ -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;

@ -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);

@ -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! */

@ -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);

@ -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;
}

@ -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];

@ -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;

@ -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 */

@ -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");

@ -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 */

@ -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);

@ -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);

@ -78,7 +78,7 @@ public:
SwapBuffers(
);
void
Resize(
ResizeWindow(
int width,
int height
);

@ -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) {

@ -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.

@ -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();

@ -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() {};
};

@ -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 }
};

@ -205,6 +205,15 @@ public:
MakeScreenShot(
const char* filename
)=0;
virtual
void
ResizeWindow(
int width,
int height
)=0;
protected:
RAS_MouseState m_mousestate;