forked from bartvdbraak/blender
style cleanup: pep8, indentation
This commit is contained in:
parent
29806d3bcf
commit
81d8f17843
@ -131,7 +131,7 @@ def handle_args():
|
||||
dest="sphinx_theme",
|
||||
type=str,
|
||||
default='default',
|
||||
help=
|
||||
help =
|
||||
# see SPHINX_THEMES below
|
||||
"Sphinx theme (default='default')\n"
|
||||
"Available themes\n"
|
||||
@ -448,6 +448,7 @@ else:
|
||||
def is_struct_seq(value):
|
||||
return isinstance(value, tuple) and type(tuple) != tuple and hasattr(value, "n_fields")
|
||||
|
||||
|
||||
def undocumented_message(module_name, type_name, identifier):
|
||||
if str(type_name).startswith('<module'):
|
||||
preloadtitle = '%s.%s' % (module_name, identifier)
|
||||
@ -503,7 +504,7 @@ def example_extract_docstring(filepath):
|
||||
|
||||
def title_string(text, heading_char, double=False):
|
||||
filler = len(text) * heading_char
|
||||
|
||||
|
||||
if double:
|
||||
return "%s\n%s\n%s\n\n" % (filler, text, filler)
|
||||
else:
|
||||
@ -692,6 +693,7 @@ def pymodule2sphinx(basepath, module_name, module, title):
|
||||
# TODO - currently only used for classes
|
||||
# grouping support
|
||||
module_grouping = MODULE_GROUPING.get(module_name)
|
||||
|
||||
def module_grouping_index(name):
|
||||
if module_grouping is not None:
|
||||
try:
|
||||
@ -706,11 +708,10 @@ def pymodule2sphinx(basepath, module_name, module, title):
|
||||
if i >= 0 and type(module_grouping[i]) == tuple:
|
||||
return module_grouping[i]
|
||||
return None, None
|
||||
|
||||
|
||||
def module_grouping_sort_key(name):
|
||||
return module_grouping_index(name)
|
||||
# done grouping support
|
||||
|
||||
|
||||
file = open(filepath, "w", encoding="utf-8")
|
||||
|
||||
@ -866,7 +867,7 @@ def pymodule2sphinx(basepath, module_name, module, title):
|
||||
|
||||
# write collected classes now
|
||||
for (type_name, value) in classes:
|
||||
|
||||
|
||||
if module_grouping is not None:
|
||||
heading, heading_char = module_grouping_heading(type_name)
|
||||
if heading:
|
||||
@ -1778,7 +1779,7 @@ def main():
|
||||
bpy_logfilehandler = logging.FileHandler(bpy_logfile, mode="w")
|
||||
bpy_logfilehandler.setLevel(logging.DEBUG)
|
||||
BPY_LOGGER.addHandler(bpy_logfilehandler)
|
||||
|
||||
|
||||
# using a FileHandler seems to disable the stdout, so we add a StreamHandler
|
||||
bpy_log_stdout_handler = logging.StreamHandler(stream=sys.stdout)
|
||||
bpy_log_stdout_handler.setLevel(logging.DEBUG)
|
||||
@ -1872,7 +1873,7 @@ def main():
|
||||
# zip REFERENCE_PATH
|
||||
basename = os.path.join(ARGS.output_dir, REFERENCE_NAME)
|
||||
tmp_path = shutil.make_archive(basename, 'zip',
|
||||
root_dir=ARGS.output_dir,
|
||||
root_dir=ARGS.output_dir,
|
||||
base_dir=REFERENCE_NAME)
|
||||
final_path = os.path.join(REFERENCE_PATH, BLENDER_ZIP_FILENAME)
|
||||
os.rename(tmp_path, final_path)
|
||||
|
@ -147,7 +147,7 @@ class AddTorus(Operator, object_utils.AddObjectHelper):
|
||||
mesh = bpy.data.meshes.new("Torus")
|
||||
|
||||
mesh.vertices.add(len(verts_loc) // 3)
|
||||
|
||||
|
||||
# BMESH_TODO, use polygons
|
||||
mesh.faces.add(len(faces) // 4)
|
||||
|
||||
|
@ -22,6 +22,7 @@ import bpy
|
||||
from bpy.types import Menu, Operator
|
||||
from bpy.props import StringProperty, BoolProperty
|
||||
|
||||
|
||||
class AddPresetBase():
|
||||
'''Base preset class, only for subclassing
|
||||
subclasses must define
|
||||
|
@ -728,7 +728,7 @@ class SEQUENCER_PT_filter(SequencerButtonsPanel, Panel):
|
||||
col = layout.column()
|
||||
col.label(text="Distortion:")
|
||||
col.prop(strip, "undistort")
|
||||
|
||||
|
||||
row = layout.row()
|
||||
row.label(text="Flip:")
|
||||
row.prop(strip, "use_flip_x", text="X")
|
||||
|
@ -1050,7 +1050,7 @@ class VIEW3D_MT_brush(Menu):
|
||||
layout.prop(ups, "use_unified_size", text="Unified Size")
|
||||
layout.prop(ups, "use_unified_strength", text="Unified Strength")
|
||||
layout.separator()
|
||||
|
||||
|
||||
# brush paint modes
|
||||
layout.menu("VIEW3D_MT_brush_paint_modes")
|
||||
|
||||
@ -1088,6 +1088,7 @@ class VIEW3D_MT_brush(Menu):
|
||||
layout.prop(brush, "use_persistent")
|
||||
layout.operator("sculpt.set_persistent_base")
|
||||
|
||||
|
||||
class VIEW3D_MT_brush_paint_modes(Menu):
|
||||
bl_label = "Enabled Modes"
|
||||
|
||||
@ -1242,7 +1243,7 @@ class VIEW3D_MT_hide(Menu):
|
||||
op = layout.operator("paint.hide_show", text="Show Bounding Box")
|
||||
op.action = 'SHOW'
|
||||
op.area = 'INSIDE'
|
||||
|
||||
|
||||
|
||||
# ********** Particle menu **********
|
||||
|
||||
|
@ -1828,11 +1828,11 @@ void CustomData_copy_data(const CustomData *source, CustomData *dest,
|
||||
dest_offset = dest_index * typeInfo->size;
|
||||
|
||||
if (!src_data || !dest_data) {
|
||||
if (src_data != NULL && dest_data != NULL) {
|
||||
printf("%s: warning null data for %s type (%p --> %p), skipping\n",
|
||||
__func__, layerType_getName(source->layers[src_i].type),
|
||||
(void *)src_data, (void *)dest_data);
|
||||
}
|
||||
if (src_data != NULL && dest_data != NULL) {
|
||||
printf("%s: warning null data for %s type (%p --> %p), skipping\n",
|
||||
__func__, layerType_getName(source->layers[src_i].type),
|
||||
(void *)src_data, (void *)dest_data);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1913,7 +1913,7 @@ static void registerCompositNodes(bNodeTreeType *ttype)
|
||||
register_node_type_cmp_channel_matte(ttype);
|
||||
register_node_type_cmp_color_spill(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_rotate(ttype);
|
||||
|
@ -538,8 +538,7 @@ typedef struct FT_Outline_
|
||||
short* contours; /* the contour end points */
|
||||
|
||||
int flags; /* outline masks */
|
||||
|
||||
} FT_Outline;
|
||||
} FT_Outline;
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -811,36 +811,36 @@ void orthogonalize_m4(float mat[][4], int axis)
|
||||
|
||||
int is_orthogonal_m3(float m[][3])
|
||||
{
|
||||
int i, j;
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
for (j = 0; j < i; j++) {
|
||||
if (fabsf(dot_v3v3(m[i], m[j])) > 1.5f * FLT_EPSILON)
|
||||
return 0;
|
||||
}
|
||||
for (i = 0; i < 3; i++) {
|
||||
for (j = 0; j < i; j++) {
|
||||
if (fabsf(dot_v3v3(m[i], m[j])) > 1.5f * FLT_EPSILON)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (fabsf(dot_v3v3(m[i], m[i]) - 1) > 1.5f * FLT_EPSILON)
|
||||
return 0;
|
||||
}
|
||||
if (fabsf(dot_v3v3(m[i], m[i]) - 1) > 1.5f * FLT_EPSILON)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int is_orthogonal_m4(float m[][4])
|
||||
{
|
||||
int i, j;
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (j = 0; j < i; j++) {
|
||||
if (fabsf(dot_vn_vn(m[i], m[j], 4)) > 1.5f * FLT_EPSILON)
|
||||
return 0;
|
||||
}
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (j = 0; j < i; j++) {
|
||||
if (fabsf(dot_vn_vn(m[i], m[j], 4)) > 1.5f * FLT_EPSILON)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (fabsf(dot_vn_vn(m[i], m[i], 4) - 1) > 1.5f * FLT_EPSILON)
|
||||
return 0;
|
||||
}
|
||||
if (fabsf(dot_vn_vn(m[i], m[i], 4) - 1) > 1.5f * FLT_EPSILON)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
int i, mask = 0, len;
|
||||
unsigned int result;
|
||||
unsigned char c = (unsigned char) *p;
|
||||
int i, mask = 0, len;
|
||||
unsigned int result;
|
||||
unsigned char c = (unsigned char) *p;
|
||||
|
||||
UTF8_COMPUTE (c, mask, len);
|
||||
if (len == -1)
|
||||
return BLI_UTF8_ERR;
|
||||
UTF8_GET (result, p, i, mask, len, BLI_UTF8_ERR);
|
||||
UTF8_COMPUTE (c, mask, len);
|
||||
if (len == -1)
|
||||
return BLI_UTF8_ERR;
|
||||
UTF8_GET (result, p, i, mask, len, BLI_UTF8_ERR);
|
||||
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
BM_elem_flag_disable(e, BM_ELEM_SELECT);
|
||||
|
||||
if ( bm->selectmode == SCE_SELECT_EDGE ||
|
||||
bm->selectmode == SCE_SELECT_FACE ||
|
||||
bm->selectmode == (SCE_SELECT_EDGE | SCE_SELECT_FACE))
|
||||
if (bm->selectmode == SCE_SELECT_EDGE ||
|
||||
bm->selectmode == SCE_SELECT_FACE ||
|
||||
bm->selectmode == (SCE_SELECT_EDGE | SCE_SELECT_FACE))
|
||||
{
|
||||
|
||||
BMIter iter;
|
||||
@ -312,9 +312,9 @@ void BM_edge_select_set(BMesh *bm, BMEdge *e, int select)
|
||||
}
|
||||
}
|
||||
|
||||
if (deselect) {
|
||||
BM_vert_select_set(bm, verts[i], FALSE);
|
||||
}
|
||||
if (deselect) {
|
||||
BM_vert_select_set(bm, verts[i], FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -475,17 +475,17 @@ static void *bmw_LoopWalker_step(BMWalker *walker)
|
||||
l = BM_face_other_vert_loop(owalk.f_hub, lwalk->lastv, v);
|
||||
nexte = BM_edge_exists(v, l->v);
|
||||
|
||||
if (!BLI_ghash_haskey(walker->visithash, nexte)) {
|
||||
lwalk = BMW_state_add(walker);
|
||||
lwalk->cur = nexte;
|
||||
lwalk->lastv = v;
|
||||
if (!BLI_ghash_haskey(walker->visithash, nexte)) {
|
||||
lwalk = BMW_state_add(walker);
|
||||
lwalk->cur = nexte;
|
||||
lwalk->lastv = v;
|
||||
|
||||
lwalk->is_boundary = owalk.is_boundary;
|
||||
lwalk->is_single = owalk.is_single;
|
||||
lwalk->f_hub = owalk.f_hub;
|
||||
lwalk->is_boundary = owalk.is_boundary;
|
||||
lwalk->is_single = owalk.is_single;
|
||||
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 */
|
||||
|
@ -48,7 +48,7 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op)
|
||||
float scale[3] = {1.0f, 1.0f, 1.0f};
|
||||
float dist = BMO_slot_float_get(op, "mergedist");
|
||||
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 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);
|
||||
float mat[4][4];
|
||||
float obmat[4][4];
|
||||
float obmat[4][4];
|
||||
|
||||
float ax[3];
|
||||
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].description && item[i].description[0]) {
|
||||
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++;
|
||||
}
|
||||
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 */
|
||||
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);
|
||||
|
||||
|
@ -877,12 +877,12 @@ static int proxy_bitflag_to_array(int size_flag, int build_sizes[4], int undisto
|
||||
int build_count = 0;
|
||||
int size_flags[2][4] = {{MCLIP_PROXY_SIZE_25,
|
||||
MCLIP_PROXY_SIZE_50,
|
||||
MCLIP_PROXY_SIZE_75,
|
||||
MCLIP_PROXY_SIZE_100},
|
||||
{MCLIP_PROXY_UNDISTORTED_SIZE_25,
|
||||
MCLIP_PROXY_UNDISTORTED_SIZE_50,
|
||||
MCLIP_PROXY_UNDISTORTED_SIZE_75,
|
||||
MCLIP_PROXY_UNDISTORTED_SIZE_100}};
|
||||
MCLIP_PROXY_SIZE_75,
|
||||
MCLIP_PROXY_SIZE_100},
|
||||
{MCLIP_PROXY_UNDISTORTED_SIZE_25,
|
||||
MCLIP_PROXY_UNDISTORTED_SIZE_50,
|
||||
MCLIP_PROXY_UNDISTORTED_SIZE_75,
|
||||
MCLIP_PROXY_UNDISTORTED_SIZE_100}};
|
||||
int size_nr = undistort ? 1 : 0;
|
||||
|
||||
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";
|
||||
|
||||
/* callbacks */
|
||||
ot->exec = node_add_file_exec;
|
||||
ot->exec = node_add_file_exec;
|
||||
ot->invoke = node_add_file_invoke;
|
||||
ot->poll = ED_operator_node_active;
|
||||
ot->poll = ED_operator_node_active;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
|
@ -73,15 +73,15 @@ static GPUBufferState GLStates = 0;
|
||||
static GPUAttrib attribData[MAX_GPU_ATTRIB_DATA] = { { -1, 0, 0 } };
|
||||
|
||||
/* stores recently-deleted buffers so that new buffers won't have to
|
||||
be recreated as often
|
||||
|
||||
only one instance of this pool is created, stored in
|
||||
gpu_buffer_pool
|
||||
|
||||
note that the number of buffers in the pool is usually limited to
|
||||
MAX_FREE_GPU_BUFFERS, but this limit may be exceeded temporarily
|
||||
when a GPUBuffer is released outside the main thread; due to OpenGL
|
||||
restrictions it cannot be immediately released
|
||||
* be recreated as often
|
||||
*
|
||||
* only one instance of this pool is created, stored in
|
||||
* gpu_buffer_pool
|
||||
*
|
||||
* note that the number of buffers in the pool is usually limited to
|
||||
* MAX_FREE_GPU_BUFFERS, but this limit may be exceeded temporarily
|
||||
* when a GPUBuffer is released outside the main thread; due to OpenGL
|
||||
* restrictions it cannot be immediately released
|
||||
*/
|
||||
typedef struct GPUBufferPool {
|
||||
/* number of allocated buffers stored */
|
||||
@ -160,7 +160,7 @@ static void gpu_buffer_pool_free(GPUBufferPool *pool)
|
||||
if (!pool)
|
||||
return;
|
||||
|
||||
while(pool->totbuf)
|
||||
while (pool->totbuf)
|
||||
gpu_buffer_pool_delete_last(pool);
|
||||
|
||||
MEM_freeN(pool->buffers);
|
||||
@ -248,7 +248,7 @@ GPUBuffer *GPU_buffer_alloc(int size)
|
||||
out-of-memory errors? looks a bit iffy to me
|
||||
though, at least on Linux I expect malloc() would
|
||||
just overcommit. --nicholas */
|
||||
while(!buf->pointer && pool->totbuf > 0) {
|
||||
while (!buf->pointer && pool->totbuf > 0) {
|
||||
gpu_buffer_pool_delete_last(pool);
|
||||
buf->pointer = MEM_mallocN(size, "GPUBuffer.pointer");
|
||||
}
|
||||
@ -279,7 +279,7 @@ void GPU_buffer_free(GPUBuffer *buffer)
|
||||
if (BLI_thread_is_main()) {
|
||||
/* in main thread, safe to decrease size of pool back
|
||||
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);
|
||||
}
|
||||
else {
|
||||
@ -507,7 +507,7 @@ static GPUBuffer *gpu_buffer_setup(DerivedMesh *dm, GPUDrawObject *object,
|
||||
if (useVBOs) {
|
||||
success = 0;
|
||||
|
||||
while(!success) {
|
||||
while (!success) {
|
||||
/* bind the buffer and discard previous data,
|
||||
avoids stalling gpu */
|
||||
glBindBufferARB(target, buffer->id);
|
||||
@ -543,7 +543,7 @@ static GPUBuffer *gpu_buffer_setup(DerivedMesh *dm, GPUDrawObject *object,
|
||||
if (dm->drawObject->legacy == 0) {
|
||||
uploaded = GL_FALSE;
|
||||
/* 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);
|
||||
/* glUnmapBuffer returns GL_FALSE if
|
||||
* 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
|
||||
GPU_color3_upload; both of these set the `colors' buffer, so seems
|
||||
like it will just needlessly overwrite? --nicholas */
|
||||
* GPU_color3_upload; both of these set the `colors' buffer, so seems
|
||||
* like it will just needlessly overwrite? --nicholas */
|
||||
void GPU_color3_upload(DerivedMesh *dm, unsigned char *data)
|
||||
{
|
||||
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
|
||||
unsigned shorts or unsigned ints. */
|
||||
#define FILL_QUAD_BUFFER(type_, tot_quad_, buffer_) \
|
||||
#define FILL_QUAD_BUFFER(type_, tot_quad_, buffer_) \
|
||||
{ \
|
||||
type_ *quad_data; \
|
||||
int offset = 0; \
|
||||
int i, j, k; \
|
||||
\
|
||||
int i, j, k; \
|
||||
\
|
||||
glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, \
|
||||
sizeof(type_) * (tot_quad_) * 4, NULL, \
|
||||
sizeof(type_) * (tot_quad_) * 4, NULL, \
|
||||
GL_STATIC_DRAW_ARB); \
|
||||
\
|
||||
\
|
||||
/* Fill the quad buffer */ \
|
||||
quad_data = glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, \
|
||||
GL_WRITE_ONLY_ARB); \
|
||||
if (quad_data) { \
|
||||
if (quad_data) { \
|
||||
for (i = 0; i < totgrid; ++i) { \
|
||||
BLI_bitmap gh = NULL; \
|
||||
if (grid_hidden) \
|
||||
if (grid_hidden) \
|
||||
gh = grid_hidden[(grid_indices)[i]]; \
|
||||
\
|
||||
for (j = 0; j < gridsize-1; ++j) { \
|
||||
for (k = 0; k < gridsize-1; ++k) { \
|
||||
for (j = 0; j < gridsize-1; ++j) { \
|
||||
for (k = 0; k < gridsize-1; ++k) { \
|
||||
/* Skip hidden grid face */ \
|
||||
if (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 (axis == 0) return -KDL::atan2(R(1,2), R(2,2));
|
||||
else if(axis == 1) return KDL::atan2(-R(0,2), t);
|
||||
else return -KDL::atan2(R(0,1), R(0,0));
|
||||
else if(axis == 1) return KDL::atan2(-R(0,2), t);
|
||||
else return -KDL::atan2(R(0,1), R(0,0));
|
||||
}
|
||||
else {
|
||||
if (axis == 0) return -KDL::atan2(-R(2,1), R(1,1));
|
||||
else if(axis == 1) return KDL::atan2(-R(0,2), t);
|
||||
else return 0.0f;
|
||||
}
|
||||
else if(axis == 1) return KDL::atan2(-R(0,2), t);
|
||||
else return 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
if (fabs(R(0,1)) > 1.0 - KDL::epsilon ) {
|
||||
X = -KDL::sign(R(0,1)) * KDL::atan2(R(1,2), R(1,0));
|
||||
Z = -KDL::sign(R(0,1)) * KDL::PI / 2;
|
||||
Y = 0.0;
|
||||
X = -KDL::sign(R(0,1)) * KDL::atan2(R(1,2), R(1,0));
|
||||
Z = -KDL::sign(R(0,1)) * KDL::PI / 2;
|
||||
Y = 0.0;
|
||||
}
|
||||
else {
|
||||
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))));
|
||||
Y = KDL::atan2(R(0,2), R(0,0));
|
||||
}
|
||||
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))));
|
||||
Y = KDL::atan2(R(0,2), R(0,0));
|
||||
}
|
||||
}
|
||||
|
||||
static void GetEulerXYZ(const KDL::Rotation& R, double& X,double& Y,double& Z)
|
||||
{
|
||||
if (fabs(R(0,2)) > 1.0 - KDL::epsilon ) {
|
||||
X = KDL::sign(R(0,2)) * KDL::atan2(-R(1,0), R(1,1));
|
||||
Y = KDL::sign(R(0,2)) * KDL::PI / 2;
|
||||
Z = 0.0;
|
||||
X = KDL::sign(R(0,2)) * KDL::atan2(-R(1,0), R(1,1));
|
||||
Y = KDL::sign(R(0,2)) * KDL::PI / 2;
|
||||
Z = 0.0;
|
||||
}
|
||||
else {
|
||||
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))));
|
||||
Z = KDL::atan2(-R(0,1), R(0,0));
|
||||
}
|
||||
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))));
|
||||
Z = KDL::atan2(-R(0,1), R(0,0));
|
||||
}
|
||||
}
|
||||
#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].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 ) {
|
||||
// Four-color block: derive the other two colors.
|
||||
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].b = ((2 * col0.b + col1.b) * 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].b = ((2 * col0.b + col1.b) * 22) / 8;
|
||||
color_array[2].a = 0xFF;
|
||||
|
||||
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].b = ((2 * col1.b + col0.b) * 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].b = ((2 * col1.b + col0.b) * 22) / 8;
|
||||
color_array[3].a = 0xFF;
|
||||
|
||||
return 4;
|
||||
}
|
||||
else {
|
||||
// Three-color block: derive the other color.
|
||||
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].b = ((col0.b + col1.b) * 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].b = ((col0.b + col1.b) * 33) / 8;
|
||||
color_array[2].a = 0xFF;
|
||||
|
||||
// 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)
|
||||
{
|
||||
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)
|
||||
@ -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 bh = min(h - y, 4U);
|
||||
|
||||
// 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. :(
|
||||
// @@ Ideally we should zero the weights of the pixels out of range.
|
||||
// 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. :(
|
||||
// @@ Ideally we should zero the weights of the pixels out of range.
|
||||
|
||||
for (uint i = 0; i < 4; i++)
|
||||
{
|
||||
const int by = i % bh;
|
||||
for (uint i = 0; i < 4; i++)
|
||||
{
|
||||
const int by = i % bh;
|
||||
|
||||
for (uint e = 0; e < 4; e++)
|
||||
{
|
||||
const int bx = e % bw;
|
||||
const uint idx = (y + by) * w + x + bx;
|
||||
for (uint e = 0; e < 4; e++)
|
||||
{
|
||||
const int bx = e % bw;
|
||||
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)
|
||||
{
|
||||
const uint bw = min(w - x, 4U);
|
||||
const uint bh = min(h - y, 4U);
|
||||
const uint bw = min(w - x, 4U);
|
||||
const uint bh = min(h - y, 4U);
|
||||
|
||||
// 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. :(
|
||||
// @@ 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++)
|
||||
{
|
||||
@ -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++)
|
||||
{
|
||||
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);
|
||||
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.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.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.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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ EnumPropertyItem image_only_type_items[] = {
|
||||
|
||||
IMAGE_TYPE_ITEMS_IMAGE_ONLY
|
||||
|
||||
{0, NULL, 0, NULL, NULL}};
|
||||
{0, NULL, 0, NULL, NULL}};
|
||||
|
||||
EnumPropertyItem image_type_items[] = {
|
||||
{0, "", 0, "Image", NULL},
|
||||
|
@ -227,10 +227,10 @@ static void rna_tracking_trackerAlgorithm_update(Main *UNUSED(bmain), Scene *UNU
|
||||
{
|
||||
MovieTrackingTrack *track = (MovieTrackingTrack *)ptr->data;
|
||||
|
||||
if (track->tracker == TRACKER_KLT)
|
||||
BKE_tracking_clamp_track(track, CLAMP_PYRAMID_LEVELS);
|
||||
else
|
||||
BKE_tracking_clamp_track(track, CLAMP_SEARCH_DIM);
|
||||
if (track->tracker == TRACKER_KLT)
|
||||
BKE_tracking_clamp_track(track, CLAMP_PYRAMID_LEVELS);
|
||||
else
|
||||
BKE_tracking_clamp_track(track, CLAMP_SEARCH_DIM);
|
||||
}
|
||||
|
||||
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 *result = PyUnicode_FromStringAndSize(str, size);
|
||||
PyObject *result = PyUnicode_FromStringAndSize(str, size);
|
||||
if (result) {
|
||||
/* 99% of the time this is enough but we better support non unicode
|
||||
* chars since blender doesnt limit this */
|
||||
|
@ -39,10 +39,10 @@ pre:
|
||||
effect: constructs a new CErrorValue containing errormessage errmsg
|
||||
*/
|
||||
{
|
||||
m_strErrorText = "[";
|
||||
m_strErrorText += errmsg;
|
||||
m_strErrorText += "]";
|
||||
SetError(true);
|
||||
m_strErrorText = "[";
|
||||
m_strErrorText += errmsg;
|
||||
m_strErrorText += "]";
|
||||
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)
|
||||
{
|
||||
// cerr << "SCA_IInputDevice::GetEventValue" << endl;
|
||||
// cerr << "SCA_IInputDevice::GetEventValue" << endl;
|
||||
return m_eventStatusTables[m_currentTable][inputcode];
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ SCA_IInputDevice* SCA_KeyboardManager::GetInputDevice()
|
||||
void SCA_KeyboardManager::NextFrame()
|
||||
{
|
||||
//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);
|
||||
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))),
|
||||
(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, 3))));
|
||||
(unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 3))));
|
||||
// success
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user