style cleanup: pep8, indentation

This commit is contained in:
Campbell Barton 2012-03-24 07:36:32 +00:00
parent 29806d3bcf
commit 81d8f17843
30 changed files with 167 additions and 168 deletions

@ -131,7 +131,7 @@ def handle_args():
dest="sphinx_theme", dest="sphinx_theme",
type=str, type=str,
default='default', default='default',
help= help =
# see SPHINX_THEMES below # see SPHINX_THEMES below
"Sphinx theme (default='default')\n" "Sphinx theme (default='default')\n"
"Available themes\n" "Available themes\n"
@ -448,6 +448,7 @@ else:
def is_struct_seq(value): def is_struct_seq(value):
return isinstance(value, tuple) and type(tuple) != tuple and hasattr(value, "n_fields") return isinstance(value, tuple) and type(tuple) != tuple and hasattr(value, "n_fields")
def undocumented_message(module_name, type_name, identifier): def undocumented_message(module_name, type_name, identifier):
if str(type_name).startswith('<module'): if str(type_name).startswith('<module'):
preloadtitle = '%s.%s' % (module_name, identifier) preloadtitle = '%s.%s' % (module_name, identifier)
@ -692,6 +693,7 @@ def pymodule2sphinx(basepath, module_name, module, title):
# TODO - currently only used for classes # TODO - currently only used for classes
# grouping support # grouping support
module_grouping = MODULE_GROUPING.get(module_name) module_grouping = MODULE_GROUPING.get(module_name)
def module_grouping_index(name): def module_grouping_index(name):
if module_grouping is not None: if module_grouping is not None:
try: try:
@ -711,7 +713,6 @@ def pymodule2sphinx(basepath, module_name, module, title):
return module_grouping_index(name) return module_grouping_index(name)
# done grouping support # done grouping support
file = open(filepath, "w", encoding="utf-8") file = open(filepath, "w", encoding="utf-8")
fw = file.write fw = file.write

@ -22,6 +22,7 @@ import bpy
from bpy.types import Menu, Operator from bpy.types import Menu, Operator
from bpy.props import StringProperty, BoolProperty from bpy.props import StringProperty, BoolProperty
class AddPresetBase(): class AddPresetBase():
'''Base preset class, only for subclassing '''Base preset class, only for subclassing
subclasses must define subclasses must define

@ -1088,6 +1088,7 @@ class VIEW3D_MT_brush(Menu):
layout.prop(brush, "use_persistent") layout.prop(brush, "use_persistent")
layout.operator("sculpt.set_persistent_base") layout.operator("sculpt.set_persistent_base")
class VIEW3D_MT_brush_paint_modes(Menu): class VIEW3D_MT_brush_paint_modes(Menu):
bl_label = "Enabled Modes" bl_label = "Enabled Modes"

@ -1828,11 +1828,11 @@ void CustomData_copy_data(const CustomData *source, CustomData *dest,
dest_offset = dest_index * typeInfo->size; dest_offset = dest_index * typeInfo->size;
if (!src_data || !dest_data) { if (!src_data || !dest_data) {
if (src_data != NULL && dest_data != NULL) { if (src_data != NULL && dest_data != NULL) {
printf("%s: warning null data for %s type (%p --> %p), skipping\n", printf("%s: warning null data for %s type (%p --> %p), skipping\n",
__func__, layerType_getName(source->layers[src_i].type), __func__, layerType_getName(source->layers[src_i].type),
(void *)src_data, (void *)dest_data); (void *)src_data, (void *)dest_data);
} }
continue; continue;
} }

@ -1913,7 +1913,7 @@ static void registerCompositNodes(bNodeTreeType *ttype)
register_node_type_cmp_channel_matte(ttype); register_node_type_cmp_channel_matte(ttype);
register_node_type_cmp_color_spill(ttype); register_node_type_cmp_color_spill(ttype);
register_node_type_cmp_luma_matte(ttype); register_node_type_cmp_luma_matte(ttype);
register_node_type_cmp_doubleedgemask(ttype); register_node_type_cmp_doubleedgemask(ttype);
register_node_type_cmp_translate(ttype); register_node_type_cmp_translate(ttype);
register_node_type_cmp_rotate(ttype); register_node_type_cmp_rotate(ttype);

@ -538,8 +538,7 @@ typedef struct FT_Outline_
short* contours; /* the contour end points */ short* contours; /* the contour end points */
int flags; /* outline masks */ int flags; /* outline masks */
} FT_Outline;
} FT_Outline;
#endif #endif

@ -811,36 +811,36 @@ void orthogonalize_m4(float mat[][4], int axis)
int is_orthogonal_m3(float m[][3]) int is_orthogonal_m3(float m[][3])
{ {
int i, j; int i, j;
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
for (j = 0; j < i; j++) { for (j = 0; j < i; j++) {
if (fabsf(dot_v3v3(m[i], m[j])) > 1.5f * FLT_EPSILON) if (fabsf(dot_v3v3(m[i], m[j])) > 1.5f * FLT_EPSILON)
return 0; return 0;
} }
if (fabsf(dot_v3v3(m[i], m[i]) - 1) > 1.5f * FLT_EPSILON) if (fabsf(dot_v3v3(m[i], m[i]) - 1) > 1.5f * FLT_EPSILON)
return 0; return 0;
} }
return 1; return 1;
} }
int is_orthogonal_m4(float m[][4]) int is_orthogonal_m4(float m[][4])
{ {
int i, j; int i, j;
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
for (j = 0; j < i; j++) { for (j = 0; j < i; j++) {
if (fabsf(dot_vn_vn(m[i], m[j], 4)) > 1.5f * FLT_EPSILON) if (fabsf(dot_vn_vn(m[i], m[j], 4)) > 1.5f * FLT_EPSILON)
return 0; return 0;
} }
if (fabsf(dot_vn_vn(m[i], m[i], 4) - 1) > 1.5f * FLT_EPSILON) if (fabsf(dot_vn_vn(m[i], m[i], 4) - 1) > 1.5f * FLT_EPSILON)
return 0; return 0;
} }
return 1; return 1;
} }
void normalize_m3(float mat[][3]) void normalize_m3(float mat[][3])

@ -359,16 +359,16 @@ int BLI_str_utf8_size(const char *p)
**/ **/
unsigned int BLI_str_utf8_as_unicode(const char *p) unsigned int BLI_str_utf8_as_unicode(const char *p)
{ {
int i, mask = 0, len; int i, mask = 0, len;
unsigned int result; unsigned int result;
unsigned char c = (unsigned char) *p; unsigned char c = (unsigned char) *p;
UTF8_COMPUTE (c, mask, len); UTF8_COMPUTE (c, mask, len);
if (len == -1) if (len == -1)
return BLI_UTF8_ERR; return BLI_UTF8_ERR;
UTF8_GET (result, p, i, mask, len, BLI_UTF8_ERR); UTF8_GET (result, p, i, mask, len, BLI_UTF8_ERR);
return result; return result;
} }
/* variant that increments the length */ /* variant that increments the length */

@ -288,9 +288,9 @@ void BM_edge_select_set(BMesh *bm, BMEdge *e, int select)
if (BM_elem_flag_test(e, BM_ELEM_SELECT)) bm->totedgesel -= 1; if (BM_elem_flag_test(e, BM_ELEM_SELECT)) bm->totedgesel -= 1;
BM_elem_flag_disable(e, BM_ELEM_SELECT); BM_elem_flag_disable(e, BM_ELEM_SELECT);
if ( bm->selectmode == SCE_SELECT_EDGE || if (bm->selectmode == SCE_SELECT_EDGE ||
bm->selectmode == SCE_SELECT_FACE || bm->selectmode == SCE_SELECT_FACE ||
bm->selectmode == (SCE_SELECT_EDGE | SCE_SELECT_FACE)) bm->selectmode == (SCE_SELECT_EDGE | SCE_SELECT_FACE))
{ {
BMIter iter; BMIter iter;
@ -312,9 +312,9 @@ void BM_edge_select_set(BMesh *bm, BMEdge *e, int select)
} }
} }
if (deselect) { if (deselect) {
BM_vert_select_set(bm, verts[i], FALSE); BM_vert_select_set(bm, verts[i], FALSE);
} }
} }
} }
else { else {

@ -475,17 +475,17 @@ static void *bmw_LoopWalker_step(BMWalker *walker)
l = BM_face_other_vert_loop(owalk.f_hub, lwalk->lastv, v); l = BM_face_other_vert_loop(owalk.f_hub, lwalk->lastv, v);
nexte = BM_edge_exists(v, l->v); nexte = BM_edge_exists(v, l->v);
if (!BLI_ghash_haskey(walker->visithash, nexte)) { if (!BLI_ghash_haskey(walker->visithash, nexte)) {
lwalk = BMW_state_add(walker); lwalk = BMW_state_add(walker);
lwalk->cur = nexte; lwalk->cur = nexte;
lwalk->lastv = v; lwalk->lastv = v;
lwalk->is_boundary = owalk.is_boundary; lwalk->is_boundary = owalk.is_boundary;
lwalk->is_single = owalk.is_single; lwalk->is_single = owalk.is_single;
lwalk->f_hub = owalk.f_hub; lwalk->f_hub = owalk.f_hub;
BLI_ghash_insert(walker->visithash, nexte, NULL); BLI_ghash_insert(walker->visithash, nexte, NULL);
} }
} }
} }
else if (l) { /* NORMAL EDGE WITH FACES */ else if (l) { /* NORMAL EDGE WITH FACES */

@ -48,7 +48,7 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op)
float scale[3] = {1.0f, 1.0f, 1.0f}; float scale[3] = {1.0f, 1.0f, 1.0f};
float dist = BMO_slot_float_get(op, "mergedist"); float dist = BMO_slot_float_get(op, "mergedist");
int i, ototvert /*, ototedge */; int i, ototvert /*, ototedge */;
int axis = BMO_slot_int_get(op, "axis"); int axis = BMO_slot_int_get(op, "axis");
int mirroru = BMO_slot_bool_get(op, "mirror_u"); int mirroru = BMO_slot_bool_get(op, "mirror_u");
int mirrorv = BMO_slot_bool_get(op, "mirror_v"); int mirrorv = BMO_slot_bool_get(op, "mirror_v");

@ -574,7 +574,7 @@ void ArmatureImporter::set_pose ( Object * ob_arm , COLLADAFW::Node * root_node
{ {
char * bone_name = (char *) bc_get_joint_name ( root_node); char * bone_name = (char *) bc_get_joint_name ( root_node);
float mat[4][4]; float mat[4][4];
float obmat[4][4]; float obmat[4][4];
float ax[3]; float ax[3];
float angle = 0.0f; float angle = 0.0f;

@ -449,7 +449,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
if (item[i].identifier[0] && item[i].value == value) { if (item[i].identifier[0] && item[i].value == value) {
if (item[i].description && item[i].description[0]) { if (item[i].description && item[i].description[0]) {
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "%s: %s", item[i].name, item[i].description); BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "%s: %s", item[i].name, item[i].description);
data->color_id[data->totline] = UI_TIP_LC_SUBMENU; data->color_id[data->totline] = UI_TIP_LC_SUBMENU;
data->totline++; data->totline++;
} }
break; break;

@ -2960,7 +2960,7 @@ static void sculpt_update_brush_delta(Sculpt *sd, Object *ob, Brush *brush)
/* compute 3d coordinate at same z from original location + mouse */ /* compute 3d coordinate at same z from original location + mouse */
mul_v3_m4v3(loc, ob->obmat, cache->orig_grab_location); mul_v3_m4v3(loc, ob->obmat, cache->orig_grab_location);
initgrabz(cache->vc->rv3d, loc[0], loc[1], loc[2]); initgrabz(cache->vc->rv3d, loc[0], loc[1], loc[2]);
ED_view3d_win_to_3d(cache->vc->ar, loc, mouse, grab_location); ED_view3d_win_to_3d(cache->vc->ar, loc, mouse, grab_location);

@ -877,12 +877,12 @@ static int proxy_bitflag_to_array(int size_flag, int build_sizes[4], int undisto
int build_count = 0; int build_count = 0;
int size_flags[2][4] = {{MCLIP_PROXY_SIZE_25, int size_flags[2][4] = {{MCLIP_PROXY_SIZE_25,
MCLIP_PROXY_SIZE_50, MCLIP_PROXY_SIZE_50,
MCLIP_PROXY_SIZE_75, MCLIP_PROXY_SIZE_75,
MCLIP_PROXY_SIZE_100}, MCLIP_PROXY_SIZE_100},
{MCLIP_PROXY_UNDISTORTED_SIZE_25, {MCLIP_PROXY_UNDISTORTED_SIZE_25,
MCLIP_PROXY_UNDISTORTED_SIZE_50, MCLIP_PROXY_UNDISTORTED_SIZE_50,
MCLIP_PROXY_UNDISTORTED_SIZE_75, MCLIP_PROXY_UNDISTORTED_SIZE_75,
MCLIP_PROXY_UNDISTORTED_SIZE_100}}; MCLIP_PROXY_UNDISTORTED_SIZE_100}};
int size_nr = undistort ? 1 : 0; int size_nr = undistort ? 1 : 0;
if (size_flag & size_flags[size_nr][0]) build_sizes[build_count++]= MCLIP_PROXY_RENDER_SIZE_25; if (size_flag & size_flags[size_nr][0]) build_sizes[build_count++]= MCLIP_PROXY_RENDER_SIZE_25;

@ -3511,9 +3511,9 @@ void NODE_OT_add_file(wmOperatorType *ot)
ot->idname = "NODE_OT_add_file"; ot->idname = "NODE_OT_add_file";
/* callbacks */ /* callbacks */
ot->exec = node_add_file_exec; ot->exec = node_add_file_exec;
ot->invoke = node_add_file_invoke; ot->invoke = node_add_file_invoke;
ot->poll = ED_operator_node_active; ot->poll = ED_operator_node_active;
/* flags */ /* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;

@ -73,15 +73,15 @@ static GPUBufferState GLStates = 0;
static GPUAttrib attribData[MAX_GPU_ATTRIB_DATA] = { { -1, 0, 0 } }; static GPUAttrib attribData[MAX_GPU_ATTRIB_DATA] = { { -1, 0, 0 } };
/* stores recently-deleted buffers so that new buffers won't have to /* stores recently-deleted buffers so that new buffers won't have to
be recreated as often * be recreated as often
*
only one instance of this pool is created, stored in * only one instance of this pool is created, stored in
gpu_buffer_pool * gpu_buffer_pool
*
note that the number of buffers in the pool is usually limited to * note that the number of buffers in the pool is usually limited to
MAX_FREE_GPU_BUFFERS, but this limit may be exceeded temporarily * MAX_FREE_GPU_BUFFERS, but this limit may be exceeded temporarily
when a GPUBuffer is released outside the main thread; due to OpenGL * when a GPUBuffer is released outside the main thread; due to OpenGL
restrictions it cannot be immediately released * restrictions it cannot be immediately released
*/ */
typedef struct GPUBufferPool { typedef struct GPUBufferPool {
/* number of allocated buffers stored */ /* number of allocated buffers stored */
@ -160,7 +160,7 @@ static void gpu_buffer_pool_free(GPUBufferPool *pool)
if (!pool) if (!pool)
return; return;
while(pool->totbuf) while (pool->totbuf)
gpu_buffer_pool_delete_last(pool); gpu_buffer_pool_delete_last(pool);
MEM_freeN(pool->buffers); MEM_freeN(pool->buffers);
@ -248,7 +248,7 @@ GPUBuffer *GPU_buffer_alloc(int size)
out-of-memory errors? looks a bit iffy to me out-of-memory errors? looks a bit iffy to me
though, at least on Linux I expect malloc() would though, at least on Linux I expect malloc() would
just overcommit. --nicholas */ just overcommit. --nicholas */
while(!buf->pointer && pool->totbuf > 0) { while (!buf->pointer && pool->totbuf > 0) {
gpu_buffer_pool_delete_last(pool); gpu_buffer_pool_delete_last(pool);
buf->pointer = MEM_mallocN(size, "GPUBuffer.pointer"); buf->pointer = MEM_mallocN(size, "GPUBuffer.pointer");
} }
@ -279,7 +279,7 @@ void GPU_buffer_free(GPUBuffer *buffer)
if (BLI_thread_is_main()) { if (BLI_thread_is_main()) {
/* in main thread, safe to decrease size of pool back /* in main thread, safe to decrease size of pool back
down to MAX_FREE_GPU_BUFFERS */ down to MAX_FREE_GPU_BUFFERS */
while(pool->totbuf >= MAX_FREE_GPU_BUFFERS) while (pool->totbuf >= MAX_FREE_GPU_BUFFERS)
gpu_buffer_pool_delete_last(pool); gpu_buffer_pool_delete_last(pool);
} }
else { else {
@ -507,7 +507,7 @@ static GPUBuffer *gpu_buffer_setup(DerivedMesh *dm, GPUDrawObject *object,
if (useVBOs) { if (useVBOs) {
success = 0; success = 0;
while(!success) { while (!success) {
/* bind the buffer and discard previous data, /* bind the buffer and discard previous data,
avoids stalling gpu */ avoids stalling gpu */
glBindBufferARB(target, buffer->id); glBindBufferARB(target, buffer->id);
@ -543,7 +543,7 @@ static GPUBuffer *gpu_buffer_setup(DerivedMesh *dm, GPUDrawObject *object,
if (dm->drawObject->legacy == 0) { if (dm->drawObject->legacy == 0) {
uploaded = GL_FALSE; uploaded = GL_FALSE;
/* attempt to upload the data to the VBO */ /* attempt to upload the data to the VBO */
while(uploaded == GL_FALSE) { while (uploaded == GL_FALSE) {
(*copy_f)(dm, varray, cur_index_per_mat, mat_orig_to_new, user); (*copy_f)(dm, varray, cur_index_per_mat, mat_orig_to_new, user);
/* glUnmapBuffer returns GL_FALSE if /* glUnmapBuffer returns GL_FALSE if
* the data store is corrupted; retry * the data store is corrupted; retry
@ -1161,8 +1161,8 @@ void GPU_buffer_unbind(void)
} }
/* confusion: code in cdderivedmesh calls both GPU_color_setup and /* confusion: code in cdderivedmesh calls both GPU_color_setup and
GPU_color3_upload; both of these set the `colors' buffer, so seems * GPU_color3_upload; both of these set the `colors' buffer, so seems
like it will just needlessly overwrite? --nicholas */ * like it will just needlessly overwrite? --nicholas */
void GPU_color3_upload(DerivedMesh *dm, unsigned char *data) void GPU_color3_upload(DerivedMesh *dm, unsigned char *data)
{ {
if (dm->drawObject == 0) if (dm->drawObject == 0)
@ -1494,27 +1494,27 @@ static int gpu_count_grid_quads(BLI_bitmap *grid_hidden,
/* Build the element array buffer of grid indices using either /* Build the element array buffer of grid indices using either
unsigned shorts or unsigned ints. */ unsigned shorts or unsigned ints. */
#define FILL_QUAD_BUFFER(type_, tot_quad_, buffer_) \ #define FILL_QUAD_BUFFER(type_, tot_quad_, buffer_) \
{ \ { \
type_ *quad_data; \ type_ *quad_data; \
int offset = 0; \ int offset = 0; \
int i, j, k; \ int i, j, k; \
\ \
glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, \ glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, \
sizeof(type_) * (tot_quad_) * 4, NULL, \ sizeof(type_) * (tot_quad_) * 4, NULL, \
GL_STATIC_DRAW_ARB); \ GL_STATIC_DRAW_ARB); \
\ \
/* Fill the quad buffer */ \ /* Fill the quad buffer */ \
quad_data = glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, \ quad_data = glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, \
GL_WRITE_ONLY_ARB); \ GL_WRITE_ONLY_ARB); \
if (quad_data) { \ if (quad_data) { \
for (i = 0; i < totgrid; ++i) { \ for (i = 0; i < totgrid; ++i) { \
BLI_bitmap gh = NULL; \ BLI_bitmap gh = NULL; \
if (grid_hidden) \ if (grid_hidden) \
gh = grid_hidden[(grid_indices)[i]]; \ gh = grid_hidden[(grid_indices)[i]]; \
\ \
for (j = 0; j < gridsize-1; ++j) { \ for (j = 0; j < gridsize-1; ++j) { \
for (k = 0; k < gridsize-1; ++k) { \ for (k = 0; k < gridsize-1; ++k) { \
/* Skip hidden grid face */ \ /* Skip hidden grid face */ \
if (gh && \ if (gh && \
paint_is_grid_face_hidden(gh, \ paint_is_grid_face_hidden(gh, \

@ -428,14 +428,14 @@ static double EulerAngleFromMatrix(const KDL::Rotation& R, int axis)
if (t > 16.0*KDL::epsilon) { if (t > 16.0*KDL::epsilon) {
if (axis == 0) return -KDL::atan2(R(1,2), R(2,2)); if (axis == 0) return -KDL::atan2(R(1,2), R(2,2));
else if(axis == 1) return KDL::atan2(-R(0,2), t); else if(axis == 1) return KDL::atan2(-R(0,2), t);
else return -KDL::atan2(R(0,1), R(0,0)); else return -KDL::atan2(R(0,1), R(0,0));
} }
else { else {
if (axis == 0) return -KDL::atan2(-R(2,1), R(1,1)); if (axis == 0) return -KDL::atan2(-R(2,1), R(1,1));
else if(axis == 1) return KDL::atan2(-R(0,2), t); else if(axis == 1) return KDL::atan2(-R(0,2), t);
else return 0.0f; else return 0.0f;
} }
} }
static double ComputeTwist(const KDL::Rotation& R) static double ComputeTwist(const KDL::Rotation& R)
@ -474,29 +474,29 @@ static void RemoveEulerAngleFromMatrix(KDL::Rotation& R, double angle, int axis)
static void GetEulerXZY(const KDL::Rotation& R, double& X,double& Z,double& Y) static void GetEulerXZY(const KDL::Rotation& R, double& X,double& Z,double& Y)
{ {
if (fabs(R(0,1)) > 1.0 - KDL::epsilon ) { if (fabs(R(0,1)) > 1.0 - KDL::epsilon ) {
X = -KDL::sign(R(0,1)) * KDL::atan2(R(1,2), R(1,0)); X = -KDL::sign(R(0,1)) * KDL::atan2(R(1,2), R(1,0));
Z = -KDL::sign(R(0,1)) * KDL::PI / 2; Z = -KDL::sign(R(0,1)) * KDL::PI / 2;
Y = 0.0; Y = 0.0;
} }
else { else {
X = KDL::atan2(R(2,1), R(1,1)); X = KDL::atan2(R(2,1), R(1,1));
Z = KDL::atan2(-R(0,1), KDL::sqrt( KDL::sqr(R(0,0)) + KDL::sqr(R(0,2)))); Z = KDL::atan2(-R(0,1), KDL::sqrt( KDL::sqr(R(0,0)) + KDL::sqr(R(0,2))));
Y = KDL::atan2(R(0,2), R(0,0)); Y = KDL::atan2(R(0,2), R(0,0));
} }
} }
static void GetEulerXYZ(const KDL::Rotation& R, double& X,double& Y,double& Z) static void GetEulerXYZ(const KDL::Rotation& R, double& X,double& Y,double& Z)
{ {
if (fabs(R(0,2)) > 1.0 - KDL::epsilon ) { if (fabs(R(0,2)) > 1.0 - KDL::epsilon ) {
X = KDL::sign(R(0,2)) * KDL::atan2(-R(1,0), R(1,1)); X = KDL::sign(R(0,2)) * KDL::atan2(-R(1,0), R(1,1));
Y = KDL::sign(R(0,2)) * KDL::PI / 2; Y = KDL::sign(R(0,2)) * KDL::PI / 2;
Z = 0.0; Z = 0.0;
} }
else { else {
X = KDL::atan2(-R(1,2), R(2,2)); X = KDL::atan2(-R(1,2), R(2,2));
Y = KDL::atan2(R(0,2), KDL::sqrt( KDL::sqr(R(0,0)) + KDL::sqr(R(0,1)))); Y = KDL::atan2(R(0,2), KDL::sqrt( KDL::sqr(R(0,0)) + KDL::sqr(R(0,1))));
Z = KDL::atan2(-R(0,1), R(0,0)); Z = KDL::atan2(-R(0,1), R(0,0));
} }
} }
#endif #endif

@ -135,27 +135,27 @@ uint BlockDXT1::evaluatePaletteNV5x(Color32 color_array[4]) const
color_array[1].b = (3 * col1.b * 22) / 8; color_array[1].b = (3 * col1.b * 22) / 8;
color_array[1].a = 0xFF; color_array[1].a = 0xFF;
int gdiff = color_array[1].g - color_array[0].g; int gdiff = color_array[1].g - color_array[0].g;
if( col0.u > col1.u ) { if( col0.u > col1.u ) {
// Four-color block: derive the other two colors. // Four-color block: derive the other two colors.
color_array[2].r = ((2 * col0.r + col1.r) * 22) / 8; color_array[2].r = ((2 * col0.r + col1.r) * 22) / 8;
color_array[2].g = (256 * color_array[0].g + gdiff / 4 + 128 + gdiff * 80) / 256; color_array[2].g = (256 * color_array[0].g + gdiff / 4 + 128 + gdiff * 80) / 256;
color_array[2].b = ((2 * col0.b + col1.b) * 22) / 8; color_array[2].b = ((2 * col0.b + col1.b) * 22) / 8;
color_array[2].a = 0xFF; color_array[2].a = 0xFF;
color_array[3].r = ((2 * col1.r + col0.r) * 22) / 8; color_array[3].r = ((2 * col1.r + col0.r) * 22) / 8;
color_array[3].g = (256 * color_array[1].g - gdiff / 4 + 128 - gdiff * 80) / 256; color_array[3].g = (256 * color_array[1].g - gdiff / 4 + 128 - gdiff * 80) / 256;
color_array[3].b = ((2 * col1.b + col0.b) * 22) / 8; color_array[3].b = ((2 * col1.b + col0.b) * 22) / 8;
color_array[3].a = 0xFF; color_array[3].a = 0xFF;
return 4; return 4;
} }
else { else {
// Three-color block: derive the other color. // Three-color block: derive the other color.
color_array[2].r = ((col0.r + col1.r) * 33) / 8; color_array[2].r = ((col0.r + col1.r) * 33) / 8;
color_array[2].g = (256 * color_array[0].g + gdiff / 4 + 128 + gdiff * 128) / 256; color_array[2].g = (256 * color_array[0].g + gdiff / 4 + 128 + gdiff * 128) / 256;
color_array[2].b = ((col0.b + col1.b) * 33) / 8; color_array[2].b = ((col0.b + col1.b) * 33) / 8;
color_array[2].a = 0xFF; color_array[2].a = 0xFF;
// Set all components to 0 to match DXT specs. // Set all components to 0 to match DXT specs.

@ -81,7 +81,7 @@ ColorBlock::ColorBlock(const Image * img, uint x, uint y)
void ColorBlock::init(const Image * img, uint x, uint y) void ColorBlock::init(const Image * img, uint x, uint y)
{ {
init(img->width(), img->height(), (const uint *)img->pixels(), x, y); init(img->width(), img->height(), (const uint *)img->pixels(), x, y);
} }
void ColorBlock::init(uint w, uint h, const uint * data, uint x, uint y) void ColorBlock::init(uint w, uint h, const uint * data, uint x, uint y)
@ -89,34 +89,34 @@ void ColorBlock::init(uint w, uint h, const uint * data, uint x, uint y)
const uint bw = min(w - x, 4U); const uint bw = min(w - x, 4U);
const uint bh = min(h - y, 4U); const uint bh = min(h - y, 4U);
// Blocks that are smaller than 4x4 are handled by repeating the pixels. // Blocks that are smaller than 4x4 are handled by repeating the pixels.
// @@ Thats only correct when block size is 1, 2 or 4, but not with 3. :( // @@ Thats only correct when block size is 1, 2 or 4, but not with 3. :(
// @@ Ideally we should zero the weights of the pixels out of range. // @@ Ideally we should zero the weights of the pixels out of range.
for (uint i = 0; i < 4; i++) for (uint i = 0; i < 4; i++)
{ {
const int by = i % bh; const int by = i % bh;
for (uint e = 0; e < 4; e++) for (uint e = 0; e < 4; e++)
{ {
const int bx = e % bw; const int bx = e % bw;
const uint idx = (y + by) * w + x + bx; const uint idx = (y + by) * w + x + bx;
color(e, i).u = data[idx]; color(e, i).u = data[idx];
} }
} }
} }
void ColorBlock::init(uint w, uint h, const float * data, uint x, uint y) void ColorBlock::init(uint w, uint h, const float * data, uint x, uint y)
{ {
const uint bw = min(w - x, 4U); const uint bw = min(w - x, 4U);
const uint bh = min(h - y, 4U); const uint bh = min(h - y, 4U);
// Blocks that are smaller than 4x4 are handled by repeating the pixels. // Blocks that are smaller than 4x4 are handled by repeating the pixels.
// @@ Thats only correct when block size is 1, 2 or 4, but not with 3. :( // @@ Thats only correct when block size is 1, 2 or 4, but not with 3. :(
// @@ Ideally we should zero the weights of the pixels out of range. // @@ Ideally we should zero the weights of the pixels out of range.
uint srcPlane = w * h; uint srcPlane = w * h;
for (uint i = 0; i < 4; i++) for (uint i = 0; i < 4; i++)
{ {
@ -125,13 +125,13 @@ void ColorBlock::init(uint w, uint h, const float * data, uint x, uint y)
for (uint e = 0; e < 4; e++) for (uint e = 0; e < 4; e++)
{ {
const uint bx = e % bw; const uint bx = e % bw;
const uint idx = ((y + by) * w + x + bx); const uint idx = ((y + by) * w + x + bx);
Color32 & c = color(e, i); Color32 & c = color(e, i);
c.r = uint8(255 * clamp(data[idx + 0 * srcPlane], 0.0f, 1.0f)); // @@ Is this the right way to quantize floats to bytes? c.r = uint8(255 * clamp(data[idx + 0 * srcPlane], 0.0f, 1.0f)); // @@ Is this the right way to quantize floats to bytes?
c.g = uint8(255 * clamp(data[idx + 1 * srcPlane], 0.0f, 1.0f)); c.g = uint8(255 * clamp(data[idx + 1 * srcPlane], 0.0f, 1.0f));
c.b = uint8(255 * clamp(data[idx + 2 * srcPlane], 0.0f, 1.0f)); c.b = uint8(255 * clamp(data[idx + 2 * srcPlane], 0.0f, 1.0f));
c.a = uint8(255 * clamp(data[idx + 3 * srcPlane], 0.0f, 1.0f)); c.a = uint8(255 * clamp(data[idx + 3 * srcPlane], 0.0f, 1.0f));
} }
} }
} }

@ -201,7 +201,7 @@ EnumPropertyItem image_only_type_items[] = {
IMAGE_TYPE_ITEMS_IMAGE_ONLY IMAGE_TYPE_ITEMS_IMAGE_ONLY
{0, NULL, 0, NULL, NULL}}; {0, NULL, 0, NULL, NULL}};
EnumPropertyItem image_type_items[] = { EnumPropertyItem image_type_items[] = {
{0, "", 0, "Image", NULL}, {0, "", 0, "Image", NULL},

@ -227,10 +227,10 @@ static void rna_tracking_trackerAlgorithm_update(Main *UNUSED(bmain), Scene *UNU
{ {
MovieTrackingTrack *track = (MovieTrackingTrack *)ptr->data; MovieTrackingTrack *track = (MovieTrackingTrack *)ptr->data;
if (track->tracker == TRACKER_KLT) if (track->tracker == TRACKER_KLT)
BKE_tracking_clamp_track(track, CLAMP_PYRAMID_LEVELS); BKE_tracking_clamp_track(track, CLAMP_PYRAMID_LEVELS);
else else
BKE_tracking_clamp_track(track, CLAMP_SEARCH_DIM); BKE_tracking_clamp_track(track, CLAMP_SEARCH_DIM);
} }
static void rna_tracking_trackerPyramid_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) static void rna_tracking_trackerPyramid_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)

@ -399,7 +399,7 @@ const char *PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce)
PyObject *PyC_UnicodeFromByteAndSize(const char *str, Py_ssize_t size) PyObject *PyC_UnicodeFromByteAndSize(const char *str, Py_ssize_t size)
{ {
PyObject *result = PyUnicode_FromStringAndSize(str, size); PyObject *result = PyUnicode_FromStringAndSize(str, size);
if (result) { if (result) {
/* 99% of the time this is enough but we better support non unicode /* 99% of the time this is enough but we better support non unicode
* chars since blender doesnt limit this */ * chars since blender doesnt limit this */

@ -39,10 +39,10 @@ pre:
effect: constructs a new CErrorValue containing errormessage errmsg effect: constructs a new CErrorValue containing errormessage errmsg
*/ */
{ {
m_strErrorText = "["; m_strErrorText = "[";
m_strErrorText += errmsg; m_strErrorText += errmsg;
m_strErrorText += "]"; m_strErrorText += "]";
SetError(true); SetError(true);
} }

@ -244,10 +244,7 @@ CExpression* COperator2Expr::CheckLink(std::vector<CBrokenLinkInfo*>& brokenlink
/ /
*/ */
return Release(); return Release();
} }

@ -62,7 +62,7 @@ void SCA_IInputDevice::ClearStatusTable(int tableid)
const SCA_InputEvent& SCA_IInputDevice::GetEventValue(SCA_IInputDevice::KX_EnumInputs inputcode) const SCA_InputEvent& SCA_IInputDevice::GetEventValue(SCA_IInputDevice::KX_EnumInputs inputcode)
{ {
// cerr << "SCA_IInputDevice::GetEventValue" << endl; // cerr << "SCA_IInputDevice::GetEventValue" << endl;
return m_eventStatusTables[m_currentTable][inputcode]; return m_eventStatusTables[m_currentTable][inputcode];
} }

@ -64,7 +64,7 @@ SCA_IInputDevice* SCA_KeyboardManager::GetInputDevice()
void SCA_KeyboardManager::NextFrame() void SCA_KeyboardManager::NextFrame()
{ {
//const SCA_InputEvent& event = GetEventValue(SCA_IInputDevice::KX_EnumInputs inputcode)=0; //const SCA_InputEvent& event = GetEventValue(SCA_IInputDevice::KX_EnumInputs inputcode)=0;
// cerr << "SCA_KeyboardManager::NextFrame"<< endl; // cerr << "SCA_KeyboardManager::NextFrame"<< endl;
SG_DList::iterator<SCA_ISensor> it(m_sensors); SG_DList::iterator<SCA_ISensor> it(m_sensors);
for (it.begin();!it.end();++it) for (it.begin();!it.end();++it)
{ {

@ -359,7 +359,7 @@ static int setBackground (PyImage * self, PyObject * value, void * closure)
getImageRender(self)->setBackground((unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 0))), getImageRender(self)->setBackground((unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 0))),
(unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 1))), (unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 1))),
(unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 2))), (unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 2))),
(unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 3)))); (unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 3))));
// success // success
return 0; return 0;
} }