svn merge ^/trunk/blender -r48378:48406

This commit is contained in:
Campbell Barton
2012-06-29 13:11:44 +00:00
19 changed files with 99 additions and 62 deletions

View File

@@ -139,6 +139,8 @@ def modules(module_cache):
return mod
else:
print("fake_module: addon missing 'bl_info' "
"gives bad performance!: %r" % mod_path)
return None
modules_stale = set(module_cache.keys())

View File

@@ -253,8 +253,8 @@ _scripts = (_os.path.normpath(_scripts), )
def user_script_path():
prefs = _bpy.context.user_preferences
path = prefs.filepaths.script_directory
# returns the env var and falls back to userprefs
path = _user_resource('SCRIPTS')
if path:
path = _os.path.normpath(path)
@@ -281,7 +281,7 @@ def script_paths(subdir=None, user_pref=True, check_all=False):
prefs = _bpy.context.user_preferences
# add user scripts dir
user_script = prefs.filepaths.script_directory if user_pref else None
user_script = user_script_path()
if check_all:
# all possible paths

View File

@@ -58,12 +58,9 @@ class MeshMirrorUV(Operator):
vcos = (v.co.to_tuple(5) for v in mesh.vertices)
for i, co in enumerate(vcos):
if co[0] > 0.0:
mirror_gt[co] = i
elif co[0] < 0.0:
mirror_lt[co] = i
else:
if co[0] >= 0.0:
mirror_gt[co] = i
if co[0] <= 0.0:
mirror_lt[co] = i
#for i, v in enumerate(mesh.vertices):
@@ -97,14 +94,13 @@ class MeshMirrorUV(Operator):
puvsel[i] = (False not in
(uv.select for uv in uv_loops[lstart:lend]))
# Vert idx of the poly.
vidxs[i] = tuple(sorted(l.vertex_index
for l in loops[lstart:lend]))
vidxs[i] = tuple(l.vertex_index for l in loops[lstart:lend])
# As we have no poly.center yet...
pcents[i] = tuple(map(lambda x: x / p.loop_total,
map(sum, zip(*(verts[idx].co
for idx in vidxs[i])))))
# Preparing next step finding matching polys.
mirror_pm[vidxs[i]] = i
mirror_pm[tuple(sorted(vidxs[i]))] = i
for i in range(nbr_polys):
# Find matching mirror poly.

View File

@@ -191,7 +191,7 @@ struct Image *BKE_image_copy(struct Image *ima);
void BKE_image_merge(struct Image *dest, struct Image *source);
/* scale the image */
void BKE_image_scale(struct Image *image, int width, int height);
int BKE_image_scale(struct Image *image, int width, int height);
/* check if texture has alpha (depth=32) */
int BKE_image_has_alpha(struct Image *image);

View File

@@ -33,6 +33,7 @@
#include "BLI_utildefines.h"
#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
#include "DNA_constraint_types.h"
#include "DNA_dynamicpaint_types.h"
#include "DNA_group_types.h" /*GroupObject*/
@@ -46,6 +47,7 @@
#include "DNA_texture_types.h"
#include "BKE_animsys.h"
#include "BKE_armature.h"
#include "BKE_bvhutils.h" /* bvh tree */
#include "BKE_blender.h"
#include "BKE_cdderivedmesh.h"
@@ -528,11 +530,6 @@ static int subframe_updateObject(Scene *scene, Object *ob, int flags, float fram
}
}
}
/* for curve following objects, parented curve has to be updated too */
if (ob->type == OB_CURVE) {
Curve *cu = ob->data;
BKE_animsys_evaluate_animdata(scene, &cu->id, cu->adt, frame, ADT_RECALC_ANIM);
}
/* was originally OB_RECALC_ALL - TODO - which flags are really needed??? */
ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
@@ -547,6 +544,18 @@ static int subframe_updateObject(Scene *scene, Object *ob, int flags, float fram
else
BKE_object_where_is_calc_time(scene, ob, frame);
/* for curve following objects, parented curve has to be updated too */
if (ob->type == OB_CURVE) {
Curve *cu = ob->data;
BKE_animsys_evaluate_animdata(scene, &cu->id, cu->adt, frame, ADT_RECALC_ANIM);
}
/* and armatures... */
if (ob->type == OB_ARMATURE) {
bArmature *arm = ob->data;
BKE_animsys_evaluate_animdata(scene, &arm->id, arm->adt, frame, ADT_RECALC_ANIM);
BKE_pose_where_is(scene, ob);
}
return 0;
}

View File

@@ -789,6 +789,12 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP
multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result+3);
if (mode == PFIELD_TEX_GRAD || !hasrgb) { /* if we don't have rgb fall back to grad */
/* generate intensity if texture only has rgb value */
if (hasrgb & TEX_RGB) {
int i;
for (i=0; i<4; i++)
result[i].tin = (1.0f / 3.0f) * (result[i].tr + result[i].tg + result[i].tb);
}
force[0] = (result[0].tin - result[1].tin) * strength;
force[1] = (result[0].tin - result[2].tin) * strength;
force[2] = (result[0].tin - result[3].tin) * strength;

View File

@@ -514,17 +514,21 @@ void BKE_image_merge(Image *dest, Image *source)
}
/* note, we could be clever and scale all imbuf's but since some are mipmaps its not so simple */
void BKE_image_scale(Image *image, int width, int height)
int BKE_image_scale(Image *image, int width, int height)
{
ImBuf *ibuf;
void *lock;
ibuf = BKE_image_acquire_ibuf(image, NULL, &lock);
IMB_scaleImBuf(ibuf, width, height);
ibuf->userflags |= IB_BITMAPDIRTY;
if (ibuf) {
IMB_scaleImBuf(ibuf, width, height);
ibuf->userflags |= IB_BITMAPDIRTY;
}
BKE_image_release_ibuf(image, lock);
return (ibuf != NULL);
}
Image *BKE_image_load(const char *filepath)

View File

@@ -354,12 +354,12 @@ BMFace *BM_face_split(BMesh *bm, BMFace *f, BMVert *v1, BMVert *v2, BMLoop **r_l
l_iter = l_first = BM_FACE_FIRST_LOOP(f);
do {
BM_loop_interp_from_face(bm, l_iter, of, FALSE, TRUE);
BM_loop_interp_multires(bm, l_iter, of);
} while ((l_iter = l_iter->next) != l_first);
l_iter = l_first = BM_FACE_FIRST_LOOP(nf);
do {
BM_loop_interp_from_face(bm, l_iter, of, FALSE, TRUE);
BM_loop_interp_multires(bm, l_iter, of);
} while ((l_iter = l_iter->next) != l_first);
BM_face_kill(bm, of);

View File

@@ -3145,40 +3145,46 @@ static const char *sculpt_tool_name(Sculpt *sd)
{
Brush *brush = paint_brush(&sd->paint);
switch (brush->sculpt_tool) {
switch ((BrushSculptTool)brush->sculpt_tool) {
case SCULPT_TOOL_DRAW:
return "Draw Brush"; break;
return "Draw Brush";
case SCULPT_TOOL_SMOOTH:
return "Smooth Brush"; break;
return "Smooth Brush";
case SCULPT_TOOL_CREASE:
return "Crease Brush"; break;
return "Crease Brush";
case SCULPT_TOOL_BLOB:
return "Blob Brush"; break;
return "Blob Brush";
case SCULPT_TOOL_PINCH:
return "Pinch Brush"; break;
return "Pinch Brush";
case SCULPT_TOOL_INFLATE:
return "Inflate Brush"; break;
return "Inflate Brush";
case SCULPT_TOOL_GRAB:
return "Grab Brush"; break;
return "Grab Brush";
case SCULPT_TOOL_NUDGE:
return "Nudge Brush"; break;
return "Nudge Brush";
case SCULPT_TOOL_THUMB:
return "Thumb Brush"; break;
return "Thumb Brush";
case SCULPT_TOOL_LAYER:
return "Layer Brush"; break;
return "Layer Brush";
case SCULPT_TOOL_FLATTEN:
return "Flatten Brush"; break;
return "Flatten Brush";
case SCULPT_TOOL_CLAY:
return "Clay Brush"; break;
return "Clay Brush";
case SCULPT_TOOL_CLAY_STRIPS:
return "Clay Strips Brush"; break;
return "Clay Strips Brush";
case SCULPT_TOOL_FILL:
return "Fill Brush"; break;
return "Fill Brush";
case SCULPT_TOOL_SCRAPE:
return "Scrape Brush"; break;
default:
return "Sculpting"; break;
return "Scrape Brush";
case SCULPT_TOOL_SNAKE_HOOK:
return "Snake Hook Brush";
case SCULPT_TOOL_ROTATE:
return "Rotate Brush";
case SCULPT_TOOL_MASK:
return "Mask Brush";
}
return "Sculpting";
}
/**

View File

@@ -24,7 +24,6 @@
* \ingroup RNA
*/
#include <stdlib.h>
#include "RNA_access.h"
@@ -37,6 +36,8 @@
#include "DNA_action_types.h"
#include "DNA_scene_types.h"
#include "BLI_utildefines.h"
#include "MEM_guardedalloc.h"
#include "ED_keyframing.h"
@@ -463,7 +464,8 @@ static FCurve *rna_Driver_from_existing(AnimData *adt, bContext *C, FCurve *src_
#else
/* helper function for Keying Set -> keying settings */
static void rna_def_common_keying_flags(StructRNA *srna, short reg)
/* TODO: use reg option! */
static void rna_def_common_keying_flags(StructRNA *srna, short UNUSED(reg))
{
PropertyRNA *prop;

View File

@@ -24,7 +24,6 @@
* \ingroup RNA
*/
#include <stdlib.h>
#include "RNA_define.h"
@@ -36,6 +35,8 @@
#include "DNA_material_types.h"
#include "DNA_scene_types.h"
#include "BLI_utildefines.h"
#include "BKE_font.h"
#include "WM_types.h"
@@ -845,7 +846,7 @@ static void rna_def_beztriple(BlenderRNA *brna)
RNA_def_struct_path_func(srna, "rna_Curve_spline_point_path");
}
static void rna_def_path(BlenderRNA *brna, StructRNA *srna)
static void rna_def_path(BlenderRNA *UNUSED(brna), StructRNA *srna)
{
PropertyRNA *prop;
@@ -894,7 +895,7 @@ static void rna_def_path(BlenderRNA *brna, StructRNA *srna)
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
}
static void rna_def_nurbs(BlenderRNA *brna, StructRNA *srna)
static void rna_def_nurbs(BlenderRNA *UNUSED(brna), StructRNA *srna)
{
PropertyRNA *prop;
@@ -905,7 +906,7 @@ static void rna_def_nurbs(BlenderRNA *brna, StructRNA *srna)
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
}
static void rna_def_font(BlenderRNA *brna, StructRNA *srna)
static void rna_def_font(BlenderRNA *UNUSED(brna), StructRNA *srna)
{
PropertyRNA *prop;

View File

@@ -549,7 +549,8 @@ void RNA_struct_free(BlenderRNA *brna, StructRNA *srna)
if (srna->flag & STRUCT_RUNTIME)
rna_freelinkN(&brna->structs, srna);
#else
(void)brna, (void)srna;
#endif
}

View File

@@ -178,9 +178,11 @@ static void rna_Image_update(Image *image, ReportList *reports)
IMB_rect_from_float(ibuf);
}
static void rna_Image_scale(Image *image, int width, int height)
static void rna_Image_scale(Image *image, ReportList *reports, int width, int height)
{
BKE_image_scale(image, width, height);
if (!BKE_image_scale(image, width, height)) {
BKE_reportf(reports, RPT_ERROR, "Image \"%s\" does not have any image data", image->id.name + 2);
}
}
static int rna_Image_gl_load(Image *image, ReportList *reports, int filter, int mag)
@@ -285,6 +287,7 @@ void RNA_api_image(StructRNA *srna)
func = RNA_def_function(srna, "scale", "rna_Image_scale");
RNA_def_function_ui_description(func, "Scale the image in pixels");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
parm = RNA_def_int(func, "width", 0, 1, 10000, "", "Width", 1, 10000);
RNA_def_property_flag(parm, PROP_REQUIRED);
parm = RNA_def_int(func, "height", 0, 1, 10000, "", "Height", 1, 10000);

View File

@@ -2062,12 +2062,17 @@ static void WM_OT_save_as_mainfile(wmOperatorType *ot)
ot->check = blend_save_check;
/* ommit window poll so this can work in background mode */
WM_operator_properties_filesel(ot, FOLDERFILE | BLENDERFILE, FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
WM_operator_properties_filesel(ot, FOLDERFILE | BLENDERFILE, FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH,
FILE_DEFAULTDISPLAY);
RNA_def_boolean(ot->srna, "compress", 0, "Compress", "Write compressed .blend file");
RNA_def_boolean(ot->srna, "relative_remap", 1, "Remap Relative", "Remap relative paths when saving in a different directory");
RNA_def_boolean(ot->srna, "copy", 0, "Save Copy", "Save a copy of the actual working state but does not make saved file active");
RNA_def_boolean(ot->srna, "relative_remap", 1, "Remap Relative",
"Remap relative paths when saving in a different directory");
RNA_def_boolean(ot->srna, "copy", 0, "Save Copy",
"Save a copy of the actual working state but does not make saved file active");
#ifdef USE_BMESH_SAVE_AS_COMPAT
RNA_def_boolean(ot->srna, "use_mesh_compat", 0, "Legacy Mesh Format", "Save using legacy mesh format (no ngons)");
RNA_def_boolean(ot->srna, "use_mesh_compat", 0, "Legacy Mesh Format",
"Save using legacy mesh format (no ngons) - WARNING: only saves tris and quads, other ngons will "
"be lost (no implicit triangulation)");
#endif
}

View File

@@ -69,10 +69,6 @@ protected:
class RAS_IRenderTools* m_rendertools; //needed for drawing routine
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("GE:KX_FontObject")
#endif
#ifdef WITH_PYTHON
static PyObject* pyattr_get_text(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_text(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);

View File

@@ -40,7 +40,7 @@ namespace
inline float vdist(const float* a, const float* b) { return sqrtf(vdistsqr(a,b)); }
inline void vcpy(float* a, const float* b) { a[0]=b[0]; a[1]=b[1]; }
inline float vdot(const float* a, const float* b) { return a[0]*b[0] + a[1]*b[1]; }
inline float vperp(const float* a, const float* b) { return a[0]*b[1] - a[1]*b[0]; }
/* inline float vperp(const float* a, const float* b) { return a[0]*b[1] - a[1]*b[0]; } */ /* UNUSED */
inline void vsub(float* v, const float* a, const float* b) { v[0] = a[0]-b[0]; v[1] = a[1]-b[1]; }
inline void vadd(float* v, const float* a, const float* b) { v[0] = a[0]+b[0]; v[1] = a[1]+b[1]; }
inline void vscale(float* v, const float* a, const float s) { v[0] = a[0]*s; v[1] = a[1]*s; }
@@ -48,7 +48,7 @@ namespace
inline float vlensqr(const float* v) { return vdot(v,v); }
inline float vlen(const float* v) { return sqrtf(vlensqr(v)); }
inline void vlerp(float* v, const float* a, const float* b, float t) { v[0] = lerp(a[0], b[0], t); v[1] = lerp(a[1], b[1], t); }
inline void vmad(float* v, const float* a, const float* b, float s) { v[0] = a[0] + b[0]*s; v[1] = a[1] + b[1]*s; }
/* inline void vmad(float* v, const float* a, const float* b, float s) { v[0] = a[0] + b[0]*s; v[1] = a[1] + b[1]*s; } */ /* UNUSED */
inline void vnorm(float* v)
{
float d = vlen(v);
@@ -549,6 +549,9 @@ void KX_ObstacleSimulationTOI_rays::sampleRVO(KX_Obstacle* activeObst, KX_NavMes
p1, p2, ob->m_rad, htmin, htmax))
continue;
}
else {
continue;
}
if (htmin > 0.0f)
{
@@ -743,6 +746,9 @@ static void processSamples(KX_Obstacle* activeObst, KX_NavMeshObject* activeNavM
// Avoid less when facing walls.
htmin *= 2.0f;
}
else {
continue;
}
if (htmin >= 0.0f)
{

View File

@@ -323,7 +323,7 @@ void RAS_2DFilterManager::SetupTextures(bool depth, bool luminance)
void RAS_2DFilterManager::UpdateOffsetMatrix(RAS_ICanvas* canvas)
{
RAS_Rect canvas_rect = canvas->GetWindowArea();
/* RAS_Rect canvas_rect = canvas->GetWindowArea(); */ /* UNUSED */
texturewidth = canvas->GetWidth();
textureheight = canvas->GetHeight();
GLint i,j;

View File

@@ -42,7 +42,7 @@
RAS_VAOpenGLRasterizer::RAS_VAOpenGLRasterizer(RAS_ICanvas* canvas, bool lock)
: RAS_OpenGLRasterizer(canvas),
m_Lock(lock && GLEW_EXT_compiled_vertex_array),
/* m_Lock(lock && GLEW_EXT_compiled_vertex_array), */ /* UNUSED */
m_last_texco_num(0),
m_last_attrib_num(0)
{

View File

@@ -37,7 +37,7 @@
class RAS_VAOpenGLRasterizer : public RAS_OpenGLRasterizer
{
void TexCoordPtr(const RAS_TexVert *tv);
bool m_Lock;
/* bool m_Lock; */ /* UNUSED */
TexCoGen m_last_texco[RAS_MAX_TEXCO];
TexCoGen m_last_attrib[RAS_MAX_ATTRIB];